* [PATCH 0/3] iio: adc: ad7768-1: add support for SPI offload
@ 2026-02-01 1:35 Jonathan Santos
2026-02-01 1:35 ` [PATCH 1/3] iio: adc: ad7768-1: fix one-shot mode data acquisition Jonathan Santos
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Jonathan Santos @ 2026-02-01 1:35 UTC (permalink / raw)
To: linux-iio, linux-kernel
Cc: Jonathan Santos, Michael.Hennerich, lars, jic23, dlechner,
nuno.sa, andy
This series adds SPI offload support to the AD7768-1 driver and includes
two critical fixes for one-shot mode operation discovered during testing.
Jonathan Santos (3):
iio: adc: ad7768-1: fix one-shot mode data acquisition
iio: adc: ad7768-1: prevent one-shot mode with wideband filter
iio: adc: ad7768-1: add support for SPI offload
drivers/iio/adc/Kconfig | 2 +
drivers/iio/adc/ad7768-1.c | 211 +++++++++++++++++++++++++++++++++++--
2 files changed, 202 insertions(+), 11 deletions(-)
base-commit: d820183f371d9aa8517a1cd21fe6edacf0f94b7f
--
2.34.1
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH 1/3] iio: adc: ad7768-1: fix one-shot mode data acquisition 2026-02-01 1:35 [PATCH 0/3] iio: adc: ad7768-1: add support for SPI offload Jonathan Santos @ 2026-02-01 1:35 ` Jonathan Santos 2026-02-07 16:48 ` Jonathan Cameron 2026-02-01 1:35 ` [PATCH 2/3] iio: adc: ad7768-1: prevent one-shot mode with wideband filter Jonathan Santos 2026-02-01 1:35 ` [PATCH 3/3] iio: adc: ad7768-1: add support for SPI offload Jonathan Santos 2 siblings, 1 reply; 14+ messages in thread From: Jonathan Santos @ 2026-02-01 1:35 UTC (permalink / raw) To: linux-iio, linux-kernel Cc: Jonathan Santos, Michael.Hennerich, lars, jic23, dlechner, nuno.sa, andy According to the datasheet, one-shot mode requires a SYNC_IN pulse to trigger a new sample conversion. In the current implementation, No sync pulse was sent after switching to one-shot mode and reinit_completion() was called before mode switching, creating a race condition where spurious interrupts during mode change could trigger completion prematurely. Fix by sending a sync pulse after configuring one-shot mode and moving reinit_completion() after the pulse to ensure it only waits for the actual conversion completion. Fixes: a5f8c7da3dbe ("iio: adc: Add AD7768-1 ADC basic support") Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> --- drivers/iio/adc/ad7768-1.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c index fcd8aea7152e..8d39b71703ae 100644 --- a/drivers/iio/adc/ad7768-1.c +++ b/drivers/iio/adc/ad7768-1.c @@ -463,12 +463,17 @@ static int ad7768_scan_direct(struct iio_dev *indio_dev) struct ad7768_state *st = iio_priv(indio_dev); int readval, ret; - reinit_completion(&st->completion); - ret = ad7768_set_mode(st, AD7768_ONE_SHOT); if (ret < 0) return ret; + /* One-shot mode requires a SYNC pulse to generate a new sample */ + ret = ad7768_send_sync_pulse(st); + if (ret) + return ret; + + reinit_completion(&st->completion); + ret = wait_for_completion_timeout(&st->completion, msecs_to_jiffies(1000)); if (!ret) -- 2.34.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] iio: adc: ad7768-1: fix one-shot mode data acquisition 2026-02-01 1:35 ` [PATCH 1/3] iio: adc: ad7768-1: fix one-shot mode data acquisition Jonathan Santos @ 2026-02-07 16:48 ` Jonathan Cameron 2026-02-09 21:38 ` Jonathan Santos 0 siblings, 1 reply; 14+ messages in thread From: Jonathan Cameron @ 2026-02-07 16:48 UTC (permalink / raw) To: Jonathan Santos Cc: linux-iio, linux-kernel, Michael.Hennerich, lars, dlechner, nuno.sa, andy On Sat, 31 Jan 2026 22:35:20 -0300 Jonathan Santos <Jonathan.Santos@analog.com> wrote: > According to the datasheet, one-shot mode requires a SYNC_IN pulse to > trigger a new sample conversion. In the current implementation, No sync > pulse was sent after switching to one-shot mode and reinit_completion() > was called before mode switching, creating a race condition where spurious > interrupts during mode change could trigger completion prematurely. > > Fix by sending a sync pulse after configuring one-shot mode and moving > reinit_completion() after the pulse to ensure it only waits for the > actual conversion completion. That smells like a race... What stops us taking a long break between ending that sync pulse and the reinit_completition() such that we have initialized if before the complete()? You always have to do it before what ever ultimately makes the complete() happen. Have you seen an sign of the spurious interrupts or is that more a conjecture of what might happen? Jonathan > > Fixes: a5f8c7da3dbe ("iio: adc: Add AD7768-1 ADC basic support") > Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> > --- > drivers/iio/adc/ad7768-1.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c > index fcd8aea7152e..8d39b71703ae 100644 > --- a/drivers/iio/adc/ad7768-1.c > +++ b/drivers/iio/adc/ad7768-1.c > @@ -463,12 +463,17 @@ static int ad7768_scan_direct(struct iio_dev *indio_dev) > struct ad7768_state *st = iio_priv(indio_dev); > int readval, ret; > > - reinit_completion(&st->completion); > - > ret = ad7768_set_mode(st, AD7768_ONE_SHOT); > if (ret < 0) > return ret; > > + /* One-shot mode requires a SYNC pulse to generate a new sample */ > + ret = ad7768_send_sync_pulse(st); > + if (ret) > + return ret; > + > + reinit_completion(&st->completion); > + > ret = wait_for_completion_timeout(&st->completion, > msecs_to_jiffies(1000)); > if (!ret) ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] iio: adc: ad7768-1: fix one-shot mode data acquisition 2026-02-07 16:48 ` Jonathan Cameron @ 2026-02-09 21:38 ` Jonathan Santos 2026-02-14 14:47 ` Jonathan Cameron 0 siblings, 1 reply; 14+ messages in thread From: Jonathan Santos @ 2026-02-09 21:38 UTC (permalink / raw) To: Jonathan Cameron Cc: Jonathan Santos, linux-iio, linux-kernel, Michael.Hennerich, lars, dlechner, nuno.sa, andy On 02/07, Jonathan Cameron wrote: > On Sat, 31 Jan 2026 22:35:20 -0300 > Jonathan Santos <Jonathan.Santos@analog.com> wrote: > > > According to the datasheet, one-shot mode requires a SYNC_IN pulse to > > trigger a new sample conversion. In the current implementation, No sync > > pulse was sent after switching to one-shot mode and reinit_completion() > > was called before mode switching, creating a race condition where spurious > > interrupts during mode change could trigger completion prematurely. > > > > Fix by sending a sync pulse after configuring one-shot mode and moving > > reinit_completion() after the pulse to ensure it only waits for the > > actual conversion completion. > That smells like a race... > > What stops us taking a long break between ending that sync pulse and > the reinit_completition() such that we have initialized if before the > complete()? > Yes, you are right, we have a race here. The inital problem was having the ad7768_set_mode() before the reinit_completion() because, almost everytime, a new conversion is done before setting the one-shot mode, so the complete() happens before the expected trigger (that never happened because ad7768_send_sync_pulse() was not present). > You always have to do it before what ever ultimately makes the complete() > happen. Have you seen an sign of the spurious interrupts or is that > more a conjecture of what might happen? > Agreed, I can put reinit_completion() before sending the sync pulse to avoid this situation. But maybe it is better just to remove the one-shot mode as discussed in the patch 2/3. What do you think? > Jonathan > > > > > Fixes: a5f8c7da3dbe ("iio: adc: Add AD7768-1 ADC basic support") > > Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> > > --- > > drivers/iio/adc/ad7768-1.c | 9 +++++++-- > > 1 file changed, 7 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c > > index fcd8aea7152e..8d39b71703ae 100644 > > --- a/drivers/iio/adc/ad7768-1.c > > +++ b/drivers/iio/adc/ad7768-1.c > > @@ -463,12 +463,17 @@ static int ad7768_scan_direct(struct iio_dev *indio_dev) > > struct ad7768_state *st = iio_priv(indio_dev); > > int readval, ret; > > > > - reinit_completion(&st->completion); > > - > > ret = ad7768_set_mode(st, AD7768_ONE_SHOT); > > if (ret < 0) > > return ret; > > > > + /* One-shot mode requires a SYNC pulse to generate a new sample */ > > + ret = ad7768_send_sync_pulse(st); > > + if (ret) > > + return ret; > > + > > + reinit_completion(&st->completion); > > + > > ret = wait_for_completion_timeout(&st->completion, > > msecs_to_jiffies(1000)); > > if (!ret) ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] iio: adc: ad7768-1: fix one-shot mode data acquisition 2026-02-09 21:38 ` Jonathan Santos @ 2026-02-14 14:47 ` Jonathan Cameron 0 siblings, 0 replies; 14+ messages in thread From: Jonathan Cameron @ 2026-02-14 14:47 UTC (permalink / raw) To: Jonathan Santos Cc: Jonathan Santos, linux-iio, linux-kernel, Michael.Hennerich, lars, dlechner, nuno.sa, andy On Mon, 9 Feb 2026 18:38:31 -0300 Jonathan Santos <jonath4nns@gmail.com> wrote: > On 02/07, Jonathan Cameron wrote: > > On Sat, 31 Jan 2026 22:35:20 -0300 > > Jonathan Santos <Jonathan.Santos@analog.com> wrote: > > > > > According to the datasheet, one-shot mode requires a SYNC_IN pulse to > > > trigger a new sample conversion. In the current implementation, No sync > > > pulse was sent after switching to one-shot mode and reinit_completion() > > > was called before mode switching, creating a race condition where spurious > > > interrupts during mode change could trigger completion prematurely. > > > > > > Fix by sending a sync pulse after configuring one-shot mode and moving > > > reinit_completion() after the pulse to ensure it only waits for the > > > actual conversion completion. > > That smells like a race... > > > > What stops us taking a long break between ending that sync pulse and > > the reinit_completition() such that we have initialized if before the > > complete()? > > > > Yes, you are right, we have a race here. The inital problem was having > the ad7768_set_mode() before the reinit_completion() because, almost > everytime, a new conversion is done before setting the one-shot mode, > so the complete() happens before the expected trigger (that never > happened because ad7768_send_sync_pulse() was not present). > > > You always have to do it before what ever ultimately makes the complete() > > happen. Have you seen an sign of the spurious interrupts or is that > > more a conjecture of what might happen? > > > > Agreed, I can put reinit_completion() before sending the sync pulse to > avoid this situation. But maybe it is better just to remove the one-shot > mode as discussed in the patch 2/3. What do you think? I don't have a strong view either way as the trade offs of using continuous type modes for oneshot and not tend to be rather driver and usecase specific. So I'll leave that decision to the driver author and anyone else who cares about a particular part. Fix wise you probably want the minor change of adding the reinit before the pulse as that gives us something small to backport, even if you then rip the code out again. Thanks, Jonathan > > > Jonathan > > > > > > > > Fixes: a5f8c7da3dbe ("iio: adc: Add AD7768-1 ADC basic support") > > > Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> > > > --- > > > drivers/iio/adc/ad7768-1.c | 9 +++++++-- > > > 1 file changed, 7 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c > > > index fcd8aea7152e..8d39b71703ae 100644 > > > --- a/drivers/iio/adc/ad7768-1.c > > > +++ b/drivers/iio/adc/ad7768-1.c > > > @@ -463,12 +463,17 @@ static int ad7768_scan_direct(struct iio_dev *indio_dev) > > > struct ad7768_state *st = iio_priv(indio_dev); > > > int readval, ret; > > > > > > - reinit_completion(&st->completion); > > > - > > > ret = ad7768_set_mode(st, AD7768_ONE_SHOT); > > > if (ret < 0) > > > return ret; > > > > > > + /* One-shot mode requires a SYNC pulse to generate a new sample */ > > > + ret = ad7768_send_sync_pulse(st); > > > + if (ret) > > > + return ret; > > > + > > > + reinit_completion(&st->completion); > > > + > > > ret = wait_for_completion_timeout(&st->completion, > > > msecs_to_jiffies(1000)); > > > if (!ret) ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/3] iio: adc: ad7768-1: prevent one-shot mode with wideband filter 2026-02-01 1:35 [PATCH 0/3] iio: adc: ad7768-1: add support for SPI offload Jonathan Santos 2026-02-01 1:35 ` [PATCH 1/3] iio: adc: ad7768-1: fix one-shot mode data acquisition Jonathan Santos @ 2026-02-01 1:35 ` Jonathan Santos 2026-02-04 16:11 ` Nuno Sá 2026-02-01 1:35 ` [PATCH 3/3] iio: adc: ad7768-1: add support for SPI offload Jonathan Santos 2 siblings, 1 reply; 14+ messages in thread From: Jonathan Santos @ 2026-02-01 1:35 UTC (permalink / raw) To: linux-iio, linux-kernel Cc: Jonathan Santos, Michael.Hennerich, lars, jic23, dlechner, nuno.sa, andy The AD7768-1 datasheet specifies that the wideband low ripple FIR filter is only available in continuous conversion mode and should not be used with one-shot mode to avoid malfunction and incorrect data. Add filter type checks in ad7768_scan_direct() to skip one-shot mode switching when wideband filter is configured. Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> --- drivers/iio/adc/ad7768-1.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c index 8d39b71703ae..374614ea97ac 100644 --- a/drivers/iio/adc/ad7768-1.c +++ b/drivers/iio/adc/ad7768-1.c @@ -463,14 +463,17 @@ static int ad7768_scan_direct(struct iio_dev *indio_dev) struct ad7768_state *st = iio_priv(indio_dev); int readval, ret; - ret = ad7768_set_mode(st, AD7768_ONE_SHOT); - if (ret < 0) - return ret; + /* Wideband filter is not available in One-Shot conversion mode */ + if (st->filter_type != AD7768_FILTER_WIDEBAND) { + ret = ad7768_set_mode(st, AD7768_ONE_SHOT); + if (ret < 0) + return ret; - /* One-shot mode requires a SYNC pulse to generate a new sample */ - ret = ad7768_send_sync_pulse(st); - if (ret) - return ret; + /* One-shot mode requires a SYNC pulse to generate a new sample */ + ret = ad7768_send_sync_pulse(st); + if (ret) + return ret; + } reinit_completion(&st->completion); @@ -496,9 +499,11 @@ static int ad7768_scan_direct(struct iio_dev *indio_dev) * Any SPI configuration of the AD7768-1 can only be * performed in continuous conversion mode. */ - ret = ad7768_set_mode(st, AD7768_CONTINUOUS); - if (ret < 0) - return ret; + if (st->filter_type != AD7768_FILTER_WIDEBAND) { + ret = ad7768_set_mode(st, AD7768_CONTINUOUS); + if (ret < 0) + return ret; + } return readval; } -- 2.34.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 2/3] iio: adc: ad7768-1: prevent one-shot mode with wideband filter 2026-02-01 1:35 ` [PATCH 2/3] iio: adc: ad7768-1: prevent one-shot mode with wideband filter Jonathan Santos @ 2026-02-04 16:11 ` Nuno Sá 2026-02-02 22:41 ` Jonathan Santos 0 siblings, 1 reply; 14+ messages in thread From: Nuno Sá @ 2026-02-04 16:11 UTC (permalink / raw) To: Jonathan Santos, linux-iio, linux-kernel Cc: Michael.Hennerich, lars, jic23, dlechner, nuno.sa, andy On Sat, 2026-01-31 at 22:35 -0300, Jonathan Santos wrote: > The AD7768-1 datasheet specifies that the wideband low ripple FIR filter > is only available in continuous conversion mode and should not be used > with one-shot mode to avoid malfunction and incorrect data. > > Add filter type checks in ad7768_scan_direct() to skip one-shot mode > switching when wideband filter is configured. > > Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> > --- > drivers/iio/adc/ad7768-1.c | 25 +++++++++++++++---------- > 1 file changed, 15 insertions(+), 10 deletions(-) > > diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c > index 8d39b71703ae..374614ea97ac 100644 > --- a/drivers/iio/adc/ad7768-1.c > +++ b/drivers/iio/adc/ad7768-1.c > @@ -463,14 +463,17 @@ static int ad7768_scan_direct(struct iio_dev *indio_dev) > struct ad7768_state *st = iio_priv(indio_dev); > int readval, ret; > > - ret = ad7768_set_mode(st, AD7768_ONE_SHOT); > - if (ret < 0) > - return ret; > + /* Wideband filter is not available in One-Shot conversion mode */ > + if (st->filter_type != AD7768_FILTER_WIDEBAND) { > + ret = ad7768_set_mode(st, AD7768_ONE_SHOT); > + if (ret < 0) > + return ret; > > - /* One-shot mode requires a SYNC pulse to generate a new sample */ > - ret = ad7768_send_sync_pulse(st); > - if (ret) > - return ret; > + /* One-shot mode requires a SYNC pulse to generate a new sample */ > + ret = ad7768_send_sync_pulse(st); > + if (ret) > + return ret; > + } > > reinit_completion(&st->completion); > > @@ -496,9 +499,11 @@ static int ad7768_scan_direct(struct iio_dev *indio_dev) > * Any SPI configuration of the AD7768-1 can only be > * performed in continuous conversion mode. > */ > - ret = ad7768_set_mode(st, AD7768_CONTINUOUS); > - if (ret < 0) > - return ret; > + if (st->filter_type != AD7768_FILTER_WIDEBAND) { > + ret = ad7768_set_mode(st, AD7768_CONTINUOUS); > + if (ret < 0) > + return ret; > + } So the idea is to still have continuous mode running and get the latest sample after we do reinit_completion()? If that's the case, why do we have the one shot logic? Does it bring that much added value? Asking because I'm just wondering we could just let it in continuous mode all the time. This also sounds like a fix so maybe a Fixes tag? - Nuno Sá ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/3] iio: adc: ad7768-1: prevent one-shot mode with wideband filter 2026-02-04 16:11 ` Nuno Sá @ 2026-02-02 22:41 ` Jonathan Santos 0 siblings, 0 replies; 14+ messages in thread From: Jonathan Santos @ 2026-02-02 22:41 UTC (permalink / raw) To: Nuno Sá Cc: Jonathan Santos, linux-iio, linux-kernel, Michael.Hennerich, lars, jic23, dlechner, nuno.sa, andy On 02/04, Nuno Sá wrote: > On Sat, 2026-01-31 at 22:35 -0300, Jonathan Santos wrote: > > The AD7768-1 datasheet specifies that the wideband low ripple FIR filter > > is only available in continuous conversion mode and should not be used > > with one-shot mode to avoid malfunction and incorrect data. > > > > Add filter type checks in ad7768_scan_direct() to skip one-shot mode > > switching when wideband filter is configured. > > > > Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> > > --- > > drivers/iio/adc/ad7768-1.c | 25 +++++++++++++++---------- > > 1 file changed, 15 insertions(+), 10 deletions(-) > > > > diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c > > index 8d39b71703ae..374614ea97ac 100644 > > --- a/drivers/iio/adc/ad7768-1.c > > +++ b/drivers/iio/adc/ad7768-1.c > > @@ -463,14 +463,17 @@ static int ad7768_scan_direct(struct iio_dev *indio_dev) > > struct ad7768_state *st = iio_priv(indio_dev); > > int readval, ret; > > > > - ret = ad7768_set_mode(st, AD7768_ONE_SHOT); > > - if (ret < 0) > > - return ret; > > + /* Wideband filter is not available in One-Shot conversion mode */ > > + if (st->filter_type != AD7768_FILTER_WIDEBAND) { > > + ret = ad7768_set_mode(st, AD7768_ONE_SHOT); > > + if (ret < 0) > > + return ret; > > > > - /* One-shot mode requires a SYNC pulse to generate a new sample */ > > - ret = ad7768_send_sync_pulse(st); > > - if (ret) > > - return ret; > > + /* One-shot mode requires a SYNC pulse to generate a new sample */ > > + ret = ad7768_send_sync_pulse(st); > > + if (ret) > > + return ret; > > + } > > > > reinit_completion(&st->completion); > > > > @@ -496,9 +499,11 @@ static int ad7768_scan_direct(struct iio_dev *indio_dev) > > * Any SPI configuration of the AD7768-1 can only be > > * performed in continuous conversion mode. > > */ > > - ret = ad7768_set_mode(st, AD7768_CONTINUOUS); > > - if (ret < 0) > > - return ret; > > + if (st->filter_type != AD7768_FILTER_WIDEBAND) { > > + ret = ad7768_set_mode(st, AD7768_CONTINUOUS); > > + if (ret < 0) > > + return ret; > > + } > > > So the idea is to still have continuous mode running and get the latest sample after > we do reinit_completion()? If that's the case, why do we have the one shot logic? Does > it bring that much added value? Asking because I'm just wondering we could just let > it in continuous mode all the time. The concern on having continuous conversion mode all the time was that sometimes, especially at higher sampling rates, a new conversion (DRDY) occurs while the controller is still reading the ADC_DATA register. I was initially worried the data register might be refreshed mid-transfer. However, after reviewing the datasheet more carefully, that does not appear to be the case. As the ADAQ7768-1 datasheet on page 76 states: "The register driving DOUT resets by the last SCLK rising edge in an SPI read frame, or a rising CS edge, whichever occurs first. -> The number of SCLKs required to reset the SPI interface depends on the read configuration. The 16th rising SCLK edge resets the SPI interface for a normal read operation and up to 40 SCLKs when reading back ADC conversion data, plus the status and CRC headers." Then I guess we could just remove the one-shot mode. > > This also sounds like a fix so maybe a Fixes tag? > > - Nuno Sá ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 3/3] iio: adc: ad7768-1: add support for SPI offload 2026-02-01 1:35 [PATCH 0/3] iio: adc: ad7768-1: add support for SPI offload Jonathan Santos 2026-02-01 1:35 ` [PATCH 1/3] iio: adc: ad7768-1: fix one-shot mode data acquisition Jonathan Santos 2026-02-01 1:35 ` [PATCH 2/3] iio: adc: ad7768-1: prevent one-shot mode with wideband filter Jonathan Santos @ 2026-02-01 1:35 ` Jonathan Santos 2026-02-04 14:09 ` Andy Shevchenko ` (4 more replies) 2 siblings, 5 replies; 14+ messages in thread From: Jonathan Santos @ 2026-02-01 1:35 UTC (permalink / raw) To: linux-iio, linux-kernel Cc: Jonathan Santos, Michael.Hennerich, lars, jic23, dlechner, nuno.sa, andy The AD7768-1 family supports sampling rates up to 1 MSPS, which exceeds the capabilities of conventional triggered buffer operations due to SPI transaction overhead and interrupt latency. Add SPI offload support to enable hardware-accelerated data acquisition that bypasses software SPI transactions using continuous data streaming. Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> --- drivers/iio/adc/Kconfig | 2 + drivers/iio/adc/ad7768-1.c | 187 ++++++++++++++++++++++++++++++++++++- 2 files changed, 185 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 60038ae8dfc4..a1c3226c3631 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -413,8 +413,10 @@ config AD7768_1 select REGMAP_SPI select RATIONAL select IIO_BUFFER + select IIO_BUFFER_DMAENGINE select IIO_TRIGGER select IIO_TRIGGERED_BUFFER + select SPI_OFFLOAD help Say yes here to build support for Analog Devices AD7768-1 SPI simultaneously sampling sigma-delta analog to digital converter (ADC). diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c index 374614ea97ac..fc497fb639d0 100644 --- a/drivers/iio/adc/ad7768-1.c +++ b/drivers/iio/adc/ad7768-1.c @@ -25,12 +25,15 @@ #include <linux/regulator/consumer.h> #include <linux/regulator/driver.h> #include <linux/sysfs.h> +#include <linux/spi/offload/consumer.h> +#include <linux/spi/offload/provider.h> #include <linux/spi/spi.h> #include <linux/unaligned.h> #include <linux/units.h> #include <linux/util_macros.h> #include <linux/iio/buffer.h> +#include <linux/iio/buffer-dmaengine.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> #include <linux/iio/trigger.h> @@ -161,6 +164,8 @@ enum ad7768_filter_regval { enum ad7768_scan_type { AD7768_SCAN_TYPE_NORMAL, AD7768_SCAN_TYPE_HIGH_SPEED, + AD7768_SCAN_TYPE_OFFLOAD_NORMAL, + AD7768_SCAN_TYPE_OFFLOAD_HIGH_SPEED, }; enum { @@ -266,6 +271,18 @@ static const struct iio_scan_type ad7768_scan_type[] = { .storagebits = 16, .endianness = IIO_BE, }, + [AD7768_SCAN_TYPE_OFFLOAD_NORMAL] = { + .sign = 's', + .realbits = 24, + .storagebits = 32, + .endianness = IIO_CPU, + }, + [AD7768_SCAN_TYPE_OFFLOAD_HIGH_SPEED] = { + .sign = 's', + .realbits = 16, + .storagebits = 32, + .endianness = IIO_CPU, + }, }; struct ad7768_chip_info { @@ -283,6 +300,8 @@ struct ad7768_chip_info { struct ad7768_state { struct spi_device *spi; + struct spi_offload *offload; + struct spi_offload_trigger *offload_trigger; struct regmap *regmap; struct regmap *regmap24; int vref_uv; @@ -306,8 +325,11 @@ struct ad7768_state { struct gpio_desc *gpio_reset; const char *labels[AD7768_MAX_CHANNELS]; struct gpio_chip gpiochip; + struct spi_transfer offload_xfer; + struct spi_message offload_msg; const struct ad7768_chip_info *chip; bool en_spi_sync; + bool offload_en; struct mutex pga_lock; /* protect device internal state (PGA) */ /* * DMA (thus cache coherency maintenance) may require the @@ -1139,6 +1161,10 @@ static int ad7768_get_current_scan_type(const struct iio_dev *indio_dev, { struct ad7768_state *st = iio_priv(indio_dev); + if (st->offload_en) + return st->oversampling_ratio == 8 ? + AD7768_SCAN_TYPE_OFFLOAD_HIGH_SPEED : AD7768_SCAN_TYPE_OFFLOAD_NORMAL; + return st->oversampling_ratio == 8 ? AD7768_SCAN_TYPE_HIGH_SPEED : AD7768_SCAN_TYPE_NORMAL; } @@ -1320,7 +1346,7 @@ static irqreturn_t ad7768_interrupt(int irq, void *dev_id) struct iio_dev *indio_dev = dev_id; struct ad7768_state *st = iio_priv(indio_dev); - if (iio_buffer_enabled(indio_dev)) + if (iio_buffer_enabled(indio_dev) && !st->offload_en) iio_trigger_poll(st->trig); else complete(&st->completion); @@ -1357,6 +1383,72 @@ static const struct iio_buffer_setup_ops ad7768_buffer_ops = { .predisable = &ad7768_buffer_predisable, }; +static int ad7768_offload_buffer_postenable(struct iio_dev *indio_dev) +{ + struct ad7768_state *st = iio_priv(indio_dev); + struct spi_offload_trigger_config config = { + .type = SPI_OFFLOAD_TRIGGER_DATA_READY, + }; + const struct iio_scan_type *scan_type; + int ret; + + scan_type = iio_get_current_scan_type(indio_dev, &indio_dev->channels[0]); + if (IS_ERR(scan_type)) + return PTR_ERR(scan_type); + + st->offload_xfer.len = roundup_pow_of_two(BITS_TO_BYTES(scan_type->realbits)); + st->offload_xfer.bits_per_word = scan_type->realbits; + st->offload_xfer.offload_flags = SPI_OFFLOAD_XFER_RX_STREAM; + + /* + * Write a 1 to the LSB of the INTERFACE_FORMAT register to enter + * continuous read mode. Subsequent data reads do not require an + * initial 8-bit write to query the ADC_DATA register. + */ + ret = regmap_write(st->regmap, AD7768_REG_INTERFACE_FORMAT, 0x01); + if (ret) + return ret; + + spi_message_init_with_transfers(&st->offload_msg, &st->offload_xfer, 1); + st->offload_msg.offload = st->offload; + + ret = spi_optimize_message(st->spi, &st->offload_msg); + if (ret) { + dev_err(&st->spi->dev, "failed to prepare offload, err: %d\n", ret); + return ret; + } + + ret = spi_offload_trigger_enable(st->offload, + st->offload_trigger, + &config); + if (ret) { + spi_unoptimize_message(&st->offload_msg); + return ret; + } + + return 0; +} + +static int ad7768_offload_buffer_predisable(struct iio_dev *indio_dev) +{ + struct ad7768_state *st = iio_priv(indio_dev); + unsigned int unused; + + spi_offload_trigger_disable(st->offload, st->offload_trigger); + spi_unoptimize_message(&st->offload_msg); + + /* + * To exit continuous read mode, perform a single read of the ADC_DATA + * reg (0x2C), which allows further configuration of the device. + */ + return regmap_read(st->regmap24, AD7768_REG24_ADC_DATA, &unused); +} + +static const struct iio_buffer_setup_ops ad7768_offload_buffer_ops = { + .postenable = ad7768_offload_buffer_postenable, + .predisable = ad7768_offload_buffer_predisable, +}; + static const struct iio_trigger_ops ad7768_trigger_ops = { .validate_device = iio_trigger_validate_own_device, }; @@ -1591,6 +1683,36 @@ static int ad7768_parse_aaf_gain(struct device *dev, struct ad7768_state *st) return 0; } +static bool ad7768_offload_trigger_match(struct spi_offload_trigger *trigger, + enum spi_offload_trigger_type type, + u64 *args, u32 nargs) +{ + if (type != SPI_OFFLOAD_TRIGGER_DATA_READY) + return false; + + /* Requires 1 arg to indicate the trigger output signal */ + if (nargs != 1 || args[0] != AD7768_TRIGGER_SOURCE_DRDY) + return false; + + return true; +} + +static int ad7768_offload_trigger_request(struct spi_offload_trigger *trigger, + enum spi_offload_trigger_type type, + u64 *args, u32 nargs) +{ + /* Should already be validated by match, but just in case. */ + if (nargs != 1) + return -EINVAL; + + return 0; +} + +static const struct spi_offload_trigger_ops ad7768_offload_trigger_ops = { + .match = ad7768_offload_trigger_match, + .request = ad7768_offload_trigger_request, +}; + static const struct ad7768_chip_info ad7768_chip_info = { .name = "ad7768-1", .channel_spec = ad7768_channels, @@ -1628,6 +1750,51 @@ static const struct ad7768_chip_info adaq7769_chip_info = { .has_variable_aaf = true, }; +static const struct spi_offload_config ad7768_spi_offload_config = { + .capability_flags = SPI_OFFLOAD_CAP_TRIGGER | + SPI_OFFLOAD_CAP_RX_STREAM_DMA, +}; + +static int ad7768_spi_offload_probe(struct iio_dev *indio_dev, + struct ad7768_state *st) +{ + struct device *dev = &st->spi->dev; + struct spi_offload_trigger_info trigger_info = { + .fwnode = dev_fwnode(dev), + .ops = &ad7768_offload_trigger_ops, + .priv = st, + }; + struct dma_chan *rx_dma; + int ret; + + ret = devm_spi_offload_trigger_register(dev, &trigger_info); + if (ret) + return dev_err_probe(dev, ret, + "failed to register offload trigger\n"); + + st->offload_trigger = devm_spi_offload_trigger_get(dev, st->offload, + SPI_OFFLOAD_TRIGGER_DATA_READY); + if (IS_ERR(st->offload_trigger)) + return dev_err_probe(dev, PTR_ERR(st->offload_trigger), + "failed to get offload trigger\n"); + + rx_dma = devm_spi_offload_rx_stream_request_dma_chan(dev, st->offload); + if (IS_ERR(rx_dma)) + return dev_err_probe(dev, PTR_ERR(rx_dma), + "failed to get offload RX DMA\n"); + + ret = devm_iio_dmaengine_buffer_setup_with_handle(dev, indio_dev, + rx_dma, IIO_BUFFER_DIRECTION_IN); + if (ret) + return dev_err_probe(dev, PTR_ERR(rx_dma), + "failed to setup offload RX DMA\n"); + + indio_dev->setup_ops = &ad7768_offload_buffer_ops; + st->offload_en = true; + + return 0; +} + static int ad7768_probe(struct spi_device *spi) { struct ad7768_state *st; @@ -1727,9 +1894,21 @@ static int ad7768_probe(struct spi_device *spi) if (ret) return ret; - ret = ad7768_triggered_buffer_alloc(indio_dev); - if (ret) - return ret; + st->offload = devm_spi_offload_get(&spi->dev, spi, &ad7768_spi_offload_config); + ret = PTR_ERR_OR_ZERO(st->offload); + if (ret && ret != -ENODEV) + return dev_err_probe(&spi->dev, ret, "failed to get SPI offload\n"); + + /* If not using SPI offload, fall back to low speed usage. */ + if (ret == -ENODEV) { + ret = ad7768_triggered_buffer_alloc(indio_dev); + if (ret) + return ret; + } else { + ret = ad7768_spi_offload_probe(indio_dev, st); + if (ret) + return ret; + } return devm_iio_device_register(&spi->dev, indio_dev); } -- 2.34.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] iio: adc: ad7768-1: add support for SPI offload 2026-02-01 1:35 ` [PATCH 3/3] iio: adc: ad7768-1: add support for SPI offload Jonathan Santos @ 2026-02-04 14:09 ` Andy Shevchenko 2026-02-04 15:38 ` David Lechner ` (3 subsequent siblings) 4 siblings, 0 replies; 14+ messages in thread From: Andy Shevchenko @ 2026-02-04 14:09 UTC (permalink / raw) To: Jonathan Santos Cc: linux-iio, linux-kernel, Michael.Hennerich, lars, jic23, dlechner, nuno.sa, andy On Sat, Jan 31, 2026 at 10:35:39PM -0300, Jonathan Santos wrote: > The AD7768-1 family supports sampling rates up to 1 MSPS, which exceeds > the capabilities of conventional triggered buffer operations due to SPI > transaction overhead and interrupt latency. > > Add SPI offload support to enable hardware-accelerated data acquisition > that bypasses software SPI transactions using continuous data streaming. ... > + if (st->offload_en) > + return st->oversampling_ratio == 8 ? > + AD7768_SCAN_TYPE_OFFLOAD_HIGH_SPEED : AD7768_SCAN_TYPE_OFFLOAD_NORMAL; Wrong indentation. ... > + ret = spi_offload_trigger_enable(st->offload, > + st->offload_trigger, > + &config); One of the parameters can be moved to the previous line (either 2nd or 3rd). > + if (ret) { > + spi_unoptimize_message(&st->offload_msg); > + return ret; > + } > + return 0; if (ret) spi_unoptimize_message(&st->offload_msg); return ret; ? ... > +static bool ad7768_offload_trigger_match(struct spi_offload_trigger *trigger, > + enum spi_offload_trigger_type type, > + u64 *args, u32 nargs) > +{ > + if (type != SPI_OFFLOAD_TRIGGER_DATA_READY) > + return false; > + > + /* Requires 1 arg to indicate the trigger output signal */ ^^^ for the context to below remark. > + if (nargs != 1 || args[0] != AD7768_TRIGGER_SOURCE_DRDY) > + return false; > + > + return true; > +} > + > +static int ad7768_offload_trigger_request(struct spi_offload_trigger *trigger, > + enum spi_offload_trigger_type type, > + u64 *args, u32 nargs) > +{ > + /* Should already be validated by match, but just in case. */ Please, be consistent with a style for one-line comments (pay attention to the period at the end and capitalisation of the sentence). Choose one (whatever you prefer or which one is already used) style and follow it everywhere. > + if (nargs != 1) > + return -EINVAL; > + > + return 0; > +} ... > +static const struct spi_offload_config ad7768_spi_offload_config = { > + .capability_flags = SPI_OFFLOAD_CAP_TRIGGER | > + SPI_OFFLOAD_CAP_RX_STREAM_DMA, It can be one line out of 84 characters. > +}; ... > +static int ad7768_spi_offload_probe(struct iio_dev *indio_dev, > + struct ad7768_state *st) > +{ > + struct device *dev = &st->spi->dev; > + struct spi_offload_trigger_info trigger_info = { > + .fwnode = dev_fwnode(dev), > + .ops = &ad7768_offload_trigger_ops, > + .priv = st, > + }; > + struct dma_chan *rx_dma; > + int ret; > + > + ret = devm_spi_offload_trigger_register(dev, &trigger_info); > + if (ret) > + return dev_err_probe(dev, ret, > + "failed to register offload trigger\n"); Can be one line, checkpatch for more than 10 years do not complain on the long string literals (even in --strict mode). Yes, not all lines can follow this, I pointed out this one, because it's okay balance between 80 limit and the overhead. > + > + st->offload_trigger = devm_spi_offload_trigger_get(dev, st->offload, > + SPI_OFFLOAD_TRIGGER_DATA_READY); Something wrong with the indentation at least second time. Please, review the code and make sure it indents accordingly. > + if (IS_ERR(st->offload_trigger)) > + return dev_err_probe(dev, PTR_ERR(st->offload_trigger), > + "failed to get offload trigger\n"); > + > + rx_dma = devm_spi_offload_rx_stream_request_dma_chan(dev, st->offload); > + if (IS_ERR(rx_dma)) > + return dev_err_probe(dev, PTR_ERR(rx_dma), > + "failed to get offload RX DMA\n"); > + > + ret = devm_iio_dmaengine_buffer_setup_with_handle(dev, indio_dev, > + rx_dma, IIO_BUFFER_DIRECTION_IN); Indentation. > + if (ret) > + return dev_err_probe(dev, PTR_ERR(rx_dma), > + "failed to setup offload RX DMA\n"); > + > + indio_dev->setup_ops = &ad7768_offload_buffer_ops; > + st->offload_en = true; > + > + return 0; > +} ... > + st->offload = devm_spi_offload_get(&spi->dev, spi, &ad7768_spi_offload_config); > + ret = PTR_ERR_OR_ZERO(st->offload); > + if (ret && ret != -ENODEV) > + return dev_err_probe(&spi->dev, ret, "failed to get SPI offload\n"); Add struct device *dev = &spi->dev; at the top of the function and make some lines shorter and easier to follow. > + /* If not using SPI offload, fall back to low speed usage. */ > + if (ret == -ENODEV) { No need to check for ENODEV twice. if (ret == -ENODEV) { ... } else if (ret) { return dev_err_probe(...); } else { ... } > + ret = ad7768_triggered_buffer_alloc(indio_dev); > + if (ret) > + return ret; > + } else { > + ret = ad7768_spi_offload_probe(indio_dev, st); > + if (ret) > + return ret; > + } -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] iio: adc: ad7768-1: add support for SPI offload 2026-02-01 1:35 ` [PATCH 3/3] iio: adc: ad7768-1: add support for SPI offload Jonathan Santos 2026-02-04 14:09 ` Andy Shevchenko @ 2026-02-04 15:38 ` David Lechner 2026-02-05 5:42 ` kernel test robot ` (2 subsequent siblings) 4 siblings, 0 replies; 14+ messages in thread From: David Lechner @ 2026-02-04 15:38 UTC (permalink / raw) To: Jonathan Santos, linux-iio, linux-kernel Cc: Michael.Hennerich, lars, jic23, nuno.sa, andy On 1/31/26 7:35 PM, Jonathan Santos wrote: > The AD7768-1 family supports sampling rates up to 1 MSPS, which exceeds > the capabilities of conventional triggered buffer operations due to SPI > transaction overhead and interrupt latency. > > Add SPI offload support to enable hardware-accelerated data acquisition > that bypasses software SPI transactions using continuous data streaming. > > Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> > --- ... > struct ad7768_state { > struct spi_device *spi; > + struct spi_offload *offload; > + struct spi_offload_trigger *offload_trigger; > struct regmap *regmap; > struct regmap *regmap24; > int vref_uv; > @@ -306,8 +325,11 @@ struct ad7768_state { > struct gpio_desc *gpio_reset; > const char *labels[AD7768_MAX_CHANNELS]; > struct gpio_chip gpiochip; > + struct spi_transfer offload_xfer; > + struct spi_message offload_msg; > const struct ad7768_chip_info *chip; > bool en_spi_sync; > + bool offload_en; offload_en makes it sound like the offload could be enabled or disabled at runtime, but that doesn't seem to be the case. I would just check if offload != NULL rather than add a new field. Or change this to has_offload. > struct mutex pga_lock; /* protect device internal state (PGA) */ > /* > * DMA (thus cache coherency maintenance) may require the > @@ -1139,6 +1161,10 @@ static int ad7768_get_current_scan_type(const struct iio_dev *indio_dev, > { > struct ad7768_state *st = iio_priv(indio_dev); > > + if (st->offload_en) > + return st->oversampling_ratio == 8 ? > + AD7768_SCAN_TYPE_OFFLOAD_HIGH_SPEED : AD7768_SCAN_TYPE_OFFLOAD_NORMAL; > + > return st->oversampling_ratio == 8 ? > AD7768_SCAN_TYPE_HIGH_SPEED : AD7768_SCAN_TYPE_NORMAL; > } > @@ -1320,7 +1346,7 @@ static irqreturn_t ad7768_interrupt(int irq, void *dev_id) > struct iio_dev *indio_dev = dev_id; > struct ad7768_state *st = iio_priv(indio_dev); > > - if (iio_buffer_enabled(indio_dev)) > + if (iio_buffer_enabled(indio_dev) && !st->offload_en) I would expect that the interrupt is just disabled when doing a buffered read with SPI offload. No sense in wasting CPU time. So no special handling should be needed here. > iio_trigger_poll(st->trig); > else > complete(&st->completion); > @@ -1357,6 +1383,72 @@ static const struct iio_buffer_setup_ops ad7768_buffer_ops = { > .predisable = &ad7768_buffer_predisable, > }; > > +static int ad7768_offload_buffer_postenable(struct iio_dev *indio_dev) > +{ > + struct ad7768_state *st = iio_priv(indio_dev); > + struct spi_offload_trigger_config config = { > + .type = SPI_OFFLOAD_TRIGGER_DATA_READY, > + }; > + const struct iio_scan_type *scan_type; > + int ret; > + > + scan_type = iio_get_current_scan_type(indio_dev, &indio_dev->channels[0]); > + if (IS_ERR(scan_type)) > + return PTR_ERR(scan_type); > + > + st->offload_xfer.len = roundup_pow_of_two(BITS_TO_BYTES(scan_type->realbits)); We have spi_bpw_to_bytes() for this. > + st->offload_xfer.bits_per_word = scan_type->realbits; > + st->offload_xfer.offload_flags = SPI_OFFLOAD_XFER_RX_STREAM; > + > + /* > + * Write a 1 to the LSB of the INTERFACE_FORMAT register to enter > + * continuous read mode. Subsequent data reads do not require an > + * initial 8-bit write to query the ADC_DATA register. > + */ > + ret = regmap_write(st->regmap, AD7768_REG_INTERFACE_FORMAT, 0x01); > + if (ret) > + return ret; > + > + spi_message_init_with_transfers(&st->offload_msg, &st->offload_xfer, 1); > + st->offload_msg.offload = st->offload; > + > + ret = spi_optimize_message(st->spi, &st->offload_msg); > + if (ret) { > + dev_err(&st->spi->dev, "failed to prepare offload, err: %d\n", ret); Do we need to do someting to undo AD7768_REG_INTERFACE_FORMAT write if this fails? > + return ret; > + } > + > + ret = spi_offload_trigger_enable(st->offload, > + st->offload_trigger, > + &config); > + if (ret) { > + spi_unoptimize_message(&st->offload_msg); > + return ret; > + } > + > + return 0; > +} > + ... > +static bool ad7768_offload_trigger_match(struct spi_offload_trigger *trigger, > + enum spi_offload_trigger_type type, > + u64 *args, u32 nargs) > +{ > + if (type != SPI_OFFLOAD_TRIGGER_DATA_READY) > + return false; > + > + /* Requires 1 arg to indicate the trigger output signal */ The DT bindings allow 1 or 2 args, so we should also allow nargs == 2 even (the 2nd arg is just ignored). > + if (nargs != 1 || args[0] != AD7768_TRIGGER_SOURCE_DRDY) > + return false; > + > + return true; > +} > + > +static int ad7768_offload_trigger_request(struct spi_offload_trigger *trigger, > + enum spi_offload_trigger_type type, > + u64 *args, u32 nargs) > +{ > + /* Should already be validated by match, but just in case. */ > + if (nargs != 1) As above. > + return -EINVAL; > + > + return 0; > +} > + ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] iio: adc: ad7768-1: add support for SPI offload 2026-02-01 1:35 ` [PATCH 3/3] iio: adc: ad7768-1: add support for SPI offload Jonathan Santos 2026-02-04 14:09 ` Andy Shevchenko 2026-02-04 15:38 ` David Lechner @ 2026-02-05 5:42 ` kernel test robot 2026-02-05 6:03 ` Dan Carpenter 2026-02-05 6:44 ` kernel test robot 4 siblings, 0 replies; 14+ messages in thread From: kernel test robot @ 2026-02-05 5:42 UTC (permalink / raw) To: Jonathan Santos, linux-iio, linux-kernel Cc: oe-kbuild-all, Jonathan Santos, Michael.Hennerich, lars, jic23, dlechner, nuno.sa, andy Hi Jonathan, kernel test robot noticed the following build warnings: [auto build test WARNING on d820183f371d9aa8517a1cd21fe6edacf0f94b7f] url: https://github.com/intel-lab-lkp/linux/commits/Jonathan-Santos/iio-adc-ad7768-1-fix-one-shot-mode-data-acquisition/20260204-203950 base: d820183f371d9aa8517a1cd21fe6edacf0f94b7f patch link: https://lore.kernel.org/r/9f9aedbe374461e48f1f1e64d5487b5b6c1fc992.1769889074.git.Jonathan.Santos%40analog.com patch subject: [PATCH 3/3] iio: adc: ad7768-1: add support for SPI offload config: x86_64-randconfig-001-20260205 (https://download.01.org/0day-ci/archive/20260205/202602051328.Qsu5tg2C-lkp@intel.com/config) compiler: gcc-12 (Debian 12.4.0-5) 12.4.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260205/202602051328.Qsu5tg2C-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202602051328.Qsu5tg2C-lkp@intel.com/ All warnings (new ones prefixed by >>, old ones prefixed by <<): >> WARNING: modpost: module ad7768-1 uses symbol devm_iio_dmaengine_buffer_setup_with_handle from namespace IIO_DMAENGINE_BUFFER, but does not import it. -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] iio: adc: ad7768-1: add support for SPI offload 2026-02-01 1:35 ` [PATCH 3/3] iio: adc: ad7768-1: add support for SPI offload Jonathan Santos ` (2 preceding siblings ...) 2026-02-05 5:42 ` kernel test robot @ 2026-02-05 6:03 ` Dan Carpenter 2026-02-05 6:44 ` kernel test robot 4 siblings, 0 replies; 14+ messages in thread From: Dan Carpenter @ 2026-02-05 6:03 UTC (permalink / raw) To: oe-kbuild, Jonathan Santos, linux-iio, linux-kernel Cc: lkp, oe-kbuild-all, Jonathan Santos, Michael.Hennerich, lars, jic23, dlechner, nuno.sa, andy Hi Jonathan, kernel test robot noticed the following build warnings: url: https://github.com/intel-lab-lkp/linux/commits/Jonathan-Santos/iio-adc-ad7768-1-fix-one-shot-mode-data-acquisition/20260204-203950 base: d820183f371d9aa8517a1cd21fe6edacf0f94b7f patch link: https://lore.kernel.org/r/9f9aedbe374461e48f1f1e64d5487b5b6c1fc992.1769889074.git.Jonathan.Santos%40analog.com patch subject: [PATCH 3/3] iio: adc: ad7768-1: add support for SPI offload config: x86_64-randconfig-161-20260205 (https://download.01.org/0day-ci/archive/20260205/202602051234.5gArzLyZ-lkp@intel.com/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 smatch version: v0.5.0-8994-gd50c5a4c If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org> | Closes: https://lore.kernel.org/r/202602051234.5gArzLyZ-lkp@intel.com/ New smatch warnings: drivers/iio/adc/ad7768-1.c:1789 ad7768_spi_offload_probe() warn: passing zero to 'PTR_ERR' vim +/PTR_ERR +1789 drivers/iio/adc/ad7768-1.c 0cac6d2893a658 Jonathan Santos 2026-01-31 1758 static int ad7768_spi_offload_probe(struct iio_dev *indio_dev, 0cac6d2893a658 Jonathan Santos 2026-01-31 1759 struct ad7768_state *st) 0cac6d2893a658 Jonathan Santos 2026-01-31 1760 { 0cac6d2893a658 Jonathan Santos 2026-01-31 1761 struct device *dev = &st->spi->dev; 0cac6d2893a658 Jonathan Santos 2026-01-31 1762 struct spi_offload_trigger_info trigger_info = { 0cac6d2893a658 Jonathan Santos 2026-01-31 1763 .fwnode = dev_fwnode(dev), 0cac6d2893a658 Jonathan Santos 2026-01-31 1764 .ops = &ad7768_offload_trigger_ops, 0cac6d2893a658 Jonathan Santos 2026-01-31 1765 .priv = st, 0cac6d2893a658 Jonathan Santos 2026-01-31 1766 }; 0cac6d2893a658 Jonathan Santos 2026-01-31 1767 struct dma_chan *rx_dma; 0cac6d2893a658 Jonathan Santos 2026-01-31 1768 int ret; 0cac6d2893a658 Jonathan Santos 2026-01-31 1769 0cac6d2893a658 Jonathan Santos 2026-01-31 1770 ret = devm_spi_offload_trigger_register(dev, &trigger_info); 0cac6d2893a658 Jonathan Santos 2026-01-31 1771 if (ret) 0cac6d2893a658 Jonathan Santos 2026-01-31 1772 return dev_err_probe(dev, ret, 0cac6d2893a658 Jonathan Santos 2026-01-31 1773 "failed to register offload trigger\n"); 0cac6d2893a658 Jonathan Santos 2026-01-31 1774 0cac6d2893a658 Jonathan Santos 2026-01-31 1775 st->offload_trigger = devm_spi_offload_trigger_get(dev, st->offload, 0cac6d2893a658 Jonathan Santos 2026-01-31 1776 SPI_OFFLOAD_TRIGGER_DATA_READY); 0cac6d2893a658 Jonathan Santos 2026-01-31 1777 if (IS_ERR(st->offload_trigger)) 0cac6d2893a658 Jonathan Santos 2026-01-31 1778 return dev_err_probe(dev, PTR_ERR(st->offload_trigger), 0cac6d2893a658 Jonathan Santos 2026-01-31 1779 "failed to get offload trigger\n"); 0cac6d2893a658 Jonathan Santos 2026-01-31 1780 0cac6d2893a658 Jonathan Santos 2026-01-31 1781 rx_dma = devm_spi_offload_rx_stream_request_dma_chan(dev, st->offload); 0cac6d2893a658 Jonathan Santos 2026-01-31 1782 if (IS_ERR(rx_dma)) 0cac6d2893a658 Jonathan Santos 2026-01-31 1783 return dev_err_probe(dev, PTR_ERR(rx_dma), 0cac6d2893a658 Jonathan Santos 2026-01-31 1784 "failed to get offload RX DMA\n"); 0cac6d2893a658 Jonathan Santos 2026-01-31 1785 0cac6d2893a658 Jonathan Santos 2026-01-31 1786 ret = devm_iio_dmaengine_buffer_setup_with_handle(dev, indio_dev, 0cac6d2893a658 Jonathan Santos 2026-01-31 1787 rx_dma, IIO_BUFFER_DIRECTION_IN); 0cac6d2893a658 Jonathan Santos 2026-01-31 1788 if (ret) 0cac6d2893a658 Jonathan Santos 2026-01-31 @1789 return dev_err_probe(dev, PTR_ERR(rx_dma), s/PTR_ERR(rx_dma)/ret/ 0cac6d2893a658 Jonathan Santos 2026-01-31 1790 "failed to setup offload RX DMA\n"); 0cac6d2893a658 Jonathan Santos 2026-01-31 1791 0cac6d2893a658 Jonathan Santos 2026-01-31 1792 indio_dev->setup_ops = &ad7768_offload_buffer_ops; 0cac6d2893a658 Jonathan Santos 2026-01-31 1793 st->offload_en = true; 0cac6d2893a658 Jonathan Santos 2026-01-31 1794 0cac6d2893a658 Jonathan Santos 2026-01-31 1795 return 0; 0cac6d2893a658 Jonathan Santos 2026-01-31 1796 } -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] iio: adc: ad7768-1: add support for SPI offload 2026-02-01 1:35 ` [PATCH 3/3] iio: adc: ad7768-1: add support for SPI offload Jonathan Santos ` (3 preceding siblings ...) 2026-02-05 6:03 ` Dan Carpenter @ 2026-02-05 6:44 ` kernel test robot 4 siblings, 0 replies; 14+ messages in thread From: kernel test robot @ 2026-02-05 6:44 UTC (permalink / raw) To: Jonathan Santos, linux-iio, linux-kernel Cc: oe-kbuild-all, Jonathan Santos, Michael.Hennerich, lars, jic23, dlechner, nuno.sa, andy Hi Jonathan, kernel test robot noticed the following build errors: [auto build test ERROR on d820183f371d9aa8517a1cd21fe6edacf0f94b7f] url: https://github.com/intel-lab-lkp/linux/commits/Jonathan-Santos/iio-adc-ad7768-1-fix-one-shot-mode-data-acquisition/20260204-203950 base: d820183f371d9aa8517a1cd21fe6edacf0f94b7f patch link: https://lore.kernel.org/r/9f9aedbe374461e48f1f1e64d5487b5b6c1fc992.1769889074.git.Jonathan.Santos%40analog.com patch subject: [PATCH 3/3] iio: adc: ad7768-1: add support for SPI offload config: i386-randconfig-054-20260205 (https://download.01.org/0day-ci/archive/20260205/202602051436.PfHU6nPa-lkp@intel.com/config) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260205/202602051436.PfHU6nPa-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202602051436.PfHU6nPa-lkp@intel.com/ All errors (new ones prefixed by >>, old ones prefixed by <<): >> ERROR: modpost: module ad7768-1 uses symbol devm_iio_dmaengine_buffer_setup_with_handle from namespace IIO_DMAENGINE_BUFFER, but does not import it. -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-02-14 14:47 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-02-01 1:35 [PATCH 0/3] iio: adc: ad7768-1: add support for SPI offload Jonathan Santos 2026-02-01 1:35 ` [PATCH 1/3] iio: adc: ad7768-1: fix one-shot mode data acquisition Jonathan Santos 2026-02-07 16:48 ` Jonathan Cameron 2026-02-09 21:38 ` Jonathan Santos 2026-02-14 14:47 ` Jonathan Cameron 2026-02-01 1:35 ` [PATCH 2/3] iio: adc: ad7768-1: prevent one-shot mode with wideband filter Jonathan Santos 2026-02-04 16:11 ` Nuno Sá 2026-02-02 22:41 ` Jonathan Santos 2026-02-01 1:35 ` [PATCH 3/3] iio: adc: ad7768-1: add support for SPI offload Jonathan Santos 2026-02-04 14:09 ` Andy Shevchenko 2026-02-04 15:38 ` David Lechner 2026-02-05 5:42 ` kernel test robot 2026-02-05 6:03 ` Dan Carpenter 2026-02-05 6:44 ` kernel test robot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox