diff mbox series

[16/29] dt-bindings:iio:dac:ti,dac082s085 yaml conversion

Message ID 20201011170749.243680-17-jic23@kernel.org (mailing list archive)
State New, archived
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>

Fairly simple conversion, but it could be tighter than currently
specified.

Is there a clean way to specify a negative dependency?
For now I have just put in the description field that we must have
spi-cpol or spi-cpha but not both.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Lukas Wunner <lukas@wunner.de>
---
 .../bindings/iio/dac/ti,dac082s085.yaml       | 58 +++++++++++++++++++
 .../bindings/iio/dac/ti-dac082s085.txt        | 34 -----------
 2 files changed, 58 insertions(+), 34 deletions(-)

Comments

Lukas Wunner Oct. 28, 2020, 8:31 p.m. UTC | #1
On Sun, Oct 11, 2020 at 06:07:36PM +0100, Jonathan Cameron wrote:
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/dac/ti,dac082s085.yaml
> @@ -0,0 +1,58 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/dac/ti,dac082s085.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Texas Instruments DAC082s085 and similar DACs
> +
> +description:
> +  A familly of Texas Instruments 8/10/12-bit 2/4-channel DACs
           ^^
s/familly/family


> +  spi-cpha: true
> +  spi-cpol:
> +    description:
> +      Should be either spi-cpha, or spi-cpol but not both.
> +
> +  vref-supply: true
[...]
> +required:
> +  - compatible
> +  - reg

"vref-supply" and ("spi-cpha" xor "spi-cpol") are also requird
per the existing txt file.


> +examples:
> +  - |
> +    spi {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        dac@0 {
> +            compatible = "ti,dac082s085";
> +            reg = <0>;
> +            spi-max-frequency = <40000000>;
> +            spi-cpol;
> +            spi-cpha;
> +            vref-supply = <&vref_2v5_reg>;
> +        };
> +    };

Hm, why wasn't the "vref_2v5_reg" node carried over from the txt file?

Thanks,

Lukas
Jonathan Cameron Oct. 29, 2020, 3:50 p.m. UTC | #2
On Wed, 28 Oct 2020 21:31:40 +0100
Lukas Wunner <lukas@wunner.de> wrote:

> On Sun, Oct 11, 2020 at 06:07:36PM +0100, Jonathan Cameron wrote:
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/iio/dac/ti,dac082s085.yaml
> > @@ -0,0 +1,58 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/iio/dac/ti,dac082s085.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Texas Instruments DAC082s085 and similar DACs
> > +
> > +description:
> > +  A familly of Texas Instruments 8/10/12-bit 2/4-channel DACs  
>            ^^
> s/familly/family
> 
> 
> > +  spi-cpha: true
> > +  spi-cpol:
> > +    description:
> > +      Should be either spi-cpha, or spi-cpol but not both.
> > +
> > +  vref-supply: true  
> [...]
> > +required:
> > +  - compatible
> > +  - reg  
> 
> "vref-supply" and ("spi-cpha" xor "spi-cpol") are also requird
> per the existing txt file.

I have no idea how to specify the spi-cpha xor spi-cpol unfortunately.
Have a question out to Rob on that one.

vref-supply was a stupid mistake from me. Will fix.

> 
> 
> > +examples:
> > +  - |
> > +    spi {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        dac@0 {
> > +            compatible = "ti,dac082s085";
> > +            reg = <0>;
> > +            spi-max-frequency = <40000000>;
> > +            spi-cpol;
> > +            spi-cpha;
> > +            vref-supply = <&vref_2v5_reg>;
> > +        };
> > +    };  
> 
> Hm, why wasn't the "vref_2v5_reg" node carried over from the txt file?

Showing how to supply a regulator isn't generally necessary in an example.
I don't mind having it there though so can keep it
(as the fixed regulator binding has been converted to yaml)

> 
> Thanks,
> 
> Lukas
Lukas Wunner Oct. 29, 2020, 7:10 p.m. UTC | #3
On Thu, Oct 29, 2020 at 03:50:25PM +0000, Jonathan Cameron wrote:
> On Wed, 28 Oct 2020 21:31:40 +0100 Lukas Wunner <lukas@wunner.de> wrote:
> > On Sun, Oct 11, 2020 at 06:07:36PM +0100, Jonathan Cameron wrote:
> > > +examples:
> > > +  - |
> > > +    spi {
> > > +        #address-cells = <1>;
> > > +        #size-cells = <0>;
> > > +
> > > +        dac@0 {
> > > +            compatible = "ti,dac082s085";
> > > +            reg = <0>;
> > > +            spi-max-frequency = <40000000>;
> > > +            spi-cpol;
> > > +            spi-cpha;
> > > +            vref-supply = <&vref_2v5_reg>;
> > > +        };
> > > +    };  
> > 
> > Hm, why wasn't the "vref_2v5_reg" node carried over from the txt file?
> 
> Showing how to supply a regulator isn't generally necessary in an example.
> I don't mind having it there though so can keep it
> (as the fixed regulator binding has been converted to yaml)

The "vref_2v5_reg" node is referenced by the "dac@0" node, so  I included
it in the example for completeness.  I'd appreciate if it could be carried
over to the YAML file, unless its inclusion is a bad practice.

Thanks,

Lukas
Jonathan Cameron Oct. 31, 2020, 11:02 a.m. UTC | #4
On Thu, 29 Oct 2020 20:10:14 +0100
Lukas Wunner <lukas@wunner.de> wrote:

> On Thu, Oct 29, 2020 at 03:50:25PM +0000, Jonathan Cameron wrote:
> > On Wed, 28 Oct 2020 21:31:40 +0100 Lukas Wunner <lukas@wunner.de> wrote:  
> > > On Sun, Oct 11, 2020 at 06:07:36PM +0100, Jonathan Cameron wrote:  
> > > > +examples:
> > > > +  - |
> > > > +    spi {
> > > > +        #address-cells = <1>;
> > > > +        #size-cells = <0>;
> > > > +
> > > > +        dac@0 {
> > > > +            compatible = "ti,dac082s085";
> > > > +            reg = <0>;
> > > > +            spi-max-frequency = <40000000>;
> > > > +            spi-cpol;
> > > > +            spi-cpha;
> > > > +            vref-supply = <&vref_2v5_reg>;
> > > > +        };
> > > > +    };    
> > > 
> > > Hm, why wasn't the "vref_2v5_reg" node carried over from the txt file?  
> > 
> > Showing how to supply a regulator isn't generally necessary in an example.
> > I don't mind having it there though so can keep it
> > (as the fixed regulator binding has been converted to yaml)  
> 
> The "vref_2v5_reg" node is referenced by the "dac@0" node, so  I included
> it in the example for completeness.  I'd appreciate if it could be carried
> over to the YAML file, unless its inclusion is a bad practice.

Sure. Will do so.  Many bindings don't do it, but nor problem with being
more specific.

If we followed the logic of including referenced nodes, some bindings
would end up including nearly a whole board dts.  That's not the case
here though so no problem.

Jonathan

> 
> Thanks,
> 
> Lukas
Jonathan Cameron Oct. 31, 2020, 1:07 p.m. UTC | #5
On Thu, 29 Oct 2020 15:50:25 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> On Wed, 28 Oct 2020 21:31:40 +0100
> Lukas Wunner <lukas@wunner.de> wrote:
> 
> > On Sun, Oct 11, 2020 at 06:07:36PM +0100, Jonathan Cameron wrote:  
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/iio/dac/ti,dac082s085.yaml
> > > @@ -0,0 +1,58 @@
> > > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/iio/dac/ti,dac082s085.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Texas Instruments DAC082s085 and similar DACs
> > > +
> > > +description:
> > > +  A familly of Texas Instruments 8/10/12-bit 2/4-channel DACs    
> >            ^^
> > s/familly/family
> > 
> >   
> > > +  spi-cpha: true
> > > +  spi-cpol:
> > > +    description:
> > > +      Should be either spi-cpha, or spi-cpol but not both.
> > > +
> > > +  vref-supply: true    
> > [...]  
> > > +required:
> > > +  - compatible
> > > +  - reg    
> > 
> > "vref-supply" and ("spi-cpha" xor "spi-cpol") are also requird
> > per the existing txt file.  
> 
> I have no idea how to specify the spi-cpha xor spi-cpol unfortunately.
> Have a question out to Rob on that one.

I tracked down an xor example in another yaml repo that seems to work
(it's convoluted to put it lightly!) so I'll put that in the next
version but will drop Rob's reviewed-by on the basis it's a substantial
change.

Jonathan

> 
> vref-supply was a stupid mistake from me. Will fix.
> 
> > 
> >   
> > > +examples:
> > > +  - |
> > > +    spi {
> > > +        #address-cells = <1>;
> > > +        #size-cells = <0>;
> > > +
> > > +        dac@0 {
> > > +            compatible = "ti,dac082s085";
> > > +            reg = <0>;
> > > +            spi-max-frequency = <40000000>;
> > > +            spi-cpol;
> > > +            spi-cpha;
> > > +            vref-supply = <&vref_2v5_reg>;
> > > +        };
> > > +    };    
> > 
> > Hm, why wasn't the "vref_2v5_reg" node carried over from the txt file?  
> 
> Showing how to supply a regulator isn't generally necessary in an example.
> I don't mind having it there though so can keep it
> (as the fixed regulator binding has been converted to yaml)
> 
> > 
> > Thanks,
> > 
> > Lukas  
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/iio/dac/ti,dac082s085.yaml b/Documentation/devicetree/bindings/iio/dac/ti,dac082s085.yaml
new file mode 100644
index 000000000000..255481f2fee9
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/dac/ti,dac082s085.yaml
@@ -0,0 +1,58 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/dac/ti,dac082s085.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments DAC082s085 and similar DACs
+
+description:
+  A familly of Texas Instruments 8/10/12-bit 2/4-channel DACs
+
+maintainers:
+  - Lukas Wunner <lukas@wunner.de>
+
+properties:
+  compatible:
+    enum:
+      - ti,dac082s085
+      - ti,dac102s085
+      - ti,dac122s085
+      - ti,dac084s085
+      - ti,dac104s085
+      - ti,dac124s085
+
+  reg:
+    maxItems: 1
+
+  spi-cpha: true
+  spi-cpol:
+    description:
+      Should be either spi-cpha, or spi-cpol but not both.
+
+  vref-supply: true
+
+  spi-max-frequency: true
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        dac@0 {
+            compatible = "ti,dac082s085";
+            reg = <0>;
+            spi-max-frequency = <40000000>;
+            spi-cpol;
+            spi-cpha;
+            vref-supply = <&vref_2v5_reg>;
+        };
+    };
+...
diff --git a/Documentation/devicetree/bindings/iio/dac/ti-dac082s085.txt b/Documentation/devicetree/bindings/iio/dac/ti-dac082s085.txt
deleted file mode 100644
index 9cb0e10df704..000000000000
--- a/Documentation/devicetree/bindings/iio/dac/ti-dac082s085.txt
+++ /dev/null
@@ -1,34 +0,0 @@ 
-Texas Instruments 8/10/12-bit 2/4-channel DAC driver
-
-Required properties:
- - compatible:		Must be one of:
-			"ti,dac082s085"
-			"ti,dac102s085"
-			"ti,dac122s085"
-			"ti,dac084s085"
-			"ti,dac104s085"
-			"ti,dac124s085"
- - reg: 		Chip select number.
- - spi-cpha, spi-cpol:	SPI mode (0,1) or (1,0) must be used, so specify
-			either spi-cpha or spi-cpol (but not both).
- - vref-supply: 	Phandle to the external reference voltage supply.
-
-For other required and optional properties of SPI slave nodes please refer to
-../../spi/spi-bus.txt.
-
-Example:
-	vref_2v5_reg: regulator-vref {
-		compatible = "regulator-fixed";
-		regulator-name = "2v5";
-		regulator-min-microvolt = <2500000>;
-		regulator-max-microvolt = <2500000>;
-		regulator-always-on;
-	};
-
-	dac@0 {
-		compatible = "ti,dac082s085";
-		reg = <0>;
-		spi-max-frequency = <40000000>;
-		spi-cpol;
-		vref-supply = <&vref_2v5_reg>;
-	};