Linux SPI subsystem development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Conor Dooley <conor@kernel.org>
Cc: "David Lechner" <dlechner@baylibre.com>,
	"Janani Sunil" <janani.sunil@analog.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Mark Brown" <broonie@kernel.org>,
	"Marius Cristea" <marius.cristea@microchip.com>,
	"Marcus Folkesson" <marcus.folkesson@gmail.com>,
	"Kent Gustavsson" <kent@minoris.se>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	"Janani Sunil" <jan.sun97@gmail.com>,
	linux-spi@vger.kernel.org, "Kent Gustavsson" <nedo80@gmail.com>
Subject: Re: [PATCH v7 2/7] dt-bindings: iio: adc: microchip,mcp3564: Add spi-device-addr
Date: Thu, 30 Jul 2026 00:09:29 +0100	[thread overview]
Message-ID: <20260730000929.2ec20cf8@jic23-huawei> (raw)
In-Reply-To: <20260729-hundredth-suffice-f28afa67bc06@spud>

On Wed, 29 Jul 2026 21:47:45 +0100
Conor Dooley <conor@kernel.org> wrote:

> On Tue, Jul 28, 2026 at 10:17:19PM +0100, Jonathan Cameron wrote:
> > On Tue, 28 Jul 2026 17:00:55 +0100
> > Conor Dooley <conor@kernel.org> wrote:
> >   
> > > On Sat, Jul 25, 2026 at 11:07:39PM +0100, Jonathan Cameron wrote:  
> > > > On Sat, 25 Jul 2026 15:57:07 -0500
> > > > David Lechner <dlechner@baylibre.com> wrote:
> > > >     
> > > > > On 7/22/26 2:54 AM, Janani Sunil wrote:    
> > > > > > Add the generic spi-device-addr property to the binding and deprecate
> > > > > > the existing vendor specific microchip,hw-device-address property.
> > > > > > 
> > > > > > Signed-off-by: Janani Sunil <janani.sunil@analog.com>
> > > > > > ---
> > > > > >  .../devicetree/bindings/iio/adc/microchip,mcp3564.yaml         | 10 ++++++++--
> > > > > >  1 file changed, 8 insertions(+), 2 deletions(-)
> > > > > > 
> > > > > > diff --git a/Documentation/devicetree/bindings/iio/adc/microchip,mcp3564.yaml b/Documentation/devicetree/bindings/iio/adc/microchip,mcp3564.yaml
> > > > > > index 675319276197..de1ea289e7f5 100644
> > > > > > --- a/Documentation/devicetree/bindings/iio/adc/microchip,mcp3564.yaml
> > > > > > +++ b/Documentation/devicetree/bindings/iio/adc/microchip,mcp3564.yaml
> > > > > > @@ -80,6 +80,7 @@ properties:
> > > > > >      $ref: /schemas/types.yaml#/definitions/uint32
> > > > > >      minimum: 0
> > > > > >      maximum: 3
> > > > > > +    deprecated: true
> > > > > >      description:
> > > > > >        The address is set on a per-device basis by fuses in the factory,
> > > > > >        configured on request. If not requested, the fuses are set for 0x1.
> > > > > > @@ -91,6 +92,12 @@ properties:
> > > > > >        clocking of the device address (BITS[7:6] - top two bits of COMMAND BYTE
> > > > > >        which is first one on the wire).
> > > > > >  
> > > > > > +  spi-device-addr:
> > > > > > +    maxItems: 1      
> > > > > 
> > > > > Does it not make sense to all for more than once device connected
> > > > > to the same CS here? I would expect maxItems to be 4 to match the
> > > > > number of possible addresses.
> > > > >     
> > > > 
> > > > I think for this part their isn't a reason to aggregate.
> > > > No magic accesses that touch them all at once.  So this hits
> > > > exactly the point you raised about how we set the address for
> > > > more than one of them.    
> > > 
> > > No David is actually right here, and maxitems should be 4.
> > > Setting the address for multiple was already discussed I thought, with
> > > the property being an array and each compatible being used to determine
> > > the "stride" between entries based on the number of supported channels?  
> > 
> > I don't think that applies for this device or at least to do so
> > is a major driver rewrite, not a simple binding change.  Probably we'd  
> 
> Whether or not it is a big driver change, the binding should represent
> what the hardware is capable of.
> 
> > just add a bus and hang the 4 instances off it. They are running on own
> > timing etc so we can't grab data across all of them in any sort of
> > synchronous way - the clocks will probably drift over time etc.  
> 
> Did I miss something about the ADI devices in this thread where they
> have some multicast ability to read all devices at once? I thought that
> that was a different series where each device had dedicated mosi and
> miso lines, rather than the shared ones here. I didn't think the ad5529r
> did anything special from my reading of the datasheet but I'm not the
> expert in this area!

It's a DAC so other way around but yes they have exactly that in the section:
https://www.analog.com/media/en/technical-documentation/data-sheets/ad5529r.pdf

	Register Details: Hotpath DAC registermap.

The is a brief description earlier of the whole feature that might
serve for this discussion:

"DAC HOTPATH
The DAC hotpath is a dedicated register region that optimizes
DAC updates in multidevice configurations where several AD5529R
devices share a common SPI bus. It reduces the number of SPI
frames required to write DAC data and supports synchronized
output updates across devices. In single device systems, the hotpath
offers no advantage over the standard register map and can be
disregarded."

As an example
MULTI DEVICE SW LDAC MODE 0 REGISTER
"This register sends a software LDAC update to the selected devices
that share the SPI lines but have different addresses, using the ID0
and ID1 pins. The selection is done on a per-device basis corresponding
to the configured bit field."

This one triggers all selected DACs (there is bit corresponding to
each address) to update in sync. (Lets put aside normal systems
where an LDAC gpio is wired to multiple devices as that is a whole
different problem).


It is this part that is driving the suggestion of having
a combined device representation for multiple physical devices.
In practice it is very similar to chained devices where we do that
already in that a longer access sequence is used to talk to multiple
devices at once.

Those SPI messages do not carry the address (or they are ignored - I didn't
dig into the mechanism).


> 
> > They are independent devices (think of them using spi-device-address
> > like an i2c address) -  so why have one DT node for up to 4 of
> > them?  Note this is different from the AD5529R where the design
> > is intended for them to operate as one single larger device.  
> 
> I don't buy this argument, I just don't see what differs between the
> devices. The microchip datasheet I read talked about using 3 devices to
> measure 3 phase power setups (I think that's what it was) which is, in
> my book, evidence that they're not just intended to be used
> independently.

Sure but that could just as easily be done with normal SPI and 3 chip
selects. For these devices there is no broadcast write magic (I think
anyway!)

> 
> That said, the more this discussion goes on, the more I think that
> merging the devices into a single node is a mistake. Logically there may
> be one device, but really there are one to four devices. Doing the
> logical device thing is nice maybe for software but I no longer think
> that it represents the hardware correctly. I know this will cause
> problems with registration of devices in the SPI core, but we need to
> pick one representation for these devices that fits in all usecases
> and with the things brought up in the other mail I am having a lot of
> doubts.

This wasn't about use cases as such but the broadcast like facilities the
ADI parts have which to me smell like the main reason you'd put them on
a single bus and use this feature in the first place - you are making
one big DAC from multiple chips.

> 
> Only going to reply to this for now, I'll reply to the other thread of
> this conversation later so as not to end up duplicating discussion, but
> I am thinking of things like what if someone puts a mcp3654r and an
> ad5529r on the same chip select? I think that's actually perfectly
> functional on a hardware level, provided the fuses/pins are set up
> correctly (and if it is not, mixing the microchip devices is possible
> and probably mixing future ADI ones will be too).

The broadcast stuff is what breaks this.  Otherwise I fully agree they
should be independent and we should have SPI allow that.

Jonathan

> 
> Cheers,
> Conor.


  parent reply	other threads:[~2026-07-29 23:09 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22  7:54 [PATCH v7 0/7] iio: dac: Add support for AD5529R DAC Janani Sunil
2026-07-22  7:54 ` [PATCH v7 1/7] spi: dt-bindings: Add spi-device-addr peripheral property Janani Sunil
2026-07-22 16:39   ` Conor Dooley
2026-07-24 23:32   ` Jonathan Cameron
2026-07-25 20:55   ` David Lechner
2026-07-25 22:04     ` Jonathan Cameron
2026-07-28 16:10       ` Conor Dooley
2026-07-28 17:06         ` Nuno Sá
2026-07-28 17:17           ` Conor Dooley
2026-07-28 18:39         ` David Lechner
2026-07-28 21:05           ` Jonathan Cameron
2026-07-28 21:46             ` David Lechner
2026-07-29 22:47               ` Jonathan Cameron
2026-07-28 16:55   ` Nuno Sá
2026-07-22  7:54 ` [PATCH v7 2/7] dt-bindings: iio: adc: microchip,mcp3564: Add spi-device-addr Janani Sunil
2026-07-22 16:40   ` Conor Dooley
2026-07-25 20:57   ` David Lechner
2026-07-25 22:07     ` Jonathan Cameron
2026-07-28 16:00       ` Conor Dooley
2026-07-28 21:17         ` Jonathan Cameron
2026-07-29 20:47           ` Conor Dooley
2026-07-29 21:40             ` David Lechner
2026-07-30 17:41               ` Conor Dooley
2026-07-29 23:09             ` Jonathan Cameron [this message]
2026-07-30 10:25               ` Nuno Sá
2026-07-30 17:34                 ` Jonathan Cameron
2026-07-30 18:09                   ` Conor Dooley
2026-07-30 18:02               ` Conor Dooley
2026-07-22  7:54 ` [PATCH v7 3/7] iio: adc: mcp3564: Add support for spi-device-addr Janani Sunil
2026-07-22 16:45   ` Conor Dooley
2026-07-22 17:02     ` Marius.Cristea
2026-07-22 17:12       ` Conor Dooley
2026-07-22 17:06   ` Marius.Cristea
2026-07-22  7:54 ` [PATCH v7 4/7] dt-bindings: iio: adc: microchip,mcp3911: Add spi-device-addr Janani Sunil
2026-07-22 16:41   ` Conor Dooley
2026-07-22  7:54 ` [PATCH v7 5/7] iio: adc: mcp3911: Add support for spi-device-addr Janani Sunil
2026-07-22 16:41   ` Conor Dooley
2026-07-22 16:43     ` Conor Dooley
2026-07-22 17:18       ` Marius.Cristea
2026-07-22 17:19   ` Marius.Cristea
2026-07-22  7:54 ` [PATCH v7 6/7] dt-bindings: iio: dac: Add AD5529R Janani Sunil
2026-07-22 16:39   ` Conor Dooley
2026-07-25 20:38   ` David Lechner
2026-07-22  7:54 ` [PATCH v7 7/7] iio: dac: Add AD5529R DAC driver support Janani Sunil
2026-07-24 23:57   ` Jonathan Cameron
2026-07-25 21:24   ` David Lechner

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=20260730000929.2ec20cf8@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=broonie@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=jan.sun97@gmail.com \
    --cc=janani.sunil@analog.com \
    --cc=kent@minoris.se \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=marcus.folkesson@gmail.com \
    --cc=marius.cristea@microchip.com \
    --cc=nedo80@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=p.zabel@pengutronix.de \
    --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