dt-bindings: leds: lacie,ns2-leds: Convert to DT schema
Subsystems (2)
PATCH v4 1/1 dt-bindings: leds: lacie,ns2-leds: Convert to DT schema
Convert lacie,ns2-leds to DT schema.
---
Changes in v4:
- Drop incorrect Reported-by and Closes tags.
- Add complete changelog.
Changes in v3:
- Add optional property num-modes to the schema.
Changes in v2:
- Change maintainers from the subsystem maintainers to Simon Guinot.
- Drop "|" from the description field and update the description.
- Remove patternProperties field and instead use additionalProperties.
.../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
@@ -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
@@ -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
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Using `additionalProperties: { type: object }` at the root level incorrectly restricts all unlisted…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Using additionalProperties: { type: object } at the root level incorrectly restricts all unlisted parent properties to be objects, causing validation to fail for standard devicetree properties. --
--- Patch [1]: [PATCH v4] dt-bindings: leds: lacie,ns2-leds: Convert to DT schema --- commit e51c70e2c2a321d27514dfdacc4ab4b3fb805568
Author: Ninad Naik <[email protected]>
dt-bindings: leds: lacie,ns2-leds: Convert to DT schema
This commit converts the lacie,ns2-leds device tree binding from plain text to YAML schema.
Quoted 4 lines
Documentation/devicetree/bindings/leds/lacie,ns2-leds.yaml new file +0
-0
[ ... ]
Documentation/devicetree/bindings/leds/lacie,ns2-leds.yaml line 27
Quoted 10 lines
Documentation/devicetree/bindings/leds/lacie,ns2-leds.yaml new file +10
-0+properties: + compatible: + const: lacie,ns2-leds + +additionalProperties: + type: object + $ref: common.yaml# + unevaluatedProperties: false + + description: Each child node represents a single LED
[Severity: Low]
By applying type: object to additionalProperties at the root level, will this incorrectly restrict standard unlisted parent properties (such as status or pinctrl-0) to be objects?
If a standard string or array property is added to the node, it looks like schema validation will fail. Should patternProperties be used here instead to selectively match the child LED nodes?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: (subset) [PATCH v4] dt-bindings: leds: lacie,ns2-leds: Convert to DT schema
In reply to Ninad NaikQuoted 1 line · Ninad Naik
Convert lacie,ns2-leds to DT schema.
Applied, thanks!
[1/1] dt-bindings: leds: lacie,ns2-leds: Convert to DT schema
commit: e36f8825616b73a09cd2308f2644aa12d7fb6db0
--
Lee Jones [李琼斯]