Title: [9181] branches/2010R1/drivers/video/backlight/adp8860_bl.c: video: backlight: adp8860: Fix ambient light zone overwrite handling
Revision
9181
Author
hennerich
Date
2010-09-29 04:47:36 -0400 (Wed, 29 Sep 2010)

Log Message

video: backlight: adp8860: Fix ambient light zone overwrite handling

Get/Set current Ambient Light Zone. Reading should return integer between 1..3
(1 = Daylight, 2 = office, 3 = dark). Writing a value between 1..3 forces
the Backlight controller to enter the corresponding Ambient Light Zone.
Writing 0 returns to normal operation.
Fix valid range and make sure we subtract 1, since the register
definition (CFGR:BLV) requires it.

Modified Paths

Diff

Modified: branches/2010R1/drivers/video/backlight/adp8860_bl.c (9180 => 9181)


--- branches/2010R1/drivers/video/backlight/adp8860_bl.c	2010-09-29 08:46:59 UTC (rev 9180)
+++ branches/2010R1/drivers/video/backlight/adp8860_bl.c	2010-09-29 08:47:36 UTC (rev 9181)
@@ -614,7 +614,7 @@
 	if (val == 0) {
 		/* Enable automatic ambient light sensing */
 		adp8860_set_bits(data->client, ADP8860_MDCR, CMP_AUTOEN);
-	} else if ((val > 0) && (val < 6)) {
+	} else if ((val > 0) && (val <= 3)) {
 		/* Disable automatic ambient light sensing */
 		adp8860_clr_bits(data->client, ADP8860_MDCR, CMP_AUTOEN);
 
@@ -622,7 +622,7 @@
 		mutex_lock(&data->lock);
 		adp8860_read(data->client, ADP8860_CFGR, &reg_val);
 		reg_val &= ~(CFGR_BLV_MASK << CFGR_BLV_SHIFT);
-		reg_val |= val << CFGR_BLV_SHIFT;
+		reg_val |= (val - 1) << CFGR_BLV_SHIFT;
 		adp8860_write(data->client, ADP8860_CFGR, reg_val);
 		mutex_unlock(&data->lock);
 	}
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to