diff mbox series

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

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

Commit Message

Ceclan, Dumitru Feb. 28, 2024, 1:54 p.m. UTC
Add support for: AD7172-2, AD7175-8, AD7177-2.
AD7172-4 does not feature an internal reference, check for external
 reference presence.

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

Comments

Krzysztof Kozlowski Feb. 29, 2024, 2:49 p.m. UTC | #1
On 28/02/2024 14:54, Dumitru Ceclan wrote:
> Add support for: AD7172-2, AD7175-8, AD7177-2.
> AD7172-4 does not feature an internal reference, check for external
>  reference presence.
> 
> Signed-off-by: Dumitru Ceclan <mitrutzceclan@gmail.com>
> ---
>  .../bindings/iio/adc/adi,ad7173.yaml          | 39 +++++++++++++++++--
>  1 file changed, 36 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
> index 36f16a325bc5..7b5bb839fc3e 100644
> --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml

There is no such file in next-20240229.

> @@ -21,17 +21,23 @@ description: |
>  
>    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
> @@ -136,8 +142,10 @@ patternProperties:
>            refout-avss: REFOUT/AVSS (Internal reference)
>            avdd       : AVDD  /AVSS
>  
> -          External reference ref2 only available on ad7173-8.
> -          If not specified, internal reference used.
> +          External reference ref2 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:
>            - vref
> @@ -157,12 +165,15 @@ required:
>  allOf:
>    - $ref: /schemas/spi/spi-peripheral-props.yaml#
>  
> +  # Only ad7172-4 and ad7173-8 support vref2
>    - if:
>        properties:
>          compatible:
>            not:
>              contains:
> -              const: adi,ad7173-8
> +              anyOf:

That's enum... or you want to make something more complicated because I
see there not:...

> +                - const: adi,ad7172-4
> +                - const: adi,ad7173-8
>      then:
>        properties:
>          vref2-supply: false
> @@ -177,6 +188,28 @@ allOf:
>              reg:
>                maximum: 3
>  
> +  # 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:
> +                - vref
> +                - vref2
> +                - avdd
> +          required:
> +            - adi,reference-select

Are you defining properties here? I cannot verify because this file does
not exist in next.

> +      oneOf:
> +        - required: [vref2-supply]
> +        - required: [vref-supply]


Best regards,
Krzysztof
Ceclan, Dumitru Feb. 29, 2024, 3:08 p.m. UTC | #2
On 29/02/2024 16:49, Krzysztof Kozlowski wrote:
> On 28/02/2024 14:54, Dumitru Ceclan wrote:
>> Add support for: AD7172-2, AD7175-8, AD7177-2.
>> AD7172-4 does not feature an internal reference, check for external
>>  reference presence.

...

>> --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
>> +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
> 
> There is no such file in next-20240229.
> 

It's not yet accepted
https://lore.kernel.org/all/20240228110622.25114-1-mitrutzceclan@gmail.com/

...

>> +  # 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:
>> +                - vref
>> +                - vref2
>> +                - avdd
>> +          required:
>> +            - adi,reference-select
> 
> Are you defining properties here? I cannot verify because this file does
> not exist in next.
> 

No, just constraining reference-select to be required and exclude
"refout-avss".

> 
> 
> Best regards,
> Krzysztof
>
Krzysztof Kozlowski Feb. 29, 2024, 4 p.m. UTC | #3
On 29/02/2024 16:08, Ceclan, Dumitru wrote:
> On 29/02/2024 16:49, Krzysztof Kozlowski wrote:
>> On 28/02/2024 14:54, Dumitru Ceclan wrote:
>>> Add support for: AD7172-2, AD7175-8, AD7177-2.
>>> AD7172-4 does not feature an internal reference, check for external
>>>  reference presence.
> 
> ...
> 
>>> --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
>>> +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
>>
>> There is no such file in next-20240229.
>>
> 
> It's not yet accepted
> https://lore.kernel.org/all/20240228110622.25114-1-mitrutzceclan@gmail.com/

And how can we know this? You must clearly document dependencies.

This also means the patch cannot be directly applied and cannot be
tested by toolset.

Did you test this particular patch?

> 
> ...
> 
>>> +  # 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:
>>> +                - vref
>>> +                - vref2
>>> +                - avdd
>>> +          required:
>>> +            - adi,reference-select
>>
>> Are you defining properties here? I cannot verify because this file does
>> not exist in next.
>>
> 
> No, just constraining reference-select to be required and exclude
> "refout-avss".
> 

ok

Best regards,
Krzysztof
Ceclan, Dumitru Feb. 29, 2024, 4:19 p.m. UTC | #4
On 29/02/2024 18:00, Krzysztof Kozlowski wrote:
> On 29/02/2024 16:08, Ceclan, Dumitru wrote:
>> On 29/02/2024 16:49, Krzysztof Kozlowski wrote:
>>> On 28/02/2024 14:54, Dumitru Ceclan wrote:
>>>> Add support for: AD7172-2, AD7175-8, AD7177-2.
>>>> AD7172-4 does not feature an internal reference, check for external
>>>>  reference presence.
>>
>> ...
>>
>>>> --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
>>>> +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
>>>
>>> There is no such file in next-20240229.
>>>
>>
>> It's not yet accepted
>> https://lore.kernel.org/all/20240228110622.25114-1-mitrutzceclan@gmail.com/
> 
> And how can we know this? You must clearly document dependencies.
> 
> This also means the patch cannot be directly applied and cannot be
> tested by toolset.

Understood, sorry.

> 
> Did you test this particular patch?
> 

Yes
David Lechner March 4, 2024, 11:41 p.m. UTC | #5
On Wed, Feb 28, 2024 at 7:55 AM Dumitru Ceclan <mitrutzceclan@gmail.com> wrote:
>
> Add support for: AD7172-2, AD7175-8, AD7177-2.
> AD7172-4 does not feature an internal reference, check for external
>  reference presence.
>
> Signed-off-by: Dumitru Ceclan <mitrutzceclan@gmail.com>
> ---
>  .../bindings/iio/adc/adi,ad7173.yaml          | 39 +++++++++++++++++--
>  1 file changed, 36 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
> index 36f16a325bc5..7b5bb839fc3e 100644
> --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
> @@ -21,17 +21,23 @@ description: |
>
>    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
> @@ -136,8 +142,10 @@ patternProperties:
>            refout-avss: REFOUT/AVSS (Internal reference)
>            avdd       : AVDD  /AVSS
>
> -          External reference ref2 only available on ad7173-8.
> -          If not specified, internal reference used.
> +          External reference ref2 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:
>            - vref
> @@ -157,12 +165,15 @@ required:
>  allOf:
>    - $ref: /schemas/spi/spi-peripheral-props.yaml#
>
> +  # Only ad7172-4 and ad7173-8 support vref2
>    - if:
>        properties:
>          compatible:
>            not:
>              contains:
> -              const: adi,ad7173-8
> +              anyOf:
> +                - const: adi,ad7172-4
> +                - const: adi,ad7173-8

According to the datasheets, it looks like adi,ad7175-8 should be
included here too.

>      then:
>        properties:
>          vref2-supply: false
> @@ -177,6 +188,28 @@ allOf:
>              reg:
>                maximum: 3
>
> +  # 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:
> +                - vref
> +                - vref2
> +                - avdd
> +          required:
> +            - adi,reference-select
> +      oneOf:
> +        - required: [vref2-supply]
> +        - required: [vref-supply]

Do these actually need to be required since avdd is also a possibility?

> +
>    - if:
>        anyOf:
>          - required: [clock-names]
> --
> 2.43.0
>
Ceclan, Dumitru March 5, 2024, 8:50 a.m. UTC | #6
On 05/03/2024 01:41, David Lechner wrote:
> On Wed, Feb 28, 2024 at 7:55 AM Dumitru Ceclan <mitrutzceclan@gmail.com> wrote:

...

>> +      oneOf:
>> +        - required: [vref2-supply]
>> +        - required: [vref-supply]
> 
> Do these actually need to be required since avdd is also a possibility?
> 

I added this constraint based on this mention from the datasheet:
"AVDD1 − AVSS. This can be used to as a diagnostic to validate other
reference values."

If you consider that to be unnecessary, mention it.
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 36f16a325bc5..7b5bb839fc3e 100644
--- a/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7173.yaml
@@ -21,17 +21,23 @@  description: |
 
   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
@@ -136,8 +142,10 @@  patternProperties:
           refout-avss: REFOUT/AVSS (Internal reference)
           avdd       : AVDD  /AVSS
 
-          External reference ref2 only available on ad7173-8.
-          If not specified, internal reference used.
+          External reference ref2 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:
           - vref
@@ -157,12 +165,15 @@  required:
 allOf:
   - $ref: /schemas/spi/spi-peripheral-props.yaml#
 
+  # Only ad7172-4 and ad7173-8 support vref2
   - if:
       properties:
         compatible:
           not:
             contains:
-              const: adi,ad7173-8
+              anyOf:
+                - const: adi,ad7172-4
+                - const: adi,ad7173-8
     then:
       properties:
         vref2-supply: false
@@ -177,6 +188,28 @@  allOf:
             reg:
               maximum: 3
 
+  # 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:
+                - vref
+                - vref2
+                - avdd
+          required:
+            - adi,reference-select
+      oneOf:
+        - required: [vref2-supply]
+        - required: [vref-supply]
+
   - if:
       anyOf:
         - required: [clock-names]