From: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
To: linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, marcelo.schmitt1@gmail.com
Cc: Marcelo Schmitt <marcelo.schmitt@analog.com>,
conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v3 07/13] iio: adc: ad4134: Support buffered data read
Date: Wed, 30 Sep 2026 15:54:00 -0300 [thread overview]
Message-ID: <ar1ayHk6n06hskyR@debian-BULLSEYE-live-builder-AMD64> (raw)
In-Reply-To: <20260929230528.8861C1F000FF@smtp.kernel.org>
On 09/29, sashiko-bot@kernel.org wrote:
...
> > +static irqreturn_t ad4134_trigger_handler(int irq, void *p)
> > +{
> > + IIO_DECLARE_BUFFER_WITH_TS(u32, channels, AD4134_NUM_CHANNELS) = { };
> > + struct iio_poll_func *pf = p;
> > + struct iio_dev *indio_dev = pf->indio_dev;
> > + struct ad4134_state *st = iio_priv(indio_dev);
> > + struct spi_transfer xfer = {
> > + .rx_buf = st->rx_buf,
>
> [Severity: High]
> If userspace reads or writes ADC registers via debugfs while the triggered
> buffer is running in minimum I/O mode (NO_CS), ad4134_debugfs_reg_access()
> can run concurrently with ad4134_trigger_handler().
>
Yeah, debugfs is not safe to use like that. I believe claiming direct mode
would solve the issue, although, the conclusion a while ago was that enforcing
that for debug interface was not the way to go, IIRC.
I'll ignore complaints about issues related to debugfs unless asked otherwise.
> [Severity: High]
> When the driver is configured in 4-wire mode (adi,spi-mode = "4-wire") and
> falls back to the software trigger handler, this flag explicitly instructs
> the SPI controller to leave the chip select line inactive (high) for the
> duration of the transfer.
>
> Since the AD4134 requires an active (low) chip select to frame the data in
> 4-wire mode, does this setting break 4-wire mode communication and prevent
> the device from outputting valid sample data?
Doesn't apply to this specific device in 4-wire operation mode since the AD4134
data interface is read with CS off.
>
> > + .len = BITS_TO_BYTES(AD4134_CHAN_PRECISION_BITS),
> > + };
> > + int ret;
> > +
> > + gpiod_set_value_cansleep(st->odr_gpio, 1);
> > + fsleep(1);
> > + gpiod_set_value_cansleep(st->odr_gpio, 0);
> > +
> > + /* Execute transfers for all channels so the entire data frame is read. */
> > + for (int ch = 0, i = 0; ch < AD4134_NUM_CHANNELS; ch++) {
> > + ret = spi_sync_transfer(st->spi, &xfer, 1);
>
> [Severity: High]
> In 4-wire mode, the AD4134 resets its data output frame if the chip select
> goes high or if the DCLK is idle for more than 250ns.
I have no idea where it supposedly found such information.
>
> Does calling spi_sync_transfer() in a loop for each channel introduce
> software delays far exceeding 250ns and toggle the CS line between calls?
>
> Could this violate the device's continuous clocking and CS timing
> requirements, causing the frame to reset on every iteration and reading
> Channel 0 repeatedly instead of streaming consecutive channels?
>
> Should a single bulk SPI transfer be used here instead of a loop?
Anyways, running a longer transfer to get data all at once can indeed be done
to minimize delays. So, I may do that on a v4.
next prev parent reply other threads:[~2026-09-30 18:53 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 22:41 [PATCH v3 00/13] iio: adc: ad4134: Enable greater sample rate data capture Marcelo Schmitt
2026-09-29 22:42 ` [PATCH v3 01/13] iio: adc: ad4134: Adjust register map range Marcelo Schmitt
2026-09-29 22:42 ` [PATCH v3 02/13] iio: adc: ad4134: Sign extend sample data Marcelo Schmitt
2026-09-30 8:50 ` Joshua Crofts
2026-09-29 22:42 ` [PATCH v3 03/13] iio: adc: ad4134: Update include list to comply with IWYU principles Marcelo Schmitt
2026-09-29 22:43 ` [PATCH v3 04/13] iio: adc: ad4134: Serialize single-read operations Marcelo Schmitt
2026-09-29 22:43 ` [PATCH v3 05/13] iio: adc: ad4134: Run shorter transfers when CRC is disabled Marcelo Schmitt
2026-09-29 22:43 ` [PATCH v3 06/13] iio: adc: ad4134: Add support for digital filter type selection Marcelo Schmitt
2026-09-29 22:44 ` [PATCH v3 07/13] iio: adc: ad4134: Support buffered data read Marcelo Schmitt
[not found] ` <20260929230528.8861C1F000FF@smtp.kernel.org>
2026-09-30 18:54 ` Marcelo Schmitt [this message]
2026-09-29 22:44 ` [PATCH v3 08/13] dt-bindings: iio: adc: adi,ad4134: Document SPI connection mode Marcelo Schmitt
2026-09-30 11:51 ` Rob Herring (Arm)
2026-09-30 12:15 ` Rob Herring
[not found] ` <20260929230226.DDDAE1F00898@smtp.kernel.org>
2026-09-30 18:23 ` Marcelo Schmitt
2026-09-30 22:29 ` Conor Dooley
2026-09-29 22:44 ` [PATCH v3 09/13] dt-bindings: iio: adc: adi,ad4134: Document external multiplexer usage Marcelo Schmitt
2026-09-30 12:16 ` Rob Herring (Arm)
2026-09-29 22:45 ` [PATCH v3 10/13] iio: adc: ad4134: Support SPI 4-wire mode Marcelo Schmitt
[not found] ` <20260929230830.A8F3A1F000FF@smtp.kernel.org>
2026-09-30 19:39 ` Marcelo Schmitt
2026-09-29 22:45 ` [PATCH v3 11/13] dt-bindings: iio: adc: adi,ad4134: Document PWM usage Marcelo Schmitt
2026-09-29 22:45 ` [PATCH v3 12/13] iio: adc: ad4134: Support high-speed data capture Marcelo Schmitt
2026-09-30 9:42 ` Andy Shevchenko
[not found] ` <20260929231610.BA7C31F000FF@smtp.kernel.org>
2026-09-30 19:59 ` Marcelo Schmitt
2026-09-29 22:46 ` [PATCH v3 13/13] Docs: iio: Add AD4134 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=ar1ayHk6n06hskyR@debian-BULLSEYE-live-builder-AMD64 \
--to=marcelo.schmitt1@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.schmitt@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
all inboxes | Powered by JetHome®