[PATCH] fix-pcf50633-backlight-never-down.patch

Andy Green andy at openmoko.com
Mon Nov 17 00:00:12 CET 2008


This solves the problem that the backlight never turns off
in stable-tracking

Signed-off-by: Andy Green <andy at openmoko.com>
---

 drivers/i2c/chips/pcf50633.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c
index 2178830..11a5f5a 100644
--- a/drivers/i2c/chips/pcf50633.c
+++ b/drivers/i2c/chips/pcf50633.c
@@ -1905,10 +1905,9 @@ static int pcf50633bl_get_intensity(struct backlight_device *bd)
 static int __pcf50633bl_set_intensity(struct pcf50633_data *pcf, int intensity)
 {
 	int old_intensity = reg_read(pcf, PCF50633_REG_LEDOUT);
-	u_int8_t ledena = 2;
 	int ret;
 
-	if (!(reg_read(pcf, PCF50633_REG_LEDENA) & 1))
+	if (!(reg_read(pcf, PCF50633_REG_LEDENA) & 3))
 		old_intensity = 0;
 
 	if ((pcf->backlight->props.power != FB_BLANK_UNBLANK) ||
@@ -1920,10 +1919,8 @@ static int __pcf50633bl_set_intensity(struct pcf50633_data *pcf, int intensity)
 	 * if seen, you have to re-enable the LED unit
 	 */
 
-	if (intensity != 0 && old_intensity == 0) {
-		ledena = reg_read(pcf, PCF50633_REG_LEDENA);
-		reg_write(pcf, PCF50633_REG_LEDENA, 0x00);
-	}
+	if (!intensity || !old_intensity)
+		reg_write(pcf, PCF50633_REG_LEDENA, 0);
 
 	if (!intensity) /* illegal to set LEDOUT to 0 */
 		ret = reg_set_bit_mask(pcf, PCF50633_REG_LEDOUT, 0x3f, 2);
@@ -1931,8 +1928,8 @@ static int __pcf50633bl_set_intensity(struct pcf50633_data *pcf, int intensity)
 		ret = reg_set_bit_mask(pcf, PCF50633_REG_LEDOUT, 0x3f,
 			       intensity);
 
-	if (intensity != 0 && old_intensity == 0)
-		reg_write(pcf, PCF50633_REG_LEDENA, ledena);
+	if (intensity)
+		reg_write(pcf, PCF50633_REG_LEDENA, 2);
 
 	return ret;
 }




More information about the openmoko-kernel mailing list