power: regulator: Add vin-supply for GPIO and Fixed regulators
authorYe Li <ye.li@nxp.com>
Thu, 11 Sep 2025 10:56:07 +0000 (18:56 +0800)
committerFabio Estevam <festevam@gmail.com>
Sat, 20 Sep 2025 20:46:15 +0000 (17:46 -0300)
Enable the vin-supply when probing the regulator device.

Signed-off-by: Ye Li <ye.li@nxp.com>
drivers/power/regulator/regulator_common.c
drivers/power/regulator/regulator_common.h

index e3565d3..c80f10c 100644 (file)
@@ -45,6 +45,16 @@ int regulator_common_of_to_plat(struct udevice *dev,
                        dev_read_u32_default(dev, "u-boot,off-on-delay-us", 0);
        }
 
+       ret = device_get_supply_regulator(dev, "vin-supply", &plat->vin_supply);
+       if (ret) {
+               debug("Regulator vin regulator not defined: %d\n", ret);
+               if (ret != -ENOENT)
+                       return ret;
+       }
+
+       if (plat->vin_supply)
+               regulator_set_enable_if_allowed(plat->vin_supply, true);
+
        return 0;
 }
 
index d496289..799c968 100644 (file)
@@ -14,6 +14,7 @@ struct regulator_common_plat {
        unsigned int startup_delay_us;
        unsigned int off_on_delay_us;
        unsigned int enable_count;
+       struct udevice *vin_supply;
 };
 
 int regulator_common_of_to_plat(struct udevice *dev,