[U-Boot] [PATCH] regulator: Allow autosetting fixed regulators

Sven Schwermer sven at svenschwermer.de
Fri May 31 07:27:29 UTC 2019


Fixed regulators don't have a set_value method. Therefore,
regulator_set_value will return -ENOSYS when called from
regulator_autoset.

Accepting this return value allows autosetting fixed regulators.

Signed-off-by: Sven Schwermer <sven at svenschwermer.de>
Cc: Jaehoon Chung <jh80.chung at samsung.com>
Cc: Peng Fan <peng.fan at nxp.com>
---
 drivers/power/regulator/regulator-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c
index 9118b8eb39..0b99c262ac 100644
--- a/drivers/power/regulator/regulator-uclass.c
+++ b/drivers/power/regulator/regulator-uclass.c
@@ -243,7 +243,7 @@ int regulator_autoset(struct udevice *dev)
 	if (!ret && (uc_pdata->flags & REGULATOR_FLAG_AUTOSET_UA))
 		ret = regulator_set_current(dev, uc_pdata->min_uA);
 
-	if (!ret)
+	if (!ret || ret == -ENOSYS)
 		ret = regulator_set_enable(dev, true);
 
 	return ret;
-- 
2.17.1



More information about the U-Boot mailing list