Re: [PATCH RFC v4 13/15] iio: adc: ad7944: add support for SPI offload

From: Jonathan Cameron
Date: Sat Oct 26 2024 - 11:52:53 EST


On Wed, 23 Oct 2024 15:59:20 -0500
David Lechner <dlechner@xxxxxxxxxxxx> wrote:

> This adds support for SPI offload to the ad7944 driver. This allows
> reading data at the max sample rate of 2.5 MSPS.
>
> Signed-off-by: David Lechner <dlechner@xxxxxxxxxxxx>
> ---
>
> static int ad7944_probe(struct spi_device *spi)
> {
> const struct ad7944_chip_info *chip_info;
> @@ -590,20 +743,75 @@ static int ad7944_probe(struct spi_device *spi)
> indio_dev->modes = INDIO_DIRECT_MODE;
> indio_dev->info = &ad7944_iio_info;
>
> - if (adc->spi_mode == AD7944_SPI_MODE_CHAIN) {
> - indio_dev->available_scan_masks = chain_scan_masks;
> - indio_dev->channels = chain_chan;
> - indio_dev->num_channels = n_chain_dev + 1;
> + adc->offload = devm_spi_offload_get(dev, spi, &ad7944_offload_config);
> + ret = PTR_ERR_OR_ZERO(adc->offload);
> + if (ret && ret != -ENODEV)
> + return dev_err_probe(dev, ret, "failed to get offload\n");
> +
> + if (ret == -ENODEV) {
> + dev_info(dev, "SPI offload not available\n");
Too noisy given this applies whenever this device is connected to a normal
SPI bus. Or an old DT is used.

> +
>
>