diff mbox series

[v2,1/4] power: pmic: mtk-pwrap: honor fallback compatible strings

Message ID 20261104-ccaione-upstream-mtk-g700-usb-v2-1-b8dc65b47373@baylibre.com
State New
Delegated to: David Lechner
Headers show
Series Enable USB host support on the Genio 510 and 700 EVKs | expand

Commit Message

Carlo Caione Nov. 4, 2026, 8:50 a.m. UTC
The MT6365 device tree lists mediatek,mt6359 as a fallback, but slave
selection compares only the first compatible string. Consequently the
wrapper reports that no PMIC slave was found even though its existing
MT6359 support matches the node.

Use ofnode_device_is_compatible() to consider the full compatible list,
as the regulator-binding path already does. This allows the Genio 510
and 700 USB supplies to be resolved without changing the device tree's
PMIC identity.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
---
 drivers/power/pmic/mtk-pwrap.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

Comments

Peng Fan (OSS) Nov. 9, 2026, 9:28 a.m. UTC | #1
On Wed, Nov 04, 2026 at 09:50:29AM +0100, Carlo Caione wrote:
>The MT6365 device tree lists mediatek,mt6359 as a fallback, but slave
>selection compares only the first compatible string. Consequently the
>wrapper reports that no PMIC slave was found even though its existing
>MT6359 support matches the node.
>
>Use ofnode_device_is_compatible() to consider the full compatible list,
>as the regulator-binding path already does. This allows the Genio 510
>and 700 USB supplies to be resolved without changing the device tree's
>PMIC identity.
>
>Signed-off-by: Carlo Caione <ccaione@baylibre.com>

Acked-by: Peng Fan <peng.fan@nxp.com>
diff mbox series

Patch

diff --git a/drivers/power/pmic/mtk-pwrap.c b/drivers/power/pmic/mtk-pwrap.c
index 468af1fba04..75dd9f743ec 100644
--- a/drivers/power/pmic/mtk-pwrap.c
+++ b/drivers/power/pmic/mtk-pwrap.c
@@ -672,9 +672,8 @@  static const struct udevice_id mtk_pmic_ids[] = {
 	{ .compatible = "mediatek,mt6357", .data = (ulong)&pmic_mt6357 },
 	{ .compatible = "mediatek,mt6359", .data = (ulong)&pmic_mt6359 },
 	/*
-	 * REVISIT: Cooresponding regulator driver only supports MT6366 for
-	 * now. We can change this to mediatek,mt6358 when the regulator driver
-	 * is updated, but will also have to change ofnode_get_property() below.
+	 * REVISIT: The regulator driver only supports MT6366 for now.
+	 * Change this to mediatek,mt6358 when MT6358 support is added.
 	 */
 	{ .compatible = "mediatek,mt6366", .data = (ulong)&pmic_mt6358 },
 	{ }
@@ -683,16 +682,9 @@  static const struct udevice_id mtk_pmic_ids[] = {
 static int mtk_pwrap_find_slave(const struct pwrap_slv_type **slave, ofnode pmic_node)
 {
 	const struct udevice_id *of_match = mtk_pmic_ids;
-	const char *pmic_name;
-
-	pmic_name = ofnode_get_property(pmic_node, "compatible", NULL);
-	if (!pmic_name) {
-		log_err("%s: missing compatible property\n", __func__);
-		return -EINVAL;
-	}
 
 	while (of_match->compatible) {
-		if (!strcmp(of_match->compatible, pmic_name)) {
+		if (ofnode_device_is_compatible(pmic_node, of_match->compatible)) {
 			*slave = (struct pwrap_slv_type *)of_match->data;
 			return 0;
 		}