From: Jonathan Cameron <jic23@kernel.org>
To: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Cc: sashiko-reviews@lists.linux.dev,
Marcelo Schmitt <marcelo.schmitt@analog.com>,
devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
linux-iio@vger.kernel.org
Subject: Re: [PATCH v5 2/4] iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs
Date: Sun, 5 Jul 2026 00:22:44 +0100 [thread overview]
Message-ID: <20260705002244.59a9c4ca@jic23-huawei> (raw)
In-Reply-To: <akfuCoai4KAlt5QZ@debian-BULLSEYE-live-builder-AMD64>
On Fri, 3 Jul 2026 14:14:50 -0300
Marcelo Schmitt <marcelo.schmitt1@gmail.com> wrote:
> On 07/02, sashiko-bot@kernel.org wrote:
> > Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
> > - [High] Hardware protocol violation: CNV is held high during SPI read
> > - [High] SPI bus not locked during ADC conversion phase
> > - [Medium] Incorrect scale calculation for LTC2338-18 and similar ADCs
> > - [Low] Undefined direct mode macros lead to build failure
> > --
> >
> > commit b74b536d18af0084ea31bd1e1e8cf9454da5e29c
> > Author: Marcelo Schmitt <marcelo.schmitt@analog.com>
> >
> > iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs
> >
> > This commit adds support for the Analog Devices LTC2378-20 and similar
> > analog-to-digital converters. It introduces a new IIO driver using the
> > SPI subsystem.
> >
> > > diff --git a/drivers/iio/adc/ltc2378.c b/drivers/iio/adc/ltc2378.c
> > > new file mode 100644
> > > index 0000000000000..b5cf2e974daca
> > > --- /dev/null
> > > +++ b/drivers/iio/adc/ltc2378.c
> > > @@ -0,0 +1,404 @@
> >
> > [ ... ]
> >
> > > +static const struct ltc2378_chip_info ltc2338_18_chip_info = {
> > > + .name = "ltc2338-18",
> > > + .internal_ref_uV = 4096000,
> > > + .chan = LTC2378_BIPOLAR_DIFF_CHANNEL(18),
> > > +};
> >
> > [ ... ]
> >
> > > +static int ltc2378_convert_and_acquire(struct ltc2378_state *st)
> > > +{
> > > + int ret;
> > > +
> > > + /* Cause a rising edge of CNV to initiate a new ADC conversion */
> > > + gpiod_set_value_cansleep(st->cnv_gpio, 1);
> > > + fsleep(4);
> >
> > [Severity: High]
> > Can this sequence cause data corruption on a shared SPI bus?
> >
> > The CNV pin is toggled and an fsleep(4) occurs before spi_sync_transfer()
> > locks the bus. If another SPI transaction occurs during this sleep window,
> > could it toggle the SCK line and prematurely clock data out of the ADC?
> Makes sense.
> >
> > Should the conversion-and-read sequence be wrapped in spi_bus_lock()
> > and spi_bus_unlock()?
> Because these chips don't have CS line, it seems that locking the bus actually
> makes sense.
What does it even mean? If there is no CS then the bus can only sensibly
have one device on it. I'm not sure if the SPI core enforces that but
in practice you should never see a board that has multiple devices.
Hence locking could be at the device driver level rather than the bus.
I guess bus locking would provide the same conditions and maybe acts
as documentation.
Jonathan
next prev parent reply other threads:[~2026-07-04 23:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 21:44 [PATCH v5 0/4] iio: adc: Add support for LTC2378 and similar ADCs Marcelo Schmitt
2026-07-02 21:45 ` [PATCH v5 1/4] dt-bindings: iio: adc: Add ltc2378 Marcelo Schmitt
2026-07-02 21:52 ` sashiko-bot
2026-07-03 17:04 ` Marcelo Schmitt
2026-07-04 23:11 ` Jonathan Cameron
2026-07-02 21:45 ` [PATCH v5 2/4] iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs Marcelo Schmitt
2026-07-02 22:02 ` sashiko-bot
2026-07-03 17:14 ` Marcelo Schmitt
2026-07-04 23:22 ` Jonathan Cameron [this message]
2026-07-04 23:43 ` Jonathan Cameron
2026-07-02 21:45 ` [PATCH v5 3/4] iio: adc: ltc2378: Enable high-speed data capture Marcelo Schmitt
2026-07-02 22:07 ` sashiko-bot
2026-07-03 17:19 ` Marcelo Schmitt
2026-07-04 23:48 ` Jonathan Cameron
2026-07-02 21:46 ` [PATCH v5 4/4] iio: adc: ltc2378: Enable triggered buffer " Marcelo Schmitt
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=20260705002244.59a9c4ca@jic23-huawei \
--to=jic23@kernel.org \
--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