]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
regulator: Allow autosetting fixed regulators
authorSven Schwermer <sven@svenschwermer.de>
Wed, 12 Jun 2019 06:32:38 +0000 (08:32 +0200)
committerTom Rini <trini@konsulko.com>
Sat, 13 Jul 2019 15:11:31 +0000 (11:11 -0400)
Fixed regulators don't have a set_value method. Therefore, trying to
set their value will always return -ENOSYS.

Signed-off-by: Sven Schwermer <sven@svenschwermer.de>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/power/regulator/regulator-uclass.c

index 9118b8eb39e34ff4266d2d1f8fc9a9f562565885..76be95bcd1591a2c8e06e4a7c3d3f8c66b798fe2 100644 (file)
@@ -238,6 +238,9 @@ int regulator_autoset(struct udevice *dev)
        if (!uc_pdata->always_on && !uc_pdata->boot_on)
                return -EMEDIUMTYPE;
 
+       if (uc_pdata->type == REGULATOR_TYPE_FIXED)
+               return regulator_set_enable(dev, true);
+
        if (uc_pdata->flags & REGULATOR_FLAG_AUTOSET_UV)
                ret = regulator_set_value(dev, uc_pdata->min_uV);
        if (!ret && (uc_pdata->flags & REGULATOR_FLAG_AUTOSET_UA))