summaryrefslogtreecommitdiffstats
path: root/drivers/led
diff options
context:
space:
mode:
authorOleg.Karfich@wago.com <Oleg.Karfich@wago.com>2018-09-05 06:20:39 +0000
committerSascha Hauer <s.hauer@pengutronix.de>2018-09-10 08:34:12 +0200
commitb0af360ccc38cbf3dd5b947c5948445bac8dd3ce (patch)
tree54745b70e4f9ae86b0e8c847bbff2e3664d9503d /drivers/led
parent500bc99264e7b25f5d4b6ece7380ad3118409794 (diff)
downloadbarebox-b0af360ccc38cbf3dd5b947c5948445bac8dd3ce.tar.gz
barebox-b0af360ccc38cbf3dd5b947c5948445bac8dd3ce.tar.xz
led: use max led value in case of led trigger
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@wago.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/led')
-rw-r--r--drivers/led/core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/led/core.c b/drivers/led/core.c
index 6f66de0fbb..a388e6b365 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);