Skip to contentSkip to conversation

dt-bindings: leds: lacie,ns2-leds: Convert to DT schema

PATCH Superseded Ninad Naik 3 participants 5 messages Jul 24 – Jul 28

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Ninad Naik

author
#0 lore raw

PATCH v3 1/1 dt-bindings: leds: lacie,ns2-leds: Convert to DT schema

Convert lacie,ns2-leds to DT schema.

---
Changes in v3:
- Add optional property num-modes to the schema.

 .../bindings/leds/lacie,ns2-leds.yaml         | 85 +++++++++++++++++++
 .../devicetree/bindings/leds/leds-ns2.txt     | 35 --------
 2 files changed, 85 insertions(+), 35 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/leds/lacie,ns2-leds.yaml
 delete mode 100644 Documentation/devicetree/bindings/leds/leds-ns2.txt
Documentation/devicetree/bindings/leds/lacie,ns2-leds.yaml new file +85 -0
new file mode 100644
index 000000000000..2138c75c0413
@@ -0,0 +1,85 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/lacie,ns2-leds.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Dual-GPIO LEDs found on Network Space v2 (and parents)
+
+maintainers:
+  - Simon Guinot <[email protected]>
+
+description:
+  The Network Space v2 dual-GPIO LED is wired to a CPLD. Three different LED
+  modes are available, off, on and SATA activity blinking. The LED modes are
+  controlled through two GPIOs (command and slow), each combination of values
+  for the command/slow GPIOs corresponds to a LED mode.
+
+properties:
+  compatible:
+    const: lacie,ns2-leds
+
+additionalProperties:
+  type: object
+  $ref: common.yaml#
+  unevaluatedProperties: false
+
+  description: Each child node represents a single LED
+
+  properties:
+    cmd-gpio:
+      maxItems: 1
+      description: GPIO connected to the command LED output
+
+    slow-gpio:
+      maxItems: 1
+      description: GPIO connected to the slow LED output
+
+    num-modes:
+      $ref: /schemas/types.yaml#/definitions/uint32
+      description:
+        Number of entries in modes-map.
+
+    modes-map:
+      $ref: /schemas/types.yaml#/definitions/uint32-matrix
+      description:
+        A mapping between LED modes (off, on or SATA activity blinking) and
+        the corresponding cmd-gpio/slow-gpio values. All the GPIO values
+        combinations should be given in order to avoid having an unknown
+        mode at driver probe time.
+
+      items:
+        items:
+          - description: LED mode
+            enum: [0, 1, 2]
+          - description: Command GPIO level
+            enum: [0, 1]
+          - description: Slow GPIO level
+            enum: [0, 1]
+
+  required:
+    - cmd-gpio
+    - slow-gpio
+    - modes-map
+
+required:
+  - compatible
+
+examples:
+  - |
+    #include <dt-bindings/leds/leds-ns2.h>
+
+    led-controller {
+        compatible = "lacie,ns2-leds";
+
+        led-0 {
+            label = "ns2:blue:sata";
+            slow-gpio = <&gpio0 29 0>;
+            cmd-gpio = <&gpio0 30 0>;
+            modes-map = <NS_V2_LED_OFF  0 1
+                         NS_V2_LED_ON   1 0
+                         NS_V2_LED_ON   0 0
+                         NS_V2_LED_SATA 1 1>;
+        };
+    };
+...
Documentation/devicetree/bindings/leds/leds-ns2.txt deleted +0 -35
deleted file mode 100644
index 9f81258a5b6e..000000000000
@@ -1,35 +0,0 @@
-Binding for dual-GPIO LED found on Network Space v2 (and parents).
-
-Required properties:
-- compatible: "lacie,ns2-leds".
-
-Each LED is represented as a sub-node of the ns2-leds device.
-
-Required sub-node properties:
-- cmd-gpio: Command LED GPIO. See OF device-tree GPIO specification.
-- slow-gpio: Slow LED GPIO. See OF device-tree GPIO specification.
-- modes-map: A mapping between LED modes (off, on or SATA activity blinking) and
-  the corresponding cmd-gpio/slow-gpio values. All the GPIO values combinations
-  should be given in order to avoid having an unknown mode at driver probe time.
-
-Optional sub-node properties:
-- label: Name for this LED. If omitted, the label is taken from the node name.
-- linux,default-trigger: Trigger assigned to the LED.
-
-Example:
-
-#include <dt-bindings/leds/leds-ns2.h>
-
-ns2-leds {
-	compatible = "lacie,ns2-leds";
-
-	blue-sata {
-		label = "ns2:blue:sata";
-		slow-gpio = <&gpio0 29 0>;
-		cmd-gpio = <&gpio0 30 0>;
-		modes-map = <NS_V2_LED_OFF  0 1
-			     NS_V2_LED_ON   1 0
-			     NS_V2_LED_ON   0 0
-			     NS_V2_LED_SATA 1 1>;
-	};
-};
Signature · 1 line
2.55.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The top-level `additionalProperties` is incorrectly defined as a child-node schema, causing it…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The top-level additionalProperties is incorrectly defined as a child-node schema, causing it to incorrectly reject standard device tree properties. --

--- Patch [1]: [PATCH v3] dt-bindings: leds: lacie,ns2-leds: Convert to DT schema --- commit 2e02c3a2b329288ad4aeeb155d96aec6b772c421
Author: Ninad Naik <[email protected]>

dt-bindings: leds: lacie,ns2-leds: Convert to DT schema

Convert lacie,ns2-leds to DT schema.

Quoted 5 lines
Documentation/devicetree/bindings/leds/lacie,ns2-leds.yaml new file +0 -0
new file mode 100644
index 0000000000000..2138c75c04133

[ ... ]

Documentation/devicetree/bindings/leds/lacie,ns2-leds.yaml line 25

Quoted 8 lines
Documentation/devicetree/bindings/leds/lacie,ns2-leds.yaml new file +8 -0
+properties:
+  compatible:
+    const: lacie,ns2-leds
+
+additionalProperties:
+  type: object
+  $ref: common.yaml#
+  unevaluatedProperties: false

[Severity: Medium]
Does this incorrectly apply an object constraint to all unspecified top-level properties?

It appears this schema logic will cause valid device trees containing standard non-object properties (like status or pinctrl-0) to fail validation during make dtbs_check.

Should child nodes instead be matched using patternProperties, with
additionalProperties: false or unevaluatedProperties: false used at the top level to allow standard DT properties?

Quoted 5 lines
Documentation/devicetree/bindings/leds/lacie,ns2-leds.yaml new file +5 -0
+
+  description: Each child node represents a single LED
+
+  properties:
+    cmd-gpio:

[ ... ]

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Reviewed-by on v3 1/1
#2 lore raw
In reply to Ninad Naik
Quoted 4 lines · Ninad Naik

Convert lacie,ns2-leds to DT schema.

Drop both. You need to read that report again.

Quoted 4 lines

---
Changes in v3:
- Add optional property num-modes to the schema.

Missing rest of the changelog.

What happened here?

Rest looks good, so with dropping incorrect tags (really, please read the email you received):

Best regards,
Krzysztof

author
#3 lore raw
Quoted 6 lines · Krzysztof Kozlowski
Quoted 4 lines · Ninad Naik

Convert lacie,ns2-leds to DT schema.

Drop both. You need to read that report again.

Sorry, I missed the line which says not to include the tags in a new version of the same patch. Will remove.

Quoted 5 lines
Quoted 5 lines

---
Changes in v3:
- Add optional property num-modes to the schema.

Quoted 8 lines

Missing rest of the changelog.

What happened here?

Rest looks good, so with dropping incorrect tags (really, please read the email you received):

Should I carry over this tag in v4?

Quoted 3 lines

Best regards,
Krzysztof

Thanks,
Ninad Naik

#4 lore raw
Quoted 17 lines · Ninad Naik
Quoted 6 lines · Krzysztof Kozlowski
Quoted 4 lines · Ninad Naik

Convert lacie,ns2-leds to DT schema.

Drop both. You need to read that report again.

Sorry, I missed the line which says not to include the tags in a new version of the same patch. Will remove.

Quoted 7 lines
Quoted 5 lines

---
Changes in v3:
- Add optional property num-modes to the schema.

Missing rest of the changelog.

Quoted 7 lines
Quoted 6 lines

What happened here?

Rest looks good, so with dropping incorrect tags (really, please read the email you received):

Should I carry over this tag in v4?

Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions of patchset, under or above your Signed-off-by tag, unless patch changed significantly (e.g. new properties added to the DT bindings). Tag is "received", when provided in a message replied to you on the mailing list. Tools like b4 can help here ('b4 trailers -u ...'). However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for tags received on the version they apply.

Full context and explanation:
https://elixir.bootlin.com/linux/v6.15/source/Documentation/process/submitting-patches.rst#L591

Best regards,
Krzysztof