devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Kyle Hsieh <kylehsieh1995@gmail.com>
Cc: "David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/2] iio: adc: ti-ads112c04: Add support for TI ADS112C04
Date: Wed, 12 Aug 2026 05:29:58 +0100	[thread overview]
Message-ID: <20260812052958.4fa61ad9@jic23-huawei> (raw)
In-Reply-To: <20260811-ti-ads112c04-driver-v4-2-ae704ac17241@gmail.com>

On Tue, 11 Aug 2026 10:48:38 +0800
Kyle Hsieh <kylehsieh1995@gmail.com> wrote:

> Add IIO driver support for the Texas Instruments ADS112C04 (16-bit)
> delta-sigma ADCs.
> 
> The driver implements:
> - Single-shot conversions using the IIO raw read interface.
> - Dynamic parsing of single-ended and differential channels from
>   device tree child nodes.
> - Hardware interrupt support via the DRDY pin, falling back to
>   software polling if no IRQ is provided.
> - Scale calculation based on the internal 2.048V reference.
> - Reference voltage scaling via the regulator subsystem (refp-supply),
>   falling back to the internal 2.048V reference if not specified.
>   refn-supply is not yet supported.
> - Hardware reset fallback using GPIO.
> 
> Signed-off-by: Kyle Hsieh <kylehsieh1995@gmail.com>
Hi Kyle,

Clearly you got plenty of good feedback already from Andy and David.
As such (and given I have 400 IIO messages unread right now :()
I only took a quick look and called out a few things that perhaps others have not
already raised.

Jonathan

> +
> +#define ADS112C04_VREF_INTERNAL_MV	2048

Probably better up top with the other defines.

> +
> +static int ads112c04_probe(struct i2c_client *client)
> +{

...

> +
> +	/* Bypass PGA for now to allow full-scale single-ended measurements */
Given there are several fields in each of these registers, it would be
nicer to fully fill it here (even though they all end up as zeros)

	st->config0 = ADS112C04_CONFIG0_PGA_BYPASS |
		      FIELD_PUT(ADS112C04_CONFIG0_GAIN, ADS112C04_CONFIG0_GAIN_X1) |
		      FIELD_PUT(ADS112C04_CONFIG0_MUX, ADS112C04_CONFIG0_MUX_AIN0_AIN1);

	st->config1 = FIELD_PUT(ADIS112C04_CONFIG1_TEMP_EN, 0) |
		...
		      FIELD_PUT(ADIS112C04_CONFIG1_CONVMODE, ADIS112C04_CONFIG1_CONVMODE_SINGLE)
etc
Long lines so maybe shorten CONFIG to CONF or CFG to help with that.

The aim of this explicit form is to make it obvious what the defaults actually mean.
That is lost if you write a 0 as done to config1.

> +	st->config0 = ADS112C04_CONFIG0_PGA_BYPASS;
> +	ret = ads112c04_write_reg(client, ADS112C04_REG_CONFIG0, st->config0);
> +	if (ret)
> +		return ret;
> +
> +	ret = ads112c04_write_reg(client, ADS112C04_REG_CONFIG1, st->config1);
> +	if (ret)
> +		return ret;

      parent reply	other threads:[~2026-08-12  4:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11  2:48 [PATCH v4 0/2] iio: adc: Add support for Texas Instruments ADS112C04 Kyle Hsieh
2026-08-11  2:48 ` [PATCH v4 1/2] dt-bindings: iio: adc: ti,ads112c04: Add binding for ADS112C04 Kyle Hsieh
2026-08-11 14:23   ` David Lechner
2026-08-11 16:56   ` Conor Dooley
2026-08-12  2:53     ` Kyle Hsieh
2026-08-12  4:11       ` Jonathan Cameron
2026-08-11  2:48 ` [PATCH v4 2/2] iio: adc: ti-ads112c04: Add support for TI ADS112C04 Kyle Hsieh
2026-08-11  9:39   ` Andy Shevchenko
2026-08-12  2:58     ` Kyle Hsieh
2026-08-11 14:18   ` David Lechner
2026-08-12  1:25     ` Kyle Hsieh
2026-08-12  3:38     ` Kyle Hsieh
2026-08-12  4:29   ` Jonathan Cameron [this message]

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=20260812052958.4fa61ad9@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=kylehsieh1995@gmail.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).