* [PATCH v2 0/3] mfd: MT6358 PMIC button support
@ 2021-05-12 15:16 Mattijs Korpershoek
2021-05-12 15:16 ` [PATCH v2 1/3] mfd: mt6397: add mt6358 register definitions for power key Mattijs Korpershoek
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Mattijs Korpershoek @ 2021-05-12 15:16 UTC (permalink / raw)
To: Lee Jones, Matthias Brugger
Cc: Fabien Parent, linux-arm-kernel, linux-mediatek, linux-kernel,
Mattijs Korpershoek
The MediaTek MT6358 PMIC has support for two buttons: PWR and HOME.
The interrupt logic is a little different than other PMICs from the
same family:
for MT6323 and MT6397, we have one interrupt source per button
* for MT6358, we have two interrupts lines per button: the press and
* release interrupts are distinct sources.
Changes since v1 at [1]:
- cover letter title prefixed with 'mfd'
This series depends on [2]
[1] https://lore.kernel.org/r/20210506094116.638527-1-mkorpershoek@baylibre.com
[2] https://lore.kernel.org/r/20210429143811.2030717-1-mkorpershoek@baylibre.com
Mattijs Korpershoek (3):
mfd: mt6397: add mt6358 register definitions for power key
mfd: mt6397: keys: use named IRQs instead of index
mfd: mt6397: add PMIC keys for MT6358
drivers/mfd/mt6397-core.c | 20 ++++++++++++++++----
include/linux/mfd/mt6358/registers.h | 2 ++
2 files changed, 18 insertions(+), 4 deletions(-)
--
2.27.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/3] mfd: mt6397: add mt6358 register definitions for power key
2021-05-12 15:16 [PATCH v2 0/3] mfd: MT6358 PMIC button support Mattijs Korpershoek
@ 2021-05-12 15:16 ` Mattijs Korpershoek
2021-05-12 15:16 ` [PATCH v2 2/3] mfd: mt6397: keys: use named IRQs instead of index Mattijs Korpershoek
2021-05-12 15:16 ` [PATCH v2 3/3] mfd: mt6397: add PMIC keys for MT6358 Mattijs Korpershoek
2 siblings, 0 replies; 4+ messages in thread
From: Mattijs Korpershoek @ 2021-05-12 15:16 UTC (permalink / raw)
To: Lee Jones, Matthias Brugger
Cc: Fabien Parent, linux-arm-kernel, linux-mediatek, linux-kernel,
Mattijs Korpershoek
To support power/home key detection, add definitions for
two more MT6358 PMIC registers:
- TOPSTATUS: homekey and powerkey debounce status
- TOP_RST_MISC: controls homekey,powerkey long press reset time
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
include/linux/mfd/mt6358/registers.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/mfd/mt6358/registers.h b/include/linux/mfd/mt6358/registers.h
index 2ad0b312aa28..201139b12140 100644
--- a/include/linux/mfd/mt6358/registers.h
+++ b/include/linux/mfd/mt6358/registers.h
@@ -8,6 +8,8 @@
/* PMIC Registers */
#define MT6358_SWCID 0xa
+#define MT6358_TOPSTATUS 0x28
+#define MT6358_TOP_RST_MISC 0x14c
#define MT6358_MISC_TOP_INT_CON0 0x188
#define MT6358_MISC_TOP_INT_STATUS0 0x194
#define MT6358_TOP_INT_STATUS0 0x19e
--
2.27.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/3] mfd: mt6397: keys: use named IRQs instead of index
2021-05-12 15:16 [PATCH v2 0/3] mfd: MT6358 PMIC button support Mattijs Korpershoek
2021-05-12 15:16 ` [PATCH v2 1/3] mfd: mt6397: add mt6358 register definitions for power key Mattijs Korpershoek
@ 2021-05-12 15:16 ` Mattijs Korpershoek
2021-05-12 15:16 ` [PATCH v2 3/3] mfd: mt6397: add PMIC keys for MT6358 Mattijs Korpershoek
2 siblings, 0 replies; 4+ messages in thread
From: Mattijs Korpershoek @ 2021-05-12 15:16 UTC (permalink / raw)
To: Lee Jones, Matthias Brugger
Cc: Fabien Parent, linux-arm-kernel, linux-mediatek, linux-kernel,
Mattijs Korpershoek
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>
---
drivers/mfd/mt6397-core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index 7518d74c3b4c..8738b5524783 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -46,13 +46,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[] = {
--
2.27.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 3/3] mfd: mt6397: add PMIC keys for MT6358
2021-05-12 15:16 [PATCH v2 0/3] mfd: MT6358 PMIC button support Mattijs Korpershoek
2021-05-12 15:16 ` [PATCH v2 1/3] mfd: mt6397: add mt6358 register definitions for power key Mattijs Korpershoek
2021-05-12 15:16 ` [PATCH v2 2/3] mfd: mt6397: keys: use named IRQs instead of index Mattijs Korpershoek
@ 2021-05-12 15:16 ` Mattijs Korpershoek
2 siblings, 0 replies; 4+ messages in thread
From: Mattijs Korpershoek @ 2021-05-12 15:16 UTC (permalink / raw)
To: Lee Jones, Matthias Brugger
Cc: Fabien Parent, linux-arm-kernel, linux-mediatek, linux-kernel,
Mattijs Korpershoek
Add compatible strings and interrupts for pmic keys
which serves as child device of MFD.
MT6358 has two interrupts per key: one for press, another one for
release (_R)
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
---
drivers/mfd/mt6397-core.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index 8738b5524783..5b79975dc13c 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -45,6 +45,13 @@ static const struct resource mt6397_rtc_resources[] = {
DEFINE_RES_IRQ(MT6397_IRQ_RTC),
};
+static const struct resource mt6358_keys_resources[] = {
+ DEFINE_RES_IRQ_NAMED(MT6358_IRQ_PWRKEY, "powerkey"),
+ DEFINE_RES_IRQ_NAMED(MT6358_IRQ_HOMEKEY, "homekey"),
+ DEFINE_RES_IRQ_NAMED(MT6358_IRQ_PWRKEY_R, "powerkey_r"),
+ DEFINE_RES_IRQ_NAMED(MT6358_IRQ_HOMEKEY_R, "homekey_r"),
+};
+
static const struct resource mt6323_keys_resources[] = {
DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_PWRKEY, "powerkey"),
DEFINE_RES_IRQ_NAMED(MT6323_IRQ_STATUS_FCHRKEY, "homekey"),
@@ -96,6 +103,11 @@ static const struct mfd_cell mt6358_devs[] = {
}, {
.name = "mt6358-sound",
.of_compatible = "mediatek,mt6358-sound"
+ }, {
+ .name = "mt6358-keys",
+ .num_resources = ARRAY_SIZE(mt6358_keys_resources),
+ .resources = mt6358_keys_resources,
+ .of_compatible = "mediatek,mt6358-keys"
},
};
--
2.27.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-12 15:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 15:16 [PATCH v2 0/3] mfd: MT6358 PMIC button support Mattijs Korpershoek
2021-05-12 15:16 ` [PATCH v2 1/3] mfd: mt6397: add mt6358 register definitions for power key Mattijs Korpershoek
2021-05-12 15:16 ` [PATCH v2 2/3] mfd: mt6397: keys: use named IRQs instead of index Mattijs Korpershoek
2021-05-12 15:16 ` [PATCH v2 3/3] mfd: mt6397: add PMIC keys for MT6358 Mattijs Korpershoek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).