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

Sven Schwermer sven at svenschwermer.de
Fri May 31 08:17:49 UTC 2019


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;

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