Re: [PATCH v8 8/8] iio: adc: ad4030: Support common-mode channels with SPI offloading
From: Andy Shevchenko
Date: Sun Feb 08 2026 - 09:03:09 EST
On Fri, Feb 06, 2026 at 04:02:42PM -0300, Marcelo Schmitt wrote:
> AD4030 and similar devices can read common-mode voltage together with
> ADC sample data. When enabled, common-mode voltage data is provided in a
> separate IIO channel since it measures something other than the primary
> ADC input signal and requires separate scaling to convert to voltage
> units. The initial SPI offload support patch for AD4030 only provided
> differential channels. Now, extend the AD4030 driver to also provide
> common-mode IIO channels when setup with SPI offloading capability.
...
> -#define AD4030_CHAN_CMO(_idx, _ch) { \
> +#define __AD4030_CHAN_CMO(_idx, _ch, _offload) { \
> .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
> BIT(IIO_CHAN_INFO_SCALE), \
> .type = IIO_VOLTAGE, \
> .scan_index = (_idx), \
> .scan_type = { \
> .sign = 'u', \
> - .storagebits = 8, \
> + .storagebits = (_offload ? 32 : 8), \
> .realbits = 8, \
> - .endianness = IIO_BE, \
> + .endianness = (_offload ? IIO_CPU : IIO_BE), \
Hmm... This is interesting. Does it mean it's designed like this for any
offloaded SPI case? Wouldn't be better to follow the same endianess in both?
> }, \
> }
--
With Best Regards,
Andy Shevchenko