diff mbox series

[v3,5/8] dt-bindings: iio: add backend support to sd modulator

Message ID 20240703160535.2277871-6-olivier.moysan@foss.st.com (mailing list archive)
State Superseded
Headers show
Series iio: adc: dfsdm: add scaling support | expand

Commit Message

Olivier Moysan July 3, 2024, 4:05 p.m. UTC
The legacy sd modulator driver registers the sigma delta modulator as
an IIO channel provider. This implementation is not convenient when the
SD modulator has to be cascaded with another IIO device. The scaling
information is distributed across devices, which makes it difficult to
report consistent scaling data on IIO devices.

The solution is to expose these cascaded IIO devices as an aggregate
device, which report global scaling information.
Add IIO backend support to SD modulator to allow scaling information
management.

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
---
 .../iio/adc/sigma-delta-modulator.yaml        | 24 +++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

Comments

Rob Herring July 3, 2024, 5:33 p.m. UTC | #1
On Wed, 03 Jul 2024 18:05:30 +0200, Olivier Moysan wrote:
> The legacy sd modulator driver registers the sigma delta modulator as
> an IIO channel provider. This implementation is not convenient when the
> SD modulator has to be cascaded with another IIO device. The scaling
> information is distributed across devices, which makes it difficult to
> report consistent scaling data on IIO devices.
> 
> The solution is to expose these cascaded IIO devices as an aggregate
> device, which report global scaling information.
> Add IIO backend support to SD modulator to allow scaling information
> management.
> 
> Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
> ---
>  .../iio/adc/sigma-delta-modulator.yaml        | 24 +++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
> 

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

yamllint warnings/errors:
./Documentation/devicetree/bindings/iio/adc/sigma-delta-modulator.yaml:38:5: [warning] wrong indentation: expected 6 but found 4 (indentation)

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/iio/adc/sigma-delta-modulator.example.dtb: /example-0/ads1201_0: failed to match any schema with compatible: ['ti,ads1201']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240703160535.2277871-6-olivier.moysan@foss.st.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.
Rob Herring July 3, 2024, 10:08 p.m. UTC | #2
On Wed, Jul 03, 2024 at 06:05:30PM +0200, Olivier Moysan wrote:
> The legacy sd modulator driver registers the sigma delta modulator as
> an IIO channel provider. This implementation is not convenient when the
> SD modulator has to be cascaded with another IIO device. The scaling
> information is distributed across devices, which makes it difficult to
> report consistent scaling data on IIO devices.
> 
> The solution is to expose these cascaded IIO devices as an aggregate
> device, which report global scaling information.
> Add IIO backend support to SD modulator to allow scaling information
> management.
> 
> Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
> ---
>  .../iio/adc/sigma-delta-modulator.yaml        | 24 +++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/iio/adc/sigma-delta-modulator.yaml b/Documentation/devicetree/bindings/iio/adc/sigma-delta-modulator.yaml
> index cab0d425eaa4..e34aa560da63 100644
> --- a/Documentation/devicetree/bindings/iio/adc/sigma-delta-modulator.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/sigma-delta-modulator.yaml
> @@ -18,18 +18,38 @@ properties:
>        - sd-modulator
>        - ads1201
>  
> +  '#io-backend-cells':
> +    const: 0
> +
>    '#io-channel-cells':
>      const: 0
>  
> +  reg:
> +    maxItems: 1
> +
> +  vref-supply:
> +    description: Phandle to the vref input analog reference voltage.
> +
>  required:
>    - compatible
> -  - '#io-channel-cells'
> +
> +allOf:

Don't need allOf

> +  - anyOf:
> +    - required: ['#io-backend-cells']
> +    - required: ['#io-channel-cells']
>  
>  additionalProperties: false
>  
>  examples:
>    - |
> -    ads1202: adc {
> +    // Exemple1: SD modulator is an IIO backend device
> +    ads1201_0 {
> +      compatible = "ti,ads1201";
> +      #io-backend-cells = <0>;
> +    };
> +
> +    //Example2: SD modulator is an IIO channel provider
> +    ads1201_1 {
>        compatible = "sd-modulator";
>        #io-channel-cells = <0>;

Don't you need some link between the nodes?

>      };
> -- 
> 2.25.1
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/iio/adc/sigma-delta-modulator.yaml b/Documentation/devicetree/bindings/iio/adc/sigma-delta-modulator.yaml
index cab0d425eaa4..e34aa560da63 100644
--- a/Documentation/devicetree/bindings/iio/adc/sigma-delta-modulator.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/sigma-delta-modulator.yaml
@@ -18,18 +18,38 @@  properties:
       - sd-modulator
       - ads1201
 
+  '#io-backend-cells':
+    const: 0
+
   '#io-channel-cells':
     const: 0
 
+  reg:
+    maxItems: 1
+
+  vref-supply:
+    description: Phandle to the vref input analog reference voltage.
+
 required:
   - compatible
-  - '#io-channel-cells'
+
+allOf:
+  - anyOf:
+    - required: ['#io-backend-cells']
+    - required: ['#io-channel-cells']
 
 additionalProperties: false
 
 examples:
   - |
-    ads1202: adc {
+    // Exemple1: SD modulator is an IIO backend device
+    ads1201_0 {
+      compatible = "ti,ads1201";
+      #io-backend-cells = <0>;
+    };
+
+    //Example2: SD modulator is an IIO channel provider
+    ads1201_1 {
       compatible = "sd-modulator";
       #io-channel-cells = <0>;
     };