Re: [PATCH v2 15/16] iio: adc: ad7768-1: add filter type and oversampling ratio attributes

From: Jonathan Cameron
Date: Thu Jan 30 2025 - 11:39:55 EST


On Mon, 27 Jan 2025 12:14:19 -0300
Jonathan Santos <Jonathan.Santos@xxxxxxxxxx> wrote:

> Separate filter type and decimation rate from the sampling frequency
> attribute. The new filter type attribute enables SINC3 and WIDEBAND
> filters, which were previously unavailable.
>
> Previously, combining decimation and MCLK divider in the sampling
> frequency obscured performance trade-offs. Lower MCLK divider
> settings increase power usage, while lower decimation rates reduce
> precision by decreasing averaging. By creating an oversampling
> attribute, which controls the decimation, users gain finer control
> over performance.
>
> The addition of those attributes allows a wider range of sampling
> frequencies and more access to the device features.
>
> Co-developed-by: PopPaul2021 <paul.pop@xxxxxxxxxx>
> Signed-off-by: PopPaul2021 <paul.pop@xxxxxxxxxx>
> Signed-off-by: Jonathan Santos <Jonathan.Santos@xxxxxxxxxx>
On trivial thing I noticed.

> @@ -745,6 +1000,12 @@ static int ad7768_setup(struct iio_dev *indio_dev)
> return ret;
> }
>
> + /*
> + * Set Default Digital Filter configuration:
> + * SINC5 filter with x32 Decimation rate
> + */
> + ret = ad7768_configure_dig_fil(indio_dev, SINC5, 32);
Check ret?
> +
> /* Set the default sampling frequency to 32000 kSPS */
> return ad7768_set_freq(st, 32000);
> }