1 From d7b66b10fd485219e211b6de14fcb5e6a5266c6a Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Fri, 25 Jul 2008 23:06:19 +0100
4 Subject: [PATCH] change-backlight-level-not-forced-up-on-resume.patch
6 We at least always enabled backlight on resume, this patch
7 changes us to set backlight back to last requested backlight
8 brightness level on resume. Note it means that you can
9 resume with screen blanked, but it should come back if that
10 happened with touchscreen action as usual.
12 /sys/class/backlight/pcf50633-bl/actual_brightness
14 /sys/class/backlight/pcf50633-bl/brightness
16 seem to agree after resume when reportedly they didn't before.
18 Signed-off-by: Andy Green <andy@openmoko.com>
20 drivers/i2c/chips/pcf50633.c | 28 +++++++++++++++++-----------
21 1 files changed, 17 insertions(+), 11 deletions(-)
23 diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c
24 index 1074b94..fea2f38 100644
25 --- a/drivers/i2c/chips/pcf50633.c
26 +++ b/drivers/i2c/chips/pcf50633.c
27 @@ -1874,16 +1874,12 @@ static int pcf50633bl_get_intensity(struct backlight_device *bd)
28 return intensity & 0x3f;
31 -static int pcf50633bl_set_intensity(struct backlight_device *bd)
32 +static int __pcf50633bl_set_intensity(struct pcf50633_data *pcf, int intensity)
34 - struct pcf50633_data *pcf = bl_get_data(bd);
35 - int intensity = bd->props.brightness;
36 int old_intensity = reg_read(pcf, PCF50633_REG_LEDOUT);
40 - dev_info(&pcf->client.dev, "pcf50633bl_set_intensity\n");
42 if (!(reg_read(pcf, PCF50633_REG_LEDENA) & 1))
45 @@ -1891,7 +1887,8 @@ static int pcf50633bl_set_intensity(struct backlight_device *bd)
46 (bd->props.fb_blank != FB_BLANK_UNBLANK))
49 - /* The PCF50633 cannot handle LEDOUT = 0 (datasheet p60)
51 + * The PCF50633 cannot handle LEDOUT = 0 (datasheet p60)
52 * if seen, you have to re-enable the LED unit
55 @@ -1912,6 +1909,18 @@ static int pcf50633bl_set_intensity(struct backlight_device *bd)
59 +static int pcf50633bl_set_intensity(struct backlight_device *bd)
61 + struct pcf50633_data *pcf = bl_get_data(bd);
62 + int intensity = bd->props.brightness;
64 + if ((bd->props.power != FB_BLANK_UNBLANK) ||
65 + (bd->props.fb_blank != FB_BLANK_UNBLANK))
68 + return __pcf50633bl_set_intensity(pcf, intensity);
71 static struct backlight_ops pcf50633bl_ops = {
72 .get_brightness = pcf50633bl_get_intensity,
73 .update_status = pcf50633bl_set_intensity,
74 @@ -2501,11 +2510,8 @@ void pcf50633_backlight_resume(struct pcf50633_data *pcf)
75 /* platform defines resume ramp speed */
76 reg_write(pcf, PCF50633_REG_LEDDIM,
77 pcf->pdata->resume_backlight_ramp_speed);
78 - reg_write(pcf, PCF50633_REG_LEDOUT, pcf->standby_regs.misc[
79 - PCF50633_REG_LEDOUT - PCF50633_REG_AUTOOUT]);
80 - /* we force the backlight on in fact */
81 - reg_write(pcf, PCF50633_REG_LEDENA, pcf->standby_regs.misc[
82 - PCF50633_REG_LEDENA - PCF50633_REG_AUTOOUT] | 1);
84 + __pcf50633bl_set_intensity(pcf, pcf->backlight->props.brightness);
86 EXPORT_SYMBOL_GPL(pcf50633_backlight_resume);