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;
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) = {
.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),
};