From: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Marcelo Schmitt <marcelo.schmitt@analog.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Ana-Maria Cusco <ana-maria.cusco@analog.com>,
lars@metafoo.de, Michael.Hennerich@analog.com,
dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v1 2/7] iio: adc: Add basic support for AD4170
Date: Mon, 14 Apr 2025 09:13:12 -0300 [thread overview]
Message-ID: <Z_z72J_gcZqW14CE@debian-BULLSEYE-live-builder-AMD64> (raw)
In-Reply-To: <20250412174710.33afb04d@jic23-huawei>
Hi Jonathan,
Thank you for reviewing this set.
Clarifying some bits inline. Will apply all other suggested changes.
Thanks,
Marcelo
On 04/12, Jonathan Cameron wrote:
> On Wed, 9 Apr 2025 09:24:35 -0300
> Marcelo Schmitt <marcelo.schmitt@analog.com> wrote:
>
> > From: Ana-Maria Cusco <ana-maria.cusco@analog.com>
> >
> > Add support for the AD4170 ADC with the following features:
> > - Single-shot read.
> > - Analog front end PGA configuration.
> > - Digital filter and sampling frequency configuration.
> > - Calibration gain and offset configuration.
> > - Differential and pseudo-differential input configuration.
> >
> > Signed-off-by: Ana-Maria Cusco <ana-maria.cusco@analog.com>
> > Co-developed-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
> > Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
> Hi.
>
> Clearly this is a massive driver, even with it broken up like this.
> So it might take a few cycles to review enough that we don't find
> new things :(
No worries. Yeah, I tried my best to make it concise but this is still not small
piece of code.
>
> I can't think of a good way to split it up further though
>
> Jonathan
>
> > diff --git a/drivers/iio/adc/ad4170.c b/drivers/iio/adc/ad4170.c
> > new file mode 100644
> > index 000000000000..0d24286ac2ab
> > --- /dev/null
> > +++ b/drivers/iio/adc/ad4170.c
>
>
...
> > +static int ad4170_regulator_setup(struct ad4170_state *st)
> > +{
> > + struct device *dev = &st->spi->dev;
> > + int ret;
> > +
> > + /* Required regulators */
> > + ret = devm_regulator_get_enable_read_voltage(dev, "avdd");
> > + if (ret < 0)
> > + return dev_err_probe(dev, ret, "Failed to get AVDD voltage.\n");
> > +
> > + st->vrefs_uv[AD4170_AVDD_SUP] = ret;
> > +
> > + ret = devm_regulator_get_enable_read_voltage(dev, "iovdd");
>
> If no channel uses this reference is it not optional? Maybe not worth the
> complexity of handling that. We have sometime bothered to do so in the past
> by first figuring out which references are in use, then trying to get the
> appropriate regulators with small changes for cases like this where
> it needs to be enabled but we might not need the voltage.
We can set the channel multiplexer to use IOVDD reference as diff chan negative
input. Similar thing can be done for the other reference supplies. I think
the examples in dt-binding don't use IOVDD but they could. Since the driver is
supporting other regulators, maybe support IOVDD too?
>
> > + if (ret < 0)
> > + return dev_err_probe(dev, ret, "Failed to get IOVDD voltage.\n");
> > +
> > + st->vrefs_uv[AD4170_IOVDD_SUP] = ret;
> > +
> > + /* Optional regulators */
> > + ret = devm_regulator_get_enable_read_voltage(dev, "avss");
> > + if (ret < 0 && ret != -ENODEV)
> > + return dev_err_probe(dev, ret, "Failed to get AVSS voltage.\n");
> > +
next prev parent reply other threads:[~2025-04-14 12:12 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-09 12:23 [PATCH v1 0/7] iio: adc: Add support for AD4170 series of ADCs Marcelo Schmitt
2025-04-09 12:24 ` [PATCH v1 1/7] dt-bindings: iio: adc: Add AD4170 Marcelo Schmitt
2025-04-11 15:47 ` Rob Herring
2025-04-12 16:07 ` Jonathan Cameron
2025-04-09 12:24 ` [PATCH v1 2/7] iio: adc: Add basic support for AD4170 Marcelo Schmitt
2025-04-10 6:31 ` Nuno Sá
2025-04-11 15:38 ` Marcelo Schmitt
2025-04-12 16:19 ` Jonathan Cameron
2025-04-12 18:26 ` Andy Shevchenko
2025-04-14 14:01 ` Marcelo Schmitt
2025-04-12 16:47 ` Jonathan Cameron
2025-04-14 12:13 ` Marcelo Schmitt [this message]
2025-04-14 18:42 ` Jonathan Cameron
2025-04-09 12:25 ` [PATCH v1 3/7] iio: adc: ad4170: Add support for buffered data capture Marcelo Schmitt
2025-04-10 9:32 ` Nuno Sá
2025-04-09 12:25 ` [PATCH v1 4/7] iio: adc: ad4170: Add clock provider support Marcelo Schmitt
2025-04-10 9:40 ` Nuno Sá
2025-04-09 12:25 ` [PATCH v1 5/7] iio: adc: ad4170: Add GPIO controller support Marcelo Schmitt
2025-04-10 9:53 ` Nuno Sá
2025-04-14 14:11 ` Marcelo Schmitt
2025-04-14 14:24 ` Andy Shevchenko
2025-04-09 12:26 ` [PATCH v1 6/7] iio: adc: ad4170: Add support for internal temperature sensor Marcelo Schmitt
2025-04-10 10:03 ` Nuno Sá
2025-04-09 12:26 ` [PATCH v1 7/7] iio: adc: ad4170: Add support for weigh scale and RTD sensors Marcelo Schmitt
2025-04-10 10:39 ` Nuno Sá
2025-04-14 15:38 ` Marcelo Schmitt
2025-04-14 17:24 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z_z72J_gcZqW14CE@debian-BULLSEYE-live-builder-AMD64 \
--to=marcelo.schmitt1@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=ana-maria.cusco@analog.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.schmitt@analog.com \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox