Devicetree
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
To: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Cc: sashiko-reviews@lists.linux.dev,
	Marcelo Schmitt <marcelo.schmitt@analog.com>,
	conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH v7 2/4] iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs
Date: Sat, 18 Jul 2026 02:46:28 +0100	[thread overview]
Message-ID: <20260718024628.3e2872ca@jic23-huawei> (raw)
In-Reply-To: <alpab2gBs4nPDU5g@debian-BULLSEYE-live-builder-AMD64>

On Fri, 17 Jul 2026 13:38:07 -0300
Marcelo Schmitt <marcelo.schmitt1@gmail.com> wrote:

> On 07/16, sashiko-bot@kernel.org wrote:
> > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> > - [Medium] The `LTC2378_DIFF_CHANNEL` macro defines an IIO channel that is intended to be differential but lacks the `.differential = 1`, `.indexed = 1`, `.channel = 0`, and `.channel2 = 1` attributes.
> > --
> > 
> > --- Patch [2]: [PATCH v7 2/4] iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs ---
> > commit 5710d5f25b45906977e2522567c1964b1d3219f8
> > Author: Marcelo Schmitt <marcelo.schmitt@analog.com>
> > 
> > iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs
> > 
> > This commit adds a new driver for the Analog Devices LTC2378-20 and
> > similar analog-to-digital converters.
> >   
> > > diff --git a/drivers/iio/adc/ltc2378.c b/drivers/iio/adc/ltc2378.c
> > > new file mode 100644
> > > index 0000000000000..5600c820c7f45
> > > --- /dev/null
> > > +++ b/drivers/iio/adc/ltc2378.c
> > > @@ -0,0 +1,416 @@  
> > [ ... ]  
> > > +#define LTC2378_DIFF_CHANNEL(_sign, _real_bits, _storage_bits)			\
> > > +{										\
> > > +	.type = IIO_VOLTAGE,							\
> > > +	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |				\
> > > +			      BIT(IIO_CHAN_INFO_SCALE),				\
> > > +	.scan_index = 0,							\  
> > 
> > [Severity: Medium]
> > Does this macro need to set .differential = 1, .indexed = 1, .channel = 0,
> > and .channel2 = 1? The name suggests these are differential channels, but
> > without these attributes, the IIO ABI will expose them as single-ended
> > (e.g., in_voltage_raw instead of in_voltage0-voltage1_raw).  
> 
> For parts with multiple inputs and configurable differential channels (e.g.
> AD4130-8, MCP3561/2/4R, NAFE13388 [1, 2, 3]), the voltageY-voltageZ ABI helps
> clarifying what physical inputs make up a channel. For differential only parts,
> the ABI seems to be flexible by only requiring a 'consistent labeling' (either
> voltageY or voltageY-voltageZ IIUC). Will set the channel with the differential
> ABI if maintainers believe that's the best way to have it. Might slightly tweak
> the channel macros to keep .differential = 0 for pseudo-differential chips
> (e.g.LTC2369-18).

Whilst I get your point on differential only cases not really requiring the
specification of two inputs, I think that does provide a simple indication
to users that they are differential channel.

I would prefer that we make them 'look' like differential channels so make up
a suitable number for the negative side.

I vaguely recall we did once consider handling these as inX-inX but it seemed
a little too weird.  Hohum. ABI was designed against the max1363 and I didn't
think much about device that always did differential.  What can I say, I was
young and foolish ;)

Jonathan

> 
> [1]: https://www.analog.com/media/en/technical-documentation/data-sheets/ad4130-8.pdf
> [2]: https://ww1.microchip.com/downloads/aemDocuments/documents/APID/ProductDocuments/DataSheets/MCP3561_2_4R-Data-Sheet-DS200006391C.pdf
> [3]: https://www.nxp.com/docs/en/data-sheet/NAFE13388.pdf
> 
> >   
> > > +	.scan_type = {								\
> > > +		.format = _sign ? IIO_SCAN_FORMAT_SIGNED_INT :			\
> > > +				  IIO_SCAN_FORMAT_UNSIGNED_INT,			\
> > > +		.realbits = _real_bits,						\
> > > +		.storagebits = _storage_bits,					\
> > > +		.shift = _storage_bits - _real_bits,				\
> > > +		.endianness = IIO_BE,						\
> > > +	},									\
> > > +}
> > > +
> > > +#define LTC2378_BIPOLAR_DIFF_CHANNEL(_real_bits)				\
> > > +	LTC2378_DIFF_CHANNEL(1, _real_bits, (((_real_bits) > 16) ? 32 : 16))
> > > +
> > > +#define LTC2378_UNIPOLAR_DIFF_CHANNEL(_real_bits)				\
> > > +	LTC2378_DIFF_CHANNEL(0, _real_bits, (((_real_bits) > 16) ? 32 : 16))
> > > +  
> > [ ... ]
> > 
> > -- 
> > Sashiko AI review · https://sashiko.dev/#/patchset/cover.1784235595.git.marcelo.schmitt@analog.com?part=2  
> 


  reply	other threads:[~2026-07-18  1:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16 21:08 [PATCH v7 0/4] iio: adc: Add support for LTC2378 and similar ADCs Marcelo Schmitt
2026-07-16 21:09 ` [PATCH v7 1/4] dt-bindings: iio: adc: Add ltc2378 Marcelo Schmitt
2026-07-16 21:09 ` [PATCH v7 2/4] iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs Marcelo Schmitt
2026-07-16 21:28   ` sashiko-bot
2026-07-17 16:38     ` Marcelo Schmitt
2026-07-18  1:46       ` Jonathan Cameron [this message]
2026-07-18  1:51   ` Jonathan Cameron
2026-07-16 21:10 ` [PATCH v7 3/4] iio: adc: ltc2378: Enable high-speed data capture Marcelo Schmitt
2026-07-16 21:24   ` sashiko-bot
2026-07-17 16:35     ` Marcelo Schmitt
2026-07-16 21:10 ` [PATCH v7 4/4] iio: adc: ltc2378: Enable triggered buffer " Marcelo Schmitt
2026-07-16 21:44 ` [PATCH v7 0/4] iio: adc: Add support for LTC2378 and similar ADCs 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=20260718024628.3e2872ca@jic23-huawei \
    --to=jonathan.cameron@oss.qualcomm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=marcelo.schmitt1@gmail.com \
    --cc=marcelo.schmitt@analog.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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