diff mbox series

[1/2] dt-bindings: adc: ad7173: add support for additional models

Message ID 20240115135416.10595-2-mitrutzceclan@gmail.com (mailing list archive)
State Changes Requested
Headers show
Series Add support for additional AD717X models | expand

Commit Message

Ceclan, Dumitru Jan. 15, 2024, 1:53 p.m. UTC
Add support for: AD7172-2, AD7175-8, AD7177-2
Add hardware description of the AD771X family instead of "Bindings for"
AD7172-4 does not feature an internal reference, check for ext-ref

Signed-off-by: Dumitru Ceclan <mitrutzceclan@gmail.com>
---
 .../bindings/iio/adc/adi,ad7173.yaml          | 50 +++++++++++++++++--
 1 file changed, 46 insertions(+), 4 deletions(-)

Comments

Conor Dooley Jan. 15, 2024, 4:10 p.m. UTC | #1
On Mon, Jan 15, 2024 at 03:53:04PM +0200, Dumitru Ceclan wrote:
> Add support for: AD7172-2, AD7175-8, AD7177-2
> Add hardware description of the AD771X family instead of "Bindings for"
> AD7172-4 does not feature an internal reference, check for ext-ref
> 
> Signed-off-by: Dumitru Ceclan <mitrutzceclan@gmail.com>
> ---
>  .../bindings/iio/adc/adi,ad7173.yaml          | 50 +++++++++++++++++--
>  1 file changed, 46 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
> index 7c8caef76528..6d4b26e43144 100644
> --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
> @@ -11,19 +11,33 @@ maintainers:
>    - Ceclan Dumitru <dumitru.ceclan@analog.com>
>  
>  description: |
> -  Bindings for the Analog Devices AD717X ADC's. Datasheets for supported chips:
> +  Analog Devices AD717X ADC's:
> +  The AD717x family offer a complete integrated Sigma-Delta ADC solution which
> +  can be used in high precision, low noise single channel applications
> +  (Life Science measurements) or higher speed multiplexed applications
> +  (Factory Automation PLC Input modules). The Sigma-Delta ADC is intended
> +  primarily for measurement of signals close to DC but also delivers outstanding
> +  performance with input bandwidths out to ~10kHz.
> +
> +  Datasheets for supported chips:
>      https://www.analog.com/media/en/technical-documentation/data-sheets/AD7172-2.pdf
> +    https://www.analog.com/media/en/technical-documentation/data-sheets/AD7172-4.pdf
>      https://www.analog.com/media/en/technical-documentation/data-sheets/AD7173-8.pdf
>      https://www.analog.com/media/en/technical-documentation/data-sheets/AD7175-2.pdf
> +    https://www.analog.com/media/en/technical-documentation/data-sheets/AD7175-8.pdf
>      https://www.analog.com/media/en/technical-documentation/data-sheets/AD7176-2.pdf
> +    https://www.analog.com/media/en/technical-documentation/data-sheets/AD7177-2.pdf
>  
>  properties:
>    compatible:
>      enum:
>        - adi,ad7172-2
> +      - adi,ad7172-4
>        - adi,ad7173-8
>        - adi,ad7175-2
> +      - adi,ad7175-8
>        - adi,ad7176-2
> +      - adi,ad7177-2
>  
>    reg:
>      maxItems: 1
> @@ -89,8 +103,10 @@ patternProperties:
>            refout-avss: REFOUT/AVSS (Internal reference)
>            avdd       : AVDD
>  
> -          External reference refin2 only available on ad7173-8.
> -          If not specified, internal reference used.
> +          External reference refin2 only available on ad7173-8 and ad7172-4.
> +          Internal reference refout-avss not available on ad7172-4.
> +
> +          If not specified, internal reference used (if available).
>          $ref: /schemas/types.yaml#/definitions/string
>          enum:
>            - refin
> @@ -111,12 +127,15 @@ required:
>  allOf:
>    - $ref: /schemas/spi/spi-peripheral-props.yaml#
>  
> +  # Only ad7172-4 and ad7173-8 support refin2
>    - if:
>        properties:
>          compatible:
>            not:
>              contains:
> -              const: adi,ad7173-8
> +              anyOf:
> +                - const: adi,ad7172-4
> +                - const: adi,ad7173-8
>      then:
>        properties:
>          refin2-supply: false
> @@ -129,6 +148,29 @@ allOf:
>                  - refout-avss
>                  - avdd
>  
> +  # Model ad7172-4 does not support internal reference
> +  #  mandatory to have an external reference
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: adi,ad7172-4
> +    then:
> +      patternProperties:
> +        "^channel@[0-9a-f]$":
> +          properties:
> +            adi,reference-select:
> +              enum:
> +                - refin
> +                - refin2
> +                - avdd
> +              default: false

The default shouldn't be needed here since the property is required.

> +          required:
> +            - adi,reference-select
> +      oneOf:
> +        - required: [refin2-supply]
> +        - required: [refin-supply]

I'm a little curious - the enum allows avdd but you are requiring one of
these two references to be set. Is one required if avdd is used as the
reference?

Thanks,
Conor.

> +
>  unevaluatedProperties: false
>  
>  examples:
> -- 
> 2.42.0
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
index 7c8caef76528..6d4b26e43144 100644
--- a/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
@@ -11,19 +11,33 @@  maintainers:
   - Ceclan Dumitru <dumitru.ceclan@analog.com>
 
 description: |
-  Bindings for the Analog Devices AD717X ADC's. Datasheets for supported chips:
+  Analog Devices AD717X ADC's:
+  The AD717x family offer a complete integrated Sigma-Delta ADC solution which
+  can be used in high precision, low noise single channel applications
+  (Life Science measurements) or higher speed multiplexed applications
+  (Factory Automation PLC Input modules). The Sigma-Delta ADC is intended
+  primarily for measurement of signals close to DC but also delivers outstanding
+  performance with input bandwidths out to ~10kHz.
+
+  Datasheets for supported chips:
     https://www.analog.com/media/en/technical-documentation/data-sheets/AD7172-2.pdf
+    https://www.analog.com/media/en/technical-documentation/data-sheets/AD7172-4.pdf
     https://www.analog.com/media/en/technical-documentation/data-sheets/AD7173-8.pdf
     https://www.analog.com/media/en/technical-documentation/data-sheets/AD7175-2.pdf
+    https://www.analog.com/media/en/technical-documentation/data-sheets/AD7175-8.pdf
     https://www.analog.com/media/en/technical-documentation/data-sheets/AD7176-2.pdf
+    https://www.analog.com/media/en/technical-documentation/data-sheets/AD7177-2.pdf
 
 properties:
   compatible:
     enum:
       - adi,ad7172-2
+      - adi,ad7172-4
       - adi,ad7173-8
       - adi,ad7175-2
+      - adi,ad7175-8
       - adi,ad7176-2
+      - adi,ad7177-2
 
   reg:
     maxItems: 1
@@ -89,8 +103,10 @@  patternProperties:
           refout-avss: REFOUT/AVSS (Internal reference)
           avdd       : AVDD
 
-          External reference refin2 only available on ad7173-8.
-          If not specified, internal reference used.
+          External reference refin2 only available on ad7173-8 and ad7172-4.
+          Internal reference refout-avss not available on ad7172-4.
+
+          If not specified, internal reference used (if available).
         $ref: /schemas/types.yaml#/definitions/string
         enum:
           - refin
@@ -111,12 +127,15 @@  required:
 allOf:
   - $ref: /schemas/spi/spi-peripheral-props.yaml#
 
+  # Only ad7172-4 and ad7173-8 support refin2
   - if:
       properties:
         compatible:
           not:
             contains:
-              const: adi,ad7173-8
+              anyOf:
+                - const: adi,ad7172-4
+                - const: adi,ad7173-8
     then:
       properties:
         refin2-supply: false
@@ -129,6 +148,29 @@  allOf:
                 - refout-avss
                 - avdd
 
+  # Model ad7172-4 does not support internal reference
+  #  mandatory to have an external reference
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: adi,ad7172-4
+    then:
+      patternProperties:
+        "^channel@[0-9a-f]$":
+          properties:
+            adi,reference-select:
+              enum:
+                - refin
+                - refin2
+                - avdd
+              default: false
+          required:
+            - adi,reference-select
+      oneOf:
+        - required: [refin2-supply]
+        - required: [refin-supply]
+
 unevaluatedProperties: false
 
 examples: