Re: [PATCH v4 9/9] iio: adc: ad7768-1: add support for multiple chip aggregation
From: Jonathan Cameron
Date: Sun Oct 25 2026 - 22:27:11 EST
On Tue, 20 Oct 2026 22:58:53 -0300
Jonathan Santos <Jonathan.Santos@xxxxxxxxxx> wrote:
> The AD7768-1 family is a single-channel ADC, but it is designed to allow
> connecting multiple devices to the same SPI controller, each on a
> dedicated CS and data lane, clocked synchronously, and sharing SDO and
> SCLK. The number of aggregated devices is derived from the number of
> CS.
This is confusing enough I'd like a very explicit spec reference
and perhaps even some asci art showing how the devices are wired.
I can see one diagram in the spec and that is less than clear.
>
> The DRDY pins are combined to trigger the data interrupt when all
> devices are ready, and since the synchronization pins are tied, they
> stay in synchrony.
>
> To reflect the multidevice setup, IIO channels are dynamically set
> based on the number of devices. Restrict buffered capture to the
> all-channels scan mask, since all devices sample in lockstep. Register
> an ancillary SPI device per lane for individual direct reads, and enable
> SPI_MULTI_LANE_MODE_STRIPE in offload mode to interleave samples from all
> lanes into the DMA stream.
>
> Since all devices must be in sync, all configurations that affect the
> sampling rate are unified, so they always have the same sampling
> frequency.
>
> Signed-off-by: Jonathan Santos <Jonathan.Santos@xxxxxxxxxx>
> ---
> Changes in v4:
> * Fixed the st->offload_xfer.len calculation to account for multiple
> devices.
> * The number of aggregated devices is now defined by the number of CS
> instead of number of lanes.
> * Used devm_bitmap_zalloc() and bitmap_set() for the masks allocation
> and definition, as requested.
>
> Changes in v3:
> * Modified channel mask allocation on ad7768_parse_aaf_gain() to get
> a static value, Since we assume the family is single channel. Added a
> comment explaining.
>
> Changes in v2:
> * New patch.