public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Cc: "Nuno Sá" <noname.nuno@gmail.com>,
	"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: Sat, 12 Apr 2025 17:19:20 +0100	[thread overview]
Message-ID: <20250412171920.531993c1@jic23-huawei> (raw)
In-Reply-To: <Z_k3e1DfxmcJgQeu@debian-BULLSEYE-live-builder-AMD64>

On Fri, 11 Apr 2025 12:38:35 -0300
Marcelo Schmitt <marcelo.schmitt1@gmail.com> wrote:

> Hi Nuno, thank you for your review.
> I've already applied most of your suggestions.
> Also providing answers to some questions inline.
> 
> Thanks
> 
> On 04/10, Nuno Sá wrote:
> > Hi Marecelo,
> > 
> > First, superficial look...
> > 
> > On Wed, 2025-04-09 at 09:24 -0300, Marcelo Schmitt 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>
> > > ---  
> ...
> > > +	ret = ad4170_set_channel_enable(st, chan->address, true);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	reinit_completion(&st->completion);  
> > 
> > I would do the above right before wait_for_completion_timeout()...  
> 
> Ack. Changed accordingly.
Hi Marcelo,

A general efficiency comment.  If you agree with a comment, no
need to reply.  Better to crop that bit of the thread out and
reply only to those parts where there is more to add.

Cuts down on what reviewers need to read!  We assume anything
you don't comment on is something you are happy with changing as
suggested!

I normally only point this out to people who are sending a lot
of code as it's just not worth it for one time contributors.
So bad luck you get me being fussier ;)


> > > +	ret = devm_regulator_get_enable_read_voltage(dev, "refin1n");
> > > +	if (ret < 0 && ret != -ENODEV)
> > > +		return dev_err_probe(dev, ret, "Failed to get REFIN- voltage.\n");
> > > +
> > > +	/* Negative supplies are assumed to provide negative voltage */
> > > +	st->vrefs_uv[AD4170_REFIN1N_SUP] = ret == -ENODEV ? -ENODEV : -ret;  
> > 
> > Maybe to early for me but the comment does not make it clear to me why the negation?
> > Won't the regulator return a negative voltage?  
> 
> devm_regulator_get_enable_read_voltage(), regulator_get_voltage(), and anything
> about reading the regulator voltage returns either a positive voltage value or
> a negative error code. I couldn't find out how to read a negative voltage with
> regulator API. So, for now, this is making the simplifying assumption that
> the negative end of external reference supplies is always below GND level (even
> though they could be positive).

Hmm. We went around this a long time back but I can't remember what the outcome was...
https://lore.kernel.org/linux-iio/544AC56F16B56944AEC3BD4E3D59177137546EF3FC@LIMKCMBX1.ad.analog.com/ 
looks like the thread.

Take a look at dac/ad5791.c for example of a negative reference

Michael might remember more of that discussion than I do!

Jonathan



  reply	other threads:[~2025-04-12 16:19 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 [this message]
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
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=20250412171920.531993c1@jic23-huawei \
    --to=jic23@kernel.org \
    --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=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.schmitt1@gmail.com \
    --cc=marcelo.schmitt@analog.com \
    --cc=noname.nuno@gmail.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