diff mbox series

[RFC,1/4] dt-bindings: iio: adc: ad7380: add adaq4370-4 and adaq4380-4 compatible parts

Message ID 20241015-ad7380-add-adaq4380-4-support-v1-1-d2e1a95fb248@baylibre.com (mailing list archive)
State Changes Requested
Headers show
Series ad7380: add adaq4370-4 and adaq4380-4 support | expand

Commit Message

Julien Stephan Oct. 15, 2024, 9:09 a.m. UTC
adaq4370-4 (2MSPS) and adaq4380-4 (4MSPS) are quad-channel precision data
acquisition signal chain μModule solutions compatible with the ad738x
family, with the following differences:

- configurable gain in front of each 4 adc
- internal reference is 3V derived from refin-supply (5V)
- additional supplies

To configure the gain a new patternProperties is added to describe each
channel. It is restricted to adaq devices.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
---
 .../devicetree/bindings/iio/adc/adi,ad7380.yaml    | 117 +++++++++++++++++++++
 1 file changed, 117 insertions(+)

Comments

Rob Herring (Arm) Oct. 15, 2024, 8:49 p.m. UTC | #1
On Tue, Oct 15, 2024 at 11:09:06AM +0200, Julien Stephan wrote:
> adaq4370-4 (2MSPS) and adaq4380-4 (4MSPS) are quad-channel precision data
> acquisition signal chain μModule solutions compatible with the ad738x
> family, with the following differences:
> 
> - configurable gain in front of each 4 adc
> - internal reference is 3V derived from refin-supply (5V)
> - additional supplies
> 
> To configure the gain a new patternProperties is added to describe each
> channel. It is restricted to adaq devices.
> 
> Signed-off-by: Julien Stephan <jstephan@baylibre.com>
> ---
>  .../devicetree/bindings/iio/adc/adi,ad7380.yaml    | 117 +++++++++++++++++++++
>  1 file changed, 117 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> index 74d82721637c..3007d8e39684 100644
> --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> @@ -25,6 +25,8 @@ description: |
>    * https://www.analog.com/en/products/ad7386-4.html
>    * https://www.analog.com/en/products/ad7387-4.html
>    * https://www.analog.com/en/products/ad7388-4.html
> +  * https://www.analog.com/en/products/adaq4370-4.html
> +  * https://www.analog.com/en/products/adaq4380-4.html
>  
>  
>  $ref: /schemas/spi/spi-peripheral-props.yaml#
> @@ -46,6 +48,8 @@ properties:
>        - adi,ad7386-4
>        - adi,ad7387-4
>        - adi,ad7388-4
> +      - adi,adaq4370-4
> +      - adi,adaq4380-4
>  
>    reg:
>      maxItems: 1
> @@ -59,6 +63,9 @@ properties:
>    vlogic-supply: true
>    refio-supply: true
>    refin-supply: true
> +  vs-p-supply: true
> +  vs-n-supply: true
> +  ldo-supply: true
>  
>    aina-supply:
>      description:
> @@ -86,12 +93,43 @@ properties:
>        specify the ALERT interrupt.
>      maxItems: 1
>  
> +  '#address-cells':
> +    const: 1
> +
> +  '#size-cells':
> +    const: 0
> +
>  required:
>    - compatible
>    - reg
>    - vcc-supply
>    - vlogic-supply
>  
> +patternProperties:
> +  "^channel@([0-3])$":
> +    $ref: adc.yaml
> +    type: object
> +
> +    properties:
> +      reg:
> +        description:
> +          The channel number. From 0 to 3 corresponding to channels A,B,C,D
> +        items:
> +          minimum: 0
> +          maximum: 3

This allows mutiple entries. Is that intended? If so, define the range 
(minItems/maxItems). If not, drop 'items'.

> +
> +      adi,gain-milli:
> +        description:
> +          The hardware gain applied to the ADC input (in milli units).
> +          If not present, default to 1000 (no actual gain applied).
> +        $ref: /schemas/types.yaml#/definitions/uint32

Elsewhere the same property is a uint16. Don't define different types 
for the same property name.


> +        default: 1000

Constraints? minimum/maximum/enum?
Jonathan Cameron Oct. 17, 2024, 6:05 p.m. UTC | #2
On Tue, 15 Oct 2024 11:09:06 +0200
Julien Stephan <jstephan@baylibre.com> wrote:

> adaq4370-4 (2MSPS) and adaq4380-4 (4MSPS) are quad-channel precision data
> acquisition signal chain μModule solutions compatible with the ad738x
> family, with the following differences:
> 
> - configurable gain in front of each 4 adc
> - internal reference is 3V derived from refin-supply (5V)

Now I'm confused. 

The earlier refin-supply change appears unused in this patch.
I was expecting it to be required for the additional devices.
With additions to the docs from the fix to explain the new
cases.  I'm not seeing that in here.


> - additional supplies
> 
> To configure the gain a new patternProperties is added to describe each
> channel. It is restricted to adaq devices.
> 
> Signed-off-by: Julien Stephan <jstephan@baylibre.com>
> ---
>  .../devicetree/bindings/iio/adc/adi,ad7380.yaml    | 117 +++++++++++++++++++++
>  1 file changed, 117 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> index 74d82721637c..3007d8e39684 100644
> --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> @@ -25,6 +25,8 @@ description: |
>    * https://www.analog.com/en/products/ad7386-4.html
>    * https://www.analog.com/en/products/ad7387-4.html
>    * https://www.analog.com/en/products/ad7388-4.html
> +  * https://www.analog.com/en/products/adaq4370-4.html
> +  * https://www.analog.com/en/products/adaq4380-4.html
>  
>  
>  $ref: /schemas/spi/spi-peripheral-props.yaml#
> @@ -46,6 +48,8 @@ properties:
>        - adi,ad7386-4
>        - adi,ad7387-4
>        - adi,ad7388-4
> +      - adi,adaq4370-4
> +      - adi,adaq4380-4
>  
>    reg:
>      maxItems: 1
> @@ -59,6 +63,9 @@ properties:
>    vlogic-supply: true
>    refio-supply: true
>    refin-supply: true
> +  vs-p-supply: true
> +  vs-n-supply: true
> +  ldo-supply: true
>  
>    aina-supply:
>      description:
> @@ -86,12 +93,43 @@ properties:
>        specify the ALERT interrupt.
>      maxItems: 1
>  
> +  '#address-cells':
> +    const: 1
> +
> +  '#size-cells':
> +    const: 0
> +
>  required:
>    - compatible
>    - reg
>    - vcc-supply
>    - vlogic-supply
>  
> +patternProperties:
> +  "^channel@([0-3])$":
> +    $ref: adc.yaml
> +    type: object
> +
> +    properties:
> +      reg:
> +        description:
> +          The channel number. From 0 to 3 corresponding to channels A,B,C,D
> +        items:
> +          minimum: 0
> +          maximum: 3
> +
> +      adi,gain-milli:
> +        description:
> +          The hardware gain applied to the ADC input (in milli units).
> +          If not present, default to 1000 (no actual gain applied).
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +        default: 1000
> +
> +    required:
> +      - reg
> +
> +    additionalProperties: false
> +
>  unevaluatedProperties: false
>  
>  allOf:
> @@ -128,7 +166,21 @@ allOf:
>          ainc-supply: false
>          aind-supply: false
>  
> +  # Using channel to declare gain property only applies to adaq devices
> +  - if:
> +      properties:
> +        compatible:
> +          not:
> +            contains:
> +              enum:
> +                - adi,adaq4370-4
> +                - adi,adaq4380-4
> +    then:
> +      patternProperties:
> +        "^channel@([0-3])$": false
> +
>    # ad7380-4 uses refin-supply as external reference.
> +  # adaq devices use internal reference only, derived from refin-supply
>    # All other chips from ad738x family use refio as optional external reference.
>    # When refio-supply is omitted, internal reference is used.
>    - if:
> @@ -136,6 +188,8 @@ allOf:
>          compatible:
>            enum:
>              - adi,ad7380-4
> +            - adi,adaq4370-4
> +            - adi,adaq4380-4
>      then:
>        properties:
>          refio-supply: false
> @@ -145,6 +199,24 @@ allOf:
>        properties:
>          refin-supply: false
>  
> +  # adaq devices need more supplies
> +  - if:
> +      properties:
> +        compatible:
> +          enum:
> +            - adi,adaq4370-4
> +            - adi,adaq4380-4
> +    then:
> +      required:
> +        - vs-p-supply
> +        - vs-n-supply
> +        - ldo-supply
> +    else:
> +      properties:
> +        vs-p-supply: false
> +        vs-n-supply: false
> +        ldo-supply: false
> +
>  examples:
>    - |
>      #include <dt-bindings/interrupt-controller/irq.h>
> @@ -169,3 +241,48 @@ examples:
>              refio-supply = <&supply_2_5V>;
>          };
>      };
> +
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    spi {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        adc@0 {
> +            compatible = "adi,adaq4380-4";
> +            reg = <0>;
> +
> +            spi-cpol;
> +            spi-cpha;
> +            spi-max-frequency = <80000000>;
> +
> +            interrupts = <27 IRQ_TYPE_EDGE_FALLING>;
> +            interrupt-parent = <&gpio0>;
> +
> +            vcc-supply = <&supply_3_3V>;
> +            vlogic-supply = <&supply_3_3V>;
> +            refin-supply = <&supply_5V>;
> +            vs-p-supply = <&supply_5V>;
> +            vs-n-supply = <&supply_0V>;
> +            ldo-supply = <&supply_5V>;
> +
> +            #address-cells = <1>;
> +            #size-cells = <0>;
> +
> +            channel@0 {
> +                reg = <0>;
> +                adi,gain-milli = <300>;
> +            };
> +
> +            channel@2 {
> +                reg = <2>;
> +                adi,gain-milli = <600>;
> +            };
> +
> +            channel@3 {
> +                reg = <3>;
> +                adi,gain-milli = <1000>;
> +            };
> +        };
> +    };
>
Julien Stephan Oct. 18, 2024, 7:36 a.m. UTC | #3
Le jeu. 17 oct. 2024 à 20:05, Jonathan Cameron <jic23@kernel.org> a écrit :
>
> On Tue, 15 Oct 2024 11:09:06 +0200
> Julien Stephan <jstephan@baylibre.com> wrote:
>
> > adaq4370-4 (2MSPS) and adaq4380-4 (4MSPS) are quad-channel precision data
> > acquisition signal chain μModule solutions compatible with the ad738x
> > family, with the following differences:
> >
> > - configurable gain in front of each 4 adc
> > - internal reference is 3V derived from refin-supply (5V)
>
> Now I'm confused.
>
> The earlier refin-supply change appears unused in this patch.
> I was expecting it to be required for the additional devices.
> With additions to the docs from the fix to explain the new
> cases.  I'm not seeing that in here.
>
>
> > - additional supplies
> >
> > To configure the gain a new patternProperties is added to describe each
> > channel. It is restricted to adaq devices.
> >
> > Signed-off-by: Julien Stephan <jstephan@baylibre.com>
> > ---
> >  .../devicetree/bindings/iio/adc/adi,ad7380.yaml    | 117 +++++++++++++++++++++
> >  1 file changed, 117 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> > index 74d82721637c..3007d8e39684 100644
> > --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> > @@ -25,6 +25,8 @@ description: |
> >    * https://www.analog.com/en/products/ad7386-4.html
> >    * https://www.analog.com/en/products/ad7387-4.html
> >    * https://www.analog.com/en/products/ad7388-4.html
> > +  * https://www.analog.com/en/products/adaq4370-4.html
> > +  * https://www.analog.com/en/products/adaq4380-4.html
> >
> >
> >  $ref: /schemas/spi/spi-peripheral-props.yaml#
> > @@ -46,6 +48,8 @@ properties:
> >        - adi,ad7386-4
> >        - adi,ad7387-4
> >        - adi,ad7388-4
> > +      - adi,adaq4370-4
> > +      - adi,adaq4380-4
> >
> >    reg:
> >      maxItems: 1
> > @@ -59,6 +63,9 @@ properties:
> >    vlogic-supply: true
> >    refio-supply: true
> >    refin-supply: true
> > +  vs-p-supply: true
> > +  vs-n-supply: true
> > +  ldo-supply: true
> >
> >    aina-supply:
> >      description:
> > @@ -86,12 +93,43 @@ properties:
> >        specify the ALERT interrupt.
> >      maxItems: 1
> >
> > +  '#address-cells':
> > +    const: 1
> > +
> > +  '#size-cells':
> > +    const: 0
> > +
> >  required:
> >    - compatible
> >    - reg
> >    - vcc-supply
> >    - vlogic-supply
> >
> > +patternProperties:
> > +  "^channel@([0-3])$":
> > +    $ref: adc.yaml
> > +    type: object
> > +
> > +    properties:
> > +      reg:
> > +        description:
> > +          The channel number. From 0 to 3 corresponding to channels A,B,C,D
> > +        items:
> > +          minimum: 0
> > +          maximum: 3
> > +
> > +      adi,gain-milli:
> > +        description:
> > +          The hardware gain applied to the ADC input (in milli units).
> > +          If not present, default to 1000 (no actual gain applied).
> > +        $ref: /schemas/types.yaml#/definitions/uint32
> > +        default: 1000
> > +
> > +    required:
> > +      - reg
> > +
> > +    additionalProperties: false
> > +
> >  unevaluatedProperties: false
> >
> >  allOf:
> > @@ -128,7 +166,21 @@ allOf:
> >          ainc-supply: false
> >          aind-supply: false
> >
> > +  # Using channel to declare gain property only applies to adaq devices
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          not:
> > +            contains:
> > +              enum:
> > +                - adi,adaq4370-4
> > +                - adi,adaq4380-4
> > +    then:
> > +      patternProperties:
> > +        "^channel@([0-3])$": false
> > +
> >    # ad7380-4 uses refin-supply as external reference.
> > +  # adaq devices use internal reference only, derived from refin-supply

Hi Jonathan,

here I add a quick description on how adaq devices are using refin-supply ...

> >    # All other chips from ad738x family use refio as optional external reference.
> >    # When refio-supply is omitted, internal reference is used.
> >    - if:
> > @@ -136,6 +188,8 @@ allOf:
> >          compatible:
> >            enum:
> >              - adi,ad7380-4
> > +            - adi,adaq4370-4
> > +            - adi,adaq4380-4

... and adaq devices are added here to require refin-supply.

Maybe I am missing your point? or I still need to improve the description?

Cheers
Julien

> >      then:
> >        properties:
> >          refio-supply: false
> > @@ -145,6 +199,24 @@ allOf:
> >        properties:
> >          refin-supply: false
> >
> > +  # adaq devices need more supplies
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          enum:
> > +            - adi,adaq4370-4
> > +            - adi,adaq4380-4
> > +    then:
> > +      required:
> > +        - vs-p-supply
> > +        - vs-n-supply
> > +        - ldo-supply
> > +    else:
> > +      properties:
> > +        vs-p-supply: false
> > +        vs-n-supply: false
> > +        ldo-supply: false
> > +
> >  examples:
> >    - |
> >      #include <dt-bindings/interrupt-controller/irq.h>
> > @@ -169,3 +241,48 @@ examples:
> >              refio-supply = <&supply_2_5V>;
> >          };
> >      };
> > +
> > +  - |
> > +    #include <dt-bindings/interrupt-controller/irq.h>
> > +
> > +    spi {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        adc@0 {
> > +            compatible = "adi,adaq4380-4";
> > +            reg = <0>;
> > +
> > +            spi-cpol;
> > +            spi-cpha;
> > +            spi-max-frequency = <80000000>;
> > +
> > +            interrupts = <27 IRQ_TYPE_EDGE_FALLING>;
> > +            interrupt-parent = <&gpio0>;
> > +
> > +            vcc-supply = <&supply_3_3V>;
> > +            vlogic-supply = <&supply_3_3V>;
> > +            refin-supply = <&supply_5V>;
> > +            vs-p-supply = <&supply_5V>;
> > +            vs-n-supply = <&supply_0V>;
> > +            ldo-supply = <&supply_5V>;
> > +
> > +            #address-cells = <1>;
> > +            #size-cells = <0>;
> > +
> > +            channel@0 {
> > +                reg = <0>;
> > +                adi,gain-milli = <300>;
> > +            };
> > +
> > +            channel@2 {
> > +                reg = <2>;
> > +                adi,gain-milli = <600>;
> > +            };
> > +
> > +            channel@3 {
> > +                reg = <3>;
> > +                adi,gain-milli = <1000>;
> > +            };
> > +        };
> > +    };
> >
>
Jonathan Cameron Oct. 18, 2024, 6:09 p.m. UTC | #4
On Fri, 18 Oct 2024 09:36:52 +0200
Julien Stephan <jstephan@baylibre.com> wrote:

> Le jeu. 17 oct. 2024 à 20:05, Jonathan Cameron <jic23@kernel.org> a écrit :
> >
> > On Tue, 15 Oct 2024 11:09:06 +0200
> > Julien Stephan <jstephan@baylibre.com> wrote:
> >  
> > > adaq4370-4 (2MSPS) and adaq4380-4 (4MSPS) are quad-channel precision data
> > > acquisition signal chain μModule solutions compatible with the ad738x
> > > family, with the following differences:
> > >
> > > - configurable gain in front of each 4 adc
> > > - internal reference is 3V derived from refin-supply (5V)  
> >
> > Now I'm confused.
> >
> > The earlier refin-supply change appears unused in this patch.
> > I was expecting it to be required for the additional devices.
> > With additions to the docs from the fix to explain the new
> > cases.  I'm not seeing that in here.
> >
> >  
> > > - additional supplies
> > >
> > > To configure the gain a new patternProperties is added to describe each
> > > channel. It is restricted to adaq devices.
> > >
> > > Signed-off-by: Julien Stephan <jstephan@baylibre.com>
> > > ---
> > >  .../devicetree/bindings/iio/adc/adi,ad7380.yaml    | 117 +++++++++++++++++++++
> > >  1 file changed, 117 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> > > index 74d82721637c..3007d8e39684 100644
> > > --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> > > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> > > @@ -25,6 +25,8 @@ description: |
> > >    * https://www.analog.com/en/products/ad7386-4.html
> > >    * https://www.analog.com/en/products/ad7387-4.html
> > >    * https://www.analog.com/en/products/ad7388-4.html
> > > +  * https://www.analog.com/en/products/adaq4370-4.html
> > > +  * https://www.analog.com/en/products/adaq4380-4.html
> > >
> > >
> > >  $ref: /schemas/spi/spi-peripheral-props.yaml#
> > > @@ -46,6 +48,8 @@ properties:
> > >        - adi,ad7386-4
> > >        - adi,ad7387-4
> > >        - adi,ad7388-4
> > > +      - adi,adaq4370-4
> > > +      - adi,adaq4380-4
> > >
> > >    reg:
> > >      maxItems: 1
> > > @@ -59,6 +63,9 @@ properties:
> > >    vlogic-supply: true
> > >    refio-supply: true
> > >    refin-supply: true
> > > +  vs-p-supply: true
> > > +  vs-n-supply: true
> > > +  ldo-supply: true
> > >
> > >    aina-supply:
> > >      description:
> > > @@ -86,12 +93,43 @@ properties:
> > >        specify the ALERT interrupt.
> > >      maxItems: 1
> > >
> > > +  '#address-cells':
> > > +    const: 1
> > > +
> > > +  '#size-cells':
> > > +    const: 0
> > > +
> > >  required:
> > >    - compatible
> > >    - reg
> > >    - vcc-supply
> > >    - vlogic-supply
> > >
> > > +patternProperties:
> > > +  "^channel@([0-3])$":
> > > +    $ref: adc.yaml
> > > +    type: object
> > > +
> > > +    properties:
> > > +      reg:
> > > +        description:
> > > +          The channel number. From 0 to 3 corresponding to channels A,B,C,D
> > > +        items:
> > > +          minimum: 0
> > > +          maximum: 3
> > > +
> > > +      adi,gain-milli:
> > > +        description:
> > > +          The hardware gain applied to the ADC input (in milli units).
> > > +          If not present, default to 1000 (no actual gain applied).
> > > +        $ref: /schemas/types.yaml#/definitions/uint32
> > > +        default: 1000
> > > +
> > > +    required:
> > > +      - reg
> > > +
> > > +    additionalProperties: false
> > > +
> > >  unevaluatedProperties: false
> > >
> > >  allOf:
> > > @@ -128,7 +166,21 @@ allOf:
> > >          ainc-supply: false
> > >          aind-supply: false
> > >
> > > +  # Using channel to declare gain property only applies to adaq devices
> > > +  - if:
> > > +      properties:
> > > +        compatible:
> > > +          not:
> > > +            contains:
> > > +              enum:
> > > +                - adi,adaq4370-4
> > > +                - adi,adaq4380-4
> > > +    then:
> > > +      patternProperties:
> > > +        "^channel@([0-3])$": false
> > > +
> > >    # ad7380-4 uses refin-supply as external reference.
> > > +  # adaq devices use internal reference only, derived from refin-supply  
> 
> Hi Jonathan,
> 
> here I add a quick description on how adaq devices are using refin-supply ...
> 
> > >    # All other chips from ad738x family use refio as optional external reference.
> > >    # When refio-supply is omitted, internal reference is used.
> > >    - if:
> > > @@ -136,6 +188,8 @@ allOf:
> > >          compatible:
> > >            enum:
> > >              - adi,ad7380-4
> > > +            - adi,adaq4370-4
> > > +            - adi,adaq4380-4  
> 
> ... and adaq devices are added here to require refin-supply.
> 
> Maybe I am missing your point? or I still need to improve the description?
Nope. I just misread the diff!  Thanks for pointing out the key bits.

Jonathan

> 
> Cheers
> Julien
> 
> > >      then:
> > >        properties:
> > >          refio-supply: false
> > > @@ -145,6 +199,24 @@ allOf:
> > >        properties:
> > >          refin-supply: false
> > >
> > > +  # adaq devices need more supplies
> > > +  - if:
> > > +      properties:
> > > +        compatible:
> > > +          enum:
> > > +            - adi,adaq4370-4
> > > +            - adi,adaq4380-4
> > > +    then:
> > > +      required:
> > > +        - vs-p-supply
> > > +        - vs-n-supply
> > > +        - ldo-supply
> > > +    else:
> > > +      properties:
> > > +        vs-p-supply: false
> > > +        vs-n-supply: false
> > > +        ldo-supply: false
> > > +
> > >  examples:
> > >    - |
> > >      #include <dt-bindings/interrupt-controller/irq.h>
> > > @@ -169,3 +241,48 @@ examples:
> > >              refio-supply = <&supply_2_5V>;
> > >          };
> > >      };
> > > +
> > > +  - |
> > > +    #include <dt-bindings/interrupt-controller/irq.h>
> > > +
> > > +    spi {
> > > +        #address-cells = <1>;
> > > +        #size-cells = <0>;
> > > +
> > > +        adc@0 {
> > > +            compatible = "adi,adaq4380-4";
> > > +            reg = <0>;
> > > +
> > > +            spi-cpol;
> > > +            spi-cpha;
> > > +            spi-max-frequency = <80000000>;
> > > +
> > > +            interrupts = <27 IRQ_TYPE_EDGE_FALLING>;
> > > +            interrupt-parent = <&gpio0>;
> > > +
> > > +            vcc-supply = <&supply_3_3V>;
> > > +            vlogic-supply = <&supply_3_3V>;
> > > +            refin-supply = <&supply_5V>;
> > > +            vs-p-supply = <&supply_5V>;
> > > +            vs-n-supply = <&supply_0V>;
> > > +            ldo-supply = <&supply_5V>;
> > > +
> > > +            #address-cells = <1>;
> > > +            #size-cells = <0>;
> > > +
> > > +            channel@0 {
> > > +                reg = <0>;
> > > +                adi,gain-milli = <300>;
> > > +            };
> > > +
> > > +            channel@2 {
> > > +                reg = <2>;
> > > +                adi,gain-milli = <600>;
> > > +            };
> > > +
> > > +            channel@3 {
> > > +                reg = <3>;
> > > +                adi,gain-milli = <1000>;
> > > +            };
> > > +        };
> > > +    };
> > >  
> >
Jonathan Cameron Oct. 20, 2024, 1:20 p.m. UTC | #5
On Tue, 15 Oct 2024 11:09:06 +0200
Julien Stephan <jstephan@baylibre.com> wrote:

> adaq4370-4 (2MSPS) and adaq4380-4 (4MSPS) are quad-channel precision data
> acquisition signal chain μModule solutions compatible with the ad738x
> family, with the following differences:
> 
> - configurable gain in front of each 4 adc
As per quick review I gave for the driver code, I'm not seeing why
a configurable gain is a DT thing on an ADC vs something that belongs
in userspace control.  I may be missing something though.

It exists for the ad4000 because the control isn't via registers
but via pin straps so we can't control it sensibly from userspace.

Jonathan

> - internal reference is 3V derived from refin-supply (5V)
> - additional supplies
> 
> To configure the gain a new patternProperties is added to describe each
> channel. It is restricted to adaq devices.
> 
> Signed-off-by: Julien Stephan <jstephan@baylibre.com>
> ---
>  .../devicetree/bindings/iio/adc/adi,ad7380.yaml    | 117 +++++++++++++++++++++
>  1 file changed, 117 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> index 74d82721637c..3007d8e39684 100644
> --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> @@ -25,6 +25,8 @@ description: |
>    * https://www.analog.com/en/products/ad7386-4.html
>    * https://www.analog.com/en/products/ad7387-4.html
>    * https://www.analog.com/en/products/ad7388-4.html
> +  * https://www.analog.com/en/products/adaq4370-4.html
> +  * https://www.analog.com/en/products/adaq4380-4.html
>  
>  
>  $ref: /schemas/spi/spi-peripheral-props.yaml#
> @@ -46,6 +48,8 @@ properties:
>        - adi,ad7386-4
>        - adi,ad7387-4
>        - adi,ad7388-4
> +      - adi,adaq4370-4
> +      - adi,adaq4380-4
>  
>    reg:
>      maxItems: 1
> @@ -59,6 +63,9 @@ properties:
>    vlogic-supply: true
>    refio-supply: true
>    refin-supply: true
> +  vs-p-supply: true
> +  vs-n-supply: true
> +  ldo-supply: true
>  
>    aina-supply:
>      description:
> @@ -86,12 +93,43 @@ properties:
>        specify the ALERT interrupt.
>      maxItems: 1
>  
> +  '#address-cells':
> +    const: 1
> +
> +  '#size-cells':
> +    const: 0
> +
>  required:
>    - compatible
>    - reg
>    - vcc-supply
>    - vlogic-supply
>  
> +patternProperties:
> +  "^channel@([0-3])$":
> +    $ref: adc.yaml
> +    type: object
> +
> +    properties:
> +      reg:
> +        description:
> +          The channel number. From 0 to 3 corresponding to channels A,B,C,D
> +        items:
> +          minimum: 0
> +          maximum: 3
> +
> +      adi,gain-milli:
> +        description:
> +          The hardware gain applied to the ADC input (in milli units).
> +          If not present, default to 1000 (no actual gain applied).
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +        default: 1000
> +
> +    required:
> +      - reg
> +
> +    additionalProperties: false
> +
>  unevaluatedProperties: false
>  
>  allOf:
> @@ -128,7 +166,21 @@ allOf:
>          ainc-supply: false
>          aind-supply: false
>  
> +  # Using channel to declare gain property only applies to adaq devices
> +  - if:
> +      properties:
> +        compatible:
> +          not:
> +            contains:
> +              enum:
> +                - adi,adaq4370-4
> +                - adi,adaq4380-4
> +    then:
> +      patternProperties:
> +        "^channel@([0-3])$": false
> +
>    # ad7380-4 uses refin-supply as external reference.
> +  # adaq devices use internal reference only, derived from refin-supply
>    # All other chips from ad738x family use refio as optional external reference.
>    # When refio-supply is omitted, internal reference is used.
>    - if:
> @@ -136,6 +188,8 @@ allOf:
>          compatible:
>            enum:
>              - adi,ad7380-4
> +            - adi,adaq4370-4
> +            - adi,adaq4380-4
>      then:
>        properties:
>          refio-supply: false
> @@ -145,6 +199,24 @@ allOf:
>        properties:
>          refin-supply: false
>  
> +  # adaq devices need more supplies
> +  - if:
> +      properties:
> +        compatible:
> +          enum:
> +            - adi,adaq4370-4
> +            - adi,adaq4380-4
> +    then:
> +      required:
> +        - vs-p-supply
> +        - vs-n-supply
> +        - ldo-supply
> +    else:
> +      properties:
> +        vs-p-supply: false
> +        vs-n-supply: false
> +        ldo-supply: false
> +
>  examples:
>    - |
>      #include <dt-bindings/interrupt-controller/irq.h>
> @@ -169,3 +241,48 @@ examples:
>              refio-supply = <&supply_2_5V>;
>          };
>      };
> +
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    spi {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        adc@0 {
> +            compatible = "adi,adaq4380-4";
> +            reg = <0>;
> +
> +            spi-cpol;
> +            spi-cpha;
> +            spi-max-frequency = <80000000>;
> +
> +            interrupts = <27 IRQ_TYPE_EDGE_FALLING>;
> +            interrupt-parent = <&gpio0>;
> +
> +            vcc-supply = <&supply_3_3V>;
> +            vlogic-supply = <&supply_3_3V>;
> +            refin-supply = <&supply_5V>;
> +            vs-p-supply = <&supply_5V>;
> +            vs-n-supply = <&supply_0V>;
> +            ldo-supply = <&supply_5V>;
> +
> +            #address-cells = <1>;
> +            #size-cells = <0>;
> +
> +            channel@0 {
> +                reg = <0>;
> +                adi,gain-milli = <300>;
> +            };
> +
> +            channel@2 {
> +                reg = <2>;
> +                adi,gain-milli = <600>;
> +            };
> +
> +            channel@3 {
> +                reg = <3>;
> +                adi,gain-milli = <1000>;
> +            };
> +        };
> +    };
>
Julien Stephan Oct. 21, 2024, 1:25 p.m. UTC | #6
Le dim. 20 oct. 2024 à 15:21, Jonathan Cameron <jic23@kernel.org> a écrit :
>
> On Tue, 15 Oct 2024 11:09:06 +0200
> Julien Stephan <jstephan@baylibre.com> wrote:
>
> > adaq4370-4 (2MSPS) and adaq4380-4 (4MSPS) are quad-channel precision data
> > acquisition signal chain μModule solutions compatible with the ad738x
> > family, with the following differences:
> >
> > - configurable gain in front of each 4 adc
> As per quick review I gave for the driver code, I'm not seeing why
> a configurable gain is a DT thing on an ADC vs something that belongs
> in userspace control.  I may be missing something though.
>
> It exists for the ad4000 because the control isn't via registers
> but via pin straps so we can't control it sensibly from userspace.


Hi Jonathan,
I indeed based my work on ad4000. I think my commit description is
erroneous and confusing.
On the first page of the datasheet
(https://www.analog.com/media/en/technical-documentation/data-sheets/adaq4380-4.pdf)
it's written : Pin selectable Gain/attenuation. So I guess adaq4380-4
and adaq4370-4 are working the same way as the adaq4000 series.
I'll rewrite my commit message. Also, I didn't want to restrict users
to the gain values in the datasheet, because I thought they are just
examples and users can always use additional resistance to change the
gain. Am I correct? Or should I use the datasheet values (as adaq4000
series does) ?

Cheers
Julien

>
> Jonathan
>
> > - internal reference is 3V derived from refin-supply (5V)
> > - additional supplies
> >
> > To configure the gain a new patternProperties is added to describe each
> > channel. It is restricted to adaq devices.
> >
> > Signed-off-by: Julien Stephan <jstephan@baylibre.com>
> > ---
> >  .../devicetree/bindings/iio/adc/adi,ad7380.yaml    | 117 +++++++++++++++++++++
> >  1 file changed, 117 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> > index 74d82721637c..3007d8e39684 100644
> > --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> > @@ -25,6 +25,8 @@ description: |
> >    * https://www.analog.com/en/products/ad7386-4.html
> >    * https://www.analog.com/en/products/ad7387-4.html
> >    * https://www.analog.com/en/products/ad7388-4.html
> > +  * https://www.analog.com/en/products/adaq4370-4.html
> > +  * https://www.analog.com/en/products/adaq4380-4.html
> >
> >
> >  $ref: /schemas/spi/spi-peripheral-props.yaml#
> > @@ -46,6 +48,8 @@ properties:
> >        - adi,ad7386-4
> >        - adi,ad7387-4
> >        - adi,ad7388-4
> > +      - adi,adaq4370-4
> > +      - adi,adaq4380-4
> >
> >    reg:
> >      maxItems: 1
> > @@ -59,6 +63,9 @@ properties:
> >    vlogic-supply: true
> >    refio-supply: true
> >    refin-supply: true
> > +  vs-p-supply: true
> > +  vs-n-supply: true
> > +  ldo-supply: true
> >
> >    aina-supply:
> >      description:
> > @@ -86,12 +93,43 @@ properties:
> >        specify the ALERT interrupt.
> >      maxItems: 1
> >
> > +  '#address-cells':
> > +    const: 1
> > +
> > +  '#size-cells':
> > +    const: 0
> > +
> >  required:
> >    - compatible
> >    - reg
> >    - vcc-supply
> >    - vlogic-supply
> >
> > +patternProperties:
> > +  "^channel@([0-3])$":
> > +    $ref: adc.yaml
> > +    type: object
> > +
> > +    properties:
> > +      reg:
> > +        description:
> > +          The channel number. From 0 to 3 corresponding to channels A,B,C,D
> > +        items:
> > +          minimum: 0
> > +          maximum: 3
> > +
> > +      adi,gain-milli:
> > +        description:
> > +          The hardware gain applied to the ADC input (in milli units).
> > +          If not present, default to 1000 (no actual gain applied).
> > +        $ref: /schemas/types.yaml#/definitions/uint32
> > +        default: 1000
> > +
> > +    required:
> > +      - reg
> > +
> > +    additionalProperties: false
> > +
> >  unevaluatedProperties: false
> >
> >  allOf:
> > @@ -128,7 +166,21 @@ allOf:
> >          ainc-supply: false
> >          aind-supply: false
> >
> > +  # Using channel to declare gain property only applies to adaq devices
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          not:
> > +            contains:
> > +              enum:
> > +                - adi,adaq4370-4
> > +                - adi,adaq4380-4
> > +    then:
> > +      patternProperties:
> > +        "^channel@([0-3])$": false
> > +
> >    # ad7380-4 uses refin-supply as external reference.
> > +  # adaq devices use internal reference only, derived from refin-supply
> >    # All other chips from ad738x family use refio as optional external reference.
> >    # When refio-supply is omitted, internal reference is used.
> >    - if:
> > @@ -136,6 +188,8 @@ allOf:
> >          compatible:
> >            enum:
> >              - adi,ad7380-4
> > +            - adi,adaq4370-4
> > +            - adi,adaq4380-4
> >      then:
> >        properties:
> >          refio-supply: false
> > @@ -145,6 +199,24 @@ allOf:
> >        properties:
> >          refin-supply: false
> >
> > +  # adaq devices need more supplies
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          enum:
> > +            - adi,adaq4370-4
> > +            - adi,adaq4380-4
> > +    then:
> > +      required:
> > +        - vs-p-supply
> > +        - vs-n-supply
> > +        - ldo-supply
> > +    else:
> > +      properties:
> > +        vs-p-supply: false
> > +        vs-n-supply: false
> > +        ldo-supply: false
> > +
> >  examples:
> >    - |
> >      #include <dt-bindings/interrupt-controller/irq.h>
> > @@ -169,3 +241,48 @@ examples:
> >              refio-supply = <&supply_2_5V>;
> >          };
> >      };
> > +
> > +  - |
> > +    #include <dt-bindings/interrupt-controller/irq.h>
> > +
> > +    spi {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        adc@0 {
> > +            compatible = "adi,adaq4380-4";
> > +            reg = <0>;
> > +
> > +            spi-cpol;
> > +            spi-cpha;
> > +            spi-max-frequency = <80000000>;
> > +
> > +            interrupts = <27 IRQ_TYPE_EDGE_FALLING>;
> > +            interrupt-parent = <&gpio0>;
> > +
> > +            vcc-supply = <&supply_3_3V>;
> > +            vlogic-supply = <&supply_3_3V>;
> > +            refin-supply = <&supply_5V>;
> > +            vs-p-supply = <&supply_5V>;
> > +            vs-n-supply = <&supply_0V>;
> > +            ldo-supply = <&supply_5V>;
> > +
> > +            #address-cells = <1>;
> > +            #size-cells = <0>;
> > +
> > +            channel@0 {
> > +                reg = <0>;
> > +                adi,gain-milli = <300>;
> > +            };
> > +
> > +            channel@2 {
> > +                reg = <2>;
> > +                adi,gain-milli = <600>;
> > +            };
> > +
> > +            channel@3 {
> > +                reg = <3>;
> > +                adi,gain-milli = <1000>;
> > +            };
> > +        };
> > +    };
> >
>
Jonathan Cameron Oct. 21, 2024, 6:17 p.m. UTC | #7
On Mon, 21 Oct 2024 15:25:23 +0200
Julien Stephan <jstephan@baylibre.com> wrote:

> Le dim. 20 oct. 2024 à 15:21, Jonathan Cameron <jic23@kernel.org> a écrit :
> >
> > On Tue, 15 Oct 2024 11:09:06 +0200
> > Julien Stephan <jstephan@baylibre.com> wrote:
> >  
> > > adaq4370-4 (2MSPS) and adaq4380-4 (4MSPS) are quad-channel precision data
> > > acquisition signal chain μModule solutions compatible with the ad738x
> > > family, with the following differences:
> > >
> > > - configurable gain in front of each 4 adc  
> > As per quick review I gave for the driver code, I'm not seeing why
> > a configurable gain is a DT thing on an ADC vs something that belongs
> > in userspace control.  I may be missing something though.
> >
> > It exists for the ad4000 because the control isn't via registers
> > but via pin straps so we can't control it sensibly from userspace.  
> 
> 
> Hi Jonathan,
> I indeed based my work on ad4000. I think my commit description is
> erroneous and confusing.
> On the first page of the datasheet
> (https://www.analog.com/media/en/technical-documentation/data-sheets/adaq4380-4.pdf)
> it's written : Pin selectable Gain/attenuation. So I guess adaq4380-4
> and adaq4370-4 are working the same way as the adaq4000 series.
> I'll rewrite my commit message. Also, I didn't want to restrict users
> to the gain values in the datasheet, because I thought they are just
> examples and users can always use additional resistance to change the
> gain. Am I correct? Or should I use the datasheet values (as adaq4000
> series does) ?
Ah. Now seeing how this works.

Hmm. For completely external circuitry we have the various analog front
end drivers that act as a consumer of an ADC.  For this case it is messier
as there are internal resistors.  However I don't immediately see examples
of using external registers to some of the pins and not others.
So I'd be inclined to just allow the pin strap values as show in figure
50 to 55. 

So I'd just add docs to give the pin wiring as well as the gain.
Afterall DT writer probably has a circuit diagram, not a statement
of the gain of that circuit.

Jonathan


> 
> Cheers
> Julien
> 
> >
> > Jonathan
> >  
> > > - internal reference is 3V derived from refin-supply (5V)
> > > - additional supplies
> > >
> > > To configure the gain a new patternProperties is added to describe each
> > > channel. It is restricted to adaq devices.
> > >
> > > Signed-off-by: Julien Stephan <jstephan@baylibre.com>
> > > ---
> > >  .../devicetree/bindings/iio/adc/adi,ad7380.yaml    | 117 +++++++++++++++++++++
> > >  1 file changed, 117 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> > > index 74d82721637c..3007d8e39684 100644
> > > --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> > > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
> > > @@ -25,6 +25,8 @@ description: |
> > >    * https://www.analog.com/en/products/ad7386-4.html
> > >    * https://www.analog.com/en/products/ad7387-4.html
> > >    * https://www.analog.com/en/products/ad7388-4.html
> > > +  * https://www.analog.com/en/products/adaq4370-4.html
> > > +  * https://www.analog.com/en/products/adaq4380-4.html
> > >
> > >
> > >  $ref: /schemas/spi/spi-peripheral-props.yaml#
> > > @@ -46,6 +48,8 @@ properties:
> > >        - adi,ad7386-4
> > >        - adi,ad7387-4
> > >        - adi,ad7388-4
> > > +      - adi,adaq4370-4
> > > +      - adi,adaq4380-4
> > >
> > >    reg:
> > >      maxItems: 1
> > > @@ -59,6 +63,9 @@ properties:
> > >    vlogic-supply: true
> > >    refio-supply: true
> > >    refin-supply: true
> > > +  vs-p-supply: true
> > > +  vs-n-supply: true
> > > +  ldo-supply: true
> > >
> > >    aina-supply:
> > >      description:
> > > @@ -86,12 +93,43 @@ properties:
> > >        specify the ALERT interrupt.
> > >      maxItems: 1
> > >
> > > +  '#address-cells':
> > > +    const: 1
> > > +
> > > +  '#size-cells':
> > > +    const: 0
> > > +
> > >  required:
> > >    - compatible
> > >    - reg
> > >    - vcc-supply
> > >    - vlogic-supply
> > >
> > > +patternProperties:
> > > +  "^channel@([0-3])$":
> > > +    $ref: adc.yaml
> > > +    type: object
> > > +
> > > +    properties:
> > > +      reg:
> > > +        description:
> > > +          The channel number. From 0 to 3 corresponding to channels A,B,C,D
> > > +        items:
> > > +          minimum: 0
> > > +          maximum: 3
> > > +
> > > +      adi,gain-milli:
> > > +        description:
> > > +          The hardware gain applied to the ADC input (in milli units).
> > > +          If not present, default to 1000 (no actual gain applied).
> > > +        $ref: /schemas/types.yaml#/definitions/uint32
> > > +        default: 1000
> > > +
> > > +    required:
> > > +      - reg
> > > +
> > > +    additionalProperties: false
> > > +
> > >  unevaluatedProperties: false
> > >
> > >  allOf:
> > > @@ -128,7 +166,21 @@ allOf:
> > >          ainc-supply: false
> > >          aind-supply: false
> > >
> > > +  # Using channel to declare gain property only applies to adaq devices
> > > +  - if:
> > > +      properties:
> > > +        compatible:
> > > +          not:
> > > +            contains:
> > > +              enum:
> > > +                - adi,adaq4370-4
> > > +                - adi,adaq4380-4
> > > +    then:
> > > +      patternProperties:
> > > +        "^channel@([0-3])$": false
> > > +
> > >    # ad7380-4 uses refin-supply as external reference.
> > > +  # adaq devices use internal reference only, derived from refin-supply
> > >    # All other chips from ad738x family use refio as optional external reference.
> > >    # When refio-supply is omitted, internal reference is used.
> > >    - if:
> > > @@ -136,6 +188,8 @@ allOf:
> > >          compatible:
> > >            enum:
> > >              - adi,ad7380-4
> > > +            - adi,adaq4370-4
> > > +            - adi,adaq4380-4
> > >      then:
> > >        properties:
> > >          refio-supply: false
> > > @@ -145,6 +199,24 @@ allOf:
> > >        properties:
> > >          refin-supply: false
> > >
> > > +  # adaq devices need more supplies
> > > +  - if:
> > > +      properties:
> > > +        compatible:
> > > +          enum:
> > > +            - adi,adaq4370-4
> > > +            - adi,adaq4380-4
> > > +    then:
> > > +      required:
> > > +        - vs-p-supply
> > > +        - vs-n-supply
> > > +        - ldo-supply
> > > +    else:
> > > +      properties:
> > > +        vs-p-supply: false
> > > +        vs-n-supply: false
> > > +        ldo-supply: false
> > > +
> > >  examples:
> > >    - |
> > >      #include <dt-bindings/interrupt-controller/irq.h>
> > > @@ -169,3 +241,48 @@ examples:
> > >              refio-supply = <&supply_2_5V>;
> > >          };
> > >      };
> > > +
> > > +  - |
> > > +    #include <dt-bindings/interrupt-controller/irq.h>
> > > +
> > > +    spi {
> > > +        #address-cells = <1>;
> > > +        #size-cells = <0>;
> > > +
> > > +        adc@0 {
> > > +            compatible = "adi,adaq4380-4";
> > > +            reg = <0>;
> > > +
> > > +            spi-cpol;
> > > +            spi-cpha;
> > > +            spi-max-frequency = <80000000>;
> > > +
> > > +            interrupts = <27 IRQ_TYPE_EDGE_FALLING>;
> > > +            interrupt-parent = <&gpio0>;
> > > +
> > > +            vcc-supply = <&supply_3_3V>;
> > > +            vlogic-supply = <&supply_3_3V>;
> > > +            refin-supply = <&supply_5V>;
> > > +            vs-p-supply = <&supply_5V>;
> > > +            vs-n-supply = <&supply_0V>;
> > > +            ldo-supply = <&supply_5V>;
> > > +
> > > +            #address-cells = <1>;
> > > +            #size-cells = <0>;
> > > +
> > > +            channel@0 {
> > > +                reg = <0>;
> > > +                adi,gain-milli = <300>;
> > > +            };
> > > +
> > > +            channel@2 {
> > > +                reg = <2>;
> > > +                adi,gain-milli = <600>;
> > > +            };
> > > +
> > > +            channel@3 {
> > > +                reg = <3>;
> > > +                adi,gain-milli = <1000>;
> > > +            };
> > > +        };
> > > +    };
> > >  
> >
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
index 74d82721637c..3007d8e39684 100644
--- a/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7380.yaml
@@ -25,6 +25,8 @@  description: |
   * https://www.analog.com/en/products/ad7386-4.html
   * https://www.analog.com/en/products/ad7387-4.html
   * https://www.analog.com/en/products/ad7388-4.html
+  * https://www.analog.com/en/products/adaq4370-4.html
+  * https://www.analog.com/en/products/adaq4380-4.html
 
 
 $ref: /schemas/spi/spi-peripheral-props.yaml#
@@ -46,6 +48,8 @@  properties:
       - adi,ad7386-4
       - adi,ad7387-4
       - adi,ad7388-4
+      - adi,adaq4370-4
+      - adi,adaq4380-4
 
   reg:
     maxItems: 1
@@ -59,6 +63,9 @@  properties:
   vlogic-supply: true
   refio-supply: true
   refin-supply: true
+  vs-p-supply: true
+  vs-n-supply: true
+  ldo-supply: true
 
   aina-supply:
     description:
@@ -86,12 +93,43 @@  properties:
       specify the ALERT interrupt.
     maxItems: 1
 
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
 required:
   - compatible
   - reg
   - vcc-supply
   - vlogic-supply
 
+patternProperties:
+  "^channel@([0-3])$":
+    $ref: adc.yaml
+    type: object
+
+    properties:
+      reg:
+        description:
+          The channel number. From 0 to 3 corresponding to channels A,B,C,D
+        items:
+          minimum: 0
+          maximum: 3
+
+      adi,gain-milli:
+        description:
+          The hardware gain applied to the ADC input (in milli units).
+          If not present, default to 1000 (no actual gain applied).
+        $ref: /schemas/types.yaml#/definitions/uint32
+        default: 1000
+
+    required:
+      - reg
+
+    additionalProperties: false
+
 unevaluatedProperties: false
 
 allOf:
@@ -128,7 +166,21 @@  allOf:
         ainc-supply: false
         aind-supply: false
 
+  # Using channel to declare gain property only applies to adaq devices
+  - if:
+      properties:
+        compatible:
+          not:
+            contains:
+              enum:
+                - adi,adaq4370-4
+                - adi,adaq4380-4
+    then:
+      patternProperties:
+        "^channel@([0-3])$": false
+
   # ad7380-4 uses refin-supply as external reference.
+  # adaq devices use internal reference only, derived from refin-supply
   # All other chips from ad738x family use refio as optional external reference.
   # When refio-supply is omitted, internal reference is used.
   - if:
@@ -136,6 +188,8 @@  allOf:
         compatible:
           enum:
             - adi,ad7380-4
+            - adi,adaq4370-4
+            - adi,adaq4380-4
     then:
       properties:
         refio-supply: false
@@ -145,6 +199,24 @@  allOf:
       properties:
         refin-supply: false
 
+  # adaq devices need more supplies
+  - if:
+      properties:
+        compatible:
+          enum:
+            - adi,adaq4370-4
+            - adi,adaq4380-4
+    then:
+      required:
+        - vs-p-supply
+        - vs-n-supply
+        - ldo-supply
+    else:
+      properties:
+        vs-p-supply: false
+        vs-n-supply: false
+        ldo-supply: false
+
 examples:
   - |
     #include <dt-bindings/interrupt-controller/irq.h>
@@ -169,3 +241,48 @@  examples:
             refio-supply = <&supply_2_5V>;
         };
     };
+
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        adc@0 {
+            compatible = "adi,adaq4380-4";
+            reg = <0>;
+
+            spi-cpol;
+            spi-cpha;
+            spi-max-frequency = <80000000>;
+
+            interrupts = <27 IRQ_TYPE_EDGE_FALLING>;
+            interrupt-parent = <&gpio0>;
+
+            vcc-supply = <&supply_3_3V>;
+            vlogic-supply = <&supply_3_3V>;
+            refin-supply = <&supply_5V>;
+            vs-p-supply = <&supply_5V>;
+            vs-n-supply = <&supply_0V>;
+            ldo-supply = <&supply_5V>;
+
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            channel@0 {
+                reg = <0>;
+                adi,gain-milli = <300>;
+            };
+
+            channel@2 {
+                reg = <2>;
+                adi,gain-milli = <600>;
+            };
+
+            channel@3 {
+                reg = <3>;
+                adi,gain-milli = <1000>;
+            };
+        };
+    };