mfd: mt6397: Use named IRQs instead of index (keys)
authorMattijs Korpershoek <mkorpershoek@baylibre.com>
Thu, 6 May 2021 09:41:14 +0000 (11:41 +0200)
committerLee Jones <lee.jones@linaro.org>
Wed, 2 Jun 2021 09:49:59 +0000 (10:49 +0100)
Some pmics of the mt6397 family (such as MT6358), have two IRQs per
physical key: one for press event, another for release event.

The mtk-pmic-keys driver assumes that each key only has one
IRQ. The key index and the RES_IRQ resource index have a 1/1 mapping.

This won't work for MT6358, as we have multiple resources (2) for one key.

To prepare mtk-pmic-keys to support MT6358, retrieve IRQs by name
instead of by index.

Note: The keys_resources are not part of the device-tree bindings so
this won't break any DT schemas.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/mt6397-core.c

index 9a615f7..dd0e0ee 100644 (file)
@@ -48,13 +48,13 @@ static const struct resource mt6397_rtc_resources[] = {
 };
 
 static const struct resource mt6323_keys_resources[] = {
-       DEFINE_RES_IRQ(MT6323_IRQ_STATUS_PWRKEY),
-       DEFINE_RES_IRQ(MT6323_IRQ_STATUS_FCHRKEY),
+       DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_PWRKEY, "powerkey"),
+       DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_FCHRKEY, "homekey"),
 };
 
 static const struct resource mt6397_keys_resources[] = {
-       DEFINE_RES_IRQ(MT6397_IRQ_PWRKEY),
-       DEFINE_RES_IRQ(MT6397_IRQ_HOMEKEY),
+       DEFINE_RES_IRQ_NAMED(MT6397_IRQ_PWRKEY, "powerkey"),
+       DEFINE_RES_IRQ_NAMED(MT6397_IRQ_HOMEKEY, "homekey"),
 };
 
 static const struct resource mt6323_pwrc_resources[] = {