Skip to contentSkip to conversation

dt-bindings: leds: bcm6358: Convert to DT schema

PATCH Superseded Ninad Naik 3 participants 5 messages May 25 – Jun 1 1 message not in the archive

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Ninad Naik

author
#0 lore raw

PATCH 1/1 dt-bindings: leds: bcm6358: Convert to DT schema

Convert the brcm,bcm6358 to DT schema.

---

Referred to this thread:
https://lore.kernel.org/all/[email protected]/
and added the fixes suggested.

 .../bindings/leds/brcm,bcm6358-leds.yaml      |  98 ++++++++++++
 .../devicetree/bindings/leds/leds-bcm6358.txt | 143 ------------------
 2 files changed, 98 insertions(+), 143 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml
 delete mode 100644 Documentation/devicetree/bindings/leds/leds-bcm6358.txt
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +98 -0
new file mode 100644
index 000000000000..a61417e5690b
@@ -0,0 +1,98 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/brcm,bcm6358-leds.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LEDs connected to Broadcom BCM6358 controller
+
+description: |
+  This controller is present on BCM6358 and BCM6368.
+  In these SoCs there are Serial LEDs (LEDs connected to a 74x164 controller),
+  which can either be controlled by software (exporting the 74x164 as spi-gpio.
+  See Documentation/devicetree/bindings/gpio/fairchild,74hc595.yaml), or
+  by hardware using this driver.
+
+maintainers:
+  - Jonas Gorski <[email protected]>
+
+properties:
+  compatible:
+    const: brcm,bcm6358-leds
+
+  reg:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+  brcm,clk-div:
+    description: SCK signal divider.
+    default: 1
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [1, 2, 4, 8]
+
+  brcm,clk-dat-low:
+    description: Makes clock and data signals active low.
+    type: boolean
+
+patternProperties:
+  "^led@(0|1?[0-9a-f])$":
+    type: object
+    $ref: common.yaml#
+    description: Each LED is represented as a sub-node of
+      this device.
+
+    properties:
+      reg:
+        description: LED pin number.
+        minimum: 0
+        maximum: 31
+
+    required:
+      - reg
+
+    unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/leds/common.h>
+    led-controller@fffe00d0 {
+        compatible = "brcm,bcm6358-leds";
+        #address-cells = <1>;
+        #size-cells = <0>;
+        reg = <0xfffe00d0 0x8>;
+
+        led@0 {
+            reg = <0>;
+            active-low;
+            label = "white:alarm";
+        };
+        led@2 {
+            reg = <2>;
+            active-low;
+            label = "white:tv";
+        };
+        led@3 {
+            reg = <3>;
+            active-low;
+            label = "white:tel";
+        };
+        led@4 {
+            reg = <4>;
+            active-low;
+            label = "white:adsl";
+        };
+    };
+...
Documentation/devicetree/bindings/leds/leds-bcm6358.txt deleted +0 -143

143 lines not on this page · raw message

Signature · 1 line
2.54.0
#1 lore raw
Quoted 64 lines · Ninad Naik

Convert the brcm,bcm6358 to DT schema.

---

Referred to this thread:
https://lore.kernel.org/all/[email protected]/
and added the fixes suggested.

 .../bindings/leds/brcm,bcm6358-leds.yaml      |  98 ++++++++++++
 .../devicetree/bindings/leds/leds-bcm6358.txt | 143 ------------------
 2 files changed, 98 insertions(+), 143 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml
 delete mode 100644 Documentation/devicetree/bindings/leds/leds-bcm6358.txt
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +43 -0
new file mode 100644
index 000000000000..a61417e5690b
@@ -0,0 +1,98 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/brcm,bcm6358-leds.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LEDs connected to Broadcom BCM6358 controller
+
+description: |
+  This controller is present on BCM6358 and BCM6368.
+  In these SoCs there are Serial LEDs (LEDs connected to a 74x164 controller),
+  which can either be controlled by software (exporting the 74x164 as spi-gpio.
+  See Documentation/devicetree/bindings/gpio/fairchild,74hc595.yaml), or
+  by hardware using this driver.
+
+maintainers:
+  - Jonas Gorski <[email protected]>
+
+properties:
+  compatible:
+    const: brcm,bcm6358-leds
+
+  reg:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 0
+
+  brcm,clk-div:
+    description: SCK signal divider.
+    default: 1
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [1, 2, 4, 8]
+
+  brcm,clk-dat-low:
+    description: Makes clock and data signals active low.
+    type: boolean
+
+patternProperties:
+  "^led@(0|1?[0-9a-f])$":

Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml line 53

Quoted 10 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +10 -0
+    type: object
+    $ref: common.yaml#
+    description: Each LED is represented as a sub-node of
+      this device.
+
+    properties:
+      reg:
+        description: LED pin number.
+        minimum: 0
+        maximum: 31

Is this missing a maxItems: 1?

Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml line 58

Quoted 5 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +5 -0
+
+    required:
+      - reg
+
+    unevaluatedProperties: false

I wonder if this should be additionalProperties: false instead, and list the three properties mentioned by the text binding explicitly?

Cheers,
Conor.

Quoted 192 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +40 -0
+
+required:
+  - compatible
+  - reg
+  - "#address-cells"
+  - "#size-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/leds/common.h>
+    led-controller@fffe00d0 {
+        compatible = "brcm,bcm6358-leds";
+        #address-cells = <1>;
+        #size-cells = <0>;
+        reg = <0xfffe00d0 0x8>;
+
+        led@0 {
+            reg = <0>;
+            active-low;
+            label = "white:alarm";
+        };
+        led@2 {
+            reg = <2>;
+            active-low;
+            label = "white:tv";
+        };
+        led@3 {
+            reg = <3>;
+            active-low;
+            label = "white:tel";
+        };
+        led@4 {
+            reg = <4>;
+            active-low;
+            label = "white:adsl";
+        };
+    };
+...
Documentation/devicetree/bindings/leds/leds-bcm6358.txt deleted +0 -143
deleted file mode 100644
index 211ffc3c4a20..000000000000
@@ -1,143 +0,0 @@
-LEDs connected to Broadcom BCM6358 controller
-
-This controller is present on BCM6358 and BCM6368.
-In these SoCs there are Serial LEDs (LEDs connected to a 74x164 controller),
-which can either be controlled by software (exporting the 74x164 as spi-gpio.
-See Documentation/devicetree/bindings/gpio/fairchild,74hc595.yaml), or
-by hardware using this driver.
-
-Required properties:
-  - compatible : should be "brcm,bcm6358-leds".
-  - #address-cells : must be 1.
-  - #size-cells : must be 0.
-  - reg : BCM6358 LED controller address and size.
-
-Optional properties:
-  - brcm,clk-div : SCK signal divider. Possible values are 1, 2, 4 and 8.
-    Default : 1
-  - brcm,clk-dat-low : Boolean, makes clock and data signals active low.
-    Default : false
-
-Each LED is represented as a sub-node of the brcm,bcm6358-leds device.
-
-LED sub-node required properties:
-  - reg : LED pin number (only LEDs 0 to 31 are valid).
-
-LED sub-node optional properties:
-  - label : see Documentation/devicetree/bindings/leds/common.txt
-  - default-state : see
-    Documentation/devicetree/bindings/leds/common.txt
-  - linux,default-trigger : see
-    Documentation/devicetree/bindings/leds/common.txt
-
-Examples:
-Scenario 1 : BCM6358
-	leds0: led-controller@fffe00d0 {
-		compatible = "brcm,bcm6358-leds";
-		#address-cells = <1>;
-		#size-cells = <0>;
-		reg = <0xfffe00d0 0x8>;
-
-		alarm_white {
-			reg = <0>;
-			active-low;
-			label = "white:alarm";
-		};
-		tv_white {
-			reg = <2>;
-			active-low;
-			label = "white:tv";
-		};
-		tel_white {
-			reg = <3>;
-			active-low;
-			label = "white:tel";
-		};
-		adsl_white {
-			reg = <4>;
-			active-low;
-			label = "white:adsl";
-		};
-	};
-
-Scenario 2 : BCM6368
-	leds0: led-controller@100000d0 {
-		compatible = "brcm,bcm6358-leds";
-		#address-cells = <1>;
-		#size-cells = <0>;
-		reg = <0x100000d0 0x8>;
-		brcm,pol-low;
-		brcm,clk-div = <4>;
-
-		power_red {
-			reg = <0>;
-			active-low;
-			label = "red:power";
-		};
-		power_green {
-			reg = <1>;
-			active-low;
-			label = "green:power";
-			default-state = "on";
-		};
-		power_blue {
-			reg = <2>;
-			label = "blue:power";
-		};
-		broadband_red {
-			reg = <3>;
-			active-low;
-			label = "red:broadband";
-		};
-		broadband_green {
-			reg = <4>;
-			label = "green:broadband";
-		};
-		broadband_blue {
-			reg = <5>;
-			active-low;
-			label = "blue:broadband";
-		};
-		wireless_red {
-			reg = <6>;
-			active-low;
-			label = "red:wireless";
-		};
-		wireless_green {
-			reg = <7>;
-			active-low;
-			label = "green:wireless";
-		};
-		wireless_blue {
-			reg = <8>;
-			label = "blue:wireless";
-		};
-		phone_red {
-			reg = <9>;
-			active-low;
-			label = "red:phone";
-		};
-		phone_green {
-			reg = <10>;
-			active-low;
-			label = "green:phone";
-		};
-		phone_blue {
-			reg = <11>;
-			label = "blue:phone";
-		};
-		upgrading_red {
-			reg = <12>;
-			active-low;
-			label = "red:upgrading";
-		};
-		upgrading_green {
-			reg = <13>;
-			active-low;
-			label = "green:upgrading";
-		};
-		upgrading_blue {
-			reg = <14>;
-			label = "blue:upgrading";
-		};
-	};
Signature · 1 line
2.54.0
author
#2 lore raw
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +5 -0
+patternProperties:
+  "^led@(0|1?[0-9a-f])$":
+    type: object
+    $ref: common.yaml#
+    description: Each LED is represented as a sub-node of
Quoted 8 lines

Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml line 53

Quoted 7 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +7 -0
+      this device.
+
+    properties:
+      reg:
+        description: LED pin number.
+        minimum: 0
+        maximum: 31

Is this missing a maxItems: 1?

Thanks Conor for pointing this out. I will include it in v2.

Quoted 10 lines

Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml line 58

Quoted 6 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +5 -0
+
+    required:
+      - reg
+
+    unevaluatedProperties: false

I wonder if this should be additionalProperties: false instead, and list the three properties mentioned by the text binding explicitly?

Quoted 2 lines

Cheers,
Conor.

I added unevaluatedProperties: false because my understanding was that explicitly listing the properties inherited from common.yaml would be redundant.
I'd be interested to hear the maintainers' preference here, and can adjust this in v2 if needed.

Thanks,
Ninad Naik

#5 lore raw
In reply to Ninad Naik

Hi,

for some reason my email filter didn't catch this ...

Quoted 29 lines · Ninad Naik

Convert the brcm,bcm6358 to DT schema.

---

Referred to this thread:
https://lore.kernel.org/all/[email protected]/
and added the fixes suggested.

 .../bindings/leds/brcm,bcm6358-leds.yaml      |  98 ++++++++++++
 .../devicetree/bindings/leds/leds-bcm6358.txt | 143 ------------------
 2 files changed, 98 insertions(+), 143 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml
 delete mode 100644 Documentation/devicetree/bindings/leds/leds-bcm6358.txt
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +7 -0
new file mode 100644
index 000000000000..a61417e5690b
@@ -0,0 +1,98 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/brcm,bcm6358-leds.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LEDs connected to Broadcom BCM6358 controller

Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml line 17

Quoted 10 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +10 -0
+
+description: |
+  This controller is present on BCM6358 and BCM6368.
+  In these SoCs there are Serial LEDs (LEDs connected to a 74x164 controller),
+  which can either be controlled by software (exporting the 74x164 as spi-gpio.
+  See Documentation/devicetree/bindings/gpio/fairchild,74hc595.yaml), or
+  by hardware using this driver.
+
+maintainers:
+  - Jonas Gorski <[email protected]>

The driver and .txt schema were originally submitted by Álvaro (added to cc), so I would have expected him to be the (suggested) maintainer.

Best regards,
Jonas

#4 lore raw
In reply to a message not in the archive
Quoted 29 lines · Ninad Naik
Quoted 16 lines

Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml line 53

Quoted 13 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +12 -0
+patternProperties:
+  "^led@(0|1?[0-9a-f])$":
+    type: object
+    $ref: common.yaml#
+    description: Each LED is represented as a sub-node of
+      this device.
+
+    properties:
+      reg:
+        description: LED pin number.
+        minimum: 0
+        maximum: 31

Is this missing a maxItems: 1?

Thanks Conor for pointing this out. I will include it in v2.

Quoted 11 lines

Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml line 58

Quoted 6 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +5 -0
+
+    required:
+      - reg
+
+    unevaluatedProperties: false

I wonder if this should be additionalProperties: false instead, and list the three properties mentioned by the text binding explicitly?

Quoted 8 lines
Quoted 3 lines

Cheers,
Conor.

I added unevaluatedProperties: false because my understanding was that explicitly listing the properties inherited from common.yaml would be redundant.
I'd be interested to hear the maintainers' preference here, and can adjust this in v2 if needed.

If only those 3 are permitted, it's probably the better approach.