Re: [RFC] iio: adc: support for multi-device aggregation

From: David Lechner

Date: Wed May 27 2026 - 01:30:03 EST


On Wed, May 27, 2026 at 3:50 AM Jonathan Santos <jonath4nns@xxxxxxxxx> wrote:
>
...
> We had a 'hack' in the HDL where we tied the CS pins to activate them at
> the same time, but since we are aiming to handle each device indually it
> would be nice to at least enable all CS defined in the devicetree. It is
> strange that we can define up to 8 CS for one device, but the spi-engine
> only selects the first one.

When I did the multi-data-lane SPI work, it was only for the multi-SDI
case, not multi-SDO, so that didn't get implemented yet. We would need
to extend the core SPI API to handle this new case and then implement
that in the AXI SPI Engine driver.

>
> > For this type of SPI controller where it can read multiple data
> > channels at the same time, the .dts should look like this:
> >
> > spi {
> > #address-cells = <1>;
> > #size-cells = <0>;
> >
> > adc@0 {
> > compatible = "adi,adaq7768-1";
> > reg = <0>, <1>, <2>, <3>;
> >
> > spi-rx-bus-width = <1>, <1>, <1>, <1>;
> >
> > /* other properties */
> > };
> > };
> >
> > The reg property is the 4 CS lines and spi-rx-bus-width having 4 items means
> > that the controller has four SDI lines (the value <1> could be different if
> > each data channel/device was dual or quad SPI).
> >
> > This goes along with what jic23 suggested about making it similar to
> > what we do with daisy-chaining.
> >
>
> Since last week I have been testing the approach you and jonathan suggested,
> handling the multiple device support within the driver and using the multiple
> data lane. Additionally, I have included the ancillary device to manage
> the devices individually when required (and to make it easier to write
> and read using regmap), but some other problems came up:
>
> * When addressing the devices/channels individually, I would like to
> select only the respective SDI lane on each transfer, but with the
> ancillary interface there's no way to define a rx lane mapping.
>
> e.g: If we want to read a register from the device 2 (index 1), the
> ideal scenario is to activate only the SDI1, so the controller writes
> the right value into the read buffer. Without this mapping, we get
> the trash from the lane SDI0.
>
> can we add some new parameter to set the rx/tx lane mapping in the
> devm_spi_new_ancillary_device()?

I don't think we should be using devm_spi_new_ancillary_device() here,
but rather add more to struct spi_transfer to allow selecting a
specific CS line in the multi-data-lane case.

>
> * This driver registers a regulator and a GPIO provider associated with
> the main SPI device. Can we register them for each ancillary device too
> or this is not allowed? I am still confused on how to handle this kind
> of situation.
>