[PATCH 2/2] led: use max led value in case of led trigger

Oleg.Karfich at wago.com Oleg.Karfich at wago.com
Tue Sep 4 23:20:39 PDT 2018


The led_poller function blink_func uses for flashing and blinking only the
values 1/0 for setting the leds. In case of an e.g. gpio led this is true. But
in case of pwm driven leds, where someone could dimm the leds, the value of 1
dimms the led. Use the max value for blinking and flashing of a led when enabling.

Signed-off-by: Oleg Karfich <oleg.karfich at wago.com>
---
 drivers/led/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/led/core.c b/drivers/led/core.c
index 6f66de0..a388e6b 100644
--- a/drivers/led/core.c
+++ b/drivers/led/core.c
@@ -127,7 +127,7 @@ static void led_blink_func(struct poller_struct *poller)
 	struct led *led;
 
 	list_for_each_entry(led, &leds, list) {
-		bool on;
+		int on;
 
 		if (!led->blink && !led->flash)
 			continue;
@@ -137,6 +137,8 @@ static void led_blink_func(struct poller_struct *poller)
 		}
 
 		on = !(led->blink_next_state % 2);
+		if (on)
+			on = led->max_value;
 
 		led->blink_next_event = get_time_ns() +
 			(led->blink_states[led->blink_next_state] * MSECOND);
-- 
2.7.4



More information about the barebox mailing list