mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: <Oleg.Karfich@wago.com>
To: barebox@lists.infradead.org
Cc: Oleg.Karfich@wago.com
Subject: [PATCH 2/2] led: use max led value in case of led trigger
Date: Wed, 5 Sep 2018 06:20:39 +0000	[thread overview]
Message-ID: <1536128432-21031-3-git-send-email-oleg.karfich@wago.com> (raw)
In-Reply-To: <1536128432-21031-1-git-send-email-oleg.karfich@wago.com>

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>
---
 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

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2018-09-05  6:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-05  6:20 [PATCH 0/2] add support for pca955x i2c led drivers Oleg.Karfich
2018-09-05  6:20 ` [PATCH 1/2] led: add pca955x led support Oleg.Karfich
2018-09-05  6:20 ` Oleg.Karfich [this message]
2018-09-07  6:21 ` [PATCH 0/2] add support for pca955x i2c led drivers Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1536128432-21031-3-git-send-email-oleg.karfich@wago.com \
    --to=oleg.karfich@wago.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox