devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
To: David Lechner <dlechner@baylibre.com>
Cc: Marcelo Schmitt <marcelo.schmitt@analog.com>,
	apw@canonical.com, joe@perches.com, dwaipayanray1@gmail.com,
	lukas.bulwahn@gmail.com, paul.cercueil@analog.com,
	Michael.Hennerich@analog.com, lars@metafoo.de, jic23@kernel.org,
	robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	conor+dt@kernel.org, dan.carpenter@linaro.org,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 10/13] dt-bindings: iio: Add AD7091R-8
Date: Fri, 8 Dec 2023 10:28:25 -0300	[thread overview]
Message-ID: <ZXMZ-Y18SwIFEIgA@debian-BULLSEYE-live-builder-AMD64> (raw)
In-Reply-To: <CAMknhBEFnTUm9FPK-74+GkJs2d80dS+Q9WeGTxd3Ajs-JJGcdA@mail.gmail.com>

Hi David, thank you for your suggestions.
Comments inline.

On 12/07, David Lechner wrote:
> On Thu, Dec 7, 2023 at 12:42 PM Marcelo Schmitt
> <marcelo.schmitt@analog.com> wrote:
> >
> > Add device tree documentation for AD7091R-8.
> >
> > Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
> > ---
> >  .../bindings/iio/adc/adi,ad7091r8.yaml        | 99 +++++++++++++++++++
> >  1 file changed, 99 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ad7091r8.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7091r8.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7091r8.yaml
> > new file mode 100644
> > index 000000000000..02320778f225
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7091r8.yaml
> > @@ -0,0 +1,99 @@
> > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/iio/adc/adi,ad7091r8.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Analog Devices AD7091R8 8-Channel 12-Bit ADC
> > +
> > +maintainers:
> > +  - Marcelo Schmitt <marcelo.schmitt@analog.com>
> > +
> > +description: |
> > +  Analog Devices AD7091R-8 8-Channel 12-Bit ADC
> > +  https://www.analog.com/media/en/technical-documentation/data-sheets/AD7091R-2_7091R-4_7091R-8.pdf
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - adi,ad7091r2
> > +      - adi,ad7091r4
> > +      - adi,ad7091r8
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> 
> Missing other supplies? Like vdd-supply and vdrive-supply?
> 

I used the name that would work with ad7091r-base.c.
If I'm not misinterpreting the datasheet, vdd-supply and vdrive-supply are
for powering the ADC and setting SPI lanes logic level, respectively.
They don't have any impact on ADC readings.
By the way, should maybe I extend ad7091r5 dt doc instead of creating this
new one?

> > +  vref-supply: true
> 
> refin-supply might be a better name to match the datasheet pin name.
> 

Agree, though I guess changing the name now would break users of ad7091r5 if
they happen to update the driver without updating their device tree.

> > +
> > +  adi,conversion-start-gpios:
> 
> gpios usually don't get a vendor prefix do they?
> 
> convst-gpios could be a better name to match the pin name on the datasheet.

Ack, will do for v4.

> 
> > +    description:
> > +      GPIO connected to the CONVST pin.
> > +      This logic input is used to initiate conversions on the analog
> > +      input channels.
> > +    maxItems: 1
> > +
> > +  reset-gpios:
> > +    maxItems: 1
> > +
> > +  interrupts:
> > +    maxItems: 1
> 
> A description of what the interrupt is attached to (ALERT/BUSY/GPO0
> pin) would be helpful.
> 

Ack, will do for v4.

> > +
> > +patternProperties:
> > +  "^channel@[0-7]$":
> > +    $ref: adc.yaml
> > +    type: object
> > +    description: Represents the external channels which are connected to the ADC.
> > +
> > +    properties:
> > +      reg:
> > +        minimum: 0
> > +        maximum: 7
> 
> Shouldn't this be:
> 
>         items:
>           - minimum: 0
>             maximum: 7
> 

Ack

> > +
> > +    required:
> > +      - reg
> 
> Missing `unevaluatedProperties: false` for channels?
> 
> Bigger picture: since no other properties besides `reg` are included
> here, do we actually need channel nodes?
> 

The channel nodes are not used by the drivers so we can remove them if we want.
I thought they would be required as documentation even if they were not used
in drivers.
Looks like they're not required so will remove them in v4.

> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - adi,conversion-start-gpios
> > +
> > +allOf:
> > +  - $ref: /schemas/spi/spi-peripheral-props.yaml#
> > +
> > +  # AD7091R-2 does not have ALERT/BUSY/GPO pin
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            enum:
> > +              - adi,ad7091r4
> > +              - adi,ad7091r8
> > +    then:
> > +      properties:
> > +        interrupts: true
> 
> Interrupts is already true. Maybe better to only match chips without
> interrupts and set false?
> 

Agree, that should simplify the constrain logic. Will do for v4.

> > +    else:
> > +      properties:
> > +        interrupts: false
> > +
> > +unevaluatedProperties: false
> > +
> > +examples:
> > +  - |
> > +    #include <dt-bindings/interrupt-controller/irq.h>
> > +    #include <dt-bindings/gpio/gpio.h>
> > +    spi {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        adc@0 {
> > +                compatible = "adi,ad7091r8";
> > +                reg = <0x0>;
> > +                spi-max-frequency = <45454545>;
> > +                vref-supply = <&adc_vref>;
> > +                adi,conversion-start-gpios = <&gpio 25 GPIO_ACTIVE_LOW>;
> > +                reset-gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
> > +                interrupts = <22 IRQ_TYPE_EDGE_FALLING>;
> > +                interrupt-parent = <&gpio>;
> > +        };
> > +    };
> > +...
> > --
> > 2.42.0
> >
> >

  reply	other threads:[~2023-12-08 13:28 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07 18:35 [PATCH v3 00/13] Add support for AD7091R-2/-4/-8 Marcelo Schmitt
2023-12-07 18:37 ` [PATCH v3 01/13] scripts: checkpatch: Add __aligned to the list of attribute notes Marcelo Schmitt
2023-12-07 18:56   ` Joe Perches
2023-12-08 12:21     ` Marcelo Schmitt
2023-12-07 18:37 ` [PATCH v3 02/13] iio: adc: ad7091r: Populate device driver data field Marcelo Schmitt
2023-12-07 23:18   ` David Lechner
2023-12-08 12:16     ` Marcelo Schmitt
2023-12-07 18:38 ` [PATCH v3 03/13] iio: adc: ad7091r: Set alert bit in config register Marcelo Schmitt
2023-12-10 12:13   ` Jonathan Cameron
2023-12-07 18:39 ` [PATCH v3 04/13] iio: adc: ad7091r: Align arguments to function call parenthesis Marcelo Schmitt
2023-12-07 18:40 ` [PATCH v3 05/13] iio: adc: ad7091r: Move generic AD7091R code to base driver and header file Marcelo Schmitt
2023-12-07 18:40 ` [PATCH v3 06/13] iio: adc: ad7091r: Move chip init data to container struct Marcelo Schmitt
2023-12-08 12:28   ` [PATCH v3 6/13] " kernel test robot
2023-12-07 18:41 ` [PATCH v3 07/13] iio: adc: ad7091r: Set device mode through chip_info callback Marcelo Schmitt
2023-12-10 12:35   ` Jonathan Cameron
2023-12-07 18:41 ` [PATCH v3 08/13] iio: adc: ad7091r: Enable internal vref if external vref is not supplied Marcelo Schmitt
2023-12-10 12:22   ` Jonathan Cameron
2023-12-07 18:41 ` [PATCH v3 09/13] iio: adc: ad7091r: Add chip_info callback to get conversion result channel Marcelo Schmitt
2023-12-07 18:42 ` [PATCH v3 10/13] dt-bindings: iio: Add AD7091R-8 Marcelo Schmitt
2023-12-07 23:56   ` David Lechner
2023-12-08 13:28     ` Marcelo Schmitt [this message]
2023-12-08 14:50       ` David Lechner
2023-12-10 12:26       ` Jonathan Cameron
2023-12-08  8:05   ` Krzysztof Kozlowski
2023-12-08 13:29     ` Marcelo Schmitt
2023-12-07 18:42 ` [PATCH v3 11/13] iio: adc: Split AD7091R-5 config symbol Marcelo Schmitt
2023-12-07 18:42 ` [PATCH v3 12/13] iio: adc: Add support for AD7091R-8 Marcelo Schmitt
2023-12-10 12:33   ` Jonathan Cameron
2023-12-10 19:54     ` Marcelo Schmitt
2023-12-07 18:43 ` [PATCH v3 13/13] MAINTAINERS: Add MAINTAINERS entry for AD7091R Marcelo Schmitt
2023-12-07 18:58   ` Joe Perches
2023-12-08 12:12     ` Marcelo Schmitt
2023-12-07 23:26 ` [PATCH v3 00/13] Add support for AD7091R-2/-4/-8 David Lechner
2023-12-08 13:50   ` 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=ZXMZ-Y18SwIFEIgA@debian-BULLSEYE-live-builder-AMD64 \
    --to=marcelo.schmitt1@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=apw@canonical.com \
    --cc=conor+dt@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=jic23@kernel.org \
    --cc=joe@perches.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=marcelo.schmitt@analog.com \
    --cc=paul.cercueil@analog.com \
    --cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).