All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] leds: rgb: leds-group-multicolor: Introduce default-intensity
@ 2026-07-08 22:46 Stefan Wahren
  2026-07-08 22:46 ` [PATCH RFC 1/2] dt-bindings: " Stefan Wahren
  2026-07-08 22:46 ` [PATCH RFC 2/2] leds: rgb: leds-group-multicolor: Implement default-intensity Stefan Wahren
  0 siblings, 2 replies; 8+ messages in thread
From: Stefan Wahren @ 2026-07-08 22:46 UTC (permalink / raw)
  To: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: Jean-Jacques Hiblot, linux-leds, devicetree, Stefan Wahren

Currently it's not possible to specify the initial color of a LED group
during boot. So introduce a new property similiar to default-brightness,
which specifies the intensity of each LED in the group.

Stefan Wahren (2):
  dt-bindings: leds-group-multicolor: Introduce default-intensity
  leds: rgb: leds-group-multicolor: Implement default-intensity

 .../bindings/leds/leds-group-multicolor.yaml  |  7 +++++++
 drivers/leds/rgb/leds-group-multicolor.c      | 21 +++++++++++++++++--
 2 files changed, 26 insertions(+), 2 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH RFC 1/2] dt-bindings: leds-group-multicolor: Introduce default-intensity
  2026-07-08 22:46 [PATCH RFC 0/2] leds: rgb: leds-group-multicolor: Introduce default-intensity Stefan Wahren
@ 2026-07-08 22:46 ` Stefan Wahren
  2026-07-09 18:03   ` Conor Dooley
  2026-07-08 22:46 ` [PATCH RFC 2/2] leds: rgb: leds-group-multicolor: Implement default-intensity Stefan Wahren
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan Wahren @ 2026-07-08 22:46 UTC (permalink / raw)
  To: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: Jean-Jacques Hiblot, linux-leds, devicetree, Stefan Wahren

Currently it's not possible to specify the initial color of a LED group
during boot. So introduce a new property similar to default-brightness,
which specifies the intensity of each LED in the group.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 .../devicetree/bindings/leds/leds-group-multicolor.yaml    | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/leds/leds-group-multicolor.yaml b/Documentation/devicetree/bindings/leds/leds-group-multicolor.yaml
index 5c9cfa39396b..18b722b807ba 100644
--- a/Documentation/devicetree/bindings/leds/leds-group-multicolor.yaml
+++ b/Documentation/devicetree/bindings/leds/leds-group-multicolor.yaml
@@ -19,6 +19,12 @@ properties:
 
   leds: true
 
+  default-intensity:
+    description:
+      Intensity to be set for each individual LED. Used only during
+      initialization. If the property is not set then max intensity is used.
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+
 required:
   - leds
 
@@ -56,6 +62,7 @@ examples:
         color = <LED_COLOR_ID_RGB>;
         function = LED_FUNCTION_INDICATOR;
         leds = <&led0>, <&led1>, <&led2>;
+        default-intensity = <1 0 0>;
     };
 
 ...
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH RFC 2/2] leds: rgb: leds-group-multicolor: Implement default-intensity
  2026-07-08 22:46 [PATCH RFC 0/2] leds: rgb: leds-group-multicolor: Introduce default-intensity Stefan Wahren
  2026-07-08 22:46 ` [PATCH RFC 1/2] dt-bindings: " Stefan Wahren
@ 2026-07-08 22:46 ` Stefan Wahren
  2026-07-23 12:01   ` Lee Jones
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan Wahren @ 2026-07-08 22:46 UTC (permalink / raw)
  To: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: Jean-Jacques Hiblot, linux-leds, devicetree, Stefan Wahren

Until now the driver initialized all LEDs with maximum intensity.
This isn't useful for LEDs, which needs to be initialized via DT.
So introduce a new DT property to define the default intensity of all
indiviual LEDs. In case the property is missing, the old behavior
is kept.

Additionally this also works with triggers. So it should be possible
to blink with a specific RGB color.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/leds/rgb/leds-group-multicolor.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/leds/rgb/leds-group-multicolor.c b/drivers/leds/rgb/leds-group-multicolor.c
index 548c7dd63ba1..19913a43b8a1 100644
--- a/drivers/leds/rgb/leds-group-multicolor.c
+++ b/drivers/leds/rgb/leds-group-multicolor.c
@@ -17,6 +17,7 @@
 #include <linux/math.h>
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/property.h>
 
@@ -106,11 +107,27 @@ static int leds_gmc_probe(struct platform_device *pdev)
 
 	for (i = 0; i < count; i++) {
 		struct led_classdev *led_cdev = priv->monochromatics[i];
+		u32 intensity;
 
 		subled[i].color_index = led_cdev->color;
 
-		/* Configure the LED intensity to its maximum */
-		subled[i].intensity = max_brightness;
+		ret = of_property_read_u32_index(pdev->dev.of_node, "default-intensity",
+						 i, &intensity);
+		if (ret) {
+			if (ret != -EINVAL && ret != -ENOSYS) {
+				return dev_err_probe(dev, ret,
+						     "Unable to get default-intensity[%d]\n", i);
+			}
+			subled[i].intensity = max_brightness;
+		} else if (intensity > max_brightness) {
+			return dev_err_probe(dev, -EINVAL, "default-intensity[%d] is invalid\n",
+					     i);
+		} else {
+			subled[i].intensity = intensity;
+		}
+
+		dev_dbg(dev, "subled[%d]: color_index: %u, intensity: %u\n",
+			i, subled[i].color_index, subled[i].intensity);
 	}
 
 	/* Initialise the multicolor's LED class device */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH RFC 1/2] dt-bindings: leds-group-multicolor: Introduce default-intensity
  2026-07-08 22:46 ` [PATCH RFC 1/2] dt-bindings: " Stefan Wahren
@ 2026-07-09 18:03   ` Conor Dooley
  2026-07-13  8:23     ` Stefan Wahren
  0 siblings, 1 reply; 8+ messages in thread
From: Conor Dooley @ 2026-07-09 18:03 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Lee Jones, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Jean-Jacques Hiblot, linux-leds, devicetree

[-- Attachment #1: Type: text/plain, Size: 1813 bytes --]

On Thu, Jul 09, 2026 at 12:46:51AM +0200, Stefan Wahren wrote:
> Currently it's not possible to specify the initial color of a LED group
> during boot. So introduce a new property similar to default-brightness,
> which specifies the intensity of each LED in the group.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> ---
>  .../devicetree/bindings/leds/leds-group-multicolor.yaml    | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/leds/leds-group-multicolor.yaml b/Documentation/devicetree/bindings/leds/leds-group-multicolor.yaml
> index 5c9cfa39396b..18b722b807ba 100644
> --- a/Documentation/devicetree/bindings/leds/leds-group-multicolor.yaml
> +++ b/Documentation/devicetree/bindings/leds/leds-group-multicolor.yaml
> @@ -19,6 +19,12 @@ properties:
>  
>    leds: true
>  
> +  default-intensity:
> +    description:
> +      Intensity to be set for each individual LED. Used only during
> +      initialization. If the property is not set then max intensity is used.
> +    $ref: /schemas/types.yaml#/definitions/uint32-array

Hmm, there's already a property proposed and applied for this:
https://lore.kernel.org/linux-leds/20260605-multicolor-default-v2-1-ed07271df6b0@pengutronix.de/
It only supports a single value, I suspect you'll have to rework this so
as not to conflict with existing property?
leds-group-multicolour imports the common leds properties after all.
Probably the one in common.yaml needs to become an array?

> +
>  required:
>    - leds
>  
> @@ -56,6 +62,7 @@ examples:
>          color = <LED_COLOR_ID_RGB>;
>          function = LED_FUNCTION_INDICATOR;
>          leds = <&led0>, <&led1>, <&led2>;
> +        default-intensity = <1 0 0>;
>      };
>  
>  ...
> -- 
> 2.43.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RFC 1/2] dt-bindings: leds-group-multicolor: Introduce default-intensity
  2026-07-09 18:03   ` Conor Dooley
@ 2026-07-13  8:23     ` Stefan Wahren
  2026-07-13  8:41       ` Jonas Rebmann
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Wahren @ 2026-07-13  8:23 UTC (permalink / raw)
  To: Conor Dooley, Lee Jones, Pavel Machek
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Jean-Jacques Hiblot, linux-leds, devicetree, Jonas Rebmann

Hi all,

Am 09.07.26 um 20:03 schrieb Conor Dooley:
> On Thu, Jul 09, 2026 at 12:46:51AM +0200, Stefan Wahren wrote:
>> Currently it's not possible to specify the initial color of a LED group
>> during boot. So introduce a new property similar to default-brightness,
>> which specifies the intensity of each LED in the group.
>>
>> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
>> ---
>>   .../devicetree/bindings/leds/leds-group-multicolor.yaml    | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/leds/leds-group-multicolor.yaml b/Documentation/devicetree/bindings/leds/leds-group-multicolor.yaml
>> index 5c9cfa39396b..18b722b807ba 100644
>> --- a/Documentation/devicetree/bindings/leds/leds-group-multicolor.yaml
>> +++ b/Documentation/devicetree/bindings/leds/leds-group-multicolor.yaml
>> @@ -19,6 +19,12 @@ properties:
>>   
>>     leds: true
>>   
>> +  default-intensity:
>> +    description:
>> +      Intensity to be set for each individual LED. Used only during
>> +      initialization. If the property is not set then max intensity is used.
>> +    $ref: /schemas/types.yaml#/definitions/uint32-array
> Hmm, there's already a property proposed and applied for this:
> https://lore.kernel.org/linux-leds/20260605-multicolor-default-v2-1-ed07271df6b0@pengutronix.de/
sorry, I missed this. Thanks for pointing to this patch. In general i'm 
fine with this approach, but there is something which confuses me.
Looking at the description, there is the statement: [default-intensity] 
"Defaults to 0".
This seems to be correct for the Linux implementation of 
leds-pwm-multicolor, but is this really an expectation along all (multi 
color) LEDs (at least for Linux)?

E.g. leds-group-multicolor init the intensity with the maximum. So all 
users of leds-group-multicolor should specify default-intensity for each 
sub LED to achieve a defined behavior without breaking existing behavior.

Best regards

> It only supports a single value, I suspect you'll have to rework this so
> as not to conflict with existing property?
> leds-group-multicolour imports the common leds properties after all.
> Probably the one in common.yaml needs to become an array?
>
>> +
>>   required:
>>     - leds
>>   
>> @@ -56,6 +62,7 @@ examples:
>>           color = <LED_COLOR_ID_RGB>;
>>           function = LED_FUNCTION_INDICATOR;
>>           leds = <&led0>, <&led1>, <&led2>;
>> +        default-intensity = <1 0 0>;
>>       };
>>   
>>   ...
>> -- 
>> 2.43.0
>>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RFC 1/2] dt-bindings: leds-group-multicolor: Introduce default-intensity
  2026-07-13  8:23     ` Stefan Wahren
@ 2026-07-13  8:41       ` Jonas Rebmann
  2026-07-13 16:34         ` Conor Dooley
  0 siblings, 1 reply; 8+ messages in thread
From: Jonas Rebmann @ 2026-07-13  8:41 UTC (permalink / raw)
  To: Stefan Wahren, Conor Dooley, Lee Jones, Pavel Machek
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Jean-Jacques Hiblot, linux-leds, devicetree

Hi Stefan,

Thanks, for CCing me here.

On 2026-07-13 10:23, Stefan Wahren wrote:
> sorry, I missed this. Thanks for pointing to this patch. In general i'm
> fine with this approach, but there is something which confuses me.
> Looking at the description, there is the statement: [default-intensity]
> "Defaults to 0".
> This seems to be correct for the Linux implementation of
> leds-pwm-multicolor, but is this really an expectation along all (multi
> color) LEDs (at least for Linux)?

You are right, sadly the initialization default of some
multicolor-LED drivers differs.

> E.g. leds-group-multicolor init the intensity with the maximum. So all
> users of leds-group-multicolor should specify default-intensity for each
> sub LED to achieve a defined behavior without breaking existing behavior.

I agree, once support is added to one of the drivers that doesn't
zero-initialize, the documentation needs updating (because as you say,
backwards-compatibilty probably beats consistency here).

I'm also just noticing that my v3 for only the dt-bindings never arrived
on the list (I think I was on a buggy b4 master), I'll re-send now.

Regards,
Jonas

-- 
Pengutronix e.K.                           | Jonas Rebmann               |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-9    |

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RFC 1/2] dt-bindings: leds-group-multicolor: Introduce default-intensity
  2026-07-13  8:41       ` Jonas Rebmann
@ 2026-07-13 16:34         ` Conor Dooley
  0 siblings, 0 replies; 8+ messages in thread
From: Conor Dooley @ 2026-07-13 16:34 UTC (permalink / raw)
  To: Jonas Rebmann
  Cc: Stefan Wahren, Lee Jones, Pavel Machek, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Jean-Jacques Hiblot,
	linux-leds, devicetree

[-- Attachment #1: Type: text/plain, Size: 1861 bytes --]

On Mon, Jul 13, 2026 at 10:41:53AM +0200, Jonas Rebmann wrote:
> Hi Stefan,
> 
> Thanks, for CCing me here.
> 
> On 2026-07-13 10:23, Stefan Wahren wrote:
> > sorry, I missed this. Thanks for pointing to this patch. In general i'm
> > fine with this approach, but there is something which confuses me.
> > Looking at the description, there is the statement: [default-intensity]
> > "Defaults to 0".
> > This seems to be correct for the Linux implementation of
> > leds-pwm-multicolor, but is this really an expectation along all (multi
> > color) LEDs (at least for Linux)?
> 
> You are right, sadly the initialization default of some
> multicolor-LED drivers differs.

Hmm, I forget if you had a default in leds common.yaml, but you should
probably remove it in this case and move the default to the individual
led type if so, rather than wait for support in a driver that doesn't
zero initialise.

> > E.g. leds-group-multicolor init the intensity with the maximum. So all
> > users of leds-group-multicolor should specify default-intensity for each
> > sub LED to achieve a defined behavior without breaking existing behavior.
> 
> I agree, once support is added to one of the drivers that doesn't
> zero-initialize, the documentation needs updating (because as you say,
> backwards-compatibilty probably beats consistency here).
> 
> I'm also just noticing that my v3 for only the dt-bindings never arrived
> on the list (I think I was on a buggy b4 master), I'll re-send now.
> 
> Regards,
> Jonas
> 
> -- 
> Pengutronix e.K.                           | Jonas Rebmann               |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-9    |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RFC 2/2] leds: rgb: leds-group-multicolor: Implement default-intensity
  2026-07-08 22:46 ` [PATCH RFC 2/2] leds: rgb: leds-group-multicolor: Implement default-intensity Stefan Wahren
@ 2026-07-23 12:01   ` Lee Jones
  0 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2026-07-23 12:01 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: Pavel Machek, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Jean-Jacques Hiblot, linux-leds, devicetree

On Thu, 09 Jul 2026, Stefan Wahren wrote:

> Until now the driver initialized all LEDs with maximum intensity.
> This isn't useful for LEDs, which needs to be initialized via DT.
> So introduce a new DT property to define the default intensity of all
> indiviual LEDs. In case the property is missing, the old behavior
> is kept.
> 
> Additionally this also works with triggers. So it should be possible
> to blink with a specific RGB color.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> ---
>  drivers/leds/rgb/leds-group-multicolor.c | 21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/leds/rgb/leds-group-multicolor.c b/drivers/leds/rgb/leds-group-multicolor.c
> index 548c7dd63ba1..19913a43b8a1 100644
> --- a/drivers/leds/rgb/leds-group-multicolor.c
> +++ b/drivers/leds/rgb/leds-group-multicolor.c
> @@ -17,6 +17,7 @@
>  #include <linux/math.h>
>  #include <linux/module.h>
>  #include <linux/mod_devicetable.h>
> +#include <linux/of.h>
>  #include <linux/platform_device.h>
>  #include <linux/property.h>
>  
> @@ -106,11 +107,27 @@ static int leds_gmc_probe(struct platform_device *pdev)
>  
>  	for (i = 0; i < count; i++) {
>  		struct led_classdev *led_cdev = priv->monochromatics[i];
> +		u32 intensity;
>  
>  		subled[i].color_index = led_cdev->color;
>  
> -		/* Configure the LED intensity to its maximum */
> -		subled[i].intensity = max_brightness;
> +		ret = of_property_read_u32_index(pdev->dev.of_node, "default-intensity",
> +						 i, &intensity);

What about using the firmware agnostic 'device_property_read_u32_array()'
before the loop to save some cycles?

> +		if (ret) {
> +			if (ret != -EINVAL && ret != -ENOSYS) {
> +				return dev_err_probe(dev, ret,
> +						     "Unable to get default-intensity[%d]\n", i);
> +			}

Deserves a comment I think.

> +			subled[i].intensity = max_brightness;
> +		} else if (intensity > max_brightness) {
> +			return dev_err_probe(dev, -EINVAL, "default-intensity[%d] is invalid\n",
> +					     i);

Nit: This is an ugly place to wrap.

> +		} else {
> +			subled[i].intensity = intensity;
> +		}
> +
> +		dev_dbg(dev, "subled[%d]: color_index: %u, intensity: %u\n",
> +			i, subled[i].color_index, subled[i].intensity);

How helpful is this outside of development?

-- 
Lee Jones

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-07-23 12:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08 22:46 [PATCH RFC 0/2] leds: rgb: leds-group-multicolor: Introduce default-intensity Stefan Wahren
2026-07-08 22:46 ` [PATCH RFC 1/2] dt-bindings: " Stefan Wahren
2026-07-09 18:03   ` Conor Dooley
2026-07-13  8:23     ` Stefan Wahren
2026-07-13  8:41       ` Jonas Rebmann
2026-07-13 16:34         ` Conor Dooley
2026-07-08 22:46 ` [PATCH RFC 2/2] leds: rgb: leds-group-multicolor: Implement default-intensity Stefan Wahren
2026-07-23 12:01   ` Lee Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.