[PATCH V3] leds: rgb: leds-group-multicolor: Implement default-intensity

Stefan Wahren <[email protected]> Tue, 4 Aug 2026 21:11:58 +0200
Newsgroups org.kernel.vger.linux-leds,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Currently it's not possible to specify the initial color of a LED
multicolor group during boot. So implement the default-intensity property
similar to the leds-pwm-multicolor driver. In case the property is
missing, the old behavior is kept.

Signed-off-by: Stefan Wahren <[email protected]>
Reviewed-by: Jonas Rebmann <[email protected]>
=2D--

Changes in V3:
- drop unnecessary patch for leds-group-multicolor.yaml
- add Jonas' RB

Changes in V2:
- adapt to approach (incl. error behavior) by Jonas Rebmann [2]
- address comments by Lee which still apply

 drivers/leds/rgb/leds-group-multicolor.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/leds/rgb/leds-group-multicolor.c b/drivers/leds/rgb/l=
eds-group-multicolor.c
index 548c7dd63ba1..69b203ec89fa 100644
=2D-- a/drivers/leds/rgb/leds-group-multicolor.c
+++ b/drivers/leds/rgb/leds-group-multicolor.c
@@ -109,8 +109,14 @@ static int leds_gmc_probe(struct platform_device *pde=
v)
=20
 		subled[i].color_index =3D led_cdev->color;
=20
-		/* Configure the LED intensity to its maximum */
-		subled[i].intensity =3D max_brightness;
+		ret =3D fwnode_property_read_u32(led_cdev->dev->fwnode, "default-intens=
ity",
+					       &subled[i].intensity);
+
+		/* In case default-intensity is missing, fallback to maximum */
+		if (ret)
+			subled[i].intensity =3D max_brightness;
+		else if (subled[i].intensity > max_brightness)
+			subled[i].intensity =3D max_brightness;
 	}
=20
 	/* Initialise the multicolor's LED class device */
=2D-=20
2.43.0