Re: [PATCH v6 07/12] iio: adc: ad4170: Add support for buffered data capture
From: Jonathan Cameron
Date: Sun Jun 22 2025 - 10:18:38 EST
On Wed, 18 Jun 2025 14:37:30 -0300
Marcelo Schmitt <marcelo.schmitt@xxxxxxxxxx> wrote:
> Extend the AD4170 driver to allow buffered data capture in continuous read
> mode. In continuous read mode, the chip skips the instruction phase and
> outputs just ADC sample data, enabling faster sample rates to be reached.
> The internal channel sequencer always starts sampling from channel 0 and
> channel 0 must be enabled if more than one channel is selected for data
> capture. The scan mask validation callback checks if the aforementioned
> condition is met.
>
> Signed-off-by: Marcelo Schmitt <marcelo.schmitt@xxxxxxxxxx>
Hi Marcelo,
One trivial thing below.
> diff --git a/drivers/iio/adc/ad4170.c b/drivers/iio/adc/ad4170.c
> index b229a24b40de..2acd4316b079 100644
> --- a/drivers/iio/adc/ad4170.c
> +++ b/drivers/iio/adc/ad4170.c
>
> +static int ad4170_trigger_setup(struct iio_dev *indio_dev)
> +{
> + struct ad4170_state *st = iio_priv(indio_dev);
> + struct device *dev = &st->spi->dev;
> + int ret;
> +
> + st->trig = devm_iio_trigger_alloc(dev, "%s-trig%d",
> + indio_dev->name,
> + iio_device_id(indio_dev));
> + if (!st->trig)
> + return -ENOMEM;
> +
> + st->trig->ops = &ad4170_trigger_ops;
> + st->trig->dev.parent = dev;
devm_iio_tigger_alloc() already set this via viio_trigger_alloc()
https://elixir.bootlin.com/linux/v6.15.3/source/drivers/iio/industrialio-trigger.c#L564
> +
> + iio_trigger_set_drvdata(st->trig, indio_dev);
> + ret = devm_iio_trigger_register(dev, st->trig);
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to register trigger\n");
> +
> + indio_dev->trig = iio_trigger_get(st->trig);
> +
> + return 0;
> +}