dt-bindings: leds: bcm6358: Convert to DT schema
Subsystems (2)
PATCH v2 1/1 dt-bindings: leds: bcm6358: Convert to DT schema
Convert the brcm,bcm6358 to DT schema.
---
Changes in v2:
- Modify the maintainers list.
- Add maxItems: 1 and removed minimum and maximum in reg property.
- Explicitly list the properties: label, default-state, linux,default-trigger and active-low
- Change unevaluatedProperties: false to additionalProperties: false
.../bindings/leds/brcm,bcm6358-leds.yaml | 105 +++++++++++++ .../devicetree/bindings/leds/leds-bcm6358.txt | 143 ------------------ 2 files changed, 105 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 +105 -0
@@ -0,0 +1,105 @@ +# 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: + - Álvaro Fernández Rojas <[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 (0 to 31). + maxItems: 1 + + label: true + + default-state: true + + linux,default-trigger: true + + active-low: true + + required: + - reg + + additionalProperties: 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
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] The LED sub-node uses `additionalProperties: false` alongside `$ref: common.yaml#`, which…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The LED sub-node uses additionalProperties: false alongside $ref: common.yaml#, which silently rejects standard LED properties.
- [Low] Unused #include <dt-bindings/leds/common.h> in the device tree example.
--
commit 7f21f3b199b43205368512a4bc4314dd320036e1
Author: Ninad Naik <[email protected]>
dt-bindings: leds: bcm6358: Convert to DT schema
This commit converts the text bindings for the Broadcom BCM6358 LED controller to DT schema.
Quoted 4 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +0
-0
[ ... ]
Quoted 14 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +14
-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 (0 to 31). + maxItems: 1 + + label: true +
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml line 65
Quoted 10 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +10
-0+ default-state: true + + linux,default-trigger: true + + active-low: true + + required: + - reg + + additionalProperties: false
[Severity: Medium]
Does this restrict the child node to only locally declared properties, rejecting the standard LED properties inherited from common.yaml#?
In DT schemas, additionalProperties does not consider properties evaluated via a $ref. Could this cause validation errors if standard LED properties are used in the device tree? Should unevaluatedProperties: false be used here instead?
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml line 77
Quoted 12 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +12
-0+ +required: + - compatible + - reg + - "#address-cells" + - "#size-cells" + +additionalProperties: false + +examples: + - | + #include <dt-bindings/leds/common.h>
[Severity: Low]
This isn't a bug, but the header is included here without any of its macros being referenced in the example nodes.
Quoted 5 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +5
-0+ led-controller@fffe00d0 { + compatible = "brcm,bcm6358-leds"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0xfffe00d0 0x8>;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 18 lines · Ninad Naik
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +18
-0+maintainers: + - Álvaro Fernández Rojas <[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.
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml line 43
Quoted 10 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +10
-0+ 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])$":
"0" is already in "[0-9a-f]".
Quoted 7 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +7
-0+ type: object + $ref: common.yaml# + description: Each LED is represented as a sub-node of + this device. + + properties: + reg:
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml line 60
Quoted 10 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +10
-0+ description: LED pin number (0 to 31). + maxItems: 1 + + label: true + + default-state: true + + linux,default-trigger: true + + active-low: true
Drop all four above and switch to unevaluatedProperties: false. unevaluatedProperties should be also placed after $ref: common.yaml for example.
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml line 65
Quoted 5 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +5
-0+ + required: + - reg + + additionalProperties: false
Best regards,
Krzysztof
Quoted 22 lines · Krzysztof Kozlowski
Quoted 21 lines · Ninad Naik
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +21
-0+maintainers: + - Álvaro Fernández Rojas <[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]
Quoted 8 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml line 43
Quoted 7 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +7
-0+ + brcm,clk-dat-low: + description: Makes clock and data signals active low. + type: boolean + +patternProperties: + "^led@(0|1?[0-9a-f])$":"0" is already in "[0-9a-f]".
Thanks for pointing out. I will remove the redundant 0.
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +12
-0+ type: object + $ref: common.yaml# + description: Each LED is represented as a sub-node of + this device. + + properties: + reg: + description: LED pin number (0 to 31). + maxItems: 1 + + label: true +
Quoted 8 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml line 60
Quoted 5 lines
Documentation/devicetree/bindings/leds/brcm,bcm6358-leds.yaml new file +5
-0+ default-state: true + + linux,default-trigger: true + + active-low: trueDrop all four above and switch to unevaluatedProperties: false. unevaluatedProperties should be also placed after $ref:
common.yamlfor example.
I explicitly listed those properties and used additionalProperties: false based on Conor's feedback in v1, but now I agree that relying on common.yaml with unevaluatedProperties: false is a cleaner and more modern approach. I will drop the explicit properties in v3.
Thanks,
Ninad Naik