Re: [PATCH v2 0/2] Add support for AD4000 series
From: David Lechner
Date: Tue Apr 09 2024 - 12:31:42 EST
On Tue, Apr 9, 2024 at 9:59 AM Marcelo Schmitt
<marcelo.schmitt1@xxxxxxxxx> wrote:
>
> On 04/08, David Lechner wrote:
> > On Mon, Apr 8, 2024 at 9:31 AM Marcelo Schmitt
> > <marcelo.schmitt@xxxxxxxxxx> wrote:
> > >
..
> > >
> > > - Why did not make vref regulator optional?
> > > Other SAR ADCs I've seen needed a voltage reference otherwise they simply
> > > could not provide any reasonable readings. Isn't it preferable to fail rather
> > > than having a device that can't provide reliable data?
> >
> > In the device tree bindings, making vref-supply required makes sense
> > since there is no internal reference. In the driver, as discussed in
> > V1, it will fail if vref-supply in regulator_get_voltage() if
> > vref-supply is missing and we use devm_regulator_get() instead of
> > devm_regulator_get_optional(). So leaving it as-is is fine. We have a
> > plan to clean this up later anyway.
> >
>
> Not sure I understand the idea here. Should the driver use
> devm_regulator_get_optional() instead of devm_regulator_get() because
> the optional call would fail immediately if no vref-supply while the regular
> call would only fail at regulator_get_voltage()? Why? This looks very counter
> intuitive to me.
Right. I'm saying just leave it the way it is for now.
(I have a plan to simplify it later, but still working on that.)