Re: [PATCH RFC v6 10/10] iio: adc: ad7380: add support for resolution boost

From: David Lechner
Date: Mon May 06 2024 - 17:45:31 EST


On Wed, May 1, 2024 at 9:56 AM Julien Stephan <jstephan@xxxxxxxxxxxx> wrote:
>

..

>
> +static int ad7380_prepare_spi_xfer(struct ad7380_state *st, struct spi_transfer *xfer)
> +{
> + int bits_per_word;
> +
> + memset(xfer, 0, sizeof(*xfer));
> +
> + xfer->rx_buf = &st->scan_data.raw;
> +
> + if (st->resolution_boost_enable == RESOLUTION_BOOST_ENABLE)
> + bits_per_word = st->chip_info->channels[0].scan_type.realbits;
> + else
> + bits_per_word = st->chip_info->channels[0].scan_type.realbits - 2;
> +
> + xfer->bits_per_word = bits_per_word;
> +
> + xfer->len = (st->chip_info->num_channels - 1) * BITS_TO_BYTES(bits_per_word);

This needs to be based on storagebits, not realbits.

> +
> + return bits_per_word;
> +}
> +