initialize the url field for packages
[openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1148-fix-backlight-disable-on-zero-intensity.patch.patch
1 From c9d44c8b43d29dd500c1dd711e490bdcd47f2830 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Tue, 13 May 2008 18:53:40 +0100
4 Subject: [PATCH] fix-backlight-disable-on-zero-intensity.patch
5
6 It's never right to put 0 intensity into LEDOUT according to datasheet
7 But having a floor at intensity 2 means backlight isn't properly off
8 when "dimmed". So change to intensity 0 --> disable backlight.
9
10 Signed-off-by: Andy Green <andy@openmoko.com>
11 ---
12 drivers/i2c/chips/pcf50633.c | 34 +++++++++++++++++++++-------------
13 1 files changed, 21 insertions(+), 13 deletions(-)
14
15 diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c
16 index dc4ea0a..205f4e3 100644
17 --- a/drivers/i2c/chips/pcf50633.c
18 +++ b/drivers/i2c/chips/pcf50633.c
19 @@ -1458,6 +1458,9 @@ static int pcf50633bl_get_intensity(struct backlight_device *bd)
20 struct pcf50633_data *pcf = bl_get_data(bd);
21 int intensity = reg_read(pcf, PCF50633_REG_LEDOUT);
22
23 + if (!(reg_read(pcf, PCF50633_REG_LEDOUT) & 1))
24 + intensity = 0;
25 +
26 return intensity & 0x3f;
27 }
28
29 @@ -1466,31 +1469,36 @@ static int pcf50633bl_set_intensity(struct backlight_device *bd)
30 struct pcf50633_data *pcf = bl_get_data(bd);
31 int intensity = bd->props.brightness;
32 int old_intensity = reg_read(pcf, PCF50633_REG_LEDOUT);
33 - u_int8_t ledena = 2;
34 int ret;
35
36 - if (bd->props.power != FB_BLANK_UNBLANK)
37 - intensity = 0;
38 - if (bd->props.fb_blank != FB_BLANK_UNBLANK)
39 + if (!(reg_read(pcf, PCF50633_REG_LEDOUT) & 1))
40 + old_intensity = 0;
41 +
42 + if ((bd->props.power != FB_BLANK_UNBLANK) ||
43 + (bd->props.fb_blank != FB_BLANK_UNBLANK))
44 intensity = 0;
45
46 - /* The PCF50633 cannot handle LEDOUT = 0 (datasheet p60)
47 + /*
48 + * The PCF50633 cannot handle LEDOUT = 0 (datasheet p60)
49 * if seen, you have to re-enable the LED unit
50 + * we treat intensity 0 as disable
51 */
52
53 - if (intensity != 0 && old_intensity == 0) {
54 - ledena = reg_read(pcf, PCF50633_REG_LEDENA);
55 - reg_write(pcf, PCF50633_REG_LEDENA, 0x00);
56 + if (intensity && !old_intensity) {
57 + ret = reg_set_bit_mask(pcf, PCF50633_REG_LEDENA, 0x01, 0x00);
58 + if (ret)
59 + return ret;
60 }
61
62 if (!intensity) /* illegal to set LEDOUT to 0 */
63 - ret = reg_set_bit_mask(pcf, PCF50633_REG_LEDOUT, 0x3f, 2);
64 - else
65 + ret = reg_set_bit_mask(pcf, PCF50633_REG_LEDENA, 0x01, 0x00);
66 + else {
67 ret = reg_set_bit_mask(pcf, PCF50633_REG_LEDOUT, 0x3f,
68 intensity);
69 -
70 - if (intensity != 0 && old_intensity == 0)
71 - reg_write(pcf, PCF50633_REG_LEDENA, ledena);
72 + if (ret)
73 + return ret;
74 + ret = reg_set_bit_mask(pcf, PCF50633_REG_LEDENA, 0x01, 0x01);
75 + }
76
77 return ret;
78 }
79 --
80 1.5.6.5
81
This page took 0.052165 seconds and 5 git commands to generate.