diff mbox series

[23/54] dt-bindings: mfd: Convert X-Powers AC100 binding to a schema

Message ID 20210721140424.725744-24-maxime@cerno.tech (mailing list archive)
State New, archived
Headers show
Series ARM: dts: Last round of DT schema fixes | expand

Commit Message

Maxime Ripard July 21, 2021, 2:03 p.m. UTC
The X-Powers AC100 hybrid devices are supported by Linux thanks to its
device tree binding.

Now that we have the DT validation in place, let's convert the device
tree bindings for that driver over to a YAML schema.

Cc: Chen-Yu Tsai <wens@csie.org>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 .../devicetree/bindings/mfd/ac100.txt         |  50 --------
 .../bindings/mfd/x-powers,ac100.yaml          | 113 ++++++++++++++++++
 2 files changed, 113 insertions(+), 50 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/mfd/ac100.txt
 create mode 100644 Documentation/devicetree/bindings/mfd/x-powers,ac100.yaml

Comments

Rob Herring July 23, 2021, 9:54 p.m. UTC | #1
On Wed, Jul 21, 2021 at 04:03:53PM +0200, Maxime Ripard wrote:
> The X-Powers AC100 hybrid devices are supported by Linux thanks to its
> device tree binding.
> 
> Now that we have the DT validation in place, let's convert the device
> tree bindings for that driver over to a YAML schema.
> 
> Cc: Chen-Yu Tsai <wens@csie.org>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>  .../devicetree/bindings/mfd/ac100.txt         |  50 --------
>  .../bindings/mfd/x-powers,ac100.yaml          | 113 ++++++++++++++++++
>  2 files changed, 113 insertions(+), 50 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/mfd/ac100.txt
>  create mode 100644 Documentation/devicetree/bindings/mfd/x-powers,ac100.yaml
> 
> diff --git a/Documentation/devicetree/bindings/mfd/ac100.txt b/Documentation/devicetree/bindings/mfd/ac100.txt
> deleted file mode 100644
> index dff219f07493..000000000000
> --- a/Documentation/devicetree/bindings/mfd/ac100.txt
> +++ /dev/null
> @@ -1,50 +0,0 @@
> -X-Powers AC100 Codec/RTC IC Device Tree bindings
> -
> -AC100 is a audio codec and RTC subsystem combo IC. The 2 parts are
> -separated, including power supplies and interrupt lines, but share
> -a common register address space and host interface.
> -
> -Required properties:
> -- compatible: "x-powers,ac100"
> -- reg: The I2C slave address or RSB hardware address for the chip
> -- sub-nodes:
> -  - codec
> -    - compatible:		"x-powers,ac100-codec"
> -    - interrupts:		SoC NMI / GPIO interrupt connected to the
> -    				IRQ_AUDIO pin
> -    - #clock-cells:		Shall be 0
> -    - clock-output-names:	"4M_adda"
> -
> -    - see clock/clock-bindings.txt for common clock bindings
> -
> -  - rtc
> -    - compatible:		"x-powers,ac100-rtc"
> -    - clocks:			A phandle to the codec's "4M_adda" clock
> -    - #clock-cells:		Shall be 1
> -    - clock-output-names:	"cko1_rtc", "cko2_rtc", "cko3_rtc"
> -
> -    - see clock/clock-bindings.txt for common clock bindings
> -
> -Example:
> -
> -ac100: codec@e89 {
> -	compatible = "x-powers,ac100";
> -	reg = <0xe89>;
> -
> -	ac100_codec: codec {
> -		compatible = "x-powers,ac100-codec";
> -		interrupt-parent = <&r_pio>;
> -		interrupts = <0 9 IRQ_TYPE_LEVEL_LOW>; /* PL9 */
> -		#clock-cells = <0>;
> -		clock-output-names = "4M_adda";
> -	};
> -
> -	ac100_rtc: rtc {
> -		compatible = "x-powers,ac100-rtc";
> -		interrupt-parent = <&nmi_intc>;
> -		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> -		clocks = <&ac100_codec>;
> -		#clock-cells = <1>;
> -		clock-output-names = "cko1_rtc", "cko2_rtc", "cko3_rtc";
> -	};
> -};
> diff --git a/Documentation/devicetree/bindings/mfd/x-powers,ac100.yaml b/Documentation/devicetree/bindings/mfd/x-powers,ac100.yaml
> new file mode 100644
> index 000000000000..6990765076b8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/x-powers,ac100.yaml
> @@ -0,0 +1,113 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: "http://devicetree.org/schemas/mfd/x-powers,ac100.yaml#"
> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
> +
> +title: X-Powers AC100 Device Tree Bindings
> +
> +maintainers:
> +  - Chen-Yu Tsai <wens@csie.org>
> +
> +properties:
> +  compatible:
> +    const: x-powers,ac100
> +
> +  reg:
> +    maxItems: 1
> +
> +  codec:
> +    type: object
> +
> +    properties:
> +      "#clock-cells":
> +        const: 0
> +
> +      compatible:
> +        const: x-powers,ac100-codec
> +
> +      interrupts:
> +        maxItems: 1
> +
> +      clock-output-names:
> +        description: >
> +          Name of the 4M_adda clock exposed by the codec

maxItems: 1

> +
> +    required:
> +      - "#clock-cells"
> +      - compatible
> +      - interrupts
> +      - clock-output-names
> +
> +    additionalProperties: false
> +
> +  rtc:
> +    type: object
> +
> +    properties:
> +      "#clock-cells":
> +        const: 1
> +
> +      compatible:
> +        const: x-powers,ac100-rtc
> +
> +      interrupts:
> +        maxItems: 1
> +
> +      clocks:
> +        description: >
> +           A phandle to the codec's "4M_adda" clock

maxItems: 1

> +
> +      clock-output-names:
> +        description: >
> +          Name of the cko1, cko2 and cko3 clocks exposed by the codec

maxItems: 3

> +
> +    required:
> +      - "#clock-cells"
> +      - compatible
> +      - interrupts
> +      - clocks
> +      - clock-output-names
> +
> +    additionalProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +  - codec
> +  - rtc
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    rsb {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        codec@e89 {
> +            compatible = "x-powers,ac100";
> +            reg = <0xe89>;
> +
> +            ac100_codec: codec {
> +                compatible = "x-powers,ac100-codec";
> +                interrupt-parent = <&r_pio>;
> +                interrupts = <0 9 IRQ_TYPE_LEVEL_LOW>; /* PL9 */
> +                #clock-cells = <0>;
> +                clock-output-names = "4M_adda";
> +            };
> +
> +            ac100_rtc: rtc {
> +                compatible = "x-powers,ac100-rtc";
> +                interrupt-parent = <&nmi_intc>;
> +                interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
> +                clocks = <&ac100_codec>;
> +                #clock-cells = <1>;
> +                clock-output-names = "cko1_rtc", "cko2_rtc", "cko3_rtc";
> +            };
> +        };
> +    };
> +
> +...
> -- 
> 2.31.1
> 
>
Chen-Yu Tsai Aug. 1, 2021, 12:15 p.m. UTC | #2
On Sat, Jul 24, 2021 at 5:54 AM Rob Herring <robh@kernel.org> wrote:
>
> On Wed, Jul 21, 2021 at 04:03:53PM +0200, Maxime Ripard wrote:
> > The X-Powers AC100 hybrid devices are supported by Linux thanks to its
> > device tree binding.
> >
> > Now that we have the DT validation in place, let's convert the device
> > tree bindings for that driver over to a YAML schema.
> >
> > Cc: Chen-Yu Tsai <wens@csie.org>
> > Cc: Lee Jones <lee.jones@linaro.org>
> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Acked-by: Chen-Yu Tsai <wens@csie.org>

once Rob's suggestions are added.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mfd/ac100.txt b/Documentation/devicetree/bindings/mfd/ac100.txt
deleted file mode 100644
index dff219f07493..000000000000
--- a/Documentation/devicetree/bindings/mfd/ac100.txt
+++ /dev/null
@@ -1,50 +0,0 @@ 
-X-Powers AC100 Codec/RTC IC Device Tree bindings
-
-AC100 is a audio codec and RTC subsystem combo IC. The 2 parts are
-separated, including power supplies and interrupt lines, but share
-a common register address space and host interface.
-
-Required properties:
-- compatible: "x-powers,ac100"
-- reg: The I2C slave address or RSB hardware address for the chip
-- sub-nodes:
-  - codec
-    - compatible:		"x-powers,ac100-codec"
-    - interrupts:		SoC NMI / GPIO interrupt connected to the
-    				IRQ_AUDIO pin
-    - #clock-cells:		Shall be 0
-    - clock-output-names:	"4M_adda"
-
-    - see clock/clock-bindings.txt for common clock bindings
-
-  - rtc
-    - compatible:		"x-powers,ac100-rtc"
-    - clocks:			A phandle to the codec's "4M_adda" clock
-    - #clock-cells:		Shall be 1
-    - clock-output-names:	"cko1_rtc", "cko2_rtc", "cko3_rtc"
-
-    - see clock/clock-bindings.txt for common clock bindings
-
-Example:
-
-ac100: codec@e89 {
-	compatible = "x-powers,ac100";
-	reg = <0xe89>;
-
-	ac100_codec: codec {
-		compatible = "x-powers,ac100-codec";
-		interrupt-parent = <&r_pio>;
-		interrupts = <0 9 IRQ_TYPE_LEVEL_LOW>; /* PL9 */
-		#clock-cells = <0>;
-		clock-output-names = "4M_adda";
-	};
-
-	ac100_rtc: rtc {
-		compatible = "x-powers,ac100-rtc";
-		interrupt-parent = <&nmi_intc>;
-		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
-		clocks = <&ac100_codec>;
-		#clock-cells = <1>;
-		clock-output-names = "cko1_rtc", "cko2_rtc", "cko3_rtc";
-	};
-};
diff --git a/Documentation/devicetree/bindings/mfd/x-powers,ac100.yaml b/Documentation/devicetree/bindings/mfd/x-powers,ac100.yaml
new file mode 100644
index 000000000000..6990765076b8
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/x-powers,ac100.yaml
@@ -0,0 +1,113 @@ 
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/mfd/x-powers,ac100.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: X-Powers AC100 Device Tree Bindings
+
+maintainers:
+  - Chen-Yu Tsai <wens@csie.org>
+
+properties:
+  compatible:
+    const: x-powers,ac100
+
+  reg:
+    maxItems: 1
+
+  codec:
+    type: object
+
+    properties:
+      "#clock-cells":
+        const: 0
+
+      compatible:
+        const: x-powers,ac100-codec
+
+      interrupts:
+        maxItems: 1
+
+      clock-output-names:
+        description: >
+          Name of the 4M_adda clock exposed by the codec
+
+    required:
+      - "#clock-cells"
+      - compatible
+      - interrupts
+      - clock-output-names
+
+    additionalProperties: false
+
+  rtc:
+    type: object
+
+    properties:
+      "#clock-cells":
+        const: 1
+
+      compatible:
+        const: x-powers,ac100-rtc
+
+      interrupts:
+        maxItems: 1
+
+      clocks:
+        description: >
+           A phandle to the codec's "4M_adda" clock
+
+      clock-output-names:
+        description: >
+          Name of the cko1, cko2 and cko3 clocks exposed by the codec
+
+    required:
+      - "#clock-cells"
+      - compatible
+      - interrupts
+      - clocks
+      - clock-output-names
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - codec
+  - rtc
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    rsb {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        codec@e89 {
+            compatible = "x-powers,ac100";
+            reg = <0xe89>;
+
+            ac100_codec: codec {
+                compatible = "x-powers,ac100-codec";
+                interrupt-parent = <&r_pio>;
+                interrupts = <0 9 IRQ_TYPE_LEVEL_LOW>; /* PL9 */
+                #clock-cells = <0>;
+                clock-output-names = "4M_adda";
+            };
+
+            ac100_rtc: rtc {
+                compatible = "x-powers,ac100-rtc";
+                interrupt-parent = <&nmi_intc>;
+                interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+                clocks = <&ac100_codec>;
+                #clock-cells = <1>;
+                clock-output-names = "cko1_rtc", "cko2_rtc", "cko3_rtc";
+            };
+        };
+    };
+
+...