Re: [PATCH 14/22] iio: dac: ad5686: add support for missing power supplies

Jonathan Cameron
2026-04-24T17:10:42Z

On Fri, 24 Apr 2026 09:08:30 +0100
Rodrigo Alencar <455.rodrigo.alencar@gmail.com> wrote:

> On 26/04/23 07:05PM, Jonathan Cameron wrote:
> > On Wed, 22 Apr 2026 15:45:48 +0100
> > Rodrigo Alencar via B4 Relay <devnull+rodrigo.alencar.analog.com@kernel.org> wrote:
> >
> > > From: Rodrigo Alencar <rodrigo.alencar@analog.com>
> > >
> > > Get optional regulators for vdd, vlogic and vref input power pins. vdd is
> > > the input power supply, while vlogic powers the digital side. vref is
> > > replacing vcc, which is being deprecated, but still supported. The value
> > > of vref_mv is checked so that a device without internal voltage reference
> > > cannot proceed without an explicit supply. Error report uses
> > > dev_err_probe(), which helps debugging an init issue.
>
> ...
>
> > > - ret = devm_regulator_get_enable_read_voltage(dev, "vcc");
> > > + ret = devm_regulator_get_enable_optional(dev, "vdd");
> > > + if (ret && ret != -ENODEV)
> > > + return dev_err_probe(dev, ret, "failed to enable vdd supply\n");
> > vdd is very rarely optional. Can we not rely on the stub regulator
> > that will be provided if there isn't one in DT?
>
> Corret, vdd should not be optional, but I havent made it required in the dt-binding
> doc. Should I be concerned on breaking existing dts in the driver implementation?

If we never read the voltage then the stub regulator you'll get
with devm_regulator_get_enable() should be fine.

Making the binding say that it is required is fine (as long as clear
reasons given) but the driver must continue working without it.
That can be via stub regulators though.

>
> > > +
> > > + ret = devm_regulator_get_enable_optional(dev, "vlogic");
> > Also doesn't sound very optional.
>
> The same way, that is not required in the dt-binding doc. Also, there are different
> packaging for the same device, on which vlogic is internally connected to vdd and only
> vdd is exposed. Some board designs may also do the same externally.

Ugly if it's a packaging thing. In some sense those different packaged
versions aren't compatible in that case. It wouldn't be correct to use
a stub regulator in this case as we should be mapping it to the same
one connected to vdd (reference count should just end up as 2 for that one).

Any way we can detect the packaging difference? I think for some similar
cases we've taken the view that this makes the parts incompatible so
they need different compatibles, but that seems overkill for this.

If not I think I'd go with a stub regulator (so drop the _optional)
and just not worry too much that it might ideally be the one on vdd.

>
> > > + if (ret && ret != -ENODEV)
> > > + return dev_err_probe(dev, ret, "failed to enable vlogic supply\n");
> > > +
> > > + ret = devm_regulator_get_enable_read_voltage(dev, "vref");
> > > + if (ret == -ENODEV) /* vcc-supply is deprecated, but supported still */
> > > + ret = devm_regulator_get_enable_read_voltage(dev, "vcc");
> > > if (ret < 0 && ret != -ENODEV)
> > > - return ret;
> > > + return dev_err_probe(dev, ret, "failed to read vref voltage\n");
> > >
>