Skip to contentSkip to conversation

mt6397: Add support for the MT6392 PMIC

PATCH Applied Val Packett 8 participants 28 messages Dec 26, 2024 – Feb 27, 2025

Subsystems (10)
lore
Share & tools
lore
#0 lore raw

cover mt6397: Add support for the MT6392 PMIC

The MediaTek MT6392 PMIC is usually found on devices powered by the MT8516/MT8167 SoC, and is yet another MT6397 variant.

This series is mostly based around patches submitted a couple years ago by Fabien Parent and not merged, and includes extra cleanups, fixes, and a new dtsi file similar to ones that exist for other PMICs.

This series only enables three functions: regulators, keys, and RTC. All that was tested on a lenovo,tb7304f tablet (basic DTS coming right after this, promise).

Fabien Parent (5):
dt-bindings: mfd: mt6397: Add bindings for MT6392 PMIC
dt-bindings: regulator: add support for MT6392
dt-bindings: input: mtk-pmic-keys: add MT6392 binding definition
mfd: mt6397: Add support for MT6392 pmic
regulator: mt6392: Add support for MT6392 regulator

Val Packett (4):
soc: mediatek: mtk-pmic-wrap: add compatible for MT6392 PMIC
input: keyboard: mtk-pmic-keys: add MT6392 support
rtc: mt6397: add compatible for MT6392 PMIC
arm64: dts: mt6392: add mt6392 PMIC dtsi

 .../bindings/input/mediatek,pmic-keys.yaml    |   1 +
 .../bindings/mfd/mediatek,mt6397.yaml         |   3 +
 arch/arm64/boot/dts/mediatek/mt6392.dtsi      | 232 +++++++++
 drivers/input/keyboard/mtk-pmic-keys.c        |  15 +
 drivers/mfd/mt6397-core.c                     |  43 ++
 drivers/mfd/mt6397-irq.c                      |   8 +
 drivers/regulator/Kconfig                     |   9 +
 drivers/regulator/Makefile                    |   1 +
 drivers/regulator/mt6392-regulator.c          | 484 +++++++++++++++++
 drivers/rtc/rtc-mt6397.c                      |   1 +
 drivers/soc/mediatek/mtk-pmic-wrap.c          |   1 +
 include/linux/mfd/mt6392/core.h               |  42 ++
 include/linux/mfd/mt6392/registers.h          | 487 ++++++++++++++++++
 include/linux/mfd/mt6397/core.h               |   1 +
 include/linux/regulator/mt6392-regulator.h    |  40 ++
 15 files changed, 1368 insertions(+)
 create mode 100644 arch/arm64/boot/dts/mediatek/mt6392.dtsi
 create mode 100644 drivers/regulator/mt6392-regulator.c
 create mode 100644 include/linux/mfd/mt6392/core.h
 create mode 100644 include/linux/mfd/mt6392/registers.h
 create mode 100644 include/linux/regulator/mt6392-regulator.h
Signature · 1 line
2.47.1
#1 lore raw

PATCH 1/9 dt-bindings: mfd: mt6397: Add bindings for MT6392 PMIC

From: Fabien Parent <[email protected]>

Add the currently supported bindings for the MT6392 PMIC.

---
 Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml +2 -0
index 86451f151a6ae..73103922978f7 100644
@@ -38,6 +38,7 @@ properties:
           - mediatek,mt6331 # "mediatek,mt6331" for PMIC MT6331 and MT6332.
           - mediatek,mt6358
           - mediatek,mt6359
+          - mediatek,mt6392
           - mediatek,mt6397
       - items:
           - enum:
@@ -66,6 +67,7 @@ properties:
               - mediatek,mt6323-rtc
               - mediatek,mt6331-rtc
               - mediatek,mt6358-rtc
+              - mediatek,mt6392-rtc
               - mediatek,mt6397-rtc
           - items:
               - enum:
Signature · 1 line
2.47.1
#2 lore raw

Re: [PATCH 1/9] dt-bindings: mfd: mt6397: Add bindings for MT6392 PMIC

Hello,

Quoted 7 lines · Val Packett

From: Fabien Parent <[email protected]>

Add the currently supported bindings for the MT6392 PMIC.

Your SoB is missing.

Quoted 27 lines
---
 Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml +2 -0
index 86451f151a6ae..73103922978f7 100644
@@ -38,6 +38,7 @@ properties:
           - mediatek,mt6331 # "mediatek,mt6331" for PMIC MT6331 and MT6332.
           - mediatek,mt6358
           - mediatek,mt6359
+          - mediatek,mt6392
           - mediatek,mt6397
       - items:
           - enum:
@@ -66,6 +67,7 @@ properties:
               - mediatek,mt6323-rtc
               - mediatek,mt6331-rtc
               - mediatek,mt6358-rtc
+              - mediatek,mt6392-rtc
               - mediatek,mt6397-rtc
           - items:
               - enum:
Signature · 1 line
2.47.1
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
maintainer Reviewed-by on v1 1/9
#3 lore raw

Re: [PATCH 1/9] dt-bindings: mfd: mt6397: Add bindings for MT6392 PMIC

In reply to Val Packett

Il 26/12/24 05:58, Val Packett ha scritto:

Quoted 7 lines

From: Fabien Parent <[email protected]>

Add the currently supported bindings for the MT6392 PMIC.

#4 lore raw

PATCH 2/9 dt-bindings: regulator: add support for MT6392

In reply to Val Packett

From: Fabien Parent <[email protected]>

Add binding documentation of the regulator for MT6392 SoCs.

---
 Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml +1 -0
index 73103922978f7..f047844782c4d 100644
@@ -92,6 +92,7 @@ properties:
               - mediatek,mt6323-regulator
               - mediatek,mt6358-regulator
               - mediatek,mt6359-regulator
+              - mediatek,mt6392-regulator
               - mediatek,mt6397-regulator
           - items:
               - enum:
Signature · 1 line
2.47.1
#6 lore raw

PATCH 3/9 dt-bindings: input: mtk-pmic-keys: add MT6392 binding definition

In reply to Val Packett

From: Fabien Parent <[email protected]>

Add the binding documentation of the mtk-pmic-keys for the MT6392 PMICs.

---
 Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml +1 -0
index 60f09caa0e4c7..5da4fbce33970 100644
@@ -29,6 +29,7 @@ properties:
       - mediatek,mt6357-keys
       - mediatek,mt6358-keys
       - mediatek,mt6359-keys
+      - mediatek,mt6392-keys
       - mediatek,mt6397-keys
 
   power-off-time-sec: true
Signature · 1 line
2.47.1
#8 lore raw

Re: [PATCH 3/9] dt-bindings: input: mtk-pmic-keys: add MT6392 binding definition

In reply to Val Packett
Quoted 6 lines · Val Packett

From: Fabien Parent <[email protected]>

Add the binding documentation of the mtk-pmic-keys for the MT6392 PMICs.

I don't think this happened. The tag added here at v6 was never received.

What's more, that's v6 or v7 or vN, so keep proper versioning and changelog, including lore links to the old patchset.

Best regards,
Krzysztof

#9 lore raw

PATCH 4/9 mfd: mt6397: Add support for MT6392 pmic

In reply to Val Packett

From: Fabien Parent <[email protected]>

Update the MT6397 MFD driver to support the MT6392 PMIC.

---
 drivers/mfd/mt6397-core.c            |  43 +++
 drivers/mfd/mt6397-irq.c             |   8 +
 include/linux/mfd/mt6392/core.h      |  42 +++
 include/linux/mfd/mt6392/registers.h | 487 +++++++++++++++++++++++++++
 include/linux/mfd/mt6397/core.h      |   1 +
 5 files changed, 581 insertions(+)
 create mode 100644 include/linux/mfd/mt6392/core.h
 create mode 100644 include/linux/mfd/mt6392/registers.h
drivers/mfd/mt6397-core.c +43 -0
index 0e5d59ae064a6..54d655668ad8c 100644
@@ -18,6 +18,7 @@
 #include <linux/mfd/mt6357/core.h>
 #include <linux/mfd/mt6358/core.h>
 #include <linux/mfd/mt6359/core.h>
+#include <linux/mfd/mt6392/core.h>
 #include <linux/mfd/mt6397/core.h>
 #include <linux/mfd/mt6323/registers.h>
 #include <linux/mfd/mt6328/registers.h>
@@ -25,6 +26,7 @@
 #include <linux/mfd/mt6357/registers.h>
 #include <linux/mfd/mt6358/registers.h>
 #include <linux/mfd/mt6359/registers.h>
+#include <linux/mfd/mt6392/registers.h>
 #include <linux/mfd/mt6397/registers.h>
 
 #define MT6323_RTC_BASE		0x8000
@@ -39,6 +41,9 @@
 #define MT6358_RTC_BASE		0x0588
 #define MT6358_RTC_SIZE		0x3c
 
+#define MT6392_RTC_BASE		0x8000
+#define MT6392_RTC_SIZE		0x3e
+
 #define MT6397_RTC_BASE		0xe000
 #define MT6397_RTC_SIZE		0x3e
 
@@ -65,6 +70,11 @@ static const struct resource mt6358_rtc_resources[] = {
 	DEFINE_RES_IRQ(MT6358_IRQ_RTC),
 };
 
+static const struct resource mt6392_rtc_resources[] = {
+	DEFINE_RES_MEM(MT6392_RTC_BASE, MT6392_RTC_SIZE),
+	DEFINE_RES_IRQ(MT6392_IRQ_RTC),
+};
+
 static const struct resource mt6397_rtc_resources[] = {
 	DEFINE_RES_MEM(MT6397_RTC_BASE, MT6397_RTC_SIZE),
 	DEFINE_RES_IRQ(MT6397_IRQ_RTC),
@@ -108,6 +118,11 @@ static const struct resource mt6331_keys_resources[] = {
 	DEFINE_RES_IRQ_NAMED(MT6331_IRQ_STATUS_HOMEKEY, "homekey"),
 };
 
+static const struct resource mt6392_keys_resources[] = {
+	DEFINE_RES_IRQ_NAMED(MT6392_IRQ_PWRKEY, "powerkey"),
+	DEFINE_RES_IRQ_NAMED(MT6392_IRQ_FCHRKEY, "homekey"),
+};
+
 static const struct resource mt6397_keys_resources[] = {
 	DEFINE_RES_IRQ_NAMED(MT6397_IRQ_PWRKEY, "powerkey"),
 	DEFINE_RES_IRQ_NAMED(MT6397_IRQ_HOMEKEY, "homekey"),
@@ -241,6 +256,23 @@ static const struct mfd_cell mt6359_devs[] = {
 	},
 };
 
+static const struct mfd_cell mt6392_devs[] = {
+	{
+		.name = "mt6397-rtc",
+		.num_resources = ARRAY_SIZE(mt6392_rtc_resources),
+		.resources = mt6392_rtc_resources,
+		.of_compatible = "mediatek,mt6392-rtc",
+	}, {
+		.name = "mt6392-regulator",
+		.of_compatible = "mediatek,mt6392-regulator",
+	}, {
+		.name = "mtk-pmic-keys",
+		.num_resources = ARRAY_SIZE(mt6392_keys_resources),
+		.resources = mt6392_keys_resources,
+		.of_compatible = "mediatek,mt6392-keys"
+	},
+};
+
 static const struct mfd_cell mt6397_devs[] = {
 	{
 		.name = "mt6397-rtc",
@@ -323,6 +355,14 @@ static const struct chip_data mt6359_core = {
 	.irq_init = mt6358_irq_init,
 };
 
+static const struct chip_data mt6392_core = {
+	.cid_addr = MT6392_CID,
+	.cid_shift = 0,
+	.cells = mt6392_devs,
+	.cell_size = ARRAY_SIZE(mt6392_devs),
+	.irq_init = mt6397_irq_init,
+};
+
 static const struct chip_data mt6397_core = {
 	.cid_addr = MT6397_CID,
 	.cid_shift = 0,
@@ -404,6 +444,9 @@ static const struct of_device_id mt6397_of_match[] = {
 	}, {
 		.compatible = "mediatek,mt6359",
 		.data = &mt6359_core,
+	}, {
+		.compatible = "mediatek,mt6392",
+		.data = &mt6392_core,
 	}, {
 		.compatible = "mediatek,mt6397",
 		.data = &mt6397_core,
drivers/mfd/mt6397-irq.c +8 -0
index 1310665200ede..25b16293e3937 100644
@@ -15,6 +15,8 @@
 #include <linux/mfd/mt6328/registers.h>
 #include <linux/mfd/mt6331/core.h>
 #include <linux/mfd/mt6331/registers.h>
+#include <linux/mfd/mt6392/core.h>
+#include <linux/mfd/mt6392/registers.h>
 #include <linux/mfd/mt6397/core.h>
 #include <linux/mfd/mt6397/registers.h>
 
@@ -203,6 +205,12 @@ int mt6397_irq_init(struct mt6397_chip *chip)
 		chip->int_status[0] = MT6397_INT_STATUS0;
 		chip->int_status[1] = MT6397_INT_STATUS1;
 		break;
+	case MT6392_CHIP_ID:
+		chip->int_con[0] = MT6392_INT_CON0;
+		chip->int_con[1] = MT6392_INT_CON1;
+		chip->int_status[0] = MT6392_INT_STATUS0;
+		chip->int_status[1] = MT6392_INT_STATUS1;
+		break;
 
 	default:
 		dev_err(chip->dev, "unsupported chip: 0x%x\n", chip->chip_id);
include/linux/mfd/mt6392/core.h new file +42 -0

42 lines not on this page · raw message

include/linux/mfd/mt6392/registers.h new file +487 -0

487 lines not on this page · raw message

include/linux/mfd/mt6397/core.h +1 -0
index b774c3a4bb62e..d665d07770658 100644
@@ -20,6 +20,7 @@ enum chip_id {
 	MT6359_CHIP_ID = 0x59,
 	MT6366_CHIP_ID = 0x66,
 	MT6391_CHIP_ID = 0x91,
+	MT6392_CHIP_ID = 0x92,
 	MT6397_CHIP_ID = 0x97,
 };
 
Signature · 1 line
2.47.1
maintainer Applied
#11 lore raw

Re: (subset) [PATCH 4/9] mfd: mt6397: Add support for MT6392 pmic

In reply to Val Packett
Quoted 3 lines · Val Packett

Update the MT6397 MFD driver to support the MT6392 PMIC.

Applied, thanks!

[4/9] mfd: mt6397: Add support for MT6392 pmic

      commit: 896b1eb4ca771b37ea50feb4d90a78dd4e9cb388

--
Lee Jones [李琼斯]

maintainer
#12 lore raw

Re: (subset) [PATCH 4/9] mfd: mt6397: Add support for MT6392 pmic

Quoted 10 lines · Lee Jones
Quoted 3 lines · Val Packett

Update the MT6397 MFD driver to support the MT6392 PMIC.

Applied, thanks!

[4/9] mfd: mt6397: Add support for MT6392 pmic

      commit: 896b1eb4ca771b37ea50feb4d90a78dd4e9cb388

This should be dropped. Missing the sender's S-o-b and the rest of the series has issues still.

Rob

maintainer
#13 lore raw

Re: (subset) [PATCH 4/9] mfd: mt6397: Add support for MT6392 pmic

Quoted 7 lines · Rob Herring
Quoted 6 lines · Lee Jones
Quoted 3 lines · Val Packett

Update the MT6397 MFD driver to support the MT6392 PMIC.

Quoted 7 lines
Quoted 4 lines

Applied, thanks!

[4/9] mfd: mt6397: Add support for MT6392 pmic

      commit: 896b1eb4ca771b37ea50feb4d90a78dd4e9cb388

This should be dropped. Missing the sender's S-o-b and the rest of the series has issues still.

Are you sure you're commenting on the correct patch?

Quoted 1 line
Signature · 1 line
Lee Jones [李琼斯]
maintainer
#14 lore raw

Re: (subset) [PATCH 4/9] mfd: mt6397: Add support for MT6392 pmic

Quoted 11 lines · Lee Jones
Quoted 9 lines · Rob Herring
Quoted 8 lines · Lee Jones
Quoted 3 lines · Val Packett

Update the MT6397 MFD driver to support the MT6392 PMIC.

Applied, thanks!

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

[4/9] mfd: mt6397: Add support for MT6392 pmic

      commit: 896b1eb4ca771b37ea50feb4d90a78dd4e9cb388

This should be dropped. Missing the sender's S-o-b and the rest of the series has issues still.

Are you sure you're commenting on the correct patch?

Yes.

Quoted 1 line
Quoted 1 line

It was sent by Val and is missing their S-o-b. If you send another author's patch, it needs your S-o-b.

Rob

maintainer
#15 lore raw

Re: (subset) [PATCH 4/9] mfd: mt6397: Add support for MT6392 pmic

Quoted 18 lines · Rob Herring
Quoted 17 lines · Lee Jones
Quoted 14 lines · Rob Herring
Quoted 10 lines · Lee Jones
Quoted 3 lines · Val Packett

Update the MT6397 MFD driver to support the MT6392 PMIC.

Applied, thanks!

[4/9] mfd: mt6397: Add support for MT6392 pmic

      commit: 896b1eb4ca771b37ea50feb4d90a78dd4e9cb388

This should be dropped. Missing the sender's S-o-b and the rest of the series has issues still.

Quoted 8 lines
Quoted 1 line

Are you sure you're commenting on the correct patch?

Yes.

Quoted 1 line
Quoted 1 line

It was sent by Val and is missing their S-o-b. If you send another author's patch, it needs your S-o-b.

Ah, gotcha. Yes, that's fair.

I'll pull the patch.

Signature · 1 line
Lee Jones [李琼斯]
#16 lore raw

PATCH 5/9 soc: mediatek: mtk-pmic-wrap: add compatible for MT6392 PMIC

In reply to Val Packett

The MT6392 PMIC is equivalent to the MT6323 in terms of pwrap. Add the compatible to use the same configuration.

---
 drivers/soc/mediatek/mtk-pmic-wrap.c | 1 +
 1 file changed, 1 insertion(+)
drivers/soc/mediatek/mtk-pmic-wrap.c +1 -0
index 9fdc0ef792026..59611ef0b144f 100644
@@ -2249,6 +2249,7 @@ static const struct pwrap_slv_type pmic_mt6397 = {
 
 static const struct of_device_id of_slave_match_tbl[] = {
 	{ .compatible = "mediatek,mt6323", .data = &pmic_mt6323 },
+	{ .compatible = "mediatek,mt6392", .data = &pmic_mt6323 },
 	{ .compatible = "mediatek,mt6331", .data = &pmic_mt6331 },
 	{ .compatible = "mediatek,mt6351", .data = &pmic_mt6351 },
 	{ .compatible = "mediatek,mt6357", .data = &pmic_mt6357 },
Signature · 1 line
2.47.1
#18 lore raw

PATCH 6/9 regulator: mt6392: Add support for MT6392 regulator

In reply to Val Packett

From: Fabien Parent <[email protected]>

The MT6392 is a regulator found on boards based on the MediaTek MT8167, MT8516, and probably other SoCs. It is a so called PMIC and connects as a slave to a SoC using SPI, wrapped inside PWRAP.

---
[Val: added missing mt6392_set_buck_vosel_reg function]

 drivers/regulator/Kconfig                  |   9 +
 drivers/regulator/Makefile                 |   1 +
 drivers/regulator/mt6392-regulator.c       | 484 +++++++++++++++++++++
 include/linux/regulator/mt6392-regulator.h |  40 ++
 4 files changed, 534 insertions(+)
 create mode 100644 drivers/regulator/mt6392-regulator.c
 create mode 100644 include/linux/regulator/mt6392-regulator.h
drivers/regulator/Kconfig +9 -0
index 39297f7d81771..99ae2bba569fb 100644
@@ -933,6 +933,15 @@ config REGULATOR_MT6380
 	  This driver supports the control of different power rails of device
 	  through regulator interface.
 
+config REGULATOR_MT6392
+	tristate "MediaTek MT6392 PMIC"
+	depends on MFD_MT6397
+	help
+	  Say y here to select this option to enable the power regulator of
+	  MediaTek MT6392 PMIC.
+	  This driver supports the control of different power rails of device
+	  through regulator interface.
+
 config REGULATOR_MT6397
 	tristate "MediaTek MT6397 PMIC"
 	depends on MFD_MT6397
drivers/regulator/Makefile +1 -0
index 3d5a803dce8a0..231b0a9b72cd2 100644
@@ -111,6 +111,7 @@ obj-$(CONFIG_REGULATOR_MT6359)	+= mt6359-regulator.o
 obj-$(CONFIG_REGULATOR_MT6360) += mt6360-regulator.o
 obj-$(CONFIG_REGULATOR_MT6370) += mt6370-regulator.o
 obj-$(CONFIG_REGULATOR_MT6380)	+= mt6380-regulator.o
+obj-$(CONFIG_REGULATOR_MT6392)	+= mt6392-regulator.o
 obj-$(CONFIG_REGULATOR_MT6397)	+= mt6397-regulator.o
 obj-$(CONFIG_REGULATOR_MTK_DVFSRC) += mtk-dvfsrc-regulator.o
 obj-$(CONFIG_REGULATOR_QCOM_LABIBB) += qcom-labibb-regulator.o
drivers/regulator/mt6392-regulator.c new file +484 -0

484 lines not on this page · raw message

include/linux/regulator/mt6392-regulator.h new file +40 -0
new file mode 100644
index 0000000000000..dfcbcacb5ad43
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2019 MediaTek Inc.
+ * Author: Chen Zhong <[email protected]>
+ */
+
+#ifndef __LINUX_REGULATOR_MT6392_H
+#define __LINUX_REGULATOR_MT6392_H
+
+enum {
+	MT6392_ID_VPROC = 0,
+	MT6392_ID_VSYS,
+	MT6392_ID_VCORE,
+	MT6392_ID_VXO22,
+	MT6392_ID_VAUD22,
+	MT6392_ID_VCAMA,
+	MT6392_ID_VAUD28,
+	MT6392_ID_VADC18,
+	MT6392_ID_VCN35,
+	MT6392_ID_VIO28,
+	MT6392_ID_VUSB = 10,
+	MT6392_ID_VMC,
+	MT6392_ID_VMCH,
+	MT6392_ID_VEMC3V3,
+	MT6392_ID_VGP1,
+	MT6392_ID_VGP2,
+	MT6392_ID_VCN18,
+	MT6392_ID_VCAMAF,
+	MT6392_ID_VM,
+	MT6392_ID_VIO18,
+	MT6392_ID_VCAMD,
+	MT6392_ID_VCAMIO,
+	MT6392_ID_VM25,
+	MT6392_ID_VEFUSE,
+	MT6392_ID_RG_MAX,
+};
+
+#define MT6392_MAX_REGULATOR	MT6392_ID_RG_MAX
+
+#endif /* __LINUX_REGULATOR_MT6392_H */
Signature · 1 line
2.47.1
maintainer Reviewed-by on v1 6/9
#19 lore raw

Re: [PATCH 6/9] regulator: mt6392: Add support for MT6392 regulator

Il 26/12/24 05:58, Val Packett ha scritto:

Quoted 9 lines

From: Fabien Parent <[email protected]>

The MT6392 is a regulator found on boards based on the MediaTek MT8167, MT8516, and probably other SoCs. It is a so called PMIC and connects as a slave to a SoC using SPI, wrapped inside PWRAP.

maintainer Acked-by on v1 6/9
#20 lore raw

Re: [PATCH 6/9] regulator: mt6392: Add support for MT6392 regulator

In reply to Val Packett
Quoted 5 lines · Val Packett

From: Fabien Parent <[email protected]>

The MT6392 is a regulator found on boards based on the MediaTek MT8167, MT8516, and probably other SoCs. It is a so called PMIC and connects as a slave to a SoC using SPI, wrapped inside PWRAP.

#21 lore raw

PATCH 7/9 input: keyboard: mtk-pmic-keys: add MT6392 support

In reply to Val Packett

Add support for the MT6392 PMIC to the keys driver.

---
 drivers/input/keyboard/mtk-pmic-keys.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/input/keyboard/mtk-pmic-keys.c +15 -0
index 5ad6be9141603..94fa0f316edc6 100644
@@ -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/mt6392/registers.h>
 #include <linux/mfd/mt6397/core.h>
 #include <linux/mfd/mt6397/registers.h>
 #include <linux/module.h>
@@ -67,6 +68,17 @@ static const struct mtk_pmic_regs mt6397_regs = {
 	.rst_lprst_mask = MTK_PMIC_RST_DU_MASK,
 };
 
+static const struct mtk_pmic_regs mt6392_regs = {
+	.keys_regs[MTK_PMIC_PWRKEY_INDEX] =
+		MTK_PMIC_KEYS_REGS(MT6392_CHRSTATUS,
+		0x2, MT6392_INT_MISC_CON, 0x10, MTK_PMIC_PWRKEY_RST),
+	.keys_regs[MTK_PMIC_HOMEKEY_INDEX] =
+		MTK_PMIC_KEYS_REGS(MT6392_CHRSTATUS,
+		0x4, MT6392_INT_MISC_CON, 0x8, MTK_PMIC_HOMEKEY_RST),
+	.pmic_rst_reg = MT6392_TOP_RST_MISC,
+	.rst_lprst_mask = MTK_PMIC_RST_DU_MASK,
+};
+
 static const struct mtk_pmic_regs mt6323_regs = {
 	.keys_regs[MTK_PMIC_PWRKEY_INDEX] =
 		MTK_PMIC_KEYS_REGS(MT6323_CHRSTATUS,
@@ -284,6 +296,9 @@ static const struct of_device_id of_mtk_pmic_keys_match_tbl[] = {
 	{
 		.compatible = "mediatek,mt6397-keys",
 		.data = &mt6397_regs,
+	}, {
+		.compatible = "mediatek,mt6392-keys",
+		.data = &mt6392_regs,
 	}, {
 		.compatible = "mediatek,mt6323-keys",
 		.data = &mt6323_regs,
Signature · 1 line
2.47.1
#23 lore raw

PATCH 8/9 rtc: mt6397: add compatible for MT6392 PMIC

In reply to Val Packett

Add a compatible, using the same data as the MT6397.

---
 drivers/rtc/rtc-mt6397.c | 1 +
 1 file changed, 1 insertion(+)
drivers/rtc/rtc-mt6397.c +1 -0
index 152699219a2b9..6fe5bff6cf442 100644
@@ -333,6 +333,7 @@ static const struct mtk_rtc_data mt6397_rtc_data = {
 static const struct of_device_id mt6397_rtc_of_match[] = {
 	{ .compatible = "mediatek,mt6323-rtc", .data = &mt6397_rtc_data },
 	{ .compatible = "mediatek,mt6358-rtc", .data = &mt6358_rtc_data },
+	{ .compatible = "mediatek,mt6392-rtc", .data = &mt6397_rtc_data },
 	{ .compatible = "mediatek,mt6397-rtc", .data = &mt6397_rtc_data },
 	{ }
 };
Signature · 1 line
2.47.1
#25 lore raw

PATCH 9/9 arm64: dts: mt6392: add mt6392 PMIC dtsi

In reply to Val Packett

Add the dts to be included by all boards using the MT6392 PMIC.

---
 arch/arm64/boot/dts/mediatek/mt6392.dtsi | 232 +++++++++++++++++++++++
 1 file changed, 232 insertions(+)
 create mode 100644 arch/arm64/boot/dts/mediatek/mt6392.dtsi
arch/arm64/boot/dts/mediatek/mt6392.dtsi new file +232 -0
new file mode 100644
index 0000000000000..a7c65dbb043c1
@@ -0,0 +1,232 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2019 MediaTek Inc.
+ * Copyright (c) 2024 Val Packett <[email protected]>
+ */
+
+#include <dt-bindings/input/input.h>
+
+&pwrap {
+	pmic: mt6392 {
+		compatible = "mediatek,mt6392";
+		interrupt-controller;
+		#interrupt-cells = <2>;
+
+		regulators {
+			compatible = "mediatek,mt6392-regulator";
+
+			mt6392_vproc_reg: buck_vproc {
+				regulator-name = "buck_vproc";
+				regulator-min-microvolt = <700000>;
+				regulator-max-microvolt = <1350000>;
+				regulator-ramp-delay = <12500>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vsys_reg: buck_vsys {
+				regulator-name = "buck_vsys";
+				regulator-min-microvolt = <1400000>;
+				regulator-max-microvolt = <2987500>;
+				regulator-ramp-delay = <25000>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vcore_reg: buck_vcore {
+				regulator-name = "buck_vcore";
+				regulator-min-microvolt = <700000>;
+				regulator-max-microvolt = <1350000>;
+				regulator-ramp-delay = <12500>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vxo22_reg: ldo_vxo22 {
+				regulator-name = "ldo_vxo22";
+				regulator-min-microvolt = <2200000>;
+				regulator-max-microvolt = <2200000>;
+				regulator-enable-ramp-delay = <110>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vaud22_reg: ldo_vaud22 {
+				regulator-name = "ldo_vaud22";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <2200000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vcama_reg: ldo_vcama {
+				regulator-name = "ldo_vcama";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vaud28_reg: ldo_vaud28 {
+				regulator-name = "ldo_vaud28";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vadc18_reg: ldo_vadc18 {
+				regulator-name = "ldo_vadc18";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vcn35_reg: ldo_vcn35 {
+				regulator-name = "ldo_vcn35";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3600000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vio28_reg: ldo_vio28 {
+				regulator-name = "ldo_vio28";
+				regulator-min-microvolt = <2800000>;
+				regulator-max-microvolt = <2800000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vusb_reg: ldo_vusb {
+				regulator-name = "ldo_vusb";
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vmc_reg: ldo_vmc {
+				regulator-name = "ldo_vmc";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-boot-on;
+			};
+
+			mt6392_vmch_reg: ldo_vmch {
+				regulator-name = "ldo_vmch";
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-boot-on;
+			};
+
+			mt6392_vemc3v3_reg: ldo_vemc3v3 {
+				regulator-name = "ldo_vemc3v3";
+				regulator-min-microvolt = <3000000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-boot-on;
+			};
+
+			mt6392_vgp1_reg: ldo_vgp1 {
+				regulator-name = "ldo_vgp1";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vgp2_reg: ldo_vgp2 {
+				regulator-name = "ldo_vgp2";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vcn18_reg: ldo_vcn18 {
+				regulator-name = "ldo_vcn18";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vcamaf_reg: ldo_vcamaf {
+				regulator-name = "ldo_vcamaf";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vm_reg: ldo_vm {
+				regulator-name = "ldo_vm";
+				regulator-min-microvolt = <1240000>;
+				regulator-max-microvolt = <1390000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vio18_reg: ldo_vio18 {
+				regulator-name = "ldo_vio18";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vcamd_reg: ldo_vcamd {
+				regulator-name = "ldo_vcamd";
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vcamio_reg: ldo_vcamio {
+				regulator-name = "ldo_vcamio";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+
+			mt6392_vm25_reg: ldo_vm25 {
+				regulator-name = "ldo_vm25";
+				regulator-min-microvolt = <2500000>;
+				regulator-max-microvolt = <2500000>;
+				regulator-enable-ramp-delay = <264>;
+				regulator-always-on;
+				regulator-boot-on;
+			};
+
+			mt6392_vefuse_reg: ldo_vefuse {
+				regulator-name = "ldo_vefuse";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <2000000>;
+				regulator-enable-ramp-delay = <264>;
+			};
+		};
+
+		rtc {
+			compatible = "mediatek,mt6392-rtc";
+		};
+
+		keys {
+			compatible = "mediatek,mt6392-keys";
+
+			key-power {
+				linux,keycodes = <KEY_POWER>;
+				wakeup-source;
+			};
+
+			key-home {
+				linux,keycodes = <KEY_HOME>;
+				wakeup-source;
+			};
+		};
+	};
+};
Signature · 1 line
2.47.1
#27 lore raw

Re: [PATCH 9/9] arm64: dts: mt6392: add mt6392 PMIC dtsi

In reply to Val Packett
Quoted 21 lines · Val Packett

Add the dts to be included by all boards using the MT6392 PMIC.

---
 arch/arm64/boot/dts/mediatek/mt6392.dtsi | 232 +++++++++++++++++++++++
 1 file changed, 232 insertions(+)
 create mode 100644 arch/arm64/boot/dts/mediatek/mt6392.dtsi
arch/arm64/boot/dts/mediatek/mt6392.dtsi new file +6 -0
new file mode 100644
index 0000000000000..a7c65dbb043c1
@@ -0,0 +1,232 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2019 MediaTek Inc.
+ * Copyright (c) 2024 Val Packett <[email protected]>
+ */
+

arch/arm64/boot/dts/mediatek/mt6392.dtsi line 16

Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt6392.dtsi new file +10 -0
+#include <dt-bindings/input/input.h>
+
+&pwrap {
+       pmic: mt6392 {
+               compatible = "mediatek,mt6392";
+               interrupt-controller;
+               #interrupt-cells = <2>;
+
+               regulators {
+                       compatible = "mediatek,mt6392-regulator";

While listed in the binding, this doesn't actually do anything in the driver.

arch/arm64/boot/dts/mediatek/mt6392.dtsi line 18

Quoted 1 line
arch/arm64/boot/dts/mediatek/mt6392.dtsi new file +1 -0
+                       mt6392_vproc_reg: buck_vproc {

Could we get rid of the "buck_" and "ldo_" prefixes?

arch/arm64/boot/dts/mediatek/mt6392.dtsi line 21

Quoted 3 lines
arch/arm64/boot/dts/mediatek/mt6392.dtsi new file +3 -0
+                               regulator-name = "buck_vproc";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1350000>;

PMIC ranges are already implied by the compatible string and regulator node name. No need to repeat them.

arch/arm64/boot/dts/mediatek/mt6392.dtsi line 21

Quoted 1 line
arch/arm64/boot/dts/mediatek/mt6392.dtsi new file +1 -0
+                               regulator-ramp-delay = <12500>;

This probably belongs in the driver?

Comments apply to all the regulator sub-nodes.

ChenYu

Quoted 214 lines
arch/arm64/boot/dts/mediatek/mt6392.dtsi new file +210 -1
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6392_vsys_reg: buck_vsys {
+                               regulator-name = "buck_vsys";
+                               regulator-min-microvolt = <1400000>;
+                               regulator-max-microvolt = <2987500>;
+                               regulator-ramp-delay = <25000>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6392_vcore_reg: buck_vcore {
+                               regulator-name = "buck_vcore";
+                               regulator-min-microvolt = <700000>;
+                               regulator-max-microvolt = <1350000>;
+                               regulator-ramp-delay = <12500>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6392_vxo22_reg: ldo_vxo22 {
+                               regulator-name = "ldo_vxo22";
+                               regulator-min-microvolt = <2200000>;
+                               regulator-max-microvolt = <2200000>;
+                               regulator-enable-ramp-delay = <110>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6392_vaud22_reg: ldo_vaud22 {
+                               regulator-name = "ldo_vaud22";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <2200000>;
+                               regulator-enable-ramp-delay = <264>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6392_vcama_reg: ldo_vcama {
+                               regulator-name = "ldo_vcama";
+                               regulator-min-microvolt = <2800000>;
+                               regulator-max-microvolt = <2800000>;
+                               regulator-enable-ramp-delay = <264>;
+                       };
+
+                       mt6392_vaud28_reg: ldo_vaud28 {
+                               regulator-name = "ldo_vaud28";
+                               regulator-min-microvolt = <2800000>;
+                               regulator-max-microvolt = <2800000>;
+                               regulator-enable-ramp-delay = <264>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6392_vadc18_reg: ldo_vadc18 {
+                               regulator-name = "ldo_vadc18";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-enable-ramp-delay = <264>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6392_vcn35_reg: ldo_vcn35 {
+                               regulator-name = "ldo_vcn35";
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3600000>;
+                               regulator-enable-ramp-delay = <264>;
+                       };
+
+                       mt6392_vio28_reg: ldo_vio28 {
+                               regulator-name = "ldo_vio28";
+                               regulator-min-microvolt = <2800000>;
+                               regulator-max-microvolt = <2800000>;
+                               regulator-enable-ramp-delay = <264>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6392_vusb_reg: ldo_vusb {
+                               regulator-name = "ldo_vusb";
+                               regulator-min-microvolt = <3300000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-enable-ramp-delay = <264>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6392_vmc_reg: ldo_vmc {
+                               regulator-name = "ldo_vmc";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-enable-ramp-delay = <264>;
+                               regulator-boot-on;
+                       };
+
+                       mt6392_vmch_reg: ldo_vmch {
+                               regulator-name = "ldo_vmch";
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-enable-ramp-delay = <264>;
+                               regulator-boot-on;
+                       };
+
+                       mt6392_vemc3v3_reg: ldo_vemc3v3 {
+                               regulator-name = "ldo_vemc3v3";
+                               regulator-min-microvolt = <3000000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-enable-ramp-delay = <264>;
+                               regulator-boot-on;
+                       };
+
+                       mt6392_vgp1_reg: ldo_vgp1 {
+                               regulator-name = "ldo_vgp1";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-enable-ramp-delay = <264>;
+                       };
+
+                       mt6392_vgp2_reg: ldo_vgp2 {
+                               regulator-name = "ldo_vgp2";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-enable-ramp-delay = <264>;
+                       };
+
+                       mt6392_vcn18_reg: ldo_vcn18 {
+                               regulator-name = "ldo_vcn18";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-enable-ramp-delay = <264>;
+                       };
+
+                       mt6392_vcamaf_reg: ldo_vcamaf {
+                               regulator-name = "ldo_vcamaf";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-enable-ramp-delay = <264>;
+                       };
+
+                       mt6392_vm_reg: ldo_vm {
+                               regulator-name = "ldo_vm";
+                               regulator-min-microvolt = <1240000>;
+                               regulator-max-microvolt = <1390000>;
+                               regulator-enable-ramp-delay = <264>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6392_vio18_reg: ldo_vio18 {
+                               regulator-name = "ldo_vio18";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-enable-ramp-delay = <264>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6392_vcamd_reg: ldo_vcamd {
+                               regulator-name = "ldo_vcamd";
+                               regulator-min-microvolt = <1200000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-enable-ramp-delay = <264>;
+                       };
+
+                       mt6392_vcamio_reg: ldo_vcamio {
+                               regulator-name = "ldo_vcamio";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
+                               regulator-enable-ramp-delay = <264>;
+                       };
+
+                       mt6392_vm25_reg: ldo_vm25 {
+                               regulator-name = "ldo_vm25";
+                               regulator-min-microvolt = <2500000>;
+                               regulator-max-microvolt = <2500000>;
+                               regulator-enable-ramp-delay = <264>;
+                               regulator-always-on;
+                               regulator-boot-on;
+                       };
+
+                       mt6392_vefuse_reg: ldo_vefuse {
+                               regulator-name = "ldo_vefuse";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <2000000>;
+                               regulator-enable-ramp-delay = <264>;
+                       };
+               };
+
+               rtc {
+                       compatible = "mediatek,mt6392-rtc";
+               };
+
+               keys {
+                       compatible = "mediatek,mt6392-keys";
+
+                       key-power {
+                               linux,keycodes = <KEY_POWER>;
+                               wakeup-source;
+                       };
+
+                       key-home {
+                               linux,keycodes = <KEY_HOME>;
+                               wakeup-source;
+                       };
+               };
+       };
+};
--

2.47.1