* [PATCH 1/2] led: trigger: use max_value to turn on led instead of hardcoded '1'
@ 2014-10-08 14:05 Sascha Hauer
2014-10-08 14:05 ` [PATCH 2/2] led: trigger: Turn of flashing leds only once Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2014-10-08 14:05 UTC (permalink / raw)
To: barebox
For PWM LEDs '1' may be really dark. Use max_value instead.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/led/led-triggers.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/led/led-triggers.c b/drivers/led/led-triggers.c
index c5484d5..adcb9e0 100644
--- a/drivers/led/led-triggers.c
+++ b/drivers/led/led-triggers.c
@@ -90,13 +90,13 @@ void led_trigger(enum led_trigger trigger, enum trigger_type type)
if (type == TRIGGER_FLASH) {
if (is_timeout(triggers[trigger].flash_start, 400 * MSECOND)) {
- led_set(triggers[trigger].led, 1);
+ led_set(triggers[trigger].led, triggers[trigger].led->max_value);
triggers[trigger].flash_start = get_time_ns();
}
return;
}
- led_set(triggers[trigger].led, type == TRIGGER_ENABLE ? 1 : 0);
+ led_set(triggers[trigger].led, type == TRIGGER_ENABLE ? triggers[trigger].led->max_value : 0);
}
/**
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 2/2] led: trigger: Turn of flashing leds only once
2014-10-08 14:05 [PATCH 1/2] led: trigger: use max_value to turn on led instead of hardcoded '1' Sascha Hauer
@ 2014-10-08 14:05 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2014-10-08 14:05 UTC (permalink / raw)
To: barebox
The current code continuously turns leds off. Preserve the current
led status so that we only turn it off once.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/led/led-triggers.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/led/led-triggers.c b/drivers/led/led-triggers.c
index adcb9e0..dee9367 100644
--- a/drivers/led/led-triggers.c
+++ b/drivers/led/led-triggers.c
@@ -49,6 +49,7 @@
struct led_trigger_struct {
struct led *led;
uint64_t flash_start;
+ int flash;
};
static struct led_trigger_struct triggers[LED_TRIGGER_MAX];
@@ -59,9 +60,10 @@ static void trigger_func(struct poller_struct *poller)
for (i = 0; i < LED_TRIGGER_MAX; i++) {
if (triggers[i].led &&
- triggers[i].flash_start &&
+ triggers[i].flash &&
is_timeout(triggers[i].flash_start, 200 * MSECOND)) {
led_set(triggers[i].led, 0);
+ triggers[i].flash = 0;
}
}
@@ -92,6 +94,7 @@ void led_trigger(enum led_trigger trigger, enum trigger_type type)
if (is_timeout(triggers[trigger].flash_start, 400 * MSECOND)) {
led_set(triggers[trigger].led, triggers[trigger].led->max_value);
triggers[trigger].flash_start = get_time_ns();
+ triggers[trigger].flash = 1;
}
return;
}
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-10-08 14:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-08 14:05 [PATCH 1/2] led: trigger: use max_value to turn on led instead of hardcoded '1' Sascha Hauer
2014-10-08 14:05 ` [PATCH 2/2] led: trigger: Turn of flashing leds only once Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox