mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Cc: Conor Dooley <conor@kernel.org>,
	Marcelo Schmitt <marcelo.schmitt@analog.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux@analog.com,
	nuno.sa@analog.com, dlechner@baylibre.com, andy@kernel.org,
	Michael.Hennerich@analog.com, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org, corbet@lwn.net,
	skhan@linuxfoundation.org
Subject: Re: [PATCH v1 08/13] dt-bindings: iio: adc: adi,ad4134: Document SPI connection mode
Date: Mon, 14 Sep 2026 01:34:33 +0100	[thread overview]
Message-ID: <20260914013433.0763e7f0@jic23-hlaptop> (raw)
In-Reply-To: <aqF4kfOCKcZhDZui@debian-BULLSEYE-live-builder-AMD64>

On Wed, 9 Sep 2026 12:17:37 -0300
Marcelo Schmitt <marcelo.schmitt1@gmail.com> wrote:

> On 09/06, Jonathan Cameron wrote:
> > On Fri, 4 Sep 2026 19:06:44 -0300
> > Marcelo Schmitt <marcelo.schmitt1@gmail.com> wrote:
> >   
> > > On 09/04, Marcelo Schmitt wrote:  
> > > > On 09/03, Conor Dooley wrote:    
> > > > > On Wed, Sep 02, 2026 at 02:24:02PM -0300, Marcelo Schmitt wrote:    
> > > > > > Document how AD4134 chips are connected to the host SPI controller
> > > > > > according to different wiring configurations.
> > > > > > 
> > > > > > Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
> > > > > > ---
> > > > > >  .../bindings/iio/adc/adi,ad4134.yaml          | 22 +++++++++++++++++++
> > > > > >  1 file changed, 22 insertions(+)
> > > > > > 
> > > > > > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad4134.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad4134.yaml
> > > > > > index ea6d7e026419..d843c02a394a 100644
> > > > > > --- a/Documentation/devicetree/bindings/iio/adc/adi,ad4134.yaml
> > > > > > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad4134.yaml
> > > > > > @@ -131,6 +131,28 @@ properties:
> > > > > >      enum: [ free-running, gated ]
> > > > > >      default: gated
> > > > > >  
> > > > > > +  adi,spi-mode:
> > > > > > +    $ref: /schemas/types.yaml#/definitions/string
> > > > > > +    enum: [ no-cs, 4-wire, one-channel-chain, two-channel-chain ]
> > > > > > +    description: |
> > > > > > +      This property indicates the SPI wiring configuration.
> > > > > > +
> > > > > > +      When this property is omitted, it is assumed that the device is using
> > > > > > +      'no-cs' wiring. When this property is present, it indicates that the
> > > > > > +      device is using one of the following wiring configurations:    
> > > > ...    
> > > > > I'd also really appreciate a dts example for a system
> > > > > with one-channel-chain or two-channel-chain looks, given the second
> > > > > device may require different supplies etc. I have no impression in my
> > > > > head of how the dt would be constructed, so I'd like to see wht you have
> > > > > in mind.    
> > > >     
> > > ...
> > > 
> > > Realized what I said doesn't make much sense. The peripherals can all have
> > > the same configuration and thus share CS, SCLK, and controller SDO. The wiring
> > > would be like the following  
> > 
> > That mux in the middle is controlled how?  
> 
> The mux is controlled by a GPIO. I ended up drawing the GPIO among SPI lines in the
> connection diagram but the mux controll signal is not part of the SPI controller.

Ok. So we are effectively making that mux part of of the ad4134 controlled hardware.
I guess I don't mind that but shout about it a lot in the driver as anyone coming
in will wonder where the magic mux appeared from :)

> 
> > I'd assume we still have separate chip selects and SDO/SDI shared. So I'd expect
> > those to be on one SPI bus and the data to be going into separate buses
> > (maybe all that can be hidden in the backend, not sure).
> > 
> > Or are you suggesting we are just letting all the chained devices see the
> > same register writes?  That might work I guess with no ability to read any register
> > state back other than for first device.  
> Correct, that's the proposed configuration for daisy-chaining. Since all
> peripherals will receive the same write commands they shall all retain the same
> register configurations (except maybe for error indication registers). Reading
> from the topmost device in the chain would be enough to figure out the status
> of the other chained devices.

It's errors that concern me about this.  Maybe it's the best we can do.
 
> 
> > If you want to do the
> > mux magic below you are going to need to treat it as an SPI mux - just with
> > some lines shared. That means this device ends up split into multiple device
> > (even if only one ad4134 which is messy).  
> You mean spi-mux.yaml/spi-mux.c? So the goal/intent would be to have one IIO
> device for each peripheral in the chain? I think that would also work. Though,
> the only device bringing ADC sample data is the topmost one so that would be
> the only one buffer capable.

We went through that discussion IIRC for the original chaining devices and it
ends up too odd as there is no way for userspace to know that we have this
strange interacting set of devices.

> 
> > 
> > So to me this has a simple SPI bus, potentially connected to multiple devices
> > and an IIO backend that deals with DOUT0 etc and the chaining.  
> Yeah, the benefit of having the mux is being able to connect both AD4134
> interfaces to a single bus while being able to have ADC sample data on all SDI
> lines as the diagrams in patch 13.
> 
> Alternatively, we could have something like
> 
>                                                               +-------------+
>   +----------------------+                                    |  DATA HOST  |
>   |       AD4134         |                                    |             |
>   |                      |                                    |             |
>   |Data interface  DOUT0 |----------------------------------->| SDI1        |
>   |for ADC data    DOUT1 |----------------------------------->| SDI2        |
>   |sample read     DOUT2 |----------------------------------->| SDI3        |
>   |                DOUT3 |----------------------------------->| SDI4        |
>   |                DCLK  |<--------------+        +---------->| CS          |
>   |                ODR   |<------------+ |        | +-------->| SCLK        |
>   |                      |             | |        | | +------>| SDO         |
>   |                      |             | |        | | | +---->| SDI         |
>   | SPI interface   CS   |<-------+    | +--------|-|-|-|-----| DCLK        |
>   | for register    SCLK |<-----+ |    |          | | | |     |             |
>   | access          SDI  |<---+ | |    |          | | | |     | TRIGGER     |
>   |                 SDO  |--+ | | |    |          | | | |     +-------------+
>   +----------------------+  | | | |    +----------|-|-|-|---------+
>                             | | | +---------------+ | | |
>                             | | +-------------------+ | |
>                             | +-----------------------+ |
>                             +---------------------------+
> 
> The downside of the above is we would need an SPI_MULTI_LANE_MODE_STRIPE to read
> only from SDI1 to SDI4.

I don't totally follow that detail, but indeed the control SPI plane would be independent
and so we'd need to do something to get that from the binding in a way that distinguishes
it from other spi controllers.  The device would be sitting on two SPI busses, one
of which had the multi channel properties.

To me this one is more natural but I can see both might get built and the complexity
of representing that as an SPI mux would be you'd be using part of a wider spi controller.
Hence I guess maybe the hidden (ish) mux is the way to go.

Jonathan
> 
> > 
> > Jonathan
> >   
> > > 
> > > ::
> > > 
> > >   +-----------------------+                               +-----------------+
> > >   |         AD4134        |                               | SPI Controller  |
> > >   |                       |                               |                 |
> > >   |                       |                               |                 |
> > >   | SPI interface    SCLK |<--------------------+---------| SCLK            |
> > >   | for register       CS |<--------------------|-+-------| CS              |
> > >   | access            SDI |<--------------------|-|-+-----| SDO             |
> > >   |                   SDO |------->|¯¯¯¯\       | | |     |                 |
> > >   |                       |        |MUX  >------|-|-|---->| SDI0            |
> > >   | Data interface  DOUT0 |------->|____/<------|-|-|---- | GPIO            |
> > >   | for ADC sample  DOUT1 |---------------------|-|-|---->| SDI1            |
> > >   | data read        DCLK |<-------------+------|-|-|-----| DCLK            |
> > >   |                 DOUT2 |<-+           |      | | |     |                 |
> > >   |                 DOUT3 |<-|-+         |      | | |     |                 |
> > >   |                   ODR |<-|-|---------|--+   | | |  +->| Offload Trigger |
> > >   +-----------------------+  | |         |  |   | | |  |  +-----------------+
> > >                              | |         |  |   | | |  +--| PWM1            |
> > >                              | |         |  +---| | | ----| PWM0            |
> > >                              | |         |  |   | | |    +-----------------+
> > >                              | |         |  |   | | |
> > >   +-----------------------+  | |         |  |   | | |
> > >   |         AD4134        |  | |         |  |   | | |
> > >   |                       |  | |         |  |   | | |
> > >   | SPI interface         |  | |         |  |   | | |
> > >   | for register     SCLK |<-|-|---------|--|---+ | |
> > >   | access             CS |<-|-|---------|--|---|-+ |
> > >   |                   SDI |<-|-|---------|--|---|-|-+
> > >   |                   SDO |  | |         |  |   | | |
> > >   | Data interface        |  | |         |  |   | | |
> > >   | for ADC sample  DOUT0 |--+ |         |  |   | | |
> > >   | data read       DOUT1 |----+         |  |   | | |
> > >   |                 DOUT2 |<-+           |  |   | | |
> > >   |                 DOUT3 |<-|-+         |  |   | | |
> > >   |                  DCLK |<-|-|---------+  |   | | |
> > >   |                   ODR |<-|-|---------|--+   | | |
> > >   +-----------------------+  | |         |  |   | | |
> > >                              | |         |  |   | | |
> > >                              | |         |  |   | | |
> > >                              | |         |  |   | | |
> > >   +-----------------------+  | |         |  |   | | |
> > >   |         AD4134        |  | |         |  |   | | |
> > >   |                       |  | |         |  |   | | |
> > >   |                       |  | |         |  |   | | |
> > >   | SPI interface    SCLK |<-|-|---------|--|---+ | |
> > >   | for register       CS |<-|-|---------|--|-----+ |
> > >   | access            SDI |<-|-|---------|--|-------+
> > >   |                       |  | |         |  |
> > >   | Data interface        |  | |         |  |
> > >   | for ADC sample  DOUT0 |--+ |         |  |
> > >   | data read       DOUT1 |----+         |  |
> > >   |                 DOUT2 |              |  |
> > >   |                 DOUT3 |              |  |
> > >   |                  DCLK |<-------------+  |
> > >   |                   ODR |<----------------+
> > >   +-----------------------+
> > > 
> > > 
> > > So we would set them as only one daisy-chained device.
> > > 
> > >     spi {
> > >         ...
> > >         adc@0 {
> > >             compatible = "adi,ad4134";
> > >             reg = <0>;
> > >             spi-rx-bus-width = <1>, <1>; /* 2 lanes of 1 bit each */
> > > 
> > >             <supplies, clock, and other properties ...> 
> > > 
> > >             #daisy-chained-devices = <2>;
> > > 
> > >             adi,spi-mode = "two-channel-chain";
> > >         };
> > >     };
> > > 
> > > Thanks,
> > > Marcelo  
> >   


  reply	other threads:[~2026-09-14  0:34 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02 17:21 [PATCH v1 00/13] iio: adc: ad4134: Enable greater sample rate data capture Marcelo Schmitt
2026-09-02 17:21 ` [PATCH v1 01/13] iio: Fix typo in vendor name Marcelo Schmitt
2026-09-03  6:22   ` Andy Shevchenko
2026-09-04 19:41     ` Marcelo Schmitt
2026-09-05  7:40       ` Andy Shevchenko
2026-09-05  7:41         ` Andy Shevchenko
2026-09-02 17:21 ` [PATCH v1 02/13] iio: adc: ad4134: Drop import to empty name space Marcelo Schmitt
2026-09-02 17:22 ` [PATCH v1 03/13] iio: adc: ad4134: Update include list to comply with IWYU principles Marcelo Schmitt
2026-09-03  6:26   ` Andy Shevchenko
2026-09-02 17:22 ` [PATCH v1 04/13] iio: adc: ad4134: Serialize single-read operations Marcelo Schmitt
2026-09-03  6:27   ` Andy Shevchenko
2026-09-06 18:50     ` Jonathan Cameron
2026-09-02 17:23 ` [PATCH v1 05/13] iio: adc: ad4134: Run shorter transfers when CRC is disabled Marcelo Schmitt
2026-09-02 17:23 ` [PATCH v1 06/13] iio: adc: ad4134: Add support for digital filter type selection Marcelo Schmitt
2026-09-03  6:31   ` Andy Shevchenko
2026-09-02 17:23 ` [PATCH v1 07/13] iio: adc: ad4134: Support buffered data read Marcelo Schmitt
2026-09-02 17:24 ` [PATCH v1 08/13] dt-bindings: iio: adc: adi,ad4134: Document SPI connection mode Marcelo Schmitt
2026-09-03 18:14   ` Conor Dooley
2026-09-04 20:47     ` Marcelo Schmitt
2026-09-04 22:06       ` Marcelo Schmitt
2026-09-06 19:26         ` Jonathan Cameron
2026-09-09 15:17           ` Marcelo Schmitt
2026-09-14  0:34             ` Jonathan Cameron [this message]
2026-09-07 17:52         ` Conor Dooley
2026-09-10 22:19           ` Marcelo Schmitt
2026-09-15 14:06             ` Conor Dooley
2026-09-06 19:15       ` Jonathan Cameron
2026-09-02 17:24 ` [PATCH v1 09/13] iio: adc: ad4134: Support SPI 4-wire mode Marcelo Schmitt
2026-09-03  6:39   ` Andy Shevchenko
2026-09-02 17:24 ` [PATCH v1 10/13] dt-bindings: iio: adc: adi,ad4134: Document PWM usage Marcelo Schmitt
2026-09-04 15:53   ` Conor Dooley
2026-09-02 17:25 ` [PATCH v1 11/13] dt-bindings: iio: adc: adi,ad4134: Add high data throughput example Marcelo Schmitt
2026-09-02 17:25 ` [PATCH v1 12/13] iio: adc: ad4134: Support high-speed data capture Marcelo Schmitt
2026-09-03  7:00   ` Andy Shevchenko
2026-09-02 17:25 ` [PATCH v1 13/13] Docs: iio: Add AD4134 Marcelo Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260914013433.0763e7f0@jic23-hlaptop \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=conor@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@analog.com \
    --cc=marcelo.schmitt1@gmail.com \
    --cc=marcelo.schmitt@analog.com \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®