From 592b6f394aeb2c9eec47a70b7b1fc0e5108cfa90 Mon Sep 17 00:00:00 2001 From: Heiko Schocher Date: Tue, 28 Jan 2025 14:52:46 +0100 Subject: led: add function naming option from linux in linux we have the option to create the name of a led optionally through the following properties: - function - color - function-enumerator This patch adds support for parsing this properties if there is no label property. The led name is created in led_post_bind() and we need some storage place for it. Currently this patch prevents to use malloc() instead it stores the name in new member : char name[LED_MAX_NAME_SIZE]; of struct led_uc_plat. While at it append led tests for the new feature. Signed-off-by: Heiko Schocher Reviewed-by: Tom Rini --- include/led.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/led.h b/include/led.h index 64247cd3a70..a67db7af38d 100644 --- a/include/led.h +++ b/include/led.h @@ -53,6 +53,11 @@ struct udevice; +/* + * value imported from linux:include/linux/uapi/linux/uleds.h + */ +#define LED_MAX_NAME_SIZE 64 + enum led_state_t { LEDST_OFF = 0, LEDST_ON = 1, @@ -86,6 +91,7 @@ struct led_sw_blink { struct led_uc_plat { const char *label; enum led_state_t default_state; + char name[LED_MAX_NAME_SIZE]; #ifdef CONFIG_LED_SW_BLINK struct led_sw_blink *sw_blink; #endif -- cgit v1.2.3