LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [LED bug fix] leds-da903x (da9030 only) led brightness reversed.
@ 2008-10-30 11:05 Jonathan Cameron
  2008-10-30 11:53 ` Mike Rapoport
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2008-10-30 11:05 UTC (permalink / raw)
  To: Mike Rapoport, eric miao, rpurdie, LKML

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:

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-10-30 14:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-30 11:05 [LED bug fix] leds-da903x (da9030 only) led brightness reversed Jonathan Cameron
2008-10-30 11:53 ` Mike Rapoport
2008-10-30 14:01   ` Eric Miao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).