linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Tilki, Ibrahim" <Ibrahim.Tilki@analog.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"Sa, Nuno" <Nuno.Sa@analog.com>,
	"Bolucu, Nurettin" <Nurettin.Bolucu@analog.com>
Subject: RE: [PATCH v4 2/3] dt-bindings: iio: adc: add adi,max11410.yaml
Date: Tue, 20 Sep 2022 15:27:23 +0000	[thread overview]
Message-ID: <DM8PR03MB62477EAB8BCF6862032B30C5964C9@DM8PR03MB6247.namprd03.prod.outlook.com> (raw)
In-Reply-To: <20220918162211.7a5ebdac@jic23-huawei>


> On Thu, 8 Sep 2022 17:49:23 +0300
> Ibrahim Tilki <Ibrahim.Tilki@analog.com> wrote:
> 
> > Adding devicetree binding documentation for max11410 adc.
> > 
> > Signed-off-by: Ibrahim Tilki <Ibrahim.Tilki@analog.com>
> > ---
> >  .../bindings/iio/adc/adi,max11410.yaml        | 174 ++++++++++++++++++
> >  1 file changed, 174 insertions(+)
> >  create mode 100644 
> > Documentation/devicetree/bindings/iio/adc/adi,max11410.yaml
> > 
> > diff --git 
> > a/Documentation/devicetree/bindings/iio/adc/adi,max11410.yaml 
> > b/Documentation/devicetree/bindings/iio/adc/adi,max11410.yaml
> > new file mode 100644
> > index 000000000..3ffab284b
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/iio/adc/adi,max11410.yaml
> > @@ -0,0 +1,174 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) # Copyright 2022 
> > +Analog Devices Inc.
> > +%YAML 1.2
> > +---
> > +$id: 
> > +https://urldefense.com/v3/__http://devicetree.org/schemas/iio/adc/adi
> > +,max11410.yaml*__;Iw!!A3Ni8CS0y2Y!9LhA6Qy9HXqdtKQfrUEeHtQ7xhm_bIEYwWU
> > +8CyFFP9qvWNxJ5EE2jJ90UG_gph6M7EecEx_r5PuFIsbL$
> > +$schema: 
> > +https://urldefense.com/v3/__http://devicetree.org/meta-schemas/core.y
> > +aml*__;Iw!!A3Ni8CS0y2Y!9LhA6Qy9HXqdtKQfrUEeHtQ7xhm_bIEYwWU8CyFFP9qvWN
> > +xJ5EE2jJ90UG_gph6M7EecEx_r5ClUIiuZ$
> > +
> > +title: Analog Devices MAX11410 ADC device driver
> > +
> > +maintainers:
> > +  - Ibrahim Tilki <ibrahim.tilki@analog.com>
> > +
> > +description: |
> > +  Bindings for the Analog Devices MAX11410 ADC device. Datasheet can 
> > +be
> > +  found here:
> > +    https://datasheets.maximintegrated.com/en/ds/MAX11410.pdf
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - adi,max11410
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  interrupts:
> > +    maxItems: 1
> 
> Why?  If someone wants to wire both lines, they can do so.
> Then it will be up to the driver to pick which one to use.
> Given we have names, we will know which is which and be able to pick our favourite line to use.
> 

Done

> > +
> > +  interrupt-names:
> > +    description: Name of the gpio pin of max11410 used for IRQ
> > +    maxItems: 1
> > +    items:
> > +      enum:
> > +        - gpio0
> > +        - gpio1
> > +
> > +  '#address-cells':
> > +    const: 1
> > +
> > +  '#size-cells':
> > +    const: 0
> > +
> > +  avdd-supply:
> > +    description: Necessarry avdd supply. Used as reference when no explicit reference supplied.
> > +
> > +  vref0p-supply:
> > +    description: vref0p supply can be used as reference for conversion.
> > +
> > +  vref1p-supply:
> > +    description: vref1p supply can be used as reference for conversion.
> > +
> > +  vref2p-supply:
> > +    description: vref2p supply can be used as reference for conversion.
> > +
> > +  vref0n-supply:
> > +    description: vref0n supply can be used as reference for conversion.
> > +
> > +  vref1n-supply:
> > +    description: vref1n supply can be used as reference for conversion.
> > +
> > +  vref2n-supply:
> > +    description: vref2n supply can be used as reference for conversion.
> > +
> > +  spi-max-frequency:
> > +    maximum: 8000000
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - avdd-supply
> hmm.
> 
> If explicit references are supplied and used, then will we query the voltage of the avdd supply?  If not, it doesn't need to be supplied. Power is needed but it might be coming from a fixed regulator no one bothered to put in the device tree.  Perhaps we just don't care about that corner case?
> 

That is correct. If all of the channels use external vref, then avdd-supply
is no longer required. It is fine by me if we ignore this corner case.

Current driver checks for avdd-supply unconditionally. Maybe we can change the
driver so that it results in error only if one of the channels use avdd as reference
in the absence of avdd-supply?


> > +
> > +patternProperties:
> > +  "^channel(@[0-9a-f]+)?$":
> 
> name isn't that flexible as we only allow reg 0-9
> 

I changed it to "^channel(@[0-9])?$" in v5 but will this allow us to define
more than 10 channels? Sharing analog inputs accross multiple channels is
supported by driver. But I don't know how to correctly specify it here.
For example following configuration is valid:

  channel@0 {
    reg = <0>;
  };
  channel@1 {
    reg = <1>;
  };
  channel@2 {
    reg = <2>;
  };
  channel@3 {
    reg = <3>;
  };
  channel@4 {
    reg = <4>;
  };
  channel@5 {
    reg = <5>;
  };
  channel@6 {
    reg = <6>;
  };
  channel@7 {
    reg = <7>;
  };
  channel@8 {
    reg = <8>;
  };
  channel@9 {
    reg = <9>;
  };
  channel@a {
    diff-channels = <1 2>;
  };
  channel@b {
    diff-channels = <7 9>;
  };


> > +    $ref: "adc.yaml"
> > +    type: object
> > +    description: Represents the external channels which are connected to the ADC.
> > +
> > +    properties:
> > +      reg:
> > +        description: The channel number in single-ended mode.
> > +        minimum: 0
> > +        maximum: 9
> > +
> > +      adi,reference:
> > +        description: |
> > +          Select the reference source to use when converting on
> > +          the specific channel. Valid values are:
> > +          0: VREF0P/VREF0N
> > +          1: VREF1P/VREF1N
> > +          2: VREF2P/VREF2N
> > +          3: AVDD/AGND
> > +          4: VREF0P/AGND
> > +          5: VREF1P/AGND
> > +          6: VREF2P/AGND
> > +          If this field is left empty, AVDD/AGND is selected.
> > +        $ref: /schemas/types.yaml#/definitions/uint32
> > +        enum: [0, 1, 2, 3, 4, 5, 6]
> > +        default: 3
> > +
> > +      adi,input-mode:
> > +        description: |
> > +          Select signal path of input channels. Valid values are:
> > +          0: Buffered, low-power, unity-gain path (default)
> > +          1: Bypass path
> > +          2: PGA path
> > +        $ref: /schemas/types.yaml#/definitions/uint32
> > +        enum: [0, 1, 2]
> > +        default: 0
> > +
> > +      diff-channels: true
> > +
> > +      bipolar: true
> > +
> > +      settling-time-us: true
> > +
> > +      adi,buffered-vrefp:
> > +        description: Enable buffered mode for positive reference.
> > +        type: boolean
> > +
> > +      adi,buffered-vrefn:
> > +        description: Enable buffered mode for negative reference.
> > +        type: boolean
> > +
> > +    required:
> > +      - reg
> > +
> > +    additionalProperties: false
> > +
> > +additionalProperties: false
> 
> This now needs to use the new spi-peripheral-props.yaml
> https://lore.kernel.org/all/20220816124321.67817-1-krzysztof.kozlowski@linaro.org/ 
> 
> Your series crossed with that cleanup / binding documentation refactor.
> 

Updated in v5

> > +
> > +examples:
> > +  - |
> > +    spi {
> > +      #address-cells = <1>;
> > +      #size-cells = <0>;
> > +
> > +      adc@0 {
> > +        reg = <0>;
> > +        compatible = "adi,max11410";
> > +        spi-max-frequency = <8000000>;
> > +
> > +        interrupt-parent = <&gpio>;
> > +        interrupts = <25 2>;
> > +        interrupt-names = "gpio1";
> > +
> > +        avdd-supply = <&adc_avdd>;
> > +
> > +        vref1p-supply = <&adc_vref1p>;
> > +        vref1n-supply = <&adc_vref1n>;
> > +
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        channel@0 {
> > +          reg = <0>;
> > +        };
> > +
> > +        channel@1 {
> > +          reg = <1>;
> > +          diff-channels = <2 3>;
> > +          adi,reference = <1>;
> > +          bipolar;
> > +          settling-time-us = <100000>;
> > +        };
> > +
> > +        channel@2 {
> > +          reg = <2>;
> > +          diff-channels = <7 9>;
> > +          adi,reference = <5>;
> > +          adi,input-mode = <2>;
> > +          settling-time-us = <50000>;
> > +        };
> > +      };
> > +    };


  reply	other threads:[~2022-09-20 15:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08 14:49 [PATCH v4 0/3] iio: adc: add max11410 adc driver Ibrahim Tilki
2022-09-08 14:49 ` [PATCH v4 1/3] " Ibrahim Tilki
2022-09-18 15:17   ` Jonathan Cameron
2022-09-08 14:49 ` [PATCH v4 2/3] dt-bindings: iio: adc: add adi,max11410.yaml Ibrahim Tilki
2022-09-18 15:22   ` Jonathan Cameron
2022-09-20 15:27     ` Tilki, Ibrahim [this message]
2022-09-24 13:58       ` Jonathan Cameron
2022-09-08 14:49 ` [PATCH v4 3/3] Documentation: ABI: testing: add max11410 doc Ibrahim Tilki
2022-09-18 15:26   ` 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=DM8PR03MB62477EAB8BCF6862032B30C5964C9@DM8PR03MB6247.namprd03.prod.outlook.com \
    --to=ibrahim.tilki@analog.com \
    --cc=Nuno.Sa@analog.com \
    --cc=Nurettin.Bolucu@analog.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.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).