Re: [PATCH 12/13] iio: offload: add new PWM triggered DMA buffer driver

From: Nuno Sá
Date: Thu Jan 11 2024 - 04:28:19 EST


On Wed, 2024-01-10 at 13:49 -0600, David Lechner wrote:
> This adds a new driver for handling SPI offloading using a PWM as the
> trigger and DMA for the received data. This will be used by ADCs in
> conjunction with SPI controllers with offloading support to be able
> to sample at high rates without CPU intervention.
>
> Signed-off-by: David Lechner <dlechner@xxxxxxxxxxxx>
> ---
>  drivers/iio/Kconfig                                |   1 +
>  drivers/iio/Makefile                               |   1 +
>  .../iio/buffer/industrialio-hw-triggered-buffer.c  |   1 +
>  drivers/iio/offload/Kconfig                        |  21 ++
>  drivers/iio/offload/Makefile                       |   2 +
>  drivers/iio/offload/iio-pwm-triggered-dma-buffer.c | 212
> +++++++++++++++++++++
>  6 files changed, 238 insertions(+)
>
> diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig
> index 52eb46ef84c1..56738282d82f 100644
> --- a/drivers/iio/Kconfig
> +++ b/drivers/iio/Kconfig
> @@ -90,6 +90,7 @@ source "drivers/iio/imu/Kconfig"
>  source "drivers/iio/light/Kconfig"
>  source "drivers/iio/magnetometer/Kconfig"
>  source "drivers/iio/multiplexer/Kconfig"
> +source "drivers/iio/offload/Kconfig"

The offload stuff is something very particular to a spi controller feature. Not
sure if having this as a generic thing makes sense at this point.

IMO, the IIO way of looking at the offload engine is as an HW triggered core for
capturing data. Hence, I would support the whole thing as an HW triggered
buffer. And, if we are really going the path of having the offload core as a
platform device, we could have different compatibles for each pair of trigger +
data_capture (or explicit dt properties).

Just my 2 cents...

- Nuno Sá