[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20231204172217.6be90ae4@jic23-huawei>
Date: Mon, 4 Dec 2023 17:22:17 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Ceclan Dumitru <mitrutzceclan@...il.com>
Cc: linus.walleij@...aro.org, brgl@...ev.pl, andy@...nel.org,
linux-gpio@...r.kernel.org, Lars-Peter Clausen <lars@...afoo.de>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Michael Walle <michael@...le.cc>,
Andy Shevchenko <andy.shevchenko@...il.com>,
Arnd Bergmann <arnd@...db.de>,
ChiaEn Wu <chiaen_wu@...htek.com>,
Niklas Schnelle <schnelle@...ux.ibm.com>,
Leonard Göhrs <l.goehrs@...gutronix.de>,
Mike Looijmans <mike.looijmans@...ic.nl>,
Haibo Chen <haibo.chen@....com>,
Hugo Villeneuve <hvilleneuve@...onoff.com>,
Ceclan Dumitru <dumitru.ceclan@...log.com>,
linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 2/2] iio: adc: ad7173: add AD7173 driver
On Mon, 4 Dec 2023 18:49:21 +0200
Ceclan Dumitru <mitrutzceclan@...il.com> wrote:
> On 11/25/23 19:21, Jonathan Cameron wrote:
> > On Thu, 23 Nov 2023 17:23:22 +0200
> > mitrutzceclan <mitrutzceclan@...il.com> wrote:
> >
> >> From: Dumitru Ceclan <mitrutzceclan@...il.com>
>
> ...
> >> + st->regulators[0].supply = ad7173_ref_sel_str[AD7173_SETUP_REF_SEL_EXT_REF];
> >> + st->regulators[1].supply = ad7173_ref_sel_str[AD7173_SETUP_REF_SEL_EXT_REF2];
> >> + st->regulators[2].supply = ad7173_ref_sel_str[AD7173_SETUP_REF_SEL_AVDD1_AVSS];
> >> +
> >> + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(st->regulators),
> >> + st->regulators);
> >
> > If only some of them are supplied, the driver works fine as long as no channel is using them?
> > If so should probably get the optionally then check for availability of the ones you
> > want. I'm sure someone will just wire up ref. Incidentally, ref2 isn't there for all chips
> > I think, so we should not get it on the ones where it can't exist.
> >
>
>
> This sets a dummy regulator in place if no proper supply is found. Then
> the call regulator_get_voltage() on the dummy will fail. About getting
> ref2, sure, I'll set the string only with the right ID.
>
> ...
> >> + ret = ad7173_get_ref_voltage_milli(st, (u8)ref_sel);
> >> + if (ret < 0)
> >> + return dev_err_probe(dev, ret,
> >> + "Cannot use reference %u", ref_sel);
>
> Here the probe would not continue if a channel selects a supply that is
> not available in the DT.
Ok. It's a little ugly though - so maybe a comment at the bulk_get to say
it will fail cleanly a bit later.
Powered by blists - more mailing lists