Re: [PATCH v1 0/3] iio: adc: Add AD4134 minimum I/O support

Marcelo Schmitt
2025-11-10T15:41:52Z

Hi Andy,

On 11/10, Andy Shevchenko wrote:
> On Mon, Nov 10, 2025 at 09:44:56AM -0300, Marcelo Schmitt wrote:
> > This patch series adds basic support for ad4134. AD4134 is a very flexible
> > device that can be configured in many different ways. This series aims to
> > support the simplest way of interfacing with AD4134 which is called minimum I/O
> > mode in data sheet. This is essentially usual SPI with the addition of an ODR
> > (Output Data Rate) GPIO which functions as conversion start signal in minimum
> > I/O mode. The CS pin may be connected to a host controller CS pin or grounded.
> >
> > This set provides just one feature:
> > - Single-shot ADC sample read.
> >
> > [PATCH 1] Device tree documentation for AD4134.
> > [PATCH 2] IIO Linux driver for AD4134.
> > [PATCH 3] Initial IIO documentation.
> >
> > There is a driver by Cosmin on ADI Linux tree that supports AD4134 in wiring
> > configurations suited for high speed data transfers. Even though the minimum I/O
> > support was initialy based on that high speed transfer driver, the result ended
> > up becoming entirely different. Also, because the different wiring
> > configurations are likely going to use different resources and software
> > interfaces, the code for AD4134 support was split into ad4134-spi.c,
> > ad4134-common.h, and ad4134-common.c.
>
> The cover letter misses the answer to: "Why do we need a brand new driver?
> Don't we have anything similar already in IIO that can be expanded to cover
> this one?"

Ah sorry about that, let me provide more context.

ADI has a design called AD4134 which people would like to use with Linux.
This is another fast sample rate ADC that would need SPI offload support to
reach maximum sample rate. The driver I mentioned above provides support for the
SPI offload use case but, it has not been reviewed nor merged to mainline Linux
(at least as far as I'm aware of). I also searched the lore and found no
previous matches for ad4134. So, we currently have no driver supporting AD4134
on mainline Linux.

Why not just upstreaming the SPI offload support driver for AD4134? To achieve
the highest sample rates, the AD4134 provides a dedicated set of lines (DOUT0 to
DOUT3) to output ADC sample data. We would need to describe and manage an
additional bus this part (an SPI bus for configuration, and a data bus to read
ADC conversions). In ADI tree + HDL, the data bus is read through SPI-Engine
as usual SPI data and a second SPI controller interface is used for normal SPI
commands. The setup actually uses two AD4134 devices and is more or less like
the diagram below.

::

+-------------+
+----------------------+ | DATA HOST |
| AD4134 | | (SPI-ENGINE)|
| | | |
|Data interface DOUT0 |----------------------------------->| GPI0 |
|for ADC data DOUT1 |----------------------------------->| GPI1 |
|read back DOUT2 |----------------------------------->| GPI2 |
| DOUT3 |----------------------------------->| GPI3 |
| DCLK |<--------------+ +---------->| GPI4 |
| ODR |<------------+ | | +-------->| GPI5 |
| | | | | | +------>| GPI6 |
| | | | | | | +---->| GPI7 |
| SPI interface CS |<-------+ | +--------|-|-|-|-+---| DCLK |
| for register SCLK |<-----+ | | | | | | | | |
| access SDI |<---+ | | | | | | | | | TRIGGER |
| SDO |--+ | | | | | | | | | +-------------+
+----------------------+ | | | | +----------|-|-|-|-|-+ ^
| | | | | | | | | | |
+----------------------+ | | | | +-----------+ | | | | | | +---+
| AD4134 | | | | | | HOST | | | | | | | |
| | | | | | |(ZED PS SPI) | | | | | | | +------------+
| SPI interface CS |<-|-|-|-+-| CS | | | | | | | | | PULSE |
| for register SCLK |<-|-|-+---| SCLK | | | | | | | | | GENERATOR |
| access SDI |<-|-+-----| MOSI | | | | | | | | |(AXI PWM GEN)
| SDO |--+------>| MISO | | | | | | | | | |
| | +-----------+ | | | | | | +--| OUT0 |
| | | | | | | +----| OUT1 |
|Data interface DOUT0 |------------------------+ | | | | | +------------+
|for ADC data DOUT1 |--------------------------+ | | | |
|read back DOUT2 |----------------------------+ | | |
| DOUT3 |------------------------------+ | |
| DCLK |<-------------------------------+ |
| ODR |<---------------------------------+
+----------------------+

Luckily, for handling the dedicated data bus, we might benefit from the multi-bus
support [1] in the future. Though, the high speed setup has other implied
intricacies such as an additional periodic signal (ODR) being required to sample
data in addition to DCLK.

[1]: https://lore.kernel.org/linux-iio/20251107-spi-add-multi-bus-support-v2-0-8a92693314d9@baylibre.com/

Although we got that working on ADI tree, there are some aspects of the high
speed driver that could be improved before upstreaming, IMHO.
So, to start with something less overwhelming, I thought of trying the minimum
I/O mode first (a.k.a. usual SPI interface). Note that the -common parts of the
driver are intended to be reusable by the high speed driver when we get to
upstreaming that. Also, by the way, that high speed driver doesn't support
minimum I/O mode and the intent is that the drivers will provide complementary
ways of interfacing with AD4134.

With best regards,
Marcelo