Re: [PATCH v8 07/11] iio: adc: ad7768-1: add multiple scan types to support 16-bits mode

From: Andy Shevchenko
Date: Fri May 16 2025 - 05:25:04 EST


On Thu, May 15, 2025 at 06:13:43PM -0300, Jonathan Santos wrote:
> When the device is configured to decimation x8, only possible in the
> sinc5 filter, output data is reduced to 16-bits in order to support
> 1 MHz of sampling frequency due to clock limitation.
>
> Use multiple scan types feature to enable the driver to switch
> scan type at runtime, making it possible to support both 24-bit and
> 16-bit resolution.

...

> +static int ad7768_get_current_scan_type(const struct iio_dev *indio_dev,
> + const struct iio_chan_spec *chan)
> +{
> + struct ad7768_state *st = iio_priv(indio_dev);
> +
> + return st->dec_rate == 8 ? AD7768_SCAN_TYPE_HIGH_SPEED :
> + AD7768_SCAN_TYPE_NORMAL;

Besides issues with the indentation, the logical split seems to me better:

return st->dec_rate == 8 ?
AD7768_SCAN_TYPE_HIGH_SPEED : AD7768_SCAN_TYPE_NORMAL;

> +}

But no need to resend just for this. Perhaps Jonathan can update.

--
With Best Regards,
Andy Shevchenko