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

Peng Fan peng.fan at nxp.com
Fri May 31 07:49:12 UTC 2019


Hi Sven,

> Subject: [PATCH] regulator: Allow autosetting fixed regulators
> 
> 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)


According to code:
        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))
                ret = regulator_set_current(dev, uc_pdata->min_uA);

So you get -ENOSYS from the upper code?

Regards,
Peng.

>  		ret = regulator_set_enable(dev, true);
> 
>  	return ret;
> --
> 2.17.1



More information about the U-Boot mailing list