diff mbox series

[5/9] dt-bindings: iio: adc: adi,ad7606: add conditions

Message ID 20240618-cleanup-ad7606-v1-5-f1854d5c779d@baylibre.com (mailing list archive)
State Not Applicable
Headers show
Series iio: adc: ad7606: Improvements | expand

Commit Message

Guillaume Stols June 18, 2024, 2:02 p.m. UTC
Since the driver supports several parts that present differences in
their layout and behaviour, it is necessary to describe the differences
from one chip to another.

Signed-off-by: Guillaume Stols <gstols@baylibre.com>
---
 .../devicetree/bindings/iio/adc/adi,ad7606.yaml    | 50 +++++++++++++++++++++-
 1 file changed, 48 insertions(+), 2 deletions(-)

Comments

Conor Dooley June 18, 2024, 3:13 p.m. UTC | #1
On Tue, Jun 18, 2024 at 02:02:37PM +0000, Guillaume Stols wrote:
> Since the driver supports several parts that present differences in
> their layout and behaviour, it is necessary to describe the differences
> from one chip to another.
> 
> Signed-off-by: Guillaume Stols <gstols@baylibre.com>

Didn't check the datasheets etc, but the idea seems fine.
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Rob Herring June 18, 2024, 3:53 p.m. UTC | #2
On Tue, 18 Jun 2024 14:02:37 +0000, Guillaume Stols wrote:
> Since the driver supports several parts that present differences in
> their layout and behaviour, it is necessary to describe the differences
> from one chip to another.
> 
> Signed-off-by: Guillaume Stols <gstols@baylibre.com>
> ---
>  .../devicetree/bindings/iio/adc/adi,ad7606.yaml    | 50 +++++++++++++++++++++-
>  1 file changed, 48 insertions(+), 2 deletions(-)
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/adc/adi,ad7606.example.dtb: adc@0: adi,sw-mode: False schema does not allow True
	from schema $id: http://devicetree.org/schemas/iio/adc/adi,ad7606.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240618-cleanup-ad7606-v1-5-f1854d5c779d@baylibre.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
Jonathan Cameron June 23, 2024, 3:33 p.m. UTC | #3
On Tue, 18 Jun 2024 14:02:37 +0000
Guillaume Stols <gstols@baylibre.com> wrote:

> Since the driver supports several parts that present differences in
> their layout and behaviour, it is necessary to describe the differences
> from one chip to another.
> 
> Signed-off-by: Guillaume Stols <gstols@baylibre.com>
I'd rather see the numbers / descriptions changed in this patch so
that it is clear why instead of the earlier documentation only patch.

If that is really hard to do, just make sure that patch description calls
out that it will briefly be inconsistent.

Otherwise LGTM
> ---
>  .../devicetree/bindings/iio/adc/adi,ad7606.yaml    | 50 +++++++++++++++++++++-
>  1 file changed, 48 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml
> index e480c9a7c7ca..65d6ca5843d7 100644
> --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml
> @@ -55,7 +55,8 @@ properties:
>        Must be the device tree identifier of the CONVST pin(s). This logic input
>        is used to initiate conversions on the analog input channels. As the line
>        is active high, it should be marked GPIO_ACTIVE_HIGH.
> -    maxItems: 1
> +    minItems: 1
> +    maxItems: 2
>  
>    reset-gpios:
>      description:
> @@ -91,7 +92,8 @@ properties:
>        GPIO_ACTIVE_HIGH. On the AD7616, there are 2 pins, and if the 2 pins are
>        tied to a logic high, software mode is enabled, otherwise one of the 3
>        possible range values is selected.
> -    maxItems: 1
> +    minItems: 1
> +    maxItems: 2
>  
>    adi,oversampling-ratio-gpios:
>      description:
> @@ -123,6 +125,50 @@ required:
>  allOf:
>    - $ref: /schemas/spi/spi-peripheral-props.yaml#
>  
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: adi,ad7616
> +    then:
> +      properties:
> +        adi,first-data-gpios: false
> +        standby-gpios: false
> +        adi,range-gpios:
> +          maxItems: 2
> +    else:
> +      properties:
> +        adi,range-gpios:
> +          maxItems: 1
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - adi,ad7605-4
> +              - adi,ad7616
> +    then:
> +      properties:
> +        adi,oversampling-ratio-gpios: false
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - adi,ad7605-4
> +              - adi,ad7606-4
> +              - adi,ad7606-6
> +              - adi,ad7606-8
> +    then:
> +      properties:
> +        adi,sw-mode: false
> +    else:
> +      properties:
> +        adi,conversion-start-gpios:
> +          maxItems: 1
> +
>  unevaluatedProperties: false
>  
>  examples:
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml
index e480c9a7c7ca..65d6ca5843d7 100644
--- a/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7606.yaml
@@ -55,7 +55,8 @@  properties:
       Must be the device tree identifier of the CONVST pin(s). This logic input
       is used to initiate conversions on the analog input channels. As the line
       is active high, it should be marked GPIO_ACTIVE_HIGH.
-    maxItems: 1
+    minItems: 1
+    maxItems: 2
 
   reset-gpios:
     description:
@@ -91,7 +92,8 @@  properties:
       GPIO_ACTIVE_HIGH. On the AD7616, there are 2 pins, and if the 2 pins are
       tied to a logic high, software mode is enabled, otherwise one of the 3
       possible range values is selected.
-    maxItems: 1
+    minItems: 1
+    maxItems: 2
 
   adi,oversampling-ratio-gpios:
     description:
@@ -123,6 +125,50 @@  required:
 allOf:
   - $ref: /schemas/spi/spi-peripheral-props.yaml#
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: adi,ad7616
+    then:
+      properties:
+        adi,first-data-gpios: false
+        standby-gpios: false
+        adi,range-gpios:
+          maxItems: 2
+    else:
+      properties:
+        adi,range-gpios:
+          maxItems: 1
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - adi,ad7605-4
+              - adi,ad7616
+    then:
+      properties:
+        adi,oversampling-ratio-gpios: false
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - adi,ad7605-4
+              - adi,ad7606-4
+              - adi,ad7606-6
+              - adi,ad7606-8
+    then:
+      properties:
+        adi,sw-mode: false
+    else:
+      properties:
+        adi,conversion-start-gpios:
+          maxItems: 1
+
 unevaluatedProperties: false
 
 examples: