[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMknhBGYd8v=t-LB7PEz3OzFRKfVXhw=4Tm7RBKbxSoi_QWh-w@mail.gmail.com>
Date: Mon, 4 Mar 2024 08:28:52 -0600
From: David Lechner <dlechner@...libre.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: linux-iio@...r.kernel.org,
Michael Hennerich <Michael.Hennerich@...log.com>, Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>, Conor Dooley <conor+dt@...nel.org>,
Nuno Sá <nuno.sa@...log.com>,
Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 2/2] iio: adc: ad7944: add driver for AD7944/AD7985/AD7986
On Sun, Mar 3, 2024 at 7:44 AM Jonathan Cameron <jic23@...nel.org> wrote:
>
> On Thu, 29 Feb 2024 10:25:51 -0600
> David Lechner <dlechner@...libre.com> wrote:
>
> > This adds a driver for the Analog Devices Inc. AD7944, AD7985, and
> > AD7986 ADCs. These are a family of pin-compatible ADCs that can sample
> > at rates up to 2.5 MSPS.
> >
> > The initial driver adds support for sampling at lower rates using the
> > usual IIO triggered buffer and can handle all 3 possible reference
> > voltage configurations.
> >
> > Signed-off-by: David Lechner <dlechner@...libre.com>
> >
> Hi David,
>
> Fresh read through showed up a few more things. They are all trivial except
> for what I think is an inverted error condition which would break
> cases where ref was not supplied in DT.
Thanks. All suggestions seems reasonable to me.
> >
> > +
> > + /*
> > + * Sort out what is being used for the reference voltage. Options are:
> > + * - internal reference: neither REF or REFIN is connected
> > + * - internal reference with external buffer: REF not connected, REFIN
> > + * is connected
> > + * - external reference: REF is connected, REFIN is not connected
> > + */
> > +
> > + ref = devm_regulator_get_optional(&spi->dev, "ref");
> > + if (IS_ERR(ref)) {
> > + if (PTR_ERR(ref) != -ENODEV)
>
> Confused. Isn't this inverse of what we want?
Yes, thanks for catching.
> return an error if we got anything other than -ENODEV.
> if (PTR_ERR(ref) |= -ENODEV)
> return dev_err_probe(&spi->dev, PTR_ERR(ref),
> "failed to get REF supply\n");
> ref = NULL;
> }
>
> > + ref = NULL;
> > + else
> > + return dev_err_probe(&spi->dev, PTR_ERR(ref),
> > + "failed to get REF supply\n");
> > + }
> > +
>
> > +
> > + adc->cnv = devm_gpiod_get(&spi->dev, "cnv", GPIOD_OUT_LOW);
> > + if (IS_ERR(adc->cnv))
> > + return dev_err_probe(&spi->dev, PTR_ERR(adc->cnv),
> > + "failed to get CNV GPIO\n");
>
> Is this optional? If we don't yet support the case the dt binding talks
> about worth a comment here to say we don't yet support XYZ so this
> is not optional.
For now, it is required since we have only implemented 4-wire mode.
Powered by blists - more mailing lists