> -----Original Message-----
> From: Sven Schwermer [mailto:s...@svenschwermer.de]
> Sent: 2019年5月31日 18:44
> To: Peng Fan <peng....@nxp.com>
> Cc: u-boot@lists.denx.de; Jaehoon Chung <jh80.ch...@samsung.com>
> Subject: Re: [PATCH] regulator: Allow autosetting fixed regulators
> 
> > How about the following patch? not tested
> >
> > diff --git a/drivers/power/regulator/regulator-uclass.c
> b/drivers/power/regulator/regulator-uclass.c
> > index 9118b8eb39..76be95bcd1 100644
> > --- a/drivers/power/regulator/regulator-uclass.c
> > +++ b/drivers/power/regulator/regulator-uclass.c
> > @@ -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))
> 
> That will probably work as well. It does, however, feel a little like a hack.
> What if there are other regulator types that require a similar workaround?

When ret is -ENOSYS, it might be a fixed regulator. So directly use FIXED
regulator check make more sense to me.

Regards,
Peng.

> 
> Sven
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to