Skip to contentSkip to conversation

dt-bindings: pwm: convert atmel pwm to json-schema

PATCH Superseded Sergiu Moga 2 participants 6 messages Mar 7, 2022

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover dt-bindings: pwm: convert atmel pwm to json-schema

This patch series addresses the conversion of the Atmel PWM DT binding to the DT Schema format and adds the SAMA7G5 compatible to the respective converted binding.

Sergiu Moga (2):
dt-bindings: pwm: convert atmel pwm to json-schema
dt-bindings: pwm: at91: Add SAMA7G5 compatible strings list

 .../devicetree/bindings/pwm/atmel-pwm.txt     | 35 ----------
 .../devicetree/bindings/pwm/atmel-pwm.yaml    | 67 +++++++++++++++++++
 2 files changed, 67 insertions(+), 35 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/pwm/atmel-pwm.txt
 create mode 100644 Documentation/devicetree/bindings/pwm/atmel-pwm.yaml
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 dt-bindings: pwm: convert atmel pwm to json-schema

Convert PWM binding for Atmel/Microchip SoCs to Device Tree Schema format.

---
 .../devicetree/bindings/pwm/atmel-pwm.txt     | 35 -----------
 .../devicetree/bindings/pwm/atmel-pwm.yaml    | 62 +++++++++++++++++++
 2 files changed, 62 insertions(+), 35 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/pwm/atmel-pwm.txt
 create mode 100644 Documentation/devicetree/bindings/pwm/atmel-pwm.yaml
Documentation/devicetree/bindings/pwm/atmel-pwm.txt deleted +0 -35
deleted file mode 100644
index fbb5325be1f0..000000000000
@@ -1,35 +0,0 @@
-Atmel PWM controller
-
-Required properties:
-  - compatible: should be one of:
-    - "atmel,at91sam9rl-pwm"
-    - "atmel,sama5d3-pwm"
-    - "atmel,sama5d2-pwm"
-    - "microchip,sam9x60-pwm"
-  - reg: physical base address and length of the controller's registers
-  - #pwm-cells: Should be 3. See pwm.yaml in this directory for a
-    description of the cells format.
-
-Example:
-
-	pwm0: pwm@f8034000 {
-		compatible = "atmel,at91sam9rl-pwm";
-		reg = <0xf8034000 0x400>;
-		#pwm-cells = <3>;
-	};
-
-	pwmleds {
-		compatible = "pwm-leds";
-
-		d1 {
-			label = "d1";
-			pwms = <&pwm0 3 5000 0>
-			max-brightness = <255>;
-		};
-
-		d2 {
-			label = "d2";
-			pwms = <&pwm0 1 5000 1>
-			max-brightness = <255>;
-		};
-	};
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
2.25.1
#4 lore raw

PATCH 2/2 dt-bindings: pwm: at91: Add SAMA7G5 compatible strings list

In reply to Sergiu Moga

Add compatible strings list for SAMA7G5.

---
 .../devicetree/bindings/pwm/atmel-pwm.yaml        | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml +10 -5
index f5378a2226bd..55d40973e6a9 100644
@@ -12,11 +12,16 @@ maintainers:
 
 properties:
   compatible:
-    enum:
-      - atmel,at91sam9rl-pwm
-      - atmel,sama5d3-pwm
-      - atmel,sama5d2-pwm
-      - microchip,sam9x60-pwm
+    oneOf:
+      - items:
+          - enum:
+              - atmel,at91sam9rl-pwm
+              - atmel,sama5d3-pwm
+              - atmel,sama5d2-pwm
+              - microchip,sam9x60-pwm
+      - items:
+          - const: microchip,sama7g5-pwm
+          - const: atmel,sama5d2-pwm
 
   reg:
     description: |
Signature · 1 line
2.25.1
#2 lore raw
In reply to Sergiu Moga
Quoted 14 lines · Sergiu Moga

Convert PWM binding for Atmel/Microchip SoCs to Device Tree Schema format.

---
 .../devicetree/bindings/pwm/atmel-pwm.txt     | 35 -----------
 .../devicetree/bindings/pwm/atmel-pwm.yaml    | 62 +++++++++++++++++++
 2 files changed, 62 insertions(+), 35 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/pwm/atmel-pwm.txt
 create mode 100644 Documentation/devicetree/bindings/pwm/atmel-pwm.yaml
Documentation/devicetree/bindings/pwm/atmel-pwm.txt deleted +0 -0
deleted file mode 100644
index fbb5325be1f0..000000000000

Documentation/devicetree/bindings/pwm/atmel-pwm.txt

Quoted 1 line
Documentation/devicetree/bindings/pwm/atmel-pwm.txt deleted +0 -1
--- a/Documentation/devicetree/bindings/pwm/atmel-pwm.txt

I would prefer for new files to switch to common DT conversion:
vendor,name.yaml

You have there another PWM bindings for Atmel, so the name should not be just "pwm" but something more specific, maybe "at91sam-pwm"?

Quoted 43 lines

+++ /dev/null

Documentation/devicetree/bindings/pwm/atmel-pwm.txt deleted +0 -35
@@ -1,35 +0,0 @@
-Atmel PWM controller
-
-Required properties:
-  - compatible: should be one of:
-    - "atmel,at91sam9rl-pwm"
-    - "atmel,sama5d3-pwm"
-    - "atmel,sama5d2-pwm"
-    - "microchip,sam9x60-pwm"
-  - reg: physical base address and length of the controller's registers
-  - #pwm-cells: Should be 3. See pwm.yaml in this directory for a
-    description of the cells format.
-
-Example:
-
-	pwm0: pwm@f8034000 {
-		compatible = "atmel,at91sam9rl-pwm";
-		reg = <0xf8034000 0x400>;
-		#pwm-cells = <3>;
-	};
-
-	pwmleds {
-		compatible = "pwm-leds";
-
-		d1 {
-			label = "d1";
-			pwms = <&pwm0 3 5000 0>
-			max-brightness = <255>;
-		};
-
-		d2 {
-			label = "d2";
-			pwms = <&pwm0 1 5000 1>
-			max-brightness = <255>;
-		};
-	};
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +0 -0
new file mode 100644
index 000000000000..f5378a2226bd

Documentation/devicetree/bindings/pwm/atmel-pwm.yaml line 8

Quoted 8 lines
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +8 -0
@@ -0,0 +1,62 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2022 Microchip Technology, Inc. and its subsidiaries
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pwm/atmel-pwm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Atmel PWM controller

title: Atmel/Microchip PWM controller

Documentation/devicetree/bindings/pwm/atmel-pwm.yaml line 12

Quoted 4 lines
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +4 -0
+
+maintainers:
+  - Claudiu Beznea <[email protected]>
+

allOf including pwm.yaml

Documentation/devicetree/bindings/pwm/atmel-pwm.yaml line 24

Quoted 12 lines
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +12 -0
+properties:
+  compatible:
+    enum:
+      - atmel,at91sam9rl-pwm
+      - atmel,sama5d3-pwm
+      - atmel,sama5d2-pwm
+      - microchip,sam9x60-pwm
+
+  reg:
+    description: |
+      Physical base address and length of the controller's
+      registers

Skip description, it's obvious.

Documentation/devicetree/bindings/pwm/atmel-pwm.yaml line 30

Quoted 6 lines
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +6 -0
+    maxItems: 1
+
+  "#pwm-cells":
+    description: |
+      Should be 3. See pwm.yaml in this directory for a
+      description of the cells format.

Skip description, it's obvious.

Documentation/devicetree/bindings/pwm/atmel-pwm.yaml line 36

Quoted 6 lines
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +6 -0
+    const: 3
+
+required:
+  - compatible
+  - reg
+  - "#pwm-cells"

Skip pwm-cells, required by pwm.yaml.

Documentation/devicetree/bindings/pwm/atmel-pwm.yaml line 48

Quoted 12 lines
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +12 -0
+
+additionalProperties: true
+
+examples:
+  - |
+        pwm0: pwm@f8034000 {
+                compatible = "atmel,at91sam9rl-pwm";
+                reg = <0xf8034000 0x400>;
+                #pwm-cells = <3>;
+        };
+
+        pwmleds {

Skip this node. No actual benefit. All clients are the same.

Quoted 4 lines
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +4 -0
+                compatible = "pwm-leds";
+
+                led-1 {
+                        label = "led-1";

Documentation/devicetree/bindings/pwm/atmel-pwm.yaml line 62

Quoted 10 lines
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +10 -0
+                        pwms = <&pwm0 3 5000 0>;
+                        max-brightness = <255>;
+                };
+
+                led-2 {
+                        label = "led-2";
+                        pwms = <&pwm0 1 5000 1>;
+                        max-brightness = <255>;
+                };
+        };

Best regards,
Krzysztof

#3 lore raw
In reply to Krzysztof Kozlowski
Quoted 19 lines · Krzysztof Kozlowski
Quoted 14 lines · Sergiu Moga

Convert PWM binding for Atmel/Microchip SoCs to Device Tree Schema format.

---
  .../devicetree/bindings/pwm/atmel-pwm.txt     | 35 -----------
  .../devicetree/bindings/pwm/atmel-pwm.yaml    | 62 +++++++++++++++++++
  2 files changed, 62 insertions(+), 35 deletions(-)

delete mode 100644 Documentation/devicetree/bindings/pwm/atmel-pwm.txt create mode 100644 Documentation/devicetree/bindings/pwm/atmel-pwm.yaml

Documentation/devicetree/bindings/pwm/atmel-pwm.txt deleted +0 -0
deleted file mode 100644
index fbb5325be1f0..000000000000

Documentation/devicetree/bindings/pwm/atmel-pwm.txt

Quoted 1 line
Documentation/devicetree/bindings/pwm/atmel-pwm.txt deleted +0 -1
--- a/Documentation/devicetree/bindings/pwm/atmel-pwm.txt

I would prefer for new files to switch to common DT conversion:
vendor,name.yaml

Quoted 4 lines

You have there another PWM bindings for Atmel, so the name should not be just "pwm" but something more specific, maybe "at91sam-pwm"?

Understood, yes, it does make more sense like this. Thank you for the suggestion, I will rename the file to atmel,at91sam-pwm.yaml.

Quoted 53 lines
Quoted 43 lines

+++ /dev/null

Documentation/devicetree/bindings/pwm/atmel-pwm.txt deleted +0 -35
@@ -1,35 +0,0 @@
-Atmel PWM controller
-
-Required properties:
-  - compatible: should be one of:
-    - "atmel,at91sam9rl-pwm"
-    - "atmel,sama5d3-pwm"
-    - "atmel,sama5d2-pwm"
-    - "microchip,sam9x60-pwm"
-  - reg: physical base address and length of the controller's registers
-  - #pwm-cells: Should be 3. See pwm.yaml in this directory for a
-    description of the cells format.
-
-Example:
-
-     pwm0: pwm@f8034000 {
-             compatible = "atmel,at91sam9rl-pwm";
-             reg = <0xf8034000 0x400>;
-             #pwm-cells = <3>;
-     };
-
-     pwmleds {
-             compatible = "pwm-leds";
-
-             d1 {
-                     label = "d1";
-                     pwms = <&pwm0 3 5000 0>
-                     max-brightness = <255>;
-             };
-
-             d2 {
-                     label = "d2";
-                     pwms = <&pwm0 1 5000 1>
-                     max-brightness = <255>;
-             };
-     };
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +0 -0
new file mode 100644
index 000000000000..f5378a2226bd

Documentation/devicetree/bindings/pwm/atmel-pwm.yaml line 8

Quoted 8 lines
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +8 -0
@@ -0,0 +1,62 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2022 Microchip Technology, Inc. and its subsidiaries
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pwm/atmel-pwm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Atmel PWM controller

title: Atmel/Microchip PWM controller

Quoted 6 lines

Documentation/devicetree/bindings/pwm/atmel-pwm.yaml line 12

Quoted 4 lines
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +4 -0
+
+maintainers:
+  - Claudiu Beznea <[email protected]>
+

allOf including pwm.yaml

Noted.

Quoted 22 lines

Documentation/devicetree/bindings/pwm/atmel-pwm.yaml line 24

Quoted 12 lines
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +12 -0
+properties:
+  compatible:
+    enum:
+      - atmel,at91sam9rl-pwm
+      - atmel,sama5d3-pwm
+      - atmel,sama5d2-pwm
+      - microchip,sam9x60-pwm
+
+  reg:
+    description: |
+      Physical base address and length of the controller's
+      registers

Skip description, it's obvious.

Documentation/devicetree/bindings/pwm/atmel-pwm.yaml line 30

Quoted 6 lines
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +6 -0
+    maxItems: 1
+
+  "#pwm-cells":
+    description: |
+      Should be 3. See pwm.yaml in this directory for a
+      description of the cells format.

Skip description, it's obvious.

Quoted 8 lines

Documentation/devicetree/bindings/pwm/atmel-pwm.yaml line 36

Quoted 6 lines
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +6 -0
+    const: 3
+
+required:
+  - compatible
+  - reg
+  - "#pwm-cells"

Skip pwm-cells, required by pwm.yaml.

Understood, will remove it in the next version along with the unnecessary descriptions.

Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +5 -0
+
+additionalProperties: true
+
+examples:
+  - |
Quoted 9 lines

Documentation/devicetree/bindings/pwm/atmel-pwm.yaml line 48

Quoted 7 lines
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +7 -0
+        pwm0: pwm@f8034000 {
+                compatible = "atmel,at91sam9rl-pwm";
+                reg = <0xf8034000 0x400>;
+                #pwm-cells = <3>;
+        };
+
+        pwmleds {

Skip this node. No actual benefit. All clients are the same.

Understood. I will include pwm0 only.

Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +9 -0
+                compatible = "pwm-leds";
+
+                led-1 {
+                        label = "led-1";
+                        pwms = <&pwm0 3 5000 0>;
+                        max-brightness = <255>;
+                };
+
+                led-2 {
Quoted 8 lines

Documentation/devicetree/bindings/pwm/atmel-pwm.yaml line 62

Quoted 5 lines
Documentation/devicetree/bindings/pwm/atmel-pwm.yaml new file +5 -0
+                        label = "led-2";
+                        pwms = <&pwm0 1 5000 1>;
+                        max-brightness = <255>;
+                };
+        };

Best regards,
Krzysztof

Thank you for the detailed feedback.

Sergiu