mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] leds: lp50xx: Read default intensity from devicetree
@ 2026-11-09 12:58 Tobias Johansson
  2026-11-19  9:52 ` Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Johansson @ 2026-11-09 12:58 UTC (permalink / raw)
  To: Lee Jones, Pavel Machek
  Cc: linux-leds, linux-kernel, kernel, Tobias Johansson

Read the default-intensity property for each LP50xx multicolor
component so that the configured color intensities are available
when brightness is applied. This allows LEDs to use the intended
RGB values without first writing multi_intensity from userspace.

Leave the intensity at zero when the property is absent.

Signed-off-by: Tobias Johansson <tobias.johansson@axis.com>
---
 drivers/leds/leds-lp50xx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c
index 20bfb315bda1..019a3e3cad05 100644
--- a/drivers/leds/leds-lp50xx.c
+++ b/drivers/leds/leds-lp50xx.c
@@ -522,6 +522,8 @@ static int lp50xx_probe_dt(struct lp50xx *priv)
 				dev_err(priv->dev, "reg %i out of range\n", multi_index);
 				return -EINVAL;
 			}
+			fwnode_property_read_u32(led_node, "default-intensity",
+						 &mc_led_info[multi_index].intensity);
 
 			mc_led_info[multi_index].color_index = color_id;
 			mc_led_info[multi_index].max_intensity = 255;

---
base-commit: 05b4738b0078f7d6f154f68068a11c8a0635e9df
change-id: 20260914-b4-leds-lp50xx-default-intensity-345d4cc702b4

Best regards,
-- 
Tobias Johansson <tobias.johansson@axis.com>


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

* Re: [PATCH] leds: lp50xx: Read default intensity from devicetree
  2026-11-09 12:58 [PATCH] leds: lp50xx: Read default intensity from devicetree Tobias Johansson
@ 2026-11-19  9:52 ` Lee Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2026-11-19  9:52 UTC (permalink / raw)
  To: Tobias Johansson; +Cc: Pavel Machek, linux-leds, linux-kernel, kernel

On Mon, 09 Nov 2026, Tobias Johansson wrote:

Please review, explain or fix the Sashiko review(s).

> Read the default-intensity property for each LP50xx multicolor
> component so that the configured color intensities are available
> when brightness is applied. This allows LEDs to use the intended
> RGB values without first writing multi_intensity from userspace.
>
> Leave the intensity at zero when the property is absent.
>
> Signed-off-by: Tobias Johansson <tobias.johansson@axis.com>
> ---
>  drivers/leds/leds-lp50xx.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c
> index 20bfb315bda1..019a3e3cad05 100644
> --- a/drivers/leds/leds-lp50xx.c
> +++ b/drivers/leds/leds-lp50xx.c
> @@ -522,6 +522,8 @@ static int lp50xx_probe_dt(struct lp50xx *priv)
>  				dev_err(priv->dev, "reg %i out of range\n", multi_index);
>  				return -EINVAL;
>  			}
> +			fwnode_property_read_u32(led_node, "default-intensity",
> +						 &mc_led_info[multi_index].intensity);

(multi_index >= LP50XX_LEDS_PER_MODULE) only tests for values too large.

What happens if `multi_index` is < 0?  OOB?

>  			mc_led_info[multi_index].color_index = color_id;
>  			mc_led_info[multi_index].max_intensity = 255;
>
> ---
> base-commit: 05b4738b0078f7d6f154f68068a11c8a0635e9df
> change-id: 20260914-b4-leds-lp50xx-default-intensity-345d4cc702b4
>
> Best regards,
> -- 
> Tobias Johansson <tobias.johansson@axis.com>
>

-- 
Lee Jones

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

end of thread, other threads:[~2026-11-19  9:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09 12:58 [PATCH] leds: lp50xx: Read default intensity from devicetree Tobias Johansson
2026-11-19  9:52 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®