diff --git a/arch/arm64/boot/dts/ti/k3-am623-pfc-750-8400.dts b/arch/arm64/boot/dts/ti/k3-am623-pfc-750-8400.dts index 7500cedecef3..5f59d8c7486c 100644 --- a/arch/arm64/boot/dts/ti/k3-am623-pfc-750-8400.dts +++ b/arch/arm64/boot/dts/ti/k3-am623-pfc-750-8400.dts @@ -26,7 +26,7 @@ reg = <0>; label = "sys"; linux,default-trigger = "timer"; - led-default-intensity = <255 80 0>; /* Orange */ + led-default-intensity = <255 80 0 64>; /* Orange, brightness 64/255 */ }; led@1 { diff --git a/drivers/leds/rgb/wago-m4-led-wrapper.c b/drivers/leds/rgb/wago-m4-led-wrapper.c index 7f5ec5dff076..e0d4bbb75b61 100644 --- a/drivers/leds/rgb/wago-m4-led-wrapper.c +++ b/drivers/leds/rgb/wago-m4-led-wrapper.c @@ -394,9 +394,10 @@ static void wago_led_init_subled(struct wago_led *led) /* * wago_led_apply_default_intensity - read optional 'led-default-intensity' - * DT property and apply R/G/B values to subled_info[]. + * DT property and apply R/G/B values and optional brightness to the LED. * - * Property format: (three u32 values, each 0-255) + * Property format: (three u32 values, each 0-255) + * or: (four u32 values, each 0-255) * If the property is absent or malformed the subled defaults (255/255/255) * set by wago_led_init_subled() are kept unchanged. */ @@ -404,18 +405,28 @@ static void wago_led_apply_default_intensity(struct device *dev, struct wago_led *led, struct fwnode_handle *fwnode) { - u32 rgb[3]; + u32 rgba[4] = { 255, 255, 255, LED_FULL }; + int count; + + /* Accept both 3-cell (R G B) and 4-cell (R G B brightness) */ + count = fwnode_property_count_u32(fwnode, "led-default-intensity"); + if (count != 3 && count != 4) + return; /* property absent or wrong size — keep defaults */ if (fwnode_property_read_u32_array(fwnode, "led-default-intensity", - rgb, ARRAY_SIZE(rgb))) - return; /* property absent — keep defaults */ + rgba, count)) + return; - led->subled_info[CH_RED].intensity = clamp_val(rgb[0], 0, 255); - led->subled_info[CH_GREEN].intensity = clamp_val(rgb[1], 0, 255); - led->subled_info[CH_BLUE].intensity = clamp_val(rgb[2], 0, 255); + led->subled_info[CH_RED].intensity = clamp_val(rgba[0], 0, 255); + led->subled_info[CH_GREEN].intensity = clamp_val(rgba[1], 0, 255); + led->subled_info[CH_BLUE].intensity = clamp_val(rgba[2], 0, 255); - dev_dbg(dev, "LED %u: default intensity RGB(%u,%u,%u) from DT\n", - led->index, rgb[0], rgb[1], rgb[2]); + if (count == 4) + led->mc_cdev.led_cdev.brightness = clamp_val(rgba[3], 0, LED_FULL); + + dev_dbg(dev, "LED %u: default intensity RGB(%u,%u,%u) brightness=%u from DT\n", + led->index, rgba[0], rgba[1], rgba[2], + led->mc_cdev.led_cdev.brightness); } /*