diff mbox series

[v2,04/16] dt-bindings: iio: adc: ad7768-1: add VMC output property

Message ID e17337bc3b0f2e95d3d4f7b6daa7755881e11fba.1737985435.git.Jonathan.Santos@analog.com (mailing list archive)
State New
Headers show
Series Add features, improvements, and fixes | expand

Commit Message

Jonathan Santos Jan. 27, 2025, 3:12 p.m. UTC
The AD7768-1 provides a buffered common-mode voltage output
on the VCM pin that can be used to bias analog input signals.

Add adi,vcm-output to enable the configuration of the VCM output
circuit.

Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
---
v2 Changes:
* New patch in v2.
---
 .../bindings/iio/adc/adi,ad7768-1.yaml           | 10 ++++++++++
 include/dt-bindings/iio/adc/adi,ad7768-1.h       | 16 ++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 include/dt-bindings/iio/adc/adi,ad7768-1.h

Comments

Rob Herring Jan. 27, 2025, 4:30 p.m. UTC | #1
On Mon, 27 Jan 2025 12:12:05 -0300, Jonathan Santos wrote:
> The AD7768-1 provides a buffered common-mode voltage output
> on the VCM pin that can be used to bias analog input signals.
> 
> Add adi,vcm-output to enable the configuration of the VCM output
> circuit.
> 
> Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
> ---
> v2 Changes:
> * New patch in v2.
> ---
>  .../bindings/iio/adc/adi,ad7768-1.yaml           | 10 ++++++++++
>  include/dt-bindings/iio/adc/adi,ad7768-1.h       | 16 ++++++++++++++++
>  2 files changed, 26 insertions(+)
>  create mode 100644 include/dt-bindings/iio/adc/adi,ad7768-1.h
> 

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

yamllint warnings/errors:
./Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml:69:9: [warning] wrong indentation: expected 6 but found 8 (indentation)
./Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml:101:6: [error] missing starting space in comment (comments)

dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.example.dts:39.35-36 syntax error
FATAL ERROR: Unable to parse input tree
make[2]: *** [scripts/Makefile.dtbs:131: Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.example.dtb] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/builds/robherring/dt-review-ci/linux/Makefile:1506: dt_binding_check] Error 2
make: *** [Makefile:251: __sub-make] Error 2

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/e17337bc3b0f2e95d3d4f7b6daa7755881e11fba.1737985435.git.Jonathan.Santos@analog.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.
David Lechner Jan. 28, 2025, 1:28 a.m. UTC | #2
On 1/27/25 9:12 AM, Jonathan Santos wrote:
> The AD7768-1 provides a buffered common-mode voltage output
> on the VCM pin that can be used to bias analog input signals.
> 
> Add adi,vcm-output to enable the configuration of the VCM output
> circuit.
> 
> Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
> ---
> v2 Changes:
> * New patch in v2.
> ---
>  .../bindings/iio/adc/adi,ad7768-1.yaml           | 10 ++++++++++
>  include/dt-bindings/iio/adc/adi,ad7768-1.h       | 16 ++++++++++++++++
>  2 files changed, 26 insertions(+)
>  create mode 100644 include/dt-bindings/iio/adc/adi,ad7768-1.h
> 
> diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml
> index da05c8448530..e26513a9469b 100644
> --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml
> @@ -59,6 +59,15 @@ properties:
>        In the absence of this property, Synchronization over SPI will be
>        enabled.
>  
> +  adi,vcm-output:
> +    description: |
> +      Configures the Common-Mode Voltage Output. The VCM is provided by an
> +      amplifier external to the AD7768-1 and can be used as common-mode voltage
> +      by the ADC. There are 8 output voltage options available, and the macros
> +      for these values can be found at dt-bindings/iio/adi,ad7768-1.h
> +    items:
> +        enum: [0, 1, 2, 3, 4, 5, 6, 7]
> +

I was expecting this to use regulator provider bindings rather than using a
custom property. Then the regulator consumer could request the voltage that
they need. But maybe that is more complicated than what is practical.

If we don't need regulator bindings, then this should be vcm-microvolt to use
standard units [1].

[1]: https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/property-units.yaml

>    reset-gpios:
>      maxItems: 1
>  
> @@ -132,6 +141,7 @@ examples:
>              gpio-controller;
>              #gpio-cells = <2>;
>              vref-supply = <&adc_vref>;
> +            adi,vcm-output = <AD7768_VCM_OUTPUT_AVDD1_AVSS_2>;
>              interrupts = <25 IRQ_TYPE_EDGE_RISING>;
>              interrupt-parent = <&gpio>;
>              adi,sync-in-gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
> diff --git a/include/dt-bindings/iio/adc/adi,ad7768-1.h b/include/dt-bindings/iio/adc/adi,ad7768-1.h
> new file mode 100644
> index 000000000000..469ea724c0d5
> --- /dev/null
> +++ b/include/dt-bindings/iio/adc/adi,ad7768-1.h
> @@ -0,0 +1,16 @@
> +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
> +
> +#ifndef _DT_BINDINGS_ADI_AD7768_1_H
> +#define _DT_BINDINGS_ADI_AD7768_1_H
> +
> +/* Sets VCM output to (AVDD1 − AVSS)/2 */
> +#define AD7768_VCM_OUTPUT_AVDD1_AVSS_2	0x00
> +#define AD7768_VCM_OUTPUT_2_5V		0x01
> +#define AD7768_VCM_OUTPUT_2_05V		0x02
> +#define AD7768_VCM_OUTPUT_1_9V		0x03
> +#define AD7768_VCM_OUTPUT_1_65V		0x04
> +#define AD7768_VCM_OUTPUT_1_1V		0x05
> +#define AD7768_VCM_OUTPUT_0_9V		0x06
> +#define AD7768_VCM_OUTPUT_OFF		0x07
> +
> +#endif /* _DT_BINDINGS_ADI_AD7768_1_H */
Jonathan Cameron Jan. 30, 2025, 4:21 p.m. UTC | #3
On Mon, 27 Jan 2025 19:28:10 -0600
David Lechner <dlechner@baylibre.com> wrote:

> On 1/27/25 9:12 AM, Jonathan Santos wrote:
> > The AD7768-1 provides a buffered common-mode voltage output
> > on the VCM pin that can be used to bias analog input signals.
> > 
> > Add adi,vcm-output to enable the configuration of the VCM output
> > circuit.
> > 
> > Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
> > ---
> > v2 Changes:
> > * New patch in v2.
> > ---
> >  .../bindings/iio/adc/adi,ad7768-1.yaml           | 10 ++++++++++
> >  include/dt-bindings/iio/adc/adi,ad7768-1.h       | 16 ++++++++++++++++
> >  2 files changed, 26 insertions(+)
> >  create mode 100644 include/dt-bindings/iio/adc/adi,ad7768-1.h
> > 
> > diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml
> > index da05c8448530..e26513a9469b 100644
> > --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml
> > +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml
> > @@ -59,6 +59,15 @@ properties:
> >        In the absence of this property, Synchronization over SPI will be
> >        enabled.
> >  
> > +  adi,vcm-output:
> > +    description: |
> > +      Configures the Common-Mode Voltage Output. The VCM is provided by an
> > +      amplifier external to the AD7768-1 and can be used as common-mode voltage
> > +      by the ADC. There are 8 output voltage options available, and the macros
> > +      for these values can be found at dt-bindings/iio/adi,ad7768-1.h
> > +    items:
> > +        enum: [0, 1, 2, 3, 4, 5, 6, 7]
> > +  
> 
> I was expecting this to use regulator provider bindings rather than using a
> custom property. Then the regulator consumer could request the voltage that
> they need. But maybe that is more complicated than what is practical.
If we need to represent the analog front end (likely we do as will affect scaling
etc) then regulator makes sense.  That front end will need a driver. Perhaps
an extension of drivers/iio/afe/iio-rescale.c

> 
> If we don't need regulator bindings, then this should be vcm-microvolt to use
> standard units [1].
> 
> [1]: https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/property-units.yaml
> 
> >    reset-gpios:
> >      maxItems: 1
> >  
> > @@ -132,6 +141,7 @@ examples:
> >              gpio-controller;
> >              #gpio-cells = <2>;
> >              vref-supply = <&adc_vref>;
> > +            adi,vcm-output = <AD7768_VCM_OUTPUT_AVDD1_AVSS_2>;
> >              interrupts = <25 IRQ_TYPE_EDGE_RISING>;
> >              interrupt-parent = <&gpio>;
> >              adi,sync-in-gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
> > diff --git a/include/dt-bindings/iio/adc/adi,ad7768-1.h b/include/dt-bindings/iio/adc/adi,ad7768-1.h
> > new file mode 100644
> > index 000000000000..469ea724c0d5
> > --- /dev/null
> > +++ b/include/dt-bindings/iio/adc/adi,ad7768-1.h
> > @@ -0,0 +1,16 @@
> > +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
> > +
> > +#ifndef _DT_BINDINGS_ADI_AD7768_1_H
> > +#define _DT_BINDINGS_ADI_AD7768_1_H
> > +
> > +/* Sets VCM output to (AVDD1 − AVSS)/2 */
> > +#define AD7768_VCM_OUTPUT_AVDD1_AVSS_2	0x00
> > +#define AD7768_VCM_OUTPUT_2_5V		0x01
> > +#define AD7768_VCM_OUTPUT_2_05V		0x02
> > +#define AD7768_VCM_OUTPUT_1_9V		0x03
> > +#define AD7768_VCM_OUTPUT_1_65V		0x04
> > +#define AD7768_VCM_OUTPUT_1_1V		0x05
> > +#define AD7768_VCM_OUTPUT_0_9V		0x06
> > +#define AD7768_VCM_OUTPUT_OFF		0x07
> > +
> > +#endif /* _DT_BINDINGS_ADI_AD7768_1_H */  
> 
> 
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml
index da05c8448530..e26513a9469b 100644
--- a/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7768-1.yaml
@@ -59,6 +59,15 @@  properties:
       In the absence of this property, Synchronization over SPI will be
       enabled.
 
+  adi,vcm-output:
+    description: |
+      Configures the Common-Mode Voltage Output. The VCM is provided by an
+      amplifier external to the AD7768-1 and can be used as common-mode voltage
+      by the ADC. There are 8 output voltage options available, and the macros
+      for these values can be found at dt-bindings/iio/adi,ad7768-1.h
+    items:
+        enum: [0, 1, 2, 3, 4, 5, 6, 7]
+
   reset-gpios:
     maxItems: 1
 
@@ -132,6 +141,7 @@  examples:
             gpio-controller;
             #gpio-cells = <2>;
             vref-supply = <&adc_vref>;
+            adi,vcm-output = <AD7768_VCM_OUTPUT_AVDD1_AVSS_2>;
             interrupts = <25 IRQ_TYPE_EDGE_RISING>;
             interrupt-parent = <&gpio>;
             adi,sync-in-gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
diff --git a/include/dt-bindings/iio/adc/adi,ad7768-1.h b/include/dt-bindings/iio/adc/adi,ad7768-1.h
new file mode 100644
index 000000000000..469ea724c0d5
--- /dev/null
+++ b/include/dt-bindings/iio/adc/adi,ad7768-1.h
@@ -0,0 +1,16 @@ 
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+
+#ifndef _DT_BINDINGS_ADI_AD7768_1_H
+#define _DT_BINDINGS_ADI_AD7768_1_H
+
+/* Sets VCM output to (AVDD1 − AVSS)/2 */
+#define AD7768_VCM_OUTPUT_AVDD1_AVSS_2	0x00
+#define AD7768_VCM_OUTPUT_2_5V		0x01
+#define AD7768_VCM_OUTPUT_2_05V		0x02
+#define AD7768_VCM_OUTPUT_1_9V		0x03
+#define AD7768_VCM_OUTPUT_1_65V		0x04
+#define AD7768_VCM_OUTPUT_1_1V		0x05
+#define AD7768_VCM_OUTPUT_0_9V		0x06
+#define AD7768_VCM_OUTPUT_OFF		0x07
+
+#endif /* _DT_BINDINGS_ADI_AD7768_1_H */