linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Mediatek Genio EVKs: add MT6359 PMIC keys support
@ 2025-07-03 15:41 Louis-Alexis Eyraud
  2025-07-03 15:41 ` [PATCH 1/3] Input: mtk-pmic-keys - add support for MT6359 PMIC keys Louis-Alexis Eyraud
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Louis-Alexis Eyraud @ 2025-07-03 15:41 UTC (permalink / raw)
  To: Dmitry Torokhov, Matthias Brugger, AngeloGioacchino Del Regno,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: kernel, linux-input, linux-kernel, linux-arm-kernel,
	linux-mediatek, devicetree, Louis-Alexis Eyraud

This patchset adds the support of the MT6359 PMIC keys (Power and Home)
that can be found on the Mediatek Genio 510, 700 and 1200 EVK boards
by:
- adding the MT6359 SoC support in the mtk-pmic-keys driver
- completing the existing definitions (only the Power key
  support was present) in Genio 510/700 EVK board common
  devicetree include file (mt8390-genio-common.dtsi)
- add the needed definitions in Genio 1200 EVK board devicetree
  (mt8395-genio-1200-evk.dts)

I've tested this patchset on Mediatek Genio 1200-EVK board with a
kernel based on linux-next (tag: next-20250703) plus [1] patch.

Output of evtest tool:
```
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:	mtk-pmic-keys
/dev/input/event1:	gpio-keys
/dev/input/event2:	Logitech USB Receiver
/dev/input/event3:	Logitech USB Receiver Mouse
/dev/input/event4:	Logitech USB Receiver Consumer Control
/dev/input/event5:	Logitech USB Receiver System Control
/dev/input/event6:	Goodix Capacitive TouchScreen
Select the device event number [0-6]: 0
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x1
Input device name: "mtk-pmic-keys"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 102 (KEY_HOME)
    Event code 116 (KEY_POWER)
Properties:
Testing ... (interrupt to exit)
Event: time 1751548607.957644, type 1 (EV_KEY), code 102 (KEY_HOME),
  value 1
Event: time 1751548607.957644, -------------- SYN_REPORT ------------
Event: time 1751548620.030611, type 1 (EV_KEY), code 116 (KEY_POWER),
  value 1
Event: time 1751548620.030611, -------------- SYN_REPORT ---
```

[1] https://lore.kernel.org/linux-mediatek/r4k3pgd3ew3ypne7ernxuzwgniiyvzosbce4cfajbcu7equblt@yato35tjb3lw/

Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
---
Louis-Alexis Eyraud (3):
      Input: mtk-pmic-keys - add support for MT6359 PMIC keys
      arm64: dts: mediatek: mt8390-genio-common: Add Home MT6359 PMIC key support
      arm64: dts: mediatek: mt8395-genio-1200-evk: Add MT6359 PMIC key support

 arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi  |  4 ++++
 arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts | 15 +++++++++++++++
 drivers/input/keyboard/mtk-pmic-keys.c                 | 17 +++++++++++++++++
 3 files changed, 36 insertions(+)
---
base-commit: b803ad80123e6efccfeeffa7cd37f98f642e37f4
change-id: 20250703-add-mt6359-pmic-keys-support-d08019d8d3c1

Best regards,
-- 
Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] Input: mtk-pmic-keys - add support for MT6359 PMIC keys
  2025-07-03 15:41 [PATCH 0/3] Mediatek Genio EVKs: add MT6359 PMIC keys support Louis-Alexis Eyraud
@ 2025-07-03 15:41 ` Louis-Alexis Eyraud
  2025-07-04  5:33   ` Dmitry Torokhov
  2025-07-03 15:41 ` [PATCH 2/3] arm64: dts: mediatek: mt8390-genio-common: Add Home MT6359 PMIC key support Louis-Alexis Eyraud
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Louis-Alexis Eyraud @ 2025-07-03 15:41 UTC (permalink / raw)
  To: Dmitry Torokhov, Matthias Brugger, AngeloGioacchino Del Regno,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: kernel, linux-input, linux-kernel, linux-arm-kernel,
	linux-mediatek, devicetree, Louis-Alexis Eyraud

Add PMIC key support on MT6359 SoC.

Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
---
 drivers/input/keyboard/mtk-pmic-keys.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
index 061d48350df661dd26832b307e1460ee8b8fd535..50e2e792c91d2626d3f282d04a1db60845827ef2 100644
--- a/drivers/input/keyboard/mtk-pmic-keys.c
+++ b/drivers/input/keyboard/mtk-pmic-keys.c
@@ -12,6 +12,7 @@
 #include <linux/mfd/mt6331/registers.h>
 #include <linux/mfd/mt6357/registers.h>
 #include <linux/mfd/mt6358/registers.h>
+#include <linux/mfd/mt6359/registers.h>
 #include <linux/mfd/mt6397/core.h>
 #include <linux/mfd/mt6397/registers.h>
 #include <linux/module.h>
@@ -117,6 +118,19 @@ static const struct mtk_pmic_regs mt6358_regs = {
 	.rst_lprst_mask = MTK_PMIC_RST_DU_MASK,
 };
 
+static const struct mtk_pmic_regs mt6359_regs = {
+	.keys_regs[MTK_PMIC_PWRKEY_INDEX] =
+		MTK_PMIC_KEYS_REGS(MT6359_TOPSTATUS,
+				   0x2, MT6359_PSC_TOP_INT_CON0, 0x5,
+				   MTK_PMIC_PWRKEY_RST),
+	.keys_regs[MTK_PMIC_HOMEKEY_INDEX] =
+		MTK_PMIC_KEYS_REGS(MT6359_TOPSTATUS,
+				   0x8, MT6359_PSC_TOP_INT_CON0, 0xa,
+				   MTK_PMIC_HOMEKEY_RST),
+	.pmic_rst_reg = MT6359_TOP_RST_MISC,
+	.rst_lprst_mask = MTK_PMIC_RST_DU_MASK,
+};
+
 struct mtk_pmic_keys_info {
 	struct mtk_pmic_keys *keys;
 	const struct mtk_pmic_keys_regs *regs;
@@ -296,6 +310,9 @@ static const struct of_device_id of_mtk_pmic_keys_match_tbl[] = {
 	}, {
 		.compatible = "mediatek,mt6358-keys",
 		.data = &mt6358_regs,
+	}, {
+		.compatible = "mediatek,mt6359-keys",
+		.data = &mt6359_regs,
 	}, {
 		/* sentinel */
 	}

-- 
2.50.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] arm64: dts: mediatek: mt8390-genio-common: Add Home MT6359 PMIC key support
  2025-07-03 15:41 [PATCH 0/3] Mediatek Genio EVKs: add MT6359 PMIC keys support Louis-Alexis Eyraud
  2025-07-03 15:41 ` [PATCH 1/3] Input: mtk-pmic-keys - add support for MT6359 PMIC keys Louis-Alexis Eyraud
@ 2025-07-03 15:41 ` Louis-Alexis Eyraud
  2025-07-03 15:41 ` [PATCH 3/3] arm64: dts: mediatek: mt8395-genio-1200-evk: Add " Louis-Alexis Eyraud
  2025-07-07  9:38 ` (subset) [PATCH 0/3] Mediatek Genio EVKs: add MT6359 PMIC keys support AngeloGioacchino Del Regno
  3 siblings, 0 replies; 6+ messages in thread
From: Louis-Alexis Eyraud @ 2025-07-03 15:41 UTC (permalink / raw)
  To: Dmitry Torokhov, Matthias Brugger, AngeloGioacchino Del Regno,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: kernel, linux-input, linux-kernel, linux-arm-kernel,
	linux-mediatek, devicetree, Louis-Alexis Eyraud

Add in mt8390-genio-common dtsi file the support of Home MT6359 PMIC
key.

Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
---
 arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi b/arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi
index eaf45d42cd347a2bd2db8af9ecef8f83f70c9183..a2cdecd2b9034e2f295d817e846d6ed1845e686a 100644
--- a/arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8390-genio-common.dtsi
@@ -1161,6 +1161,10 @@ power-key {
 			linux,keycodes = <KEY_POWER>;
 			wakeup-source;
 		};
+
+		home {
+			linux,keycodes = <KEY_HOME>;
+		};
 	};
 };
 

-- 
2.50.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] arm64: dts: mediatek: mt8395-genio-1200-evk: Add MT6359 PMIC key support
  2025-07-03 15:41 [PATCH 0/3] Mediatek Genio EVKs: add MT6359 PMIC keys support Louis-Alexis Eyraud
  2025-07-03 15:41 ` [PATCH 1/3] Input: mtk-pmic-keys - add support for MT6359 PMIC keys Louis-Alexis Eyraud
  2025-07-03 15:41 ` [PATCH 2/3] arm64: dts: mediatek: mt8390-genio-common: Add Home MT6359 PMIC key support Louis-Alexis Eyraud
@ 2025-07-03 15:41 ` Louis-Alexis Eyraud
  2025-07-07  9:38 ` (subset) [PATCH 0/3] Mediatek Genio EVKs: add MT6359 PMIC keys support AngeloGioacchino Del Regno
  3 siblings, 0 replies; 6+ messages in thread
From: Louis-Alexis Eyraud @ 2025-07-03 15:41 UTC (permalink / raw)
  To: Dmitry Torokhov, Matthias Brugger, AngeloGioacchino Del Regno,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: kernel, linux-input, linux-kernel, linux-arm-kernel,
	linux-mediatek, devicetree, Louis-Alexis Eyraud

Add in mt8395-genio-1200-evk devicetree file a sub node in pmic for
the mt6359-keys compatible to add the Power and Home MT6359 PMIC keys
support.

Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
---
 arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts b/arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts
index 9f0734731b5ef3c6b86693a389adc399707d5212..cf8cd37f570845a836a97564fd64a6a9a0e4e4d0 100644
--- a/arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts
+++ b/arch/arm64/boot/dts/mediatek/mt8395-genio-1200-evk.dts
@@ -990,6 +990,21 @@ pins {
 
 &pmic {
 	interrupts-extended = <&pio 222 IRQ_TYPE_LEVEL_HIGH>;
+
+	mt6359keys: keys {
+		compatible = "mediatek,mt6359-keys";
+		mediatek,long-press-mode = <1>;
+		power-off-time-sec = <0>;
+
+		power-key {
+			linux,keycodes = <KEY_POWER>;
+			wakeup-source;
+		};
+
+		home {
+			linux,keycodes = <KEY_HOME>;
+		};
+	};
 };
 
 &scp {

-- 
2.50.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] Input: mtk-pmic-keys - add support for MT6359 PMIC keys
  2025-07-03 15:41 ` [PATCH 1/3] Input: mtk-pmic-keys - add support for MT6359 PMIC keys Louis-Alexis Eyraud
@ 2025-07-04  5:33   ` Dmitry Torokhov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2025-07-04  5:33 UTC (permalink / raw)
  To: Louis-Alexis Eyraud
  Cc: Matthias Brugger, AngeloGioacchino Del Regno, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, kernel, linux-input,
	linux-kernel, linux-arm-kernel, linux-mediatek, devicetree

On Thu, Jul 03, 2025 at 05:41:03PM +0200, Louis-Alexis Eyraud wrote:
> Add PMIC key support on MT6359 SoC.
> 
> Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>

Applied, thank you.

-- 
Dmitry


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: (subset) [PATCH 0/3] Mediatek Genio EVKs: add MT6359 PMIC keys support
  2025-07-03 15:41 [PATCH 0/3] Mediatek Genio EVKs: add MT6359 PMIC keys support Louis-Alexis Eyraud
                   ` (2 preceding siblings ...)
  2025-07-03 15:41 ` [PATCH 3/3] arm64: dts: mediatek: mt8395-genio-1200-evk: Add " Louis-Alexis Eyraud
@ 2025-07-07  9:38 ` AngeloGioacchino Del Regno
  3 siblings, 0 replies; 6+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-07-07  9:38 UTC (permalink / raw)
  To: Dmitry Torokhov, Matthias Brugger, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Louis-Alexis Eyraud
  Cc: kernel, linux-input, linux-kernel, linux-arm-kernel,
	linux-mediatek, devicetree

On Thu, 03 Jul 2025 17:41:02 +0200, Louis-Alexis Eyraud wrote:
> This patchset adds the support of the MT6359 PMIC keys (Power and Home)
> that can be found on the Mediatek Genio 510, 700 and 1200 EVK boards
> by:
> - adding the MT6359 SoC support in the mtk-pmic-keys driver
> - completing the existing definitions (only the Power key
>   support was present) in Genio 510/700 EVK board common
>   devicetree include file (mt8390-genio-common.dtsi)
> - add the needed definitions in Genio 1200 EVK board devicetree
>   (mt8395-genio-1200-evk.dts)
> 
> [...]

Applied to v6.16-next/dts64, thanks!

[2/3] arm64: dts: mediatek: mt8390-genio-common: Add Home MT6359 PMIC key support
      commit: cf0cdde64b3246aca28961ec169ba1c5e9295d8d
[3/3] arm64: dts: mediatek: mt8395-genio-1200-evk: Add MT6359 PMIC key support
      commit: a9b906f15995e18b700a7e7791865ecf2f1cee65

Cheers,
Angelo




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-07-07 10:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-03 15:41 [PATCH 0/3] Mediatek Genio EVKs: add MT6359 PMIC keys support Louis-Alexis Eyraud
2025-07-03 15:41 ` [PATCH 1/3] Input: mtk-pmic-keys - add support for MT6359 PMIC keys Louis-Alexis Eyraud
2025-07-04  5:33   ` Dmitry Torokhov
2025-07-03 15:41 ` [PATCH 2/3] arm64: dts: mediatek: mt8390-genio-common: Add Home MT6359 PMIC key support Louis-Alexis Eyraud
2025-07-03 15:41 ` [PATCH 3/3] arm64: dts: mediatek: mt8395-genio-1200-evk: Add " Louis-Alexis Eyraud
2025-07-07  9:38 ` (subset) [PATCH 0/3] Mediatek Genio EVKs: add MT6359 PMIC keys support AngeloGioacchino Del Regno

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).