Re: [PATCH v2 09/10] iio: adc: ad7606: Add iio-backend support

Jonathan Cameron
2024-09-29T12:54:29Z

On Fri, 20 Sep 2024 17:33:29 +0000
Guillaume Stols <gstols@baylibre.com> wrote:

> - Basic support for iio backend.
> - Supports IIO_CHAN_INFO_SAMP_FREQ R/W.
> - Only hardware mode is available, and that IIO_CHAN_INFO_RAW is not
> supported if iio-backend mode is selected.
>
> Signed-off-by: Guillaume Stols <gstols@baylibre.com>
One trivial comment to add to what David covered.
I'm also curious now on what the limitation is that meant we didn't
support the AD7606B with parallel interface before, and what stops us
supporting other devices with the backend IP? Is there a fundamental difference?
> ---
> drivers/iio/adc/Kconfig | 2 +
> drivers/iio/adc/ad7606.c | 94 +++++++++++++++++++++++++++++++++++++-------
> drivers/iio/adc/ad7606.h | 15 +++++++
> drivers/iio/adc/ad7606_par.c | 91 ++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 187 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> index 4ab1a3092d88..9b52d5b2c592 100644
> --- a/drivers/iio/adc/Kconfig
> +++ b/drivers/iio/adc/Kconfig
> @@ -224,9 +224,11 @@ config AD7606_IFACE_PARALLEL
> tristate "Analog Devices AD7606 ADC driver with parallel interface support"
> depends on HAS_IOPORT
> select AD7606
> + select IIO_BACKEND
> help
> Say yes here to build parallel interface support for Analog Devices:
> ad7605-4, ad7606, ad7606-6, ad7606-4 analog to digital converters (ADC).
> + It also support iio_backended devices for AD7606B.

But not for other devices? Is the expectation that they will need
a different IP for the backend, or just a case of not tested yet?

>
> To compile this driver as a module, choose M here: the
> module will be called ad7606_par.

> +
> +static int ad7606_update_scan_mode(struct iio_dev *indio_dev,
> + const unsigned long *scan_mask)
> +{
> + struct ad7606_state *st = iio_priv(indio_dev);
> +
> + /* The update scan mode is only for iio backend compatible drivers.
/*
* The update...

> + * If the specific update_scan_mode is not defined in the bus ops,
> + * just do nothing and return 0.
> + */
> + if (st->bops->update_scan_mode)
> + return st->bops->update_scan_mode(indio_dev, scan_mask);
> + else
> + return 0;
> +}
> +