diff mbox series

dt-bindings: leds: Allow differently named multicolor leds

Message ID 20250209-multi-led-v1-1-5aebccbd2db7@posteo.net
State New
Headers show
Series dt-bindings: leds: Allow differently named multicolor leds | expand

Commit Message

J. Neuschäfer via B4 Relay Feb. 9, 2025, 10:06 p.m. UTC
From: "J. Neuschäfer" <j.ne@posteo.net>

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.

Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
---
 Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


---
base-commit: 645b5c24cf8590eea322a4fd79c811817046a2e6
change-id: 20250209-multi-led-9991e205befd

Best regards,

Comments

Lee Jones Feb. 11, 2025, 2:43 p.m. UTC | #1
On Sun, 09 Feb 2025, J. Neuschäfer via B4 Relay wrote:

> From: "J. Neuschäfer" <j.ne@posteo.net>
> 
> 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?

> Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
> ---
>  Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml b/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml
> index bb40bb9e036ee00e06d21e2321ecd5a7d471c408..c22af25b6430be71300c0e37f696cd61112ea190 100644
> --- a/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml
> +++ b/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml
> @@ -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,
> -- 
> J. Neuschäfer <j.ne@posteo.net>
> 
>
J. Neuschäfer Feb. 11, 2025, 6:50 p.m. UTC | #2
On Tue, Feb 11, 2025 at 02:43:00PM +0000, Lee Jones wrote:
> On Sun, 09 Feb 2025, J. Neuschäfer via B4 Relay wrote:
> 
> > From: "J. Neuschäfer" <j.ne@posteo.net>
> > 
> > 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/20250102-mpc83xx-v1-16-86f78ba2a7af@posteo.net/

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


> 
> > Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
> > ---
> >  Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml | 4 +++-
[...]
> > +      - pattern: "^multi-led(@[0-9a-f])?$"
> > +      - pattern: "^multi-led-.*$"
Krzysztof Kozlowski Feb. 11, 2025, 7:10 p.m. UTC | #3
On 11/02/2025 19:50, J. Neuschäfer wrote:
> On Tue, Feb 11, 2025 at 02:43:00PM +0000, Lee Jones wrote:
>> On Sun, 09 Feb 2025, J. Neuschäfer via B4 Relay wrote:
>>
>>> From: "J. Neuschäfer" <j.ne@posteo.net>
>>>
>>> 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/20250102-mpc83xx-v1-16-86f78ba2a7af@posteo.net/

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?

> 
> 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
Krzysztof Kozlowski Feb. 11, 2025, 7:11 p.m. UTC | #4
On 09/02/2025 23:06, J. Neuschäfer via B4 Relay wrote:
> From: "J. Neuschäfer" <j.ne@posteo.net>
> 
> 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.
> 
> Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
> ---
>  Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml b/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml
> index bb40bb9e036ee00e06d21e2321ecd5a7d471c408..c22af25b6430be71300c0e37f696cd61112ea190 100644
> --- a/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml
> +++ b/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml
> @@ -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
J. Neuschäfer Feb. 16, 2025, 6:49 p.m. UTC | #5
On Tue, Feb 11, 2025 at 08:10:28PM +0100, Krzysztof Kozlowski wrote:
> On 11/02/2025 19:50, J. Neuschäfer wrote:
> > On Tue, Feb 11, 2025 at 02:43:00PM +0000, Lee Jones wrote:
> >> On Sun, 09 Feb 2025, J. Neuschäfer via B4 Relay wrote:
> >>
> >>> From: "J. Neuschäfer" <j.ne@posteo.net>
> >>>
> >>> 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/20250102-mpc83xx-v1-16-86f78ba2a7af@posteo.net/
> 
> 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-".

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

This was my mistake while writing the NWAPP2 devicetree.

> 
> 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.

> 
> > 
> > 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
Krzysztof Kozlowski Feb. 17, 2025, 10:58 a.m. UTC | #6
On 09/02/2025 23:06, J. Neuschäfer via B4 Relay wrote:
> From: "J. Neuschäfer" <j.ne@posteo.net>
> 
> 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.
> 
> Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
> ---

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml b/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml
index bb40bb9e036ee00e06d21e2321ecd5a7d471c408..c22af25b6430be71300c0e37f696cd61112ea190 100644
--- a/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml
+++ b/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml
@@ -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: |