[PATCH v3 00/12] iio: adc: ad7173: add SPI offload support

David Lechner posted 12 patches 3 months, 1 week ago
There is a newer version of this series
.../trigger-source/adi,util-sigma-delta-spi.yaml   |  49 ++++
MAINTAINERS                                        |   7 +-
drivers/iio/adc/ad7173.c                           |  13 +
drivers/iio/adc/ad_sigma_delta.c                   | 295 +++++++++++++--------
drivers/spi/Kconfig                                |   5 +
drivers/spi/Makefile                               |   1 +
.../spi/spi-offload-trigger-adi-util-sigma-delta.c |  62 +++++
include/linux/iio/adc/ad_sigma_delta.h             |  27 +-
8 files changed, 345 insertions(+), 114 deletions(-)
[PATCH v3 00/12] iio: adc: ad7173: add SPI offload support
Posted by David Lechner 3 months, 1 week ago
Here comes another series for adding SPI offload support to an ADC.

The primary target is AD411x, but since this uses the ad_sigma_delta
shared module, a lot of this series is focused on that.

To start with, we have some cleanups to the ad_sigma_delta code, so feel
free to pick these up as they are ready as they generally stand on their
own.

Then before adding proper SPI offload support, we make use of
spi_optimize_message() to reduce CPU usage of all users of this driver
during buffered reads.

Also there is a new dt-binding and driver for a special SPI offload
trigger FPGA IP core that is used in this particular setup.

Then finally actual SPI offload support is added to the ad_sigma_delta
module and the ad7173 driver.

This was tested using EVAL-AD4112ARDZ on a DE10-Nano.

---
Changes in v3:
- Added extra patch to replace 8 with sizeof(s64) in ALIGN() [4/12]
- Fixed typo in commit message. [6/12]
- Fixed includes in spi offload trigger driver. [10/12]
- Link to v2: https://lore.kernel.org/r/20250627-iio-adc-ad7173-add-spi-offload-support-v2-0-f49c55599113@baylibre.com

Changes in v2:
- New patch to fix overallocation of buffer size. [1/11]
- Also change int64_t to s64. [3/11]
- Fix typo in commit message. [4/11]
- Factor out scan_type to reduce line wraps. [4/11]
- New patch to clean up include more. [5/11]
- Duplicate comment about odd case of 24-bit data. [7/11]
- Fixed missing MODULE_IMPORT_NS() [10/11]
- Link to v1: https://lore.kernel.org/r/20250620-iio-adc-ad7173-add-spi-offload-support-v1-0-0766f6297430@baylibre.com

---
David Lechner (12):
      iio: adc: ad_sigma_delta: don't overallocate scan buffer
      iio: adc: ad_sigma_delta: sort includes
      iio: adc: ad_sigma_delta: use u8 instead of uint8_t
      iio: adc: ad_sigma_delta: use sizeof() in ALIGN()
      iio: adc: ad_sigma_delta: use BITS_TO_BYTES() macro
      iio: adc: ad_sigma_delta: audit included headers
      iio: adc: ad_sigma_delta: refactor setting read address
      iio: adc: ad_sigma_delta: use spi_optimize_message()
      dt-bindings: trigger-source: add ADI Util Sigma-Delta SPI
      spi: offload trigger: add ADI Util Sigma-Delta SPI driver
      iio: adc: ad_sigma_delta: add SPI offload support
      iio: adc: ad7173: add SPI offload support

 .../trigger-source/adi,util-sigma-delta-spi.yaml   |  49 ++++
 MAINTAINERS                                        |   7 +-
 drivers/iio/adc/ad7173.c                           |  13 +
 drivers/iio/adc/ad_sigma_delta.c                   | 295 +++++++++++++--------
 drivers/spi/Kconfig                                |   5 +
 drivers/spi/Makefile                               |   1 +
 .../spi/spi-offload-trigger-adi-util-sigma-delta.c |  62 +++++
 include/linux/iio/adc/ad_sigma_delta.h             |  27 +-
 8 files changed, 345 insertions(+), 114 deletions(-)
---
base-commit: d02f330b0c78bcf76643fbb7d3215a58b181f829
change-id: 20250620-iio-adc-ad7173-add-spi-offload-support-32a178b666a3

Best regards,
-- 
David Lechner <dlechner@baylibre.com>
Re: [PATCH v3 00/12] iio: adc: ad7173: add SPI offload support
Posted by Nuno Sá 3 months, 1 week ago
On Tue, 2025-07-01 at 16:37 -0500, David Lechner wrote:
> Here comes another series for adding SPI offload support to an ADC.
> 
> The primary target is AD411x, but since this uses the ad_sigma_delta
> shared module, a lot of this series is focused on that.
> 
> To start with, we have some cleanups to the ad_sigma_delta code, so feel
> free to pick these up as they are ready as they generally stand on their
> own.
> 
> Then before adding proper SPI offload support, we make use of
> spi_optimize_message() to reduce CPU usage of all users of this driver
> during buffered reads.
> 
> Also there is a new dt-binding and driver for a special SPI offload
> trigger FPGA IP core that is used in this particular setup.
> 
> Then finally actual SPI offload support is added to the ad_sigma_delta
> module and the ad7173 driver.
> 
> This was tested using EVAL-AD4112ARDZ on a DE10-Nano.
> 
> ---
> Changes in v3:
> - Added extra patch to replace 8 with sizeof(s64) in ALIGN() [4/12]
> - Fixed typo in commit message. [6/12]
> - Fixed includes in spi offload trigger driver. [10/12]
> - Link to v2:
> https://lore.kernel.org/r/20250627-iio-adc-ad7173-add-spi-offload-support-v2-0-f49c55599113@baylibre.com
> 
> Changes in v2:
> - New patch to fix overallocation of buffer size. [1/11]
> - Also change int64_t to s64. [3/11]
> - Fix typo in commit message. [4/11]
> - Factor out scan_type to reduce line wraps. [4/11]
> - New patch to clean up include more. [5/11]
> - Duplicate comment about odd case of 24-bit data. [7/11]
> - Fixed missing MODULE_IMPORT_NS() [10/11]
> - Link to v1:
> https://lore.kernel.org/r/20250620-iio-adc-ad7173-add-spi-offload-support-v1-0-0766f6297430@baylibre.com
> 
> ---

Hi David,

Great series. Small nit on the new trigger patch but not really important:

Reviewed-by: Nuno Sá <nuno.sa@analog.com>

> David Lechner (12):
>       iio: adc: ad_sigma_delta: don't overallocate scan buffer
>       iio: adc: ad_sigma_delta: sort includes
>       iio: adc: ad_sigma_delta: use u8 instead of uint8_t
>       iio: adc: ad_sigma_delta: use sizeof() in ALIGN()
>       iio: adc: ad_sigma_delta: use BITS_TO_BYTES() macro
>       iio: adc: ad_sigma_delta: audit included headers
>       iio: adc: ad_sigma_delta: refactor setting read address
>       iio: adc: ad_sigma_delta: use spi_optimize_message()
>       dt-bindings: trigger-source: add ADI Util Sigma-Delta SPI
>       spi: offload trigger: add ADI Util Sigma-Delta SPI driver
>       iio: adc: ad_sigma_delta: add SPI offload support
>       iio: adc: ad7173: add SPI offload support
> 
>  .../trigger-source/adi,util-sigma-delta-spi.yaml   |  49 ++++
>  MAINTAINERS                                        |   7 +-
>  drivers/iio/adc/ad7173.c                           |  13 +
>  drivers/iio/adc/ad_sigma_delta.c                   | 295 +++++++++++++-------
> -
>  drivers/spi/Kconfig                                |   5 +
>  drivers/spi/Makefile                               |   1 +
>  .../spi/spi-offload-trigger-adi-util-sigma-delta.c |  62 +++++
>  include/linux/iio/adc/ad_sigma_delta.h             |  27 +-
>  8 files changed, 345 insertions(+), 114 deletions(-)
> ---
> base-commit: d02f330b0c78bcf76643fbb7d3215a58b181f829
> change-id: 20250620-iio-adc-ad7173-add-spi-offload-support-32a178b666a3
> 
> Best regards,
Re: [PATCH v3 00/12] iio: adc: ad7173: add SPI offload support
Posted by Andy Shevchenko 3 months, 1 week ago
On Tue, Jul 01, 2025 at 04:37:48PM -0500, David Lechner wrote:
> Here comes another series for adding SPI offload support to an ADC.
> 
> The primary target is AD411x, but since this uses the ad_sigma_delta
> shared module, a lot of this series is focused on that.
> 
> To start with, we have some cleanups to the ad_sigma_delta code, so feel
> free to pick these up as they are ready as they generally stand on their
> own.
> 
> Then before adding proper SPI offload support, we make use of
> spi_optimize_message() to reduce CPU usage of all users of this driver
> during buffered reads.
> 
> Also there is a new dt-binding and driver for a special SPI offload
> trigger FPGA IP core that is used in this particular setup.
> 
> Then finally actual SPI offload support is added to the ad_sigma_delta
> module and the ad7173 driver.
> 
> This was tested using EVAL-AD4112ARDZ on a DE10-Nano.

This version LGTM,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v3 00/12] iio: adc: ad7173: add SPI offload support
Posted by Jonathan Cameron 3 months ago
On Wed, 2 Jul 2025 11:04:48 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Tue, Jul 01, 2025 at 04:37:48PM -0500, David Lechner wrote:
> > Here comes another series for adding SPI offload support to an ADC.
> > 
> > The primary target is AD411x, but since this uses the ad_sigma_delta
> > shared module, a lot of this series is focused on that.
> > 
> > To start with, we have some cleanups to the ad_sigma_delta code, so feel
> > free to pick these up as they are ready as they generally stand on their
> > own.
> > 
> > Then before adding proper SPI offload support, we make use of
> > spi_optimize_message() to reduce CPU usage of all users of this driver
> > during buffered reads.
> > 
> > Also there is a new dt-binding and driver for a special SPI offload
> > trigger FPGA IP core that is used in this particular setup.
> > 
> > Then finally actual SPI offload support is added to the ad_sigma_delta
> > module and the ad7173 driver.
> > 
> > This was tested using EVAL-AD4112ARDZ on a DE10-Nano.  
> 
> This version LGTM,
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 

Applied 1-7 and 11-12.  Mark picked up 8 and 9 from v2.

Thanks,

Jonathan
Re: [PATCH v3 00/12] iio: adc: ad7173: add SPI offload support
Posted by Jonathan Cameron 3 months ago
On Sun, 6 Jul 2025 11:04:17 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Wed, 2 Jul 2025 11:04:48 +0300
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > On Tue, Jul 01, 2025 at 04:37:48PM -0500, David Lechner wrote:
> > > Here comes another series for adding SPI offload support to an ADC.
> > > 
> > > The primary target is AD411x, but since this uses the ad_sigma_delta
> > > shared module, a lot of this series is focused on that.
> > > 
> > > To start with, we have some cleanups to the ad_sigma_delta code, so feel
> > > free to pick these up as they are ready as they generally stand on their
> > > own.
> > > 
> > > Then before adding proper SPI offload support, we make use of
> > > spi_optimize_message() to reduce CPU usage of all users of this driver
> > > during buffered reads.
> > > 
> > > Also there is a new dt-binding and driver for a special SPI offload
> > > trigger FPGA IP core that is used in this particular setup.
> > > 
> > > Then finally actual SPI offload support is added to the ad_sigma_delta
> > > module and the ad7173 driver.
> > > 
> > > This was tested using EVAL-AD4112ARDZ on a DE10-Nano.  
> > 
> > This version LGTM,
> > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > 
> 
> Applied 1-7 and 11-12.  Mark picked up 8 and 9 from v2.
1-8 and 11-12. 9 and 10 are now the ones that match with 8 and 9 that
Mark picked up. Oops.
> 
> Thanks,
> 
> Jonathan
> 
> 
>