Skip to contentSkip to conversation

power: pmic: mtk-pwrap: add more capability flags

PATCH Applied David Lechner 3 participants 14 messages Apr 9 – Apr 29 Arm MediaTek

lore
Share & tools
lore
#0 lore raw

v2 cover power: pmic: mtk-pwrap: add more capability flags

After using the mtk-pwrap driver a bit, we noticed that there were a few places where it was writing to registers that were not defined on all platforms. The undefined registers are treated as 0, which is the DONE2 register on the affected platforms. This could cause the DONE2 register to have an incorrect value, which could cause Linux to re-initialize the PMIC unnecessarily.

To avoid this issue and ensure that we only write to registers that are defined on a given platform, we can add some more capability flags to conditionally call any register writes that aren't common to all platforms.

There are also a couple of other cleanups that we do along the way. And in v2, I've picked up Julien's patch to add support for MT8195 and rebased on top of this.

---
Changes in v2:
- Use EOPNOTSUPP.
- Reorder patches to reduce churn.
- Added new patch to fix driver description comment.
- Added new patch to drop chip type enum.
- Picked up Julien's patches from [1] and rebased on these changes.
- Link to [1]: https://lore.kernel.org/u-boot/[email protected]/
- Link to v1: https://patch.msgid.link/[email protected]

---
David Lechner (6):
power: pmic: mtk-pwrap: fix file description
power: pmic: mtk-pwrap: add PWRAP_CAP_WDT_SRC flag
power: pmic: mtk-pwrap: add init capability flag
power: pmic: mtk-pwrap: drop PWRAP_SLV_CAP_DUALIO on mt6359
power: pmic: mtk-pwrap: remove interrupt related code
power: pmic: mtk-pwrap: use pmic compatible to select child info

Julien Stephan (2):
power: pmic: mtk-pwrap: use tabs for alignment
power: pmic: mtk-pwrap: add MT8195 support

 drivers/power/pmic/mtk-pwrap.c | 115 +++++++++++++++++++++--------------------
 1 file changed, 60 insertions(+), 55 deletions(-)

---
base-commit: 2a1bcefce835b827bbf88a9e112d646c5c4af9c1
change-id: 20260317-mtk-pmic-fixes-c1523b1b0dad

Best regards,

Signature · 1 line
David Lechner <[email protected]>
#1 lore raw

PATCH v2 1/8 power: pmic: mtk-pwrap: fix file description

Fix the comment at the start of the file to accurately describe what this file does. The old description was likely copied from the related regulator driver.

---
 drivers/power/pmic/mtk-pwrap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/pmic/mtk-pwrap.c +1 -1
index 3e3a691d9e8..f4dfb48e93b 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * MT6357 regulator driver
+ * MediaTek PMIC Wrapper driver
  *
  * Copyright (c) 2026 BayLibre, SAS.
  * Author: Julien Masson <[email protected]>
Signature · 1 line
2.43.0
#2 lore raw

PATCH v2 2/8 power: pmic: mtk-pwrap: add PWRAP_CAP_WDT_SRC flag

In reply to David Lechner

Add a PWRAP_CAP_WDT_SRC flag to indicate if a PMIC wrapper has a WDT_SRC or not. Then use this to conditionally enable the watchdog timer.

Prior to this change, since the register was not defined, it defaulted to 0, so the wrong register (DONE2) was being written to.

---
 drivers/power/pmic/mtk-pwrap.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/power/pmic/mtk-pwrap.c +5 -3
index f4dfb48e93b..3ed21dcf2ef 100644
@@ -60,8 +60,9 @@ static const struct pmic_child_info mt6359_pmic_children_info[] = {
 
 /* Group of bits used for shown pwrap capability */
 #define PWRAP_CAP_INT1_EN		BIT(3)
-#define PWRAP_CAP_WDT_SRC1		BIT(4)
-#define PWRAP_CAP_ARB			BIT(5)
+#define PWRAP_CAP_WDT_SRC		BIT(4)
+#define PWRAP_CAP_WDT_SRC1		BIT(5)
+#define PWRAP_CAP_ARB			BIT(6)
 
 /* defines for slave device wrapper registers */
 enum dew_regs {
@@ -755,7 +756,8 @@ static int mtk_pwrap_probe(struct udevice *dev)
 	 * Since STAUPD was not used on mt8173 platform,
 	 * so STAUPD of WDT_SRC which should be turned off
 	 */
-	pwrap_writel(wrp, wrp->master->wdt_src, PWRAP_WDT_SRC_EN);
+	if (HAS_CAP(wrp->master->caps, PWRAP_CAP_WDT_SRC))
+		pwrap_writel(wrp, wrp->master->wdt_src, PWRAP_WDT_SRC_EN);
 
 	if (HAS_CAP(wrp->master->caps, PWRAP_CAP_WDT_SRC1))
 		pwrap_writel(wrp, wrp->master->wdt_src, PWRAP_WDT_SRC_EN_1);
Signature · 1 line
2.43.0
#3 lore raw

PATCH v2 3/8 power: pmic: mtk-pwrap: add init capability flag

In reply to David Lechner

Add a PWRAP_CAP_INIT capability flag to specify if it is safe to call pwrap_init() or not. Not all targets define the registers accessed by pwrap_init(). In that case, it is expected that an earlier bootloader has already initialized the PMIC. If not, we now return an error instead of trying to access undefined registers.

---
 drivers/power/pmic/mtk-pwrap.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/power/pmic/mtk-pwrap.c +8 -1
index 3ed21dcf2ef..38ae44f0abf 100644
@@ -63,6 +63,8 @@ static const struct pmic_child_info mt6359_pmic_children_info[] = {
 #define PWRAP_CAP_WDT_SRC		BIT(4)
 #define PWRAP_CAP_WDT_SRC1		BIT(5)
 #define PWRAP_CAP_ARB			BIT(6)
+/* To implement this capability, the registers used in pwrap_init() must be defined. */
+#define PWRAP_CAP_INIT			BIT(7)
 
 /* defines for slave device wrapper registers */
 enum dew_regs {
@@ -735,6 +737,11 @@ static int mtk_pwrap_probe(struct udevice *dev)
 	 * Skip initialization here in this case.
 	 */
 	if (!pwrap_readl(wrp, PWRAP_INIT_DONE2)) {
+		if (!HAS_CAP(wrp->master->caps, PWRAP_CAP_INIT)) {
+			dev_err(dev, "initialization is required but not supported\n");
+			return -EOPNOTSUPP;
+		}
+
 		ret = pwrap_init(wrp);
 		if (ret) {
 			dev_err(dev, "init failed with %d\n", ret);
@@ -877,7 +884,7 @@ static const struct pmic_wrapper_type pwrap_mt8365 = {
 	.int1_en_all = 0x0,
 	.spi_w = PWRAP_MAN_CMD_SPI_WRITE,
 	.wdt_src = PWRAP_WDT_SRC_MASK_ALL,
-	.caps = PWRAP_CAP_INT1_EN | PWRAP_CAP_WDT_SRC1,
+	.caps = PWRAP_CAP_INT1_EN | PWRAP_CAP_WDT_SRC1 | PWRAP_CAP_INIT,
 };
 
 static const struct udevice_id mtk_pwrap_ids[] = {
Signature · 1 line
2.43.0
#4 lore raw

PATCH v2 4/8 power: pmic: mtk-pwrap: drop PWRAP_SLV_CAP_DUALIO on mt6359

In reply to David Lechner

Drop the PWRAP_SLV_CAP_DUALIO flag from the mt6359 PMIC definition. The mt6359p variant of the PMIC does support dual I/O.

Prior to this change, the driver would attempt to write to the PWRAP_DEW_DIO_EN register, which was not defined, so would write register 0 (DONE2).

---
 drivers/power/pmic/mtk-pwrap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/pmic/mtk-pwrap.c +1 -1
index 38ae44f0abf..64c483b2f3b 100644
@@ -647,7 +647,7 @@ static const struct pwrap_slv_type pmic_mt6357 = {
 
 static const struct pwrap_slv_type pmic_mt6359 = {
 	.dew_regs = mt6359_regs,
-	.caps = PWRAP_SLV_CAP_DUALIO,
+	.caps = 0,
 };
 
 static const struct udevice_id mtk_pmic_ids[] = {
Signature · 1 line
2.43.0
#5 lore raw

PATCH v2 5/8 power: pmic: mtk-pwrap: remove interrupt related code

In reply to David Lechner

Remove the interrupt related code in mtk-pwrap driver. This was just enabling interrupts without any handler.

Even if we did have a handler, the only thing we could do is log a message. Since U-Boot isn't long running, this likely wouldn't be very useful.

---
 drivers/power/pmic/mtk-pwrap.c | 16 ----------------
 1 file changed, 16 deletions(-)
drivers/power/pmic/mtk-pwrap.c +0 -16
index 64c483b2f3b..c41ebeb62cc 100644
@@ -367,8 +367,6 @@ struct pmic_wrapper_type {
 	int *regs;
 	enum pwrap_type type;
 	u32 arb_en_all;
-	u32 int_en_all;
-	u32 int1_en_all;
 	u32 spi_w;
 	u32 wdt_src;
 	/* Flags indicating the capability for the target pwrap */
@@ -774,15 +772,6 @@ static int mtk_pwrap_probe(struct udevice *dev)
 	else
 		pwrap_writel(wrp, 0x1, PWRAP_TIMER_EN);
 
-	pwrap_writel(wrp, wrp->master->int_en_all, PWRAP_INT_EN);
-
-	/*
-	 * We add INT1 interrupt to handle starvation and request exception
-	 * If we support it, we should enable it here.
-	 */
-	if (HAS_CAP(wrp->master->caps, PWRAP_CAP_INT1_EN))
-		pwrap_writel(wrp, wrp->master->int1_en_all, PWRAP_INT1_EN);
-
 	return 0;
 }
 
@@ -859,8 +848,6 @@ static struct pmic_wrapper_type pwrap_mt8188 = {
 	.regs = mt8188_regs,
 	.type = PWRAP_MT8188,
 	.arb_en_all = 0x777f,
-	.int_en_all = 0x180000,
-	.int1_en_all = 0x0,
 	.spi_w = PWRAP_MAN_CMD_SPI_WRITE,
 	.wdt_src = PWRAP_WDT_SRC_MASK_ALL,
 	.caps = PWRAP_CAP_INT1_EN | PWRAP_CAP_ARB,
@@ -870,7 +857,6 @@ static struct pmic_wrapper_type pwrap_mt8189 = {
 	.regs = mt8189_regs,
 	.type = PWRAP_MT8189,
 	.arb_en_all = 0x777f,
-	.int_en_all = 0x180000,
 	.spi_w = PWRAP_MAN_CMD_SPI_WRITE,
 	.wdt_src = PWRAP_WDT_SRC_MASK_ALL,
 	.caps = PWRAP_CAP_ARB,
@@ -880,8 +866,6 @@ static const struct pmic_wrapper_type pwrap_mt8365 = {
 	.regs = mt8365_regs,
 	.type = PWRAP_MT8365,
 	.arb_en_all = 0x3ffff,
-	.int_en_all = 0x7f1fffff,
-	.int1_en_all = 0x0,
 	.spi_w = PWRAP_MAN_CMD_SPI_WRITE,
 	.wdt_src = PWRAP_WDT_SRC_MASK_ALL,
 	.caps = PWRAP_CAP_INT1_EN | PWRAP_CAP_WDT_SRC1 | PWRAP_CAP_INIT,
Signature · 1 line
2.43.0
#6 lore raw

Re: [PATCH v2 5/8] power: pmic: mtk-pwrap: remove interrupt related code

Quoted 3 lines · David Lechner

Remove the interrupt related code in mtk-pwrap driver. This was just enabling interrupts without any handler.

Drat, I forgot to remove the PWRAP_CAP_INT1_EN flag.

If nothing else comes up, I can fix that up while applying the patches.

#7 lore raw

PATCH v2 6/8 power: pmic: mtk-pwrap: use pmic compatible to select child info

In reply to David Lechner

Change the logic for selecting pmic_children_info to use the compatible string from the devicetree instead of expecting the pwrap (part of the MCU) to correspond to the separate PMIC chip.

In addition to being more correct, it also saves a few lines of code for each MCU type that is added by dropping the enum and type field.

---
 drivers/power/pmic/mtk-pwrap.c | 24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)
drivers/power/pmic/mtk-pwrap.c +5 -19
index c41ebeb62cc..7d84ab1f6d3 100644
@@ -341,12 +341,6 @@ static int mt8365_regs[] = {
 	[PWRAP_WDT_SRC_EN_1] =		0xf8,
 };
 
-enum pwrap_type {
-	PWRAP_MT8188,
-	PWRAP_MT8189,
-	PWRAP_MT8365,
-};
-
 struct pwrap_slv_type {
 	const u32 *dew_regs;
 	u32 caps;
@@ -365,7 +359,6 @@ struct pmic_wrapper {
 
 struct pmic_wrapper_type {
 	int *regs;
-	enum pwrap_type type;
 	u32 arb_en_all;
 	u32 spi_w;
 	u32 wdt_src;
@@ -780,7 +773,6 @@ static int mtk_pwrap_bind(struct udevice *dev)
 	ofnode pmic_node, regulators_node;
 	int children;
 	const struct pmic_child_info *pmic_children_info;
-	struct pmic_wrapper_type *pw_type = (void *)dev_get_driver_data(dev);
 
 	pmic_node = dev_read_first_subnode(dev);
 	if (!ofnode_valid(pmic_node)) {
@@ -788,16 +780,13 @@ static int mtk_pwrap_bind(struct udevice *dev)
 		return -ENXIO;
 	}
 
-	switch (pw_type->type) {
-	case PWRAP_MT8365:
+	if (ofnode_device_is_compatible(pmic_node, "mediatek,mt6357")) {
 		pmic_children_info = mt6357_pmic_children_info;
-		break;
-	case PWRAP_MT8188:
-	case PWRAP_MT8189:
+	} else if (ofnode_device_is_compatible(pmic_node, "mediatek,mt6359")) {
 		pmic_children_info = mt6359_pmic_children_info;
-		break;
-	default:
-		dev_err(dev, "pwrap type %d not supported\n", pw_type->type);
+	} else {
+		dev_err(dev, "pmic type %s not supported\n",
+			ofnode_read_string(pmic_node, "compatible"));
 		return -ENXIO;
 	}
 
@@ -846,7 +835,6 @@ static struct dm_pmic_ops mtk_pwrap_ops = {
 
 static struct pmic_wrapper_type pwrap_mt8188 = {
 	.regs = mt8188_regs,
-	.type = PWRAP_MT8188,
 	.arb_en_all = 0x777f,
 	.spi_w = PWRAP_MAN_CMD_SPI_WRITE,
 	.wdt_src = PWRAP_WDT_SRC_MASK_ALL,
@@ -855,7 +843,6 @@ static struct pmic_wrapper_type pwrap_mt8188 = {
 
 static struct pmic_wrapper_type pwrap_mt8189 = {
 	.regs = mt8189_regs,
-	.type = PWRAP_MT8189,
 	.arb_en_all = 0x777f,
 	.spi_w = PWRAP_MAN_CMD_SPI_WRITE,
 	.wdt_src = PWRAP_WDT_SRC_MASK_ALL,
@@ -864,7 +851,6 @@ static struct pmic_wrapper_type pwrap_mt8189 = {
 
 static const struct pmic_wrapper_type pwrap_mt8365 = {
 	.regs = mt8365_regs,
-	.type = PWRAP_MT8365,
 	.arb_en_all = 0x3ffff,
 	.spi_w = PWRAP_MAN_CMD_SPI_WRITE,
 	.wdt_src = PWRAP_WDT_SRC_MASK_ALL,
Signature · 1 line
2.43.0
#8 lore raw

PATCH v2 7/8 power: pmic: mtk-pwrap: use tabs for alignment

In reply to David Lechner

From: Julien Stephan <[email protected]>

Fix mt8188_regs definition to use tabs instead of spaces for alignment to be consistent with other definitions.

---
 drivers/power/pmic/mtk-pwrap.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/power/pmic/mtk-pwrap.c +14 -14
index 7d84ab1f6d3..b05c6b88157 100644
@@ -252,20 +252,20 @@ enum pwrap_regs {
 };
 
 static int mt8188_regs[] = {
-	[PWRAP_INIT_DONE2] =            0x0,
-	[PWRAP_STAUPD_CTRL] =           0x4C,
-	[PWRAP_TIMER_EN] =              0x3E4,
-	[PWRAP_INT_EN] =                0x420,
-	[PWRAP_INT_FLG] =               0x428,
-	[PWRAP_INT_CLR] =               0x42C,
-	[PWRAP_INT1_EN] =               0x450,
-	[PWRAP_INT1_FLG] =              0x458,
-	[PWRAP_INT1_CLR] =              0x45C,
-	[PWRAP_WACS2_CMD] =             0x880,
-	[PWRAP_SWINF_2_WDATA_31_0] =    0x884,
-	[PWRAP_SWINF_2_RDATA_31_0] =    0x894,
-	[PWRAP_WACS2_VLDCLR] =          0x8A4,
-	[PWRAP_WACS2_RDATA] =           0x8A8,
+	[PWRAP_INIT_DONE2] =		0x0,
+	[PWRAP_STAUPD_CTRL] =		0x4C,
+	[PWRAP_TIMER_EN] =		0x3E4,
+	[PWRAP_INT_EN] =		0x420,
+	[PWRAP_INT_FLG] =		0x428,
+	[PWRAP_INT_CLR] =		0x42C,
+	[PWRAP_INT1_EN] =		0x450,
+	[PWRAP_INT1_FLG] =		0x458,
+	[PWRAP_INT1_CLR] =		0x45C,
+	[PWRAP_WACS2_CMD] =		0x880,
+	[PWRAP_SWINF_2_WDATA_31_0] =	0x884,
+	[PWRAP_SWINF_2_RDATA_31_0] =	0x894,
+	[PWRAP_WACS2_VLDCLR] =		0x8A4,
+	[PWRAP_WACS2_RDATA] =		0x8A8,
 };
 
 static int mt8189_regs[] = {
Signature · 1 line
2.43.0
#9 lore raw

PATCH v2 8/8 power: pmic: mtk-pwrap: add MT8195 support

In reply to David Lechner

From: Julien Stephan <[email protected]>

Add mt8195 support.

Support comes directly from commit e88edc977b00 ("soc: mediatek: pwrap:
add pwrap driver for MT8195 SoC") from the Linux Kernel.

---
 drivers/power/pmic/mtk-pwrap.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/power/pmic/mtk-pwrap.c +26 -0
index b05c6b88157..88aa3dace29 100644
@@ -279,6 +279,23 @@ static int mt8189_regs[] = {
 	[PWRAP_WACS2_RDATA] =		0x8A8,
 };
 
+static int mt8195_regs[] = {
+	[PWRAP_INIT_DONE2] =		0x0,
+	[PWRAP_STAUPD_CTRL] =		0x4C,
+	[PWRAP_TIMER_EN] =		0x3E4,
+	[PWRAP_INT_EN] =		0x420,
+	[PWRAP_INT_FLG] =		0x428,
+	[PWRAP_INT_CLR] =		0x42C,
+	[PWRAP_INT1_EN] =		0x450,
+	[PWRAP_INT1_FLG] =		0x458,
+	[PWRAP_INT1_CLR] =		0x45C,
+	[PWRAP_WACS2_CMD] =		0x880,
+	[PWRAP_SWINF_2_WDATA_31_0] =	0x884,
+	[PWRAP_SWINF_2_RDATA_31_0] =	0x894,
+	[PWRAP_WACS2_VLDCLR] =		0x8A4,
+	[PWRAP_WACS2_RDATA] =		0x8A8,
+};
+
 static int mt8365_regs[] = {
 	[PWRAP_MUX_SEL] =		0x0,
 	[PWRAP_WRAP_EN] =		0x4,
@@ -849,6 +866,14 @@ static struct pmic_wrapper_type pwrap_mt8189 = {
 	.caps = PWRAP_CAP_ARB,
 };
 
+static const struct pmic_wrapper_type pwrap_mt8195 = {
+	.regs = mt8195_regs,
+	.arb_en_all = 0x777f, /* NEED CONFIRM */
+	.spi_w = PWRAP_MAN_CMD_SPI_WRITE,
+	.wdt_src = PWRAP_WDT_SRC_MASK_ALL,
+	.caps = PWRAP_CAP_INT1_EN | PWRAP_CAP_ARB,
+};
+
 static const struct pmic_wrapper_type pwrap_mt8365 = {
 	.regs = mt8365_regs,
 	.arb_en_all = 0x3ffff,
@@ -860,6 +885,7 @@ static const struct pmic_wrapper_type pwrap_mt8365 = {
 static const struct udevice_id mtk_pwrap_ids[] = {
 	{ .compatible = "mediatek,mt8188-pwrap", .data = (ulong)&pwrap_mt8188 },
 	{ .compatible = "mediatek,mt8189-pwrap", .data = (ulong)&pwrap_mt8189 },
+	{ .compatible = "mediatek,mt8195-pwrap", .data = (ulong)&pwrap_mt8195 },
 	{ .compatible = "mediatek,mt8365-pwrap", .data = (ulong)&pwrap_mt8365 },
 	{ }
 };
Signature · 1 line
2.43.0
#10 lore raw
In reply to David Lechner
Quoted 40 lines · David Lechner

After using the mtk-pwrap driver a bit, we noticed that there were a few places where it was writing to registers that were not defined on all platforms. The undefined registers are treated as 0, which is the DONE2 register on the affected platforms. This could cause the DONE2 register to have an incorrect value, which could cause Linux to re-initialize the PMIC unnecessarily.

To avoid this issue and ensure that we only write to registers that are defined on a given platform, we can add some more capability flags to conditionally call any register writes that aren't common to all platforms.

There are also a couple of other cleanups that we do along the way. And in v2, I've picked up Julien's patch to add support for MT8195 and rebased on top of this.

---
Changes in v2:
- Use EOPNOTSUPP.
- Reorder patches to reduce churn.
- Added new patch to fix driver description comment.
- Added new patch to drop chip type enum.
- Picked up Julien's patches from [1] and rebased on these changes.
- Link to [1]: https://lore.kernel.org/u-boot/[email protected]/
- Link to v1: https://patch.msgid.link/[email protected]

---
David Lechner (6):
power: pmic: mtk-pwrap: fix file description
power: pmic: mtk-pwrap: add PWRAP_CAP_WDT_SRC flag
power: pmic: mtk-pwrap: add init capability flag
power: pmic: mtk-pwrap: drop PWRAP_SLV_CAP_DUALIO on mt6359
power: pmic: mtk-pwrap: remove interrupt related code
power: pmic: mtk-pwrap: use pmic compatible to select child info

Julien Stephan (2):
power: pmic: mtk-pwrap: use tabs for alignment
power: pmic: mtk-pwrap: add MT8195 support

Quoted 10 lines
 drivers/power/pmic/mtk-pwrap.c | 115 +++++++++++++++++++++--------------------
 1 file changed, 60 insertions(+), 55 deletions(-)

---
base-commit: 2a1bcefce835b827bbf88a9e112d646c5c4af9c1
change-id: 20260317-mtk-pmic-fixes-c1523b1b0dad

Best regards,

Signature · 1 line
David Lechner <[email protected]>

Hi Jaehoon,

Is it OK if I take this through the MediaTek tree? We need to pick this up for v2026.07 to make sure the boards we added recently are working correctly.

#11 lore raw
Quoted 52 lines · David Lechner
Quoted 40 lines · David Lechner

After using the mtk-pwrap driver a bit, we noticed that there were a few places where it was writing to registers that were not defined on all platforms. The undefined registers are treated as 0, which is the DONE2 register on the affected platforms. This could cause the DONE2 register to have an incorrect value, which could cause Linux to re-initialize the PMIC unnecessarily.

To avoid this issue and ensure that we only write to registers that are defined on a given platform, we can add some more capability flags to conditionally call any register writes that aren't common to all platforms.

There are also a couple of other cleanups that we do along the way. And in v2, I've picked up Julien's patch to add support for MT8195 and rebased on top of this.

---
Changes in v2:
- Use EOPNOTSUPP.
- Reorder patches to reduce churn.
- Added new patch to fix driver description comment.
- Added new patch to drop chip type enum.
- Picked up Julien's patches from [1] and rebased on these changes.
- Link to [1]: https://lore.kernel.org/u-boot/[email protected]/
- Link to v1: https://patch.msgid.link/[email protected]

---
David Lechner (6):
power: pmic: mtk-pwrap: fix file description
power: pmic: mtk-pwrap: add PWRAP_CAP_WDT_SRC flag
power: pmic: mtk-pwrap: add init capability flag
power: pmic: mtk-pwrap: drop PWRAP_SLV_CAP_DUALIO on mt6359
power: pmic: mtk-pwrap: remove interrupt related code
power: pmic: mtk-pwrap: use pmic compatible to select child info

Julien Stephan (2):
power: pmic: mtk-pwrap: use tabs for alignment
power: pmic: mtk-pwrap: add MT8195 support

Quoted 10 lines
 drivers/power/pmic/mtk-pwrap.c | 115 +++++++++++++++++++++--------------------
 1 file changed, 60 insertions(+), 55 deletions(-)

---
base-commit: 2a1bcefce835b827bbf88a9e112d646c5c4af9c1
change-id: 20260317-mtk-pmic-fixes-c1523b1b0dad

Best regards,

Signature · 1 line
David Lechner <[email protected]>
Quoted 6 lines

Hi Jaehoon,

Is it OK if I take this through the MediaTek tree? We need to pick this up for v2026.07 to make sure the boards we added recently are working correctly.

Feel free to take it through MTK tree.

Regards
Peng.

Reviewed-by on the v2 series
#12 lore raw
In reply to David Lechner
Quoted 43 lines · David Lechner

After using the mtk-pwrap driver a bit, we noticed that there were a few places where it was writing to registers that were not defined on all platforms. The undefined registers are treated as 0, which is the DONE2 register on the affected platforms. This could cause the DONE2 register to have an incorrect value, which could cause Linux to re-initialize the PMIC unnecessarily.

To avoid this issue and ensure that we only write to registers that are defined on a given platform, we can add some more capability flags to conditionally call any register writes that aren't common to all platforms.

There are also a couple of other cleanups that we do along the way. And in v2, I've picked up Julien's patch to add support for MT8195 and rebased on top of this.

---
Changes in v2:
- Use EOPNOTSUPP.
- Reorder patches to reduce churn.
- Added new patch to fix driver description comment.
- Added new patch to drop chip type enum.
- Picked up Julien's patches from [1] and rebased on these changes.
- Link to [1]: https://lore.kernel.org/u-boot/[email protected]/
- Link to v1: https://patch.msgid.link/[email protected]

---
David Lechner (6):
power: pmic: mtk-pwrap: fix file description
power: pmic: mtk-pwrap: add PWRAP_CAP_WDT_SRC flag
power: pmic: mtk-pwrap: add init capability flag
power: pmic: mtk-pwrap: drop PWRAP_SLV_CAP_DUALIO on mt6359
power: pmic: mtk-pwrap: remove interrupt related code
power: pmic: mtk-pwrap: use pmic compatible to select child info

Julien Stephan (2):
power: pmic: mtk-pwrap: use tabs for alignment
power: pmic: mtk-pwrap: add MT8195 support

 drivers/power/pmic/mtk-pwrap.c | 115 +++++++++++++++++++++--------------------
 1 file changed, 60 insertions(+), 55 deletions(-)
Quoted 8 lines

---
base-commit: 2a1bcefce835b827bbf88a9e112d646c5c4af9c1
change-id: 20260317-mtk-pmic-fixes-c1523b1b0dad

Best regards,
--
David Lechner <[email protected]>

Thank you David for adding my patches on this series

author Applied
#13 lore raw
In reply to David Lechner
Quoted 10 lines · David Lechner

power: pmic: mtk-pwrap: add more capability flags

After using the mtk-pwrap driver a bit, we noticed that there were a few places where it was writing to registers that were not defined on all platforms. The undefined registers are treated as 0, which is the DONE2 register on the affected platforms. This could cause the DONE2 register to have an incorrect value, which could cause Linux to re-initialize the PMIC unnecessarily.

[...]

Applied to mediatek-for-master, thanks!

[1/8] power: pmic: mtk-pwrap: fix file description

      commit: 0f50131f99a68b53c08c3c41c1a2e3e421d6fdad
[2/8] power: pmic: mtk-pwrap: add PWRAP_CAP_WDT_SRC flag
      commit: 8fac923a5f15c3edd66bde274a80612387bb7bf8
[3/8] power: pmic: mtk-pwrap: add init capability flag
      commit: 6fbc2ca84ec33df70a464e9a12d64115f1a2844c
[4/8] power: pmic: mtk-pwrap: drop PWRAP_SLV_CAP_DUALIO on mt6359
      commit: 804e6702f3b33f8cfef15cdf45aafe77661c1a23
[5/8] power: pmic: mtk-pwrap: remove interrupt related code
      commit: 095458ef73672857d1b09c666375679dd399e4d1
[6/8] power: pmic: mtk-pwrap: use pmic compatible to select child info
      commit: 5f73fe49317db5ee348ee4daeadec3c082345e04
[7/8] power: pmic: mtk-pwrap: use tabs for alignment
      commit: 3dede5fed1ec9847daabee87da61e162abda7ecc
[8/8] power: pmic: mtk-pwrap: add MT8195 support
      commit: 4ddb07e24e7a13b0b9280c7cc6e0e2c816f32d25

Best regards,

Signature · 1 line
David Lechner <[email protected]>