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

Peng Fan peng.fan at nxp.com
Fri May 31 08:23:23 UTC 2019


> Subject: Re: [PATCH] regulator: Allow autosetting fixed regulators
> 
> Hi Peng,
> 
> > 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?
> 
> Yes, for fixed regulators, the following if clause evaluates to true in
> regulator_pre_probe:
> 
> 	/* Those values are optional (-ENODATA if unset) */
> 	if ((uc_pdata->min_uV != -ENODATA) &&
> 	    (uc_pdata->max_uV != -ENODATA) &&
> 	    (uc_pdata->min_uV == uc_pdata->max_uV))
> 		uc_pdata->flags |= REGULATOR_FLAG_AUTOSET_UV;

For fixed regulator, will min_uV/max_uV be set to value other
than -ENODATA? I think no.

Regards,
Peng.

> 
> However, in regulator_set_value, there is this section:
> 
> 	if (!ops || !ops->set_value)
> 		return -ENOSYS;
> 
> So for fixed regulators, which don’t have a set_value, we’ll always get a
> -ENOSYS.
> 
> Sven


More information about the U-Boot mailing list