summaryrefslogtreecommitdiffstats
path: root/target/linux/s3c24xx/patches-2.6.26/0211-change-backlight-level-not-forced-up-on-resume.patch.patch
blob: 8bf93692c679ab9b1e1c5971651e5f50f3639efe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
From d7b66b10fd485219e211b6de14fcb5e6a5266c6a Mon Sep 17 00:00:00 2001
From: Andy Green <andy@openmoko.com>
Date: Fri, 25 Jul 2008 23:06:19 +0100
Subject: [PATCH] change-backlight-level-not-forced-up-on-resume.patch

We at least always enabled backlight on resume, this patch
changes us to set backlight back to last requested backlight
brightness level on resume.  Note it means that you can
resume with screen blanked, but it should come back if that
happened with touchscreen action as usual.

/sys/class/backlight/pcf50633-bl/actual_brightness
and
/sys/class/backlight/pcf50633-bl/brightness

seem to agree after resume when reportedly they didn't before.

Signed-off-by: Andy Green <andy@openmoko.com>
---
 drivers/i2c/chips/pcf50633.c |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/drivers/i2c/chips/pcf50633.c b/drivers/i2c/chips/pcf50633.c
index 1074b94..fea2f38 100644
--- a/drivers/i2c/chips/pcf50633.c
+++ b/drivers/i2c/chips/pcf50633.c
@@ -1874,16 +1874,12 @@ static int pcf50633bl_get_intensity(struct backlight_device *bd)
 	return intensity & 0x3f;
 }
 
-static int pcf50633bl_set_intensity(struct backlight_device *bd)
+static int __pcf50633bl_set_intensity(struct pcf50633_data *pcf, int intensity)
 {
-	struct pcf50633_data *pcf = bl_get_data(bd);
-	int intensity = bd->props.brightness;
 	int old_intensity = reg_read(pcf, PCF50633_REG_LEDOUT);
 	u_int8_t ledena = 2;
 	int ret;
 
-	dev_info(&pcf->client.dev, "pcf50633bl_set_intensity\n");
-
 	if (!(reg_read(pcf, PCF50633_REG_LEDENA) & 1))
 		old_intensity = 0;
 
@@ -1891,7 +1887,8 @@ static int pcf50633bl_set_intensity(struct backlight_device *bd)
 	    (bd->props.fb_blank != FB_BLANK_UNBLANK))
 		intensity = 0;
 
-	/* The PCF50633 cannot handle LEDOUT = 0 (datasheet p60)
+	/*
+	 * The PCF50633 cannot handle LEDOUT = 0 (datasheet p60)
 	 * if seen, you have to re-enable the LED unit
 	 */
 
@@ -1912,6 +1909,18 @@ static int pcf50633bl_set_intensity(struct backlight_device *bd)
 	return ret;
 }
 
+static int pcf50633bl_set_intensity(struct backlight_device *bd)
+{
+	struct pcf50633_data *pcf = bl_get_data(bd);
+	int intensity = bd->props.brightness;
+
+	if ((bd->props.power != FB_BLANK_UNBLANK) ||
+	    (bd->props.fb_blank != FB_BLANK_UNBLANK))
+		intensity = 0;
+
+	return __pcf50633bl_set_intensity(pcf, intensity);
+}
+
 static struct backlight_ops pcf50633bl_ops = {
 	.get_brightness	= pcf50633bl_get_intensity,
 	.update_status	= pcf50633bl_set_intensity,
@@ -2501,11 +2510,8 @@ void pcf50633_backlight_resume(struct pcf50633_data *pcf)
 	/* platform defines resume ramp speed */
 	reg_write(pcf, PCF50633_REG_LEDDIM,
 				       pcf->pdata->resume_backlight_ramp_speed);
-	reg_write(pcf, PCF50633_REG_LEDOUT, pcf->standby_regs.misc[
-				   PCF50633_REG_LEDOUT - PCF50633_REG_AUTOOUT]);
-	/* we force the backlight on in fact */
-	reg_write(pcf, PCF50633_REG_LEDENA, pcf->standby_regs.misc[
-			       PCF50633_REG_LEDENA - PCF50633_REG_AUTOOUT] | 1);
+
+	__pcf50633bl_set_intensity(pcf, pcf->backlight->props.brightness);
 }
 EXPORT_SYMBOL_GPL(pcf50633_backlight_resume);
 
-- 
1.5.6.3