regulator: mt6363: Fix interrmittent timeout
authorAdam Ford <aford173@gmail.com>
Tue, 10 Feb 2026 05:37:04 +0000 (23:37 -0600)
committerMark Brown <broonie@kernel.org>
Tue, 10 Feb 2026 13:46:19 +0000 (13:46 +0000)
Sometimes, the mt6363 regulator would fail to initialize and return with
a TIMEOUT error, so add an extra instruction to wake up the bus before
issuing the commands.

Fixes: 3c36965df808 ("regulator: Add support for MediaTek MT6363 SPMI PMIC Regulators")
Signed-off-by: Adam Ford <aford173@gmail.com>
Link: https://patch.msgid.link/20260210053708.17239-4-aford173@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/mt6363-regulator.c

index e0fbf92..03af5fa 100644 (file)
@@ -861,7 +861,7 @@ static int mt6363_regulator_probe(struct platform_device *pdev)
        struct irq_domain *domain;
        struct irq_fwspec fwspec;
        struct spmi_device *sdev;
-       int i, ret;
+       int i, ret, val;
 
        config.regmap = mt6363_spmi_register_regmap(dev);
        if (IS_ERR(config.regmap))
@@ -870,6 +870,13 @@ static int mt6363_regulator_probe(struct platform_device *pdev)
        config.dev = dev;
        sdev = to_spmi_device(dev->parent);
 
+       /*
+        * The first read may fail if the bootloader sets sleep mode: wake up
+        * this PMIC with W/R on the SPMI bus and ignore the first result.
+        * This matches the MT6373 driver behavior.
+        */
+       regmap_read(config.regmap, MT6363_TOP_TRAP, &val);
+
        interrupt_parent = of_irq_find_parent(dev->of_node);
        if (!interrupt_parent)
                return dev_err_probe(dev, -EINVAL, "Cannot find IRQ parent\n");