diff mbox series

[17/29] dt-bindings:iio:dac:adi,ad7303 yaml conversion

Message ID 20201011170749.243680-18-jic23@kernel.org (mailing list archive)
State New
Headers show
Series dt-bindings:iio: Another set of yaml conversions. | expand

Commit Message

Jonathan Cameron Oct. 11, 2020, 5:07 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Converted to maintain the requirement for Vdd-supply as per original file.
It is possible we could relax this requirement to make it at least one
of Vdd-supply and REF-supply.  We need to establish the scaling of the
output channel and if REF-supply is provided that is used instead of
Vdd-supply, hence I cannot see why a dummy regulator cannot be used for
Vdd-supply if this happens.

For now, let us keep it simple.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
---
 .../devicetree/bindings/iio/dac/ad7303.txt    | 23 ---------
 .../bindings/iio/dac/adi,ad7303.yaml          | 51 +++++++++++++++++++
 2 files changed, 51 insertions(+), 23 deletions(-)

Comments

Lars-Peter Clausen Oct. 11, 2020, 5:13 p.m. UTC | #1
On 10/11/20 7:07 PM, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Converted to maintain the requirement for Vdd-supply as per original file.
> It is possible we could relax this requirement to make it at least one
> of Vdd-supply and REF-supply.  We need to establish the scaling of the
> output channel and if REF-supply is provided that is used instead of
> Vdd-supply, hence I cannot see why a dummy regulator cannot be used for
> Vdd-supply if this happens.
>
> For now, let us keep it simple.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> ---
>   .../devicetree/bindings/iio/dac/ad7303.txt    | 23 ---------
>   .../bindings/iio/dac/adi,ad7303.yaml          | 51 +++++++++++++++++++
>   2 files changed, 51 insertions(+), 23 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/iio/dac/ad7303.txt b/Documentation/devicetree/bindings/iio/dac/ad7303.txt
> deleted file mode 100644
> index 914610f0556e..000000000000
> --- a/Documentation/devicetree/bindings/iio/dac/ad7303.txt
> +++ /dev/null
> @@ -1,23 +0,0 @@
> -Analog Devices AD7303 DAC device driver
> -
> -Required properties:
> -	- compatible: Must be "adi,ad7303"
> -	- reg: SPI chip select number for the device
> -	- spi-max-frequency: Max SPI frequency to use (< 30000000)
> -	- Vdd-supply: Phandle to the Vdd power supply
> -
> -Optional properties:
> -	- REF-supply: Phandle to the external reference voltage supply. This should
> -	  only be set if there is an external reference voltage connected to the REF
> -	  pin. If the property is not set Vdd/2 is used as the reference voltage.
> -
> -Example:
> -
> -		ad7303@4 {
> -			compatible = "adi,ad7303";
> -			reg = <4>;
> -			spi-max-frequency = <10000000>;
> -			Vdd-supply = <&vdd_supply>;
> -			adi,use-external-reference;
> -			REF-supply = <&vref_supply>;
> -		};
> diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad7303.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad7303.yaml
> new file mode 100644
> index 000000000000..f76c31bf6ee3
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/dac/adi,ad7303.yaml
> @@ -0,0 +1,51 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/dac/adi,ad7303.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Analog Devices AD7303 DAC
> +
> +maintainers:
> +  - Lars-Peter Clausen <lars@metafoo.de>
> +
> +properties:
> +  compatible:
> +    const: adi,ad7303
> +
> +  reg:
> +    maxItems: 1
> +
> +  Vdd-supply:
> +    description:
> +      Used to calculate output channel scalling if REF-supply not specified.
> +  REF-supply:
> +    description:
> +      If not provided, Vdd/2 is used as the reference voltage.
> +
> +  spi-max-frequency:
> +    maximum: 30000000
> +
> +required:
> +  - compatible
> +  - reg
> +  - Vdd-supply
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    spi {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        dac@4 {
> +            compatible = "adi,ad7303";
> +            reg = <4>;
> +            spi-max-frequency = <10000000>;
> +            Vdd-supply = <&vdd_supply>;
> +            adi,use-external-reference;
This is a bug in the original example. But might as well take this as 
chance to remove the 'adi,use-external-reference' here, since that 
property does not exist.
> +            REF-supply = <&vref_supply>;
> +        };
> +    };
> +...
Jonathan Cameron Oct. 18, 2020, 5:43 p.m. UTC | #2
On Sun, 11 Oct 2020 19:13:32 +0200
Lars-Peter Clausen <lars@metafoo.de> wrote:

> On 10/11/20 7:07 PM, Jonathan Cameron wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > Converted to maintain the requirement for Vdd-supply as per original file.
> > It is possible we could relax this requirement to make it at least one
> > of Vdd-supply and REF-supply.  We need to establish the scaling of the
> > output channel and if REF-supply is provided that is used instead of
> > Vdd-supply, hence I cannot see why a dummy regulator cannot be used for
> > Vdd-supply if this happens.
> >
> > For now, let us keep it simple.
> >
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Lars-Peter Clausen <lars@metafoo.de>
> > ---
> >   .../devicetree/bindings/iio/dac/ad7303.txt    | 23 ---------
> >   .../bindings/iio/dac/adi,ad7303.yaml          | 51 +++++++++++++++++++
> >   2 files changed, 51 insertions(+), 23 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/iio/dac/ad7303.txt b/Documentation/devicetree/bindings/iio/dac/ad7303.txt
> > deleted file mode 100644
> > index 914610f0556e..000000000000
> > --- a/Documentation/devicetree/bindings/iio/dac/ad7303.txt
> > +++ /dev/null
> > @@ -1,23 +0,0 @@
> > -Analog Devices AD7303 DAC device driver
> > -
> > -Required properties:
> > -	- compatible: Must be "adi,ad7303"
> > -	- reg: SPI chip select number for the device
> > -	- spi-max-frequency: Max SPI frequency to use (< 30000000)
> > -	- Vdd-supply: Phandle to the Vdd power supply
> > -
> > -Optional properties:
> > -	- REF-supply: Phandle to the external reference voltage supply. This should
> > -	  only be set if there is an external reference voltage connected to the REF
> > -	  pin. If the property is not set Vdd/2 is used as the reference voltage.
> > -
> > -Example:
> > -
> > -		ad7303@4 {
> > -			compatible = "adi,ad7303";
> > -			reg = <4>;
> > -			spi-max-frequency = <10000000>;
> > -			Vdd-supply = <&vdd_supply>;
> > -			adi,use-external-reference;
> > -			REF-supply = <&vref_supply>;
> > -		};
> > diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad7303.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad7303.yaml
> > new file mode 100644
> > index 000000000000..f76c31bf6ee3
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/iio/dac/adi,ad7303.yaml
> > @@ -0,0 +1,51 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/iio/dac/adi,ad7303.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Analog Devices AD7303 DAC
> > +
> > +maintainers:
> > +  - Lars-Peter Clausen <lars@metafoo.de>
> > +
> > +properties:
> > +  compatible:
> > +    const: adi,ad7303
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  Vdd-supply:
> > +    description:
> > +      Used to calculate output channel scalling if REF-supply not specified.
> > +  REF-supply:
> > +    description:
> > +      If not provided, Vdd/2 is used as the reference voltage.
> > +
> > +  spi-max-frequency:
> > +    maximum: 30000000
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - Vdd-supply
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    spi {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        dac@4 {
> > +            compatible = "adi,ad7303";
> > +            reg = <4>;
> > +            spi-max-frequency = <10000000>;
> > +            Vdd-supply = <&vdd_supply>;
> > +            adi,use-external-reference;  
> This is a bug in the original example. But might as well take this as 
> chance to remove the 'adi,use-external-reference' here, since that 
> property does not exist.
Good point. Will fix in v2.

Thanks,

Jonathan

> > +            REF-supply = <&vref_supply>;
> > +        };
> > +    };
> > +...  
> 
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/iio/dac/ad7303.txt b/Documentation/devicetree/bindings/iio/dac/ad7303.txt
deleted file mode 100644
index 914610f0556e..000000000000
--- a/Documentation/devicetree/bindings/iio/dac/ad7303.txt
+++ /dev/null
@@ -1,23 +0,0 @@ 
-Analog Devices AD7303 DAC device driver
-
-Required properties:
-	- compatible: Must be "adi,ad7303"
-	- reg: SPI chip select number for the device
-	- spi-max-frequency: Max SPI frequency to use (< 30000000)
-	- Vdd-supply: Phandle to the Vdd power supply
-
-Optional properties:
-	- REF-supply: Phandle to the external reference voltage supply. This should
-	  only be set if there is an external reference voltage connected to the REF
-	  pin. If the property is not set Vdd/2 is used as the reference voltage.
-
-Example:
-
-		ad7303@4 {
-			compatible = "adi,ad7303";
-			reg = <4>;
-			spi-max-frequency = <10000000>;
-			Vdd-supply = <&vdd_supply>;
-			adi,use-external-reference;
-			REF-supply = <&vref_supply>;
-		};
diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad7303.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad7303.yaml
new file mode 100644
index 000000000000..f76c31bf6ee3
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad7303.yaml
@@ -0,0 +1,51 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/dac/adi,ad7303.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices AD7303 DAC
+
+maintainers:
+  - Lars-Peter Clausen <lars@metafoo.de>
+
+properties:
+  compatible:
+    const: adi,ad7303
+
+  reg:
+    maxItems: 1
+
+  Vdd-supply:
+    description:
+      Used to calculate output channel scalling if REF-supply not specified.
+  REF-supply:
+    description:
+      If not provided, Vdd/2 is used as the reference voltage.
+
+  spi-max-frequency:
+    maximum: 30000000
+
+required:
+  - compatible
+  - reg
+  - Vdd-supply
+
+additionalProperties: false
+
+examples:
+  - |
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        dac@4 {
+            compatible = "adi,ad7303";
+            reg = <4>;
+            spi-max-frequency = <10000000>;
+            Vdd-supply = <&vdd_supply>;
+            adi,use-external-reference;
+            REF-supply = <&vref_supply>;
+        };
+    };
+...