[kernel] olpc: add missing LCD config entries
[openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1327-jbt6k74_no_deep_sleep.patch.patch
1 From 62b3330f97b940c715a8931abc7161c99362abaa Mon Sep 17 00:00:00 2001
2 From: Nicolas Dufresne <nicolas.dufresne@gmail.com>
3 Date: Thu, 4 Dec 2008 17:49:02 +0000
4 Subject: [PATCH] jbt6k74_no_deep_sleep.patch
5
6 This patch from
7
8 https://docs.openmoko.org/trac/ticket/1841
9
10 defeats deep sleep on the LCM ASIC and is reported to stop the WSOD
11 behaviour on LCMs that exhibit it.
12 ---
13 drivers/video/display/jbt6k74.c | 114 ++++++++++++++++++++++-----------------
14 1 files changed, 65 insertions(+), 49 deletions(-)
15
16 diff --git a/drivers/video/display/jbt6k74.c b/drivers/video/display/jbt6k74.c
17 index 9570543..0635823 100644
18 --- a/drivers/video/display/jbt6k74.c
19 +++ b/drivers/video/display/jbt6k74.c
20 @@ -252,22 +252,36 @@ static int jbt_init_regs(struct jbt_info *jbt, int qvga)
21 return rc ? -EIO : 0;
22 }
23
24 -static int standby_to_sleep(struct jbt_info *jbt)
25 +int jbt6k74_display_onoff(struct jbt_info *jbt, int on)
26 {
27 - int rc;
28 -
29 - /* three times command zero */
30 - rc = jbt_reg_write_nodata(jbt, 0x00);
31 - mdelay(1);
32 - rc |= jbt_reg_write_nodata(jbt, 0x00);
33 - mdelay(1);
34 - rc |= jbt_reg_write_nodata(jbt, 0x00);
35 - mdelay(1);
36 -
37 - /* deep standby out */
38 - rc |= jbt_reg_write(jbt, JBT_REG_POWER_ON_OFF, 0x17);
39 + if (on)
40 + return jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_ON);
41 + else
42 + return jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_OFF);
43 +}
44 +EXPORT_SYMBOL_GPL(jbt6k74_display_onoff);
45
46 - return rc ? -EIO : 0;
47 +static int standby_to_sleep(struct jbt_info *jbt)
48 +{
49 + static int once = 0;
50 + if (!once++) {
51 + int rc;
52 +
53 + /* three times command zero */
54 + rc = jbt_reg_write_nodata(jbt, 0x00);
55 + mdelay(1);
56 + rc |= jbt_reg_write_nodata(jbt, 0x00);
57 + mdelay(1);
58 + rc |= jbt_reg_write_nodata(jbt, 0x00);
59 + mdelay(1);
60 +
61 + /* deep standby out */
62 + rc |= jbt_reg_write(jbt, JBT_REG_POWER_ON_OFF, 0x17);
63 +
64 + return rc ? -EIO : 0;
65 + }
66 + else
67 + return 0;
68 }
69
70 static int sleep_to_normal(struct jbt_info *jbt)
71 @@ -292,6 +306,9 @@ static int sleep_to_normal(struct jbt_info *jbt)
72 /* initialize register set */
73 rc |= jbt_init_regs(jbt, 0);
74
75 + /* Turn on display */
76 + rc |= jbt6k74_display_onoff(jbt, 1);
77 +
78 return rc ? -EIO : 0;
79 }
80
81 @@ -317,6 +334,9 @@ static int sleep_to_qvga_normal(struct jbt_info *jbt)
82 /* initialize register set for qvga*/
83 rc |= jbt_init_regs(jbt, 1);
84
85 + /* Turn on display */
86 + rc |= jbt6k74_display_onoff(jbt, 1);
87 +
88 return rc ? -EIO : 0;
89 }
90
91 @@ -324,7 +344,8 @@ static int normal_to_sleep(struct jbt_info *jbt)
92 {
93 int rc;
94
95 - rc = jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_OFF);
96 + rc = jbt6k74_display_onoff(jbt, 0);
97 + rc |= jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_OFF);
98 rc |= jbt_reg_write16(jbt, JBT_REG_OUTPUT_CONTROL, 0x8002);
99 rc |= jbt_reg_write_nodata(jbt, JBT_REG_SLEEP_IN);
100
101 @@ -333,7 +354,11 @@ static int normal_to_sleep(struct jbt_info *jbt)
102
103 static int sleep_to_standby(struct jbt_info *jbt)
104 {
105 +#if 0
106 return jbt_reg_write(jbt, JBT_REG_POWER_ON_OFF, 0x00);
107 +#else
108 + return 0;
109 +#endif
110 }
111
112 /* frontend function */
113 @@ -436,6 +461,7 @@ int jbt6k74_enter_state(struct jbt_info *jbt, enum jbt_state new_state)
114 }
115 break;
116 }
117 +
118 if (rc == 0)
119 jbt->state = new_state;
120
121 @@ -443,15 +469,6 @@ int jbt6k74_enter_state(struct jbt_info *jbt, enum jbt_state new_state)
122 }
123 EXPORT_SYMBOL_GPL(jbt6k74_enter_state);
124
125 -int jbt6k74_display_onoff(struct jbt_info *jbt, int on)
126 -{
127 - if (on)
128 - return jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_ON);
129 - else
130 - return jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_OFF);
131 -}
132 -EXPORT_SYMBOL_GPL(jbt6k74_display_onoff);
133 -
134 static ssize_t state_read(struct device *dev, struct device_attribute *attr,
135 char *buf)
136 {
137 @@ -475,17 +492,6 @@ static ssize_t state_write(struct device *dev, struct device_attribute *attr,
138 rc = jbt6k74_enter_state(jbt, i);
139 if (rc)
140 return rc;
141 - switch (i) {
142 - case JBT_STATE_NORMAL:
143 - case JBT_STATE_QVGA_NORMAL:
144 - /* Enable display again after deep-standby */
145 - rc = jbt6k74_display_onoff(jbt, 1);
146 - if (rc)
147 - return rc;
148 - break;
149 - default:
150 - break;
151 - }
152 return count;
153 }
154 }
155 @@ -528,6 +534,8 @@ static ssize_t gamma_write(struct device *dev, struct device_attribute *attr,
156 int reg = reg_by_string(attr->attr.name);
157 unsigned long val = simple_strtoul(buf, NULL, 10);
158
159 + dev_info(dev, "**** jbt6k74 writing gama %lu\n", val & 0xff);
160 +
161 jbt_reg_write(jbt, reg, val & 0xff);
162
163 return count;
164 @@ -567,19 +575,27 @@ static int fb_notifier_callback(struct notifier_block *self,
165
166 switch (fb_blank) {
167 case FB_BLANK_UNBLANK:
168 + dev_info(&jbt->spi_dev->dev, "**** jbt6k74 unblank\n");
169 + break;
170 case FB_BLANK_NORMAL:
171 - jbt6k74_enter_state(jbt, JBT_STATE_NORMAL);
172 - jbt6k74_display_onoff(jbt, 1);
173 + dev_info(&jbt->spi_dev->dev, "**** jbt6k74 normal\n");
174 + /*jbt6k74_enter_state(jbt, JBT_STATE_NORMAL);
175 + jbt6k74_display_onoff(jbt, 1); */
176 break;
177 case FB_BLANK_VSYNC_SUSPEND:
178 + dev_info(&jbt->spi_dev->dev, "**** jbt6k74 vsync suspend\n");
179 + break;
180 case FB_BLANK_HSYNC_SUSPEND:
181 + dev_info(&jbt->spi_dev->dev, "**** jbt6k74 hsync suspend\n");
182 /* FIXME: we disable SLEEP since it would result in
183 * a visible artefact (white screen) before the backlight
184 * is dimmed to a dark enough level */
185 /* jbt6k74_enter_state(jbt, JBT_STATE_SLEEP); */
186 + /*jbt6k74_display_onoff(jbt, 0);*/
187 break;
188 case FB_BLANK_POWERDOWN:
189 - jbt6k74_enter_state(jbt, JBT_STATE_DEEP_STANDBY);
190 + dev_info(&jbt->spi_dev->dev, "**** jbt6k74 powerdown\n");
191 + /*jbt6k74_enter_state(jbt, JBT_STATE_DEEP_STANDBY);*/
192 break;
193 }
194
195 @@ -621,16 +637,10 @@ static int __devinit jbt_probe(struct spi_device *spi)
196 goto err_free_drvdata;
197 }
198
199 - rc = jbt6k74_display_onoff(jbt, 1);
200 - if (rc < 0) {
201 - dev_err(&spi->dev, "cannot switch display on\n");
202 - goto err_standby;
203 - }
204 -
205 rc = sysfs_create_group(&spi->dev.kobj, &jbt_attr_group);
206 if (rc < 0) {
207 dev_err(&spi->dev, "cannot create sysfs group\n");
208 - goto err_off;
209 + goto err_standby;
210 }
211
212 jbt->fb_notif.notifier_call = fb_notifier_callback;
213 @@ -644,8 +654,6 @@ static int __devinit jbt_probe(struct spi_device *spi)
214
215 err_sysfs:
216 sysfs_remove_group(&spi->dev.kobj, &jbt_attr_group);
217 -err_off:
218 - jbt6k74_display_onoff(jbt, 0);
219 err_standby:
220 jbt6k74_enter_state(jbt, JBT_STATE_DEEP_STANDBY);
221 err_free_drvdata:
222 @@ -676,6 +684,8 @@ static int jbt_suspend(struct spi_device *spi, pm_message_t state)
223 struct jbt_info *jbt = dev_get_drvdata(&spi->dev);
224 struct jbt6k74_platform_data *jbt6k74_pdata = spi->dev.platform_data;
225
226 + dev_info(&spi->dev, "**** jbt6k74 suspend start\n");
227 +
228 /* platform can register resume dependencies here, if any */
229 if (jbt6k74_pdata->suspending)
230 (jbt6k74_pdata->suspending)(0, spi);
231 @@ -689,6 +699,8 @@ static int jbt_suspend(struct spi_device *spi, pm_message_t state)
232
233 /* (jbt6k74_pdata->reset)(0, 0); */
234
235 + dev_info(&spi->dev, "**** jbt6k74 suspend end\n");
236 +
237 return 0;
238 }
239
240 @@ -697,6 +709,7 @@ int jbt6k74_resume(struct spi_device *spi)
241 struct jbt_info *jbt = dev_get_drvdata(&spi->dev);
242 struct jbt6k74_platform_data *jbt6k74_pdata = spi->dev.platform_data;
243
244 + dev_info(&spi->dev, "**** jbt6k74 resume start\n");
245 if (jbt6k74_pdata->all_dependencies_resumed)
246 if (!(jbt6k74_pdata->all_dependencies_resumed)(0))
247 return 0;
248 @@ -704,8 +717,10 @@ int jbt6k74_resume(struct spi_device *spi)
249 /* we can get called twice with all dependencies resumed if our core
250 * resume callback is last of all. Protect against doing anything twice
251 */
252 - if (jbt->have_resumed)
253 + if (jbt->have_resumed) {
254 + dev_info(&spi->dev, "**** jbt6k74 already resumed\n");
255 return 0;
256 + }
257
258 jbt->have_resumed |= 1;
259
260 @@ -717,11 +732,12 @@ int jbt6k74_resume(struct spi_device *spi)
261 jbt6k74_enter_state(jbt, JBT_STATE_NORMAL);
262 break;
263 }
264 - jbt6k74_display_onoff(jbt, 1);
265
266 if (jbt6k74_pdata->resuming)
267 (jbt6k74_pdata->resuming)(0);
268
269 + dev_info(&spi->dev, "**** jbt6k74 resume end\n");
270 +
271 return 0;
272 }
273 EXPORT_SYMBOL_GPL(jbt6k74_resume);
274 --
275 1.5.6.5
276
This page took 0.061455 seconds and 5 git commands to generate.