Skip to contentSkip to conversation

dt-bindings: leds: Allow differently named multicolor leds

PATCH Superseded J. Neuschäfer 2 participants 3 messages Apr 12, 2025 – Apr 17, 2025

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 dt-bindings: leds: Allow differently named multicolor leds

In some cases, for example when using multiple instances of leds-group-multicolor, a board may have multiple multi-leds which can't be distinguished by unit address. In such cases it should be possible to name them differently, for example multi-led-a and multi-led-b. This patch adds another node name pattern to leds-class-multicolor.yaml to allow such names.

---
V2:
- Add Krzysztof's review tag
- mention leds-group-multicolor in the commit message
- rebase on 6.15-rc1

Link to v1: https://lore.kernel.org/r/[email protected]

---
 Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml +3 -1
index bb40bb9e036ee00e06d21e2321ecd5a7d471c408..c22af25b6430be71300c0e37f696cd61112ea190 100644
@@ -21,7 +21,9 @@ description: |
 
 properties:
   $nodename:
-    pattern: "^multi-led(@[0-9a-f])?$"
+    oneOf:
+      - pattern: "^multi-led(@[0-9a-f])?$"
+      - pattern: "^multi-led-.*$"
 
   color:
     description: |

---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250209-multi-led-9991e205befd

Best regards,

Signature · 1 line
J. Neuschäfer <[email protected]>
maintainer
#1 lore raw
Quoted 6 lines · J. Neuschäfer

In some cases, for example when using multiple instances of leds-group-multicolor, a board may have multiple multi-leds which can't be distinguished by unit address. In such cases it should be possible to name them differently, for example multi-led-a and multi-led-b. This patch adds another node name pattern to leds-class-multicolor.yaml to allow such names.

Really, multi-led-0, multi-led-1, etc. would be preferred like we have in other places.

Quoted 19 lines

---
V2:
- Add Krzysztof's review tag
- mention leds-group-multicolor in the commit message
- rebase on 6.15-rc1

Link to v1: https://lore.kernel.org/r/[email protected]

---
 Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml +0 -0
index bb40bb9e036ee00e06d21e2321ecd5a7d471c408..c22af25b6430be71300c0e37f696cd61112ea190 100644

Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml description: | · line 26

Quoted 7 lines
Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml +3 -1
@@ -21,7 +21,9 @@ description: |
 
 properties:
   $nodename:
-    pattern: "^multi-led(@[0-9a-f])?$"
+    oneOf:
+      - pattern: "^multi-led(@[0-9a-f])?$"
+      - pattern: "^multi-led-.*$"

Combine these:

'^multi-led(-.+|@[0-9a-f])?$'

oneOf is best avoided because the error messages aren't so great.

Quoted 12 lines
Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml +0 -1
   color:
     description: |
 
---

base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250209-multi-led-9991e205befd

Best regards,

Signature · 1 line
J. Neuschäfer <[email protected]>
#2 lore raw
Quoted 10 lines · Rob Herring
Quoted 6 lines · J. Neuschäfer

In some cases, for example when using multiple instances of leds-group-multicolor, a board may have multiple multi-leds which can't be distinguished by unit address. In such cases it should be possible to name them differently, for example multi-led-a and multi-led-b. This patch adds another node name pattern to leds-class-multicolor.yaml to allow such names.

Really, multi-led-0, multi-led-1, etc. would be preferred like we have in other places.

I'll change the examples to -0, -1. I'm also open to restricting the pattern to something else than -.+

Quoted 30 lines
Quoted 20 lines

---
V2:
- Add Krzysztof's review tag
- mention leds-group-multicolor in the commit message
- rebase on 6.15-rc1

Link to v1: https://lore.kernel.org/r/[email protected]

---
 Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml +0 -0
index bb40bb9e036ee00e06d21e2321ecd5a7d471c408..c22af25b6430be71300c0e37f696cd61112ea190 100644

Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml description: | · line 26

Quoted 7 lines
Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml +3 -1
@@ -21,7 +21,9 @@ description: |
 
 properties:
   $nodename:
-    pattern: "^multi-led(@[0-9a-f])?$"
+    oneOf:
+      - pattern: "^multi-led(@[0-9a-f])?$"
+      - pattern: "^multi-led-.*$"

Combine these:

Quoted 3 lines

'^multi-led(-.+|@[0-9a-f])?$'

oneOf is best avoided because the error messages aren't so great.

Alright, I'll change that.

Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml +0 -1
   color:
     description: |
 
---

base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250209-multi-led-9991e205befd

Best regards,

Signature · 1 line
J. Neuschäfer <[email protected]>