From: Jonathan Cameron <Jonathan.Cameron@gmail.com>
To: Mike Rapoport <mike@compulab.co.il>,
eric miao <eric.y.miao@gmail.com>,
rpurdie@rpsys.net, LKML <linux-kernel@vger.kernel.org>
Subject: [LED bug fix] leds-da903x (da9030 only) led brightness reversed.
Date: Thu, 30 Oct 2008 11:05:00 +0000 [thread overview]
Message-ID: <490994DC.7040409@gmail.com> (raw)
The brightness control register calculation (for the pwm) is
effectively the reverse of what would be expected.
1 is maximum brightness, 255 minimum.
This patch inverts this.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
---
diff --git a/drivers/leds/leds-da903x.c b/drivers/leds/leds-da903x.c
index f1fddb1..ab632e9 100644
--- a/drivers/leds/leds-da903x.c
+++ b/drivers/leds/leds-da903x.c
@@ -57,7 +57,7 @@ static void da903x_led_work(struct work_struct *work)
offset = DA9030_LED_OFFSET(led->id);
val = led->flags & ~0x87;
val |= (led->new_brightness) ? 0x80 : 0; /* EN bit */
- val |= (led->new_brightness >> 5) & 0x7; /* PWM<2:0> */
+ val |= (0x7 - (led->new_brightness >> 5)) & 0x7; /* PWM<2:0> */
da903x_write(led->master, DA9030_LED1_CONTROL + offset, val);
break;
case DA9030_ID_VIBRA:
next reply other threads:[~2008-10-30 11:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-30 11:05 Jonathan Cameron [this message]
2008-10-30 11:53 ` [LED bug fix] leds-da903x (da9030 only) led brightness reversed Mike Rapoport
2008-10-30 14:01 ` Eric Miao
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=490994DC.7040409@gmail.com \
--to=jonathan.cameron@gmail.com \
--cc=eric.y.miao@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mike@compulab.co.il \
--cc=rpurdie@rpsys.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.