dt-bindings: leds: lacie,netxbig-leds: Convert to DT schema
Subsystems (2)
PATCH 1/1 dt-bindings: leds: lacie,netxbig-leds: Convert to DT schema
Convert lacie,netxbig-leds devicetree binding from legacy text format to DT schema.
--- .../bindings/leds/lacie,netxbig-leds.yaml | 134 ++++++++++++++++++ .../devicetree/bindings/leds/leds-netxbig.txt | 92 ------------ 2 files changed, 134 insertions(+), 92 deletions(-) create mode 100644 Documentation/devicetree/bindings/leds/lacie,netxbig-leds.yaml delete mode 100644 Documentation/devicetree/bindings/leds/leds-netxbig.txt
Documentation/devicetree/bindings/leds/lacie,netxbig-leds.yaml new file +134 -0
@@ -0,0 +1,134 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/leds/lacie,netxbig-leds.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: LaCie/Seagate netxbig CPLD LEDs + +maintainers: + - Simon Guinot <[email protected]> + +description: | + Binding for the CPLD LEDs (GPIO extension bus) found on some LaCie/Seagate + boards (Example: 2Big/5Big Network v2, 2Big NAS). + +properties: + compatible: + const: lacie,netxbig-leds + + gpio-ext: + description: Phandle for the gpio-ext bus. + $ref: /schemas/types.yaml#/definitions/phandle + + timers: + description: | + Timer array. Each timer entry is represented by three integers: + Mode (gpio-ext bus), delay_on and delay_off. + $ref: /schemas/types.yaml#/definitions/uint32-array + +required: + - compatible + - gpio-ext + +additionalProperties: + description: Each child node represents a single LED + type: object + $ref: common.yaml# + unevaluatedProperties: false + + properties: + mode-addr: + description: Mode register address on gpio-ext bus. + $ref: /schemas/types.yaml#/definitions/uint32 + + mode-val: + description: | + Mode to value mapping. Each entry is represented by two integers: a mode and + the corresponding value on the gpio-ext bus. + $ref: /schemas/types.yaml#/definitions/uint32-array + + bright-addr: + description: Brightness register address on gpio-ext bus. + $ref: /schemas/types.yaml#/definitions/uint32 + + max-brightness: + description: Maximum brightness value. + $ref: /schemas/types.yaml#/definitions/uint32 + + required: + - mode-addr + - mode-val + - bright-addr + - max-brightness + +examples: + - | + #include <dt-bindings/leds/leds-netxbig.h> + + netxbig-leds { + compatible = "lacie,netxbig-leds"; + + gpio-ext = <&netxbig_gpio_ext>; + + timers = <NETXBIG_LED_TIMER1 500 500 + NETXBIG_LED_TIMER2 500 1000>; + + blue-power { + label = "netxbig:blue:power"; + mode-addr = <0>; + mode-val = <NETXBIG_LED_OFF 0 + NETXBIG_LED_ON 1 + NETXBIG_LED_TIMER1 3 + NETXBIG_LED_TIMER2 7>; + bright-addr = <1>; + max-brightness = <7>; + }; + red-power { + label = "netxbig:red:power"; + mode-addr = <0>; + mode-val = <NETXBIG_LED_OFF 0 + NETXBIG_LED_ON 2 + NETXBIG_LED_TIMER1 4>; + bright-addr = <1>; + max-brightness = <7>; + }; + blue-sata0 { + label = "netxbig:blue:sata0"; + mode-addr = <3>; + mode-val = <NETXBIG_LED_OFF 0 + NETXBIG_LED_ON 7 + NETXBIG_LED_SATA 1 + NETXBIG_LED_TIMER1 3>; + bright-addr = <2>; + max-brightness = <7>; + }; + red-sata0 { + label = "netxbig:red:sata0"; + mode-addr = <3>; + mode-val = <NETXBIG_LED_OFF 0 + NETXBIG_LED_ON 2 + NETXBIG_LED_TIMER1 4>; + bright-addr = <2>; + max-brightness = <7>; + }; + blue-sata1 { + label = "netxbig:blue:sata1"; + mode-addr = <4>; + mode-val = <NETXBIG_LED_OFF 0 + NETXBIG_LED_ON 7 + NETXBIG_LED_SATA 1 + NETXBIG_LED_TIMER1 3>; + bright-addr = <2>; + max-brightness = <7>; + }; + red-sata1 { + label = "netxbig:red:sata1"; + mode-addr = <4>; + mode-val = <NETXBIG_LED_OFF 0 + NETXBIG_LED_ON 2 + NETXBIG_LED_TIMER1 4>; + bright-addr = <2>; + max-brightness = <7>; + }; + };
Documentation/devicetree/bindings/leds/leds-netxbig.txt deleted +0 -92
92 lines not on this page · raw message
Signature · 1 line
2.34.1
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The dt-schema incorrectly uses an object schema for `additionalProperties` to define child LED…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The dt-schema incorrectly uses an object schema for additionalProperties to define child LED nodes instead of patternProperties. --
--- Patch [1]: [PATCH] dt-bindings: leds: lacie,netxbig-leds: Convert to DT schema --- commit aac938a074c3b72885d598a72f89b254f35a5d88
Author: Udaya Kiran Challa <[email protected]>
dt-bindings: leds: lacie,netxbig-leds: Convert to DT schema
This commit converts the lacie,netxbig-leds devicetree binding from the legacy text format to DT schema.
Quoted 5 lines
Documentation/devicetree/bindings/leds/lacie,netxbig-leds.yaml new file +0
-0
[ ... ]
Documentation/devicetree/bindings/leds/lacie,netxbig-leds.yaml line 38
Quoted 9 lines
Documentation/devicetree/bindings/leds/lacie,netxbig-leds.yaml new file +9
-0+required: + - compatible + - gpio-ext + +additionalProperties: + description: Each child node represents a single LED + type: object + $ref: common.yaml# + unevaluatedProperties: false
[Severity: Medium]
Will this strict additionalProperties definition cause standard device tree properties to fail validation?
Because additionalProperties is defined as an object schema here, any top-level property added to the netxbig-leds node that isn't explicitly defined (like status = "okay" or pinctrl-0) will be forced to evaluate as an object, triggering schema validation errors for strings or arrays.
Should child LED nodes be defined using patternProperties instead, so that standard node properties are not caught by this block?
Quoted 4 lines
Documentation/devicetree/bindings/leds/lacie,netxbig-leds.yaml new file +4
-0+ + properties: + mode-addr: + description: Mode register address on gpio-ext bus.
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 39 lines · Udaya Kiran Challa
Convert lacie,netxbig-leds devicetree binding from legacy text format to DT schema.
Signed-off-by Udaya Kiran Challa <[email protected]>--- .../bindings/leds/lacie,netxbig-leds.yaml | 134 ++++++++++++++++++ .../devicetree/bindings/leds/leds-netxbig.txt | 92 ------------ 2 files changed, 134 insertions(+), 92 deletions(-) create mode 100644 Documentation/devicetree/bindings/leds/lacie,netxbig-leds.yaml delete mode 100644 Documentation/devicetree/bindings/leds/leds-netxbig.txtDocumentation/devicetree/bindings/leds/lacie,netxbig-leds.yaml new file +22
-0@@ -0,0 +1,134 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/leds/lacie,netxbig-leds.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: LaCie/Seagate netxbig CPLD LEDs + +maintainers: + - Simon Guinot <[email protected]> + +description: | + Binding for the CPLD LEDs (GPIO extension bus) found on some LaCie/Seagate + boards (Example: 2Big/5Big Network v2, 2Big NAS). + +properties: + compatible: + const: lacie,netxbig-leds + + gpio-ext: + description: Phandle for the gpio-ext bus. + $ref: /schemas/types.yaml#/definitions/phandle
Documentation/devicetree/bindings/leds/lacie,netxbig-leds.yaml line 32
Quoted 10 lines
Documentation/devicetree/bindings/leds/lacie,netxbig-leds.yaml new file +10
-0+ + timers: + description: | + Timer array. Each timer entry is represented by three integers: + Mode (gpio-ext bus), delay_on and delay_off. + $ref: /schemas/types.yaml#/definitions/uint32-array + +required: + - compatible + - gpio-ext
This should be after the block defining the child nodes.
Documentation/devicetree/bindings/leds/lacie,netxbig-leds.yaml line 34
Quoted 2 lines
Documentation/devicetree/bindings/leds/lacie,netxbig-leds.yaml new file +2
-0+ +additionalProperties:
This is not how the child nodes should be implmeneted, it should use pattenProperties instead.
Documentation/devicetree/bindings/leds/lacie,netxbig-leds.yaml line 38
Quoted 5 lines
Documentation/devicetree/bindings/leds/lacie,netxbig-leds.yaml new file +4
-0+ description: Each child node represents a single LED + type: object + $ref: common.yaml# + unevaluatedProperties: false
This should IMO be additionalProperties: false, and the two option properties that are supported explicitly cited.
The rest of this looks fine I think.
pw-bot: changes-requested
Thanks,
Conor.
Quoted 197 lines
Documentation/devicetree/bindings/leds/lacie,netxbig-leds.yaml new file +96
-0+ + properties: + mode-addr: + description: Mode register address on gpio-ext bus. + $ref: /schemas/types.yaml#/definitions/uint32 + + mode-val: + description: | + Mode to value mapping. Each entry is represented by two integers: a mode and + the corresponding value on the gpio-ext bus. + $ref: /schemas/types.yaml#/definitions/uint32-array + + bright-addr: + description: Brightness register address on gpio-ext bus. + $ref: /schemas/types.yaml#/definitions/uint32 + + max-brightness: + description: Maximum brightness value. + $ref: /schemas/types.yaml#/definitions/uint32 + + required: + - mode-addr + - mode-val + - bright-addr + - max-brightness + +examples: + - | + #include <dt-bindings/leds/leds-netxbig.h> + + netxbig-leds { + compatible = "lacie,netxbig-leds"; + + gpio-ext = <&netxbig_gpio_ext>; + + timers = <NETXBIG_LED_TIMER1 500 500 + NETXBIG_LED_TIMER2 500 1000>; + + blue-power { + label = "netxbig:blue:power"; + mode-addr = <0>; + mode-val = <NETXBIG_LED_OFF 0 + NETXBIG_LED_ON 1 + NETXBIG_LED_TIMER1 3 + NETXBIG_LED_TIMER2 7>; + bright-addr = <1>; + max-brightness = <7>; + }; + red-power { + label = "netxbig:red:power"; + mode-addr = <0>; + mode-val = <NETXBIG_LED_OFF 0 + NETXBIG_LED_ON 2 + NETXBIG_LED_TIMER1 4>; + bright-addr = <1>; + max-brightness = <7>; + }; + blue-sata0 { + label = "netxbig:blue:sata0"; + mode-addr = <3>; + mode-val = <NETXBIG_LED_OFF 0 + NETXBIG_LED_ON 7 + NETXBIG_LED_SATA 1 + NETXBIG_LED_TIMER1 3>; + bright-addr = <2>; + max-brightness = <7>; + }; + red-sata0 { + label = "netxbig:red:sata0"; + mode-addr = <3>; + mode-val = <NETXBIG_LED_OFF 0 + NETXBIG_LED_ON 2 + NETXBIG_LED_TIMER1 4>; + bright-addr = <2>; + max-brightness = <7>; + }; + blue-sata1 { + label = "netxbig:blue:sata1"; + mode-addr = <4>; + mode-val = <NETXBIG_LED_OFF 0 + NETXBIG_LED_ON 7 + NETXBIG_LED_SATA 1 + NETXBIG_LED_TIMER1 3>; + bright-addr = <2>; + max-brightness = <7>; + }; + red-sata1 { + label = "netxbig:red:sata1"; + mode-addr = <4>; + mode-val = <NETXBIG_LED_OFF 0 + NETXBIG_LED_ON 2 + NETXBIG_LED_TIMER1 4>; + bright-addr = <2>; + max-brightness = <7>; + }; + };Documentation/devicetree/bindings/leds/leds-netxbig.txt deleted +0
-92@@ -1,92 +0,0 @@ -Binding for the CPLD LEDs (GPIO extension bus) found on some LaCie/Seagate -boards (Example: 2Big/5Big Network v2, 2Big NAS). - -Required properties: -- compatible: "lacie,netxbig-leds". -- gpio-ext: Phandle for the gpio-ext bus. - -Optional properties: -- timers: Timer array. Each timer entry is represented by three integers: - Mode (gpio-ext bus), delay_on and delay_off. - -Each LED is represented as a sub-node of the netxbig-leds device. - -Required sub-node properties: -- mode-addr: Mode register address on gpio-ext bus. -- mode-val: Mode to value mapping. Each entry is represented by two integers: - A mode and the corresponding value on the gpio-ext bus. -- bright-addr: Brightness register address on gpio-ext bus. -- max-brightness: Maximum brightness value. - -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: - -netxbig-leds { - compatible = "lacie,netxbig-leds"; - - gpio-ext = &gpio_ext; - - timers = <NETXBIG_LED_TIMER1 500 500 - NETXBIG_LED_TIMER2 500 1000>; - - blue-power { - label = "netxbig:blue:power"; - mode-addr = <0>; - mode-val = <NETXBIG_LED_OFF 0 - NETXBIG_LED_ON 1 - NETXBIG_LED_TIMER1 3 - NETXBIG_LED_TIMER2 7>; - bright-addr = <1>; - max-brightness = <7>; - }; - red-power { - label = "netxbig:red:power"; - mode-addr = <0>; - mode-val = <NETXBIG_LED_OFF 0 - NETXBIG_LED_ON 2 - NETXBIG_LED_TIMER1 4>; - bright-addr = <1>; - max-brightness = <7>; - }; - blue-sata0 { - label = "netxbig:blue:sata0"; - mode-addr = <3>; - mode-val = <NETXBIG_LED_OFF 0 - NETXBIG_LED_ON 7 - NETXBIG_LED_SATA 1 - NETXBIG_LED_TIMER1 3>; - bright-addr = <2>; - max-brightness = <7>; - }; - red-sata0 { - label = "netxbig:red:sata0"; - mode-addr = <3>; - mode-val = <NETXBIG_LED_OFF 0 - NETXBIG_LED_ON 2 - NETXBIG_LED_TIMER1 4>; - bright-addr = <2>; - max-brightness = <7>; - }; - blue-sata1 { - label = "netxbig:blue:sata1"; - mode-addr = <4>; - mode-val = <NETXBIG_LED_OFF 0 - NETXBIG_LED_ON 7 - NETXBIG_LED_SATA 1 - NETXBIG_LED_TIMER1 3>; - bright-addr = <2>; - max-brightness = <7>; - }; - red-sata1 { - label = "netxbig:red:sata1"; - mode-addr = <4>; - mode-val = <NETXBIG_LED_OFF 0 - NETXBIG_LED_ON 2 - NETXBIG_LED_TIMER1 4>; - bright-addr = <2>; - max-brightness = <7>; - }; -};Signature · 1 line
2.34.1