summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorYe Li <[email protected]>2025-09-11 18:56:07 +0800
committerFabio Estevam <[email protected]>2025-09-20 17:46:15 -0300
commitf98d812e5353408ef77a46bad1f1cdc793ff8a03 (patch)
tree425d33bdc78a0aee77b81a7213ce7e9604a01cf6 /drivers
parentd680ac6cfd052ced54f51d7cfe081ad291550e44 (diff)
power: regulator: Add vin-supply for GPIO and Fixed regulators
Enable the vin-supply when probing the regulator device. Signed-off-by: Ye Li <[email protected]>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/power/regulator/regulator_common.c10
-rw-r--r--drivers/power/regulator/regulator_common.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/drivers/power/regulator/regulator_common.c b/drivers/power/regulator/regulator_common.c
index e3565d32a01..c80f10c3aa3 100644
--- a/drivers/power/regulator/regulator_common.c
+++ b/drivers/power/regulator/regulator_common.c
@@ -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;
}
diff --git a/drivers/power/regulator/regulator_common.h b/drivers/power/regulator/regulator_common.h
index d4962899d83..799c968d0b6 100644
--- a/drivers/power/regulator/regulator_common.h
+++ b/drivers/power/regulator/regulator_common.h
@@ -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,