Skip to contentSkip to conversation

dt-bindings: leds: Allow differently named multicolor leds

PATCH Superseded J. Neuschäfer 3 participants 7 messages Feb 9, 2025 – Feb 17, 2025

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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

In some cases, 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.

---
 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: 645b5c24cf8590eea322a4fd79c811817046a2e6
change-id: 20250209-multi-led-9991e205befd

Best regards,

Signature · 1 line
J. Neuschäfer <[email protected]>
maintainer
#1 lore raw
Quoted 7 lines · On Sun, 09 Feb 2025, J. Neuschäfer via B4 Relay wrote:

From: "J. Neuschäfer" <[email protected]>

In some cases, 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.

Which H/W needs this? Is it upstream? Where is the doc / usage?

Quoted 30 lines
---
 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 -2
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: 645b5c24cf8590eea322a4fd79c811817046a2e6
change-id: 20250209-multi-led-9991e205befd

Best regards,

Signature · 1 line
J. Neuschäfer <[email protected]>
Signature · 1 line
Lee Jones [李琼斯]
#2 lore raw
Quoted 11 lines · Lee Jones
Quoted 7 lines · On Sun, 09 Feb 2025, J. Neuschäfer via B4 Relay wrote:

From: "J. Neuschäfer" <[email protected]>

In some cases, 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.

Which H/W needs this? Is it upstream? Where is the doc / usage?

I encountered this situation while upstreaming the LANCOM NWAPP2 board, which has multiple LED-group-based multicolor LEDs:

https://lore.kernel.org/lkml/[email protected]/

Since they are based on leds-group-multicolor, they don't have a unit address, but there is more than one on the same level (as direct sub-nodes of the DT root node).

I can add a comment about node names, if that's desired, e.g.:

If multiple multi-color LEDs exist on the same level, they can be differentiated by unit-address (e.g. multi-led@abc0) or name (e.g. multi-led-power).

Such as a comment doesn't exist currently either; the existing "^multi-led(@[0-9a-f])?$" pattern is not documented in prose.

Best regards,
J. Neuschäfer

Quoted 4 lines
Quoted 4 lines
---
 Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml | 4 +++-

[...]

Quoted 2 lines
Quoted 2 lines
Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml +2 -0
+      - pattern: "^multi-led(@[0-9a-f])?$"
+      - pattern: "^multi-led-.*$"
#3 lore raw
Quoted 11 lines · J. Neuschäfer
Quoted 10 lines · Lee Jones
Quoted 7 lines · On Sun, 09 Feb 2025, J. Neuschäfer via B4 Relay wrote:

From: "J. Neuschäfer" <[email protected]>

In some cases, 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.

Quoted 6 lines
Quoted 1 line

Which H/W needs this? Is it upstream? Where is the doc / usage?

I encountered this situation while upstreaming the LANCOM NWAPP2 board, which has multiple LED-group-based multicolor LEDs:

https://lore.kernel.org/lkml/[email protected]/

Which LEDs are these? I don't see multi-led there node name at all.

This patch must come with user. It's fine to send the user separately, but please provide lore link to exact user.

Otherwise what certainty we have that this change is needed in the first place?

Quoted 4 lines

Since they are based on leds-group-multicolor, they don't have a unit address, but there is more than one on the same level (as direct sub-nodes of the DT root node).

Which binding is this?

Best regards,
Krzysztof

#4 lore raw
Quoted 12 lines · Krzysztof Kozlowski
Quoted 11 lines · J. Neuschäfer
Quoted 10 lines · Lee Jones
Quoted 7 lines · On Sun, 09 Feb 2025, J. Neuschäfer via B4 Relay wrote:

From: "J. Neuschäfer" <[email protected]>

In some cases, 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.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Which H/W needs this? Is it upstream? Where is the doc / usage?

I encountered this situation while upstreaming the LANCOM NWAPP2 board, which has multiple LED-group-based multicolor LEDs:

https://lore.kernel.org/lkml/[email protected]/

Which LEDs are these?

These and a few more:

	led-power {
		label = "multicolor:power";
		compatible = "leds-group-multicolor";
		color = <LED_COLOR_ID_MULTI>;
		function = LED_FUNCTION_POWER;
		leds = <&led_power_red>, <&led_power_green>;
	};

	led-wlan-link {
		label = "multicolor:wlan-link";
		compatible = "leds-group-multicolor";
		color = <LED_COLOR_ID_MULTI>;
		function = LED_FUNCTION_WLAN;
		leds = <&led_wlan_link_red>, <&led_wlan_link_green>;
	};

According to the leds-class-multicolor.yaml binding, they should be named "multi-led", optionally with a unit address. Unit addresses don't make a lot of sense, as these nodes don't have (or need) a reg property. They can't, however, have the same name, which brings me to the idea of this patch: To allow different names that start with "multi-led-".

Quoted 1 line

I don't see multi-led there node name at all.

This was my mistake while writing the NWAPP2 devicetree.

Quoted 6 lines

This patch must come with user. It's fine to send the user separately, but please provide lore link to exact user.

Otherwise what certainty we have that this change is needed in the first place?

For ease of review, I'll include this patch in v2 of the NWAPP2 series, and extend the commit message.

Quoted 7 lines
Quoted 5 lines

Since they are based on leds-group-multicolor, they don't have a unit address, but there is more than one on the same level (as direct sub-nodes of the DT root node).

Which binding is this?

Documentation/devicetree/bindings/leds/leds-group-multicolor.yaml
specifies compatible = "leds-group-multicolor", and includes:

Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml
defines node name pattern of "^multi-led(@[0-9a-f])?$"

Best regards,
J. Neuschäfer

#5 lore raw
In reply to J. Neuschäfer
Quoted 18 lines · On 09/02/2025 23:06, J. Neuschäfer via B4 Relay wrote:

From: "J. Neuschäfer" <[email protected]>

In some cases, 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.

---
 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-.*$"

I don't see any bindings using this or allowing this. If this is because of some new binding, it is supposed to be part of that patchset. Otherwise please provide reference which binding needs this.

Best regards,
Krzysztof

Reviewed-by on v1 1/1
#6 lore raw
In reply to J. Neuschäfer
Quoted 10 lines · On 09/02/2025 23:06, J. Neuschäfer via B4 Relay wrote:

From: "J. Neuschäfer" <[email protected]>

In some cases, 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.

---

Best regards,
Krzysztof