Devicetree
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "Alisa-Dariana Roman" <alisadariana@gmail.com>,
	"Alisa-Dariana Roman" <alisa.roman@analog.com>,
	"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Uwe Kleine-König" <ukleinek@kernel.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>
Subject: Re: [PATCH v1 2/3] dt-bindings: iio: adc: add AD7191
Date: Tue, 24 Dec 2024 20:27:11 +0000	[thread overview]
Message-ID: <20241224-unlivable-calibrate-ba5eed1ce741@spud> (raw)
In-Reply-To: <20241222181857.00b38e57@jic23-huawei>

[-- Attachment #1: Type: text/plain, Size: 5700 bytes --]

On Sun, Dec 22, 2024 at 06:18:57PM +0000, Jonathan Cameron wrote:
> On Sun, 22 Dec 2024 14:48:08 +0000
> Conor Dooley <conor@kernel.org> wrote:
> 
> > On Sat, Dec 21, 2024 at 05:56:01PM +0200, Alisa-Dariana Roman wrote:
> > > AD7191 is a pin-programmable, ultralow noise 24-bit sigma-delta ADC
> > > designed for precision bridge sensor measurements. It features two
> > > differential analog input channels, selectable output rates,
> > > programmable gain, internal temperature sensor and simultaneous
> > > 50Hz/60Hz rejection.
> > > 
> > > Signed-off-by: Alisa-Dariana Roman <alisa.roman@analog.com>
> 
> Maybe I'm over thinking things, but comments inline about possibility of
> pinstrapping holding this device in a particular configuration, without
> the GPIOS connected.
> 
> > > ---
> > >  .../bindings/iio/adc/adi,ad7191.yaml          | 128 ++++++++++++++++++
> > >  MAINTAINERS                                   |   7 +
> > >  2 files changed, 135 insertions(+)
> > >  create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ad7191.yaml
> > > 
> > > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7191.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7191.yaml
> > > new file mode 100644
> > > index 000000000000..f3e596918c22
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7191.yaml
> > > @@ -0,0 +1,128 @@
> > > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > > +# Copyright 2025 Analog Devices Inc.
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/iio/adc/adi,ad7191.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Analog Devices AD7191 ADC device driver
> > > +
> > > +maintainers:
> > > +  - Alisa-Dariana Roman <alisa.roman@analog.com>
> > > +
> > > +description: |
> > > +  Bindings for the Analog Devices AD7191 ADC device. Datasheet can be
> > > +  found here:
> > > +  https://www.analog.com/media/en/technical-documentation/data-sheets/AD7191.pdf
> > > +
> > > +properties:
> > > +  compatible:
> > > +    enum:
> > > +      - adi,ad7191
> > > +
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +  spi-cpol: true
> > > +
> > > +  spi-cpha: true
> > > +
> > > +  clocks:
> > > +    maxItems: 1
> > > +    description:
> > > +      Optionally, either a crystal can be attached externally between MCLK1 and
> > > +      MCLK2 pins, or an external CMOS-compatible clock can drive the MCLK2
> > > +      pin. If absent, internal 4.92MHz clock is used.  
> > 
> > Without clock-names, how do you tell the difference between driven ctal and
> > the cmos-compatible clock? That CLKSEL's job?
> 
> Seems it's an unusual part and there is no config associated with whether we
> have a clock or an xtal, so we probably don't need the name.
> 
> Related to that, in many cases I'd expect clksel to be tied to always
> use the external clock or not (depending on whether one is connected)
> not to be a gpio.  So you probably need to take that configuration into
> account as well.
> 
> Similar may apply for the odr, and pga pins.  Sometimes people
> hardwire those things.  There are examples in tree (I can't point at one
> right now though) that deal with this. Fairly sure at least 1 ADI part
> has a binding to handle that.  (the ad7606 does a bit of this as it needs
> a particular pinstrap for sw-mode).
> 
> You should be fine with chan and temp always being GPIOs as it would be weird
> to buy a part with the extra channels + temperature sensor and not wire it
> to be useable.
> 
> > 
> > > +
> > > +  interrupts:
> > > +    maxItems: 1
> > > +
> > > +  avdd-supply:
> > > +    description: AVdd voltage supply
> > > +
> > > +  dvdd-supply:
> > > +    description: DVdd voltage supply
> > > +
> > > +  vref-supply:
> > > +    description: Vref voltage supply
> > > +
> > > +  odr1-gpios:
> > > +    description: GPIO connected to ODR1 pin for output data rate selection
> > > +    maxItems: 1
> > > +
> > > +  odr2-gpios:
> > > +    description: GPIO connected to ODR2 pin for output data rate selection
> > > +    maxItems: 1
> > > +
> > > +  pga1-gpios:
> > > +    description: GPIO connected to PGA1 pin for gain selection
> > > +    maxItems: 1
> > > +
> > > +  pga2-gpios:
> > > +    description: GPIO connected to PGA2 pin for gain selection
> > > +    maxItems: 1
> > > +
> > > +  temp-gpios:
> > > +    description: GPIO connected to TEMP pin for temperature sensor enable
> > > +    maxItems: 1
> > > +
> > > +  chan-gpios:
> > > +    description: GPIO connected to CHAN pin for input channel selection
> > > +    maxItems: 1
> > > +
> > > +  clksel-gpios:
> > > +    description: GPIO connected to CLKSEL pin for clock source selection
> > > +    maxItems: 1
> > > +
> > > +required:
> > > +  - compatible
> > > +  - reg
> > > +  - interrupts
> > > +  - avdd-supply
> > > +  - dvdd-supply
> > > +  - vref-supply
> > > +  - spi-cpol
> > > +  - spi-cpha  
> > 
> > > +  - odr1-gpios
> > > +  - odr2-gpios
> > > +  - pga1-gpios
> > > +  - pga2-gpios  
> > 
> > For these 4, since all are required, seems like grouping as odr-pgios
> > and pga-gpios would be a good idea?
> Agreed except for the annoying option of pin strapping.  Maybe we ignore that
> for now.  If it becomes a problem, we can add it safely as a driver predating
> that will try to grab the gpios and fail if it sees a DT not providing them.
> So will fail safe before we add pinstrapping.  Maybe we will never need to.

To me, it's a cosmetic nicety to merge them, so I'm happy with any valid
reason to not do so.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2024-12-24 20:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-21 15:55 [PATCH v0 0/3] Add support for AD7191 Alisa-Dariana Roman
2024-12-21 15:56 ` [PATCH v1 1/3] iio: adc: ad_sigma_delta: Add CS assert function Alisa-Dariana Roman
2024-12-22 18:07   ` Jonathan Cameron
2025-01-21  9:36     ` Alisa-Dariana Roman
2025-01-21 22:32       ` David Lechner
2025-01-22 12:26         ` Alisa-Dariana Roman
2024-12-21 15:56 ` [PATCH v1 2/3] dt-bindings: iio: adc: add AD7191 Alisa-Dariana Roman
2024-12-22 14:48   ` Conor Dooley
2024-12-22 18:18     ` Jonathan Cameron
2024-12-24 20:27       ` Conor Dooley [this message]
2024-12-27  8:53   ` Krzysztof Kozlowski
2024-12-21 15:56 ` [PATCH v1 3/3] iio: adc: ad7191: " Alisa-Dariana Roman
2024-12-22 18:54   ` Jonathan Cameron

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=20241224-unlivable-calibrate-ba5eed1ce741@spud \
    --to=conor@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=alisa.roman@analog.com \
    --cc=alisadariana@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=ukleinek@kernel.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