summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2024-09-27 01:14:13 +0200
committerTom Rini <trini@konsulko.com>2024-09-30 19:19:07 -0600
commit332e0a0148915c994bda9128cb2bb0a0f14e6ec8 (patch)
tree6fdeca46cb26e9ae04eafd2842dfbc9c5136f1ec
parent51c4679d2f848e91b4a0cf867a426ffe5bb094b2 (diff)
power: regulator: Convert regulators_enable_boot_on/off() to regulator_post_probe
Turn regulators_enable_boot_on() and regulators_enable_boot_off() into empty functions. Implement matching functionality in regulator_post_probe() instead. The regulator_post_probe() is called for all regulators after they probe, and regulators that have regulator-always-on or regulator-boot-on DT properties now always probe due to DM_FLAG_PROBE_AFTER_BIND being set on such regulators in regulator_post_bind(). Finally, fold regulator_unset() functionality into regulator_autoset(). Signed-off-by: Marek Vasut <marex@denx.de>
-rw-r--r--drivers/power/regulator/regulator-uclass.c60
1 files changed, 19 insertions, 41 deletions
diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c
index 1a970004540..9fcc4bd85b9 100644
--- a/drivers/power/regulator/regulator-uclass.c
+++ b/drivers/power/regulator/regulator-uclass.c
@@ -314,6 +314,11 @@ int regulator_autoset(struct udevice *dev)
return ret;
}
+ if (uc_pdata->force_off) {
+ ret = regulator_set_enable(dev, false);
+ goto out;
+ }
+
if (!uc_pdata->always_on && !uc_pdata->boot_on) {
ret = -EMEDIUMTYPE;
goto out;
@@ -518,56 +523,28 @@ static int regulator_pre_probe(struct udevice *dev)
return 0;
}
-int regulators_enable_boot_on(bool verbose)
+static int regulator_post_probe(struct udevice *dev)
{
- struct udevice *dev;
- struct uclass *uc;
int ret;
- ret = uclass_get(UCLASS_REGULATOR, &uc);
- if (ret)
+ ret = regulator_autoset(dev);
+ if (ret && ret != -EMEDIUMTYPE && ret != -EALREADY && ret != ENOSYS)
return ret;
- for (uclass_first_device(UCLASS_REGULATOR, &dev);
- dev;
- uclass_next_device(&dev)) {
- ret = regulator_autoset(dev);
- if (ret == -EMEDIUMTYPE || ret == -EALREADY) {
- ret = 0;
- continue;
- }
- if (verbose)
- regulator_show(dev, ret);
- if (ret == -ENOSYS)
- ret = 0;
- }
- return ret;
+ if (_DEBUG)
+ regulator_show(dev, ret);
+
+ return 0;
}
-int regulators_enable_boot_off(bool verbose)
+int regulators_enable_boot_on(bool verbose)
{
- struct udevice *dev;
- struct uclass *uc;
- int ret;
-
- ret = uclass_get(UCLASS_REGULATOR, &uc);
- if (ret)
- return ret;
- for (uclass_first_device(UCLASS_REGULATOR, &dev);
- dev;
- uclass_next_device(&dev)) {
- ret = regulator_unset(dev);
- if (ret == -EMEDIUMTYPE) {
- ret = 0;
- continue;
- }
- if (verbose)
- regulator_show(dev, ret);
- if (ret == -ENOSYS)
- ret = 0;
- }
+ return 0;
+}
- return ret;
+int regulators_enable_boot_off(bool verbose)
+{
+ return 0;
}
UCLASS_DRIVER(regulator) = {
@@ -575,5 +552,6 @@ UCLASS_DRIVER(regulator) = {
.name = "regulator",
.post_bind = regulator_post_bind,
.pre_probe = regulator_pre_probe,
+ .post_probe = regulator_post_probe,
.per_device_plat_auto = sizeof(struct dm_regulator_uclass_plat),
};