diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2008-01-01 19:09:54 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-01-28 08:13:25 -0500 |
commit | ca4d6cfcee0cb2d25c0eb3b0172ecc6f223133ef (patch) | |
tree | 5bfcb4419f27b20782b76b81ae7f341bcd507e1b /arch/arm | |
parent | 2e927b76267a57a44c018ffcc64cde5fedde1fcf (diff) |
[ARM] 4737/1: Refactor corgi_lcd to improve readability + bugfix
This patch refactors the code in corgi_lcd.c moving it to the board
specific corgi and spitz files where appropriate instead of the
existing ifdef mess which hinders readability.
Fix spitz_get_hsync_len() to call get_hsync_invperiod so pxafb can be
compiled as a module.
The confusing variables which represent the inverse horizintal sync
period are renamed to "invperiod" consistently.
An incorrect comment in corgi_ts.c is also corrected.
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-pxa/corgi.c | 183 | ||||
-rw-r--r-- | arch/arm/mach-pxa/corgi_lcd.c | 299 | ||||
-rw-r--r-- | arch/arm/mach-pxa/sharpsl.h | 19 | ||||
-rw-r--r-- | arch/arm/mach-pxa/spitz.c | 106 |
4 files changed, 287 insertions, 320 deletions
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index 2363cc64fe07..7304fdbfbb0f 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/mmc/host.h> | 21 | #include <linux/mmc/host.h> |
22 | #include <linux/pm.h> | 22 | #include <linux/pm.h> |
23 | #include <linux/backlight.h> | 23 | #include <linux/backlight.h> |
24 | #include <video/w100fb.h> | ||
24 | 25 | ||
25 | #include <asm/setup.h> | 26 | #include <asm/setup.h> |
26 | #include <asm/memory.h> | 27 | #include <asm/memory.h> |
@@ -141,6 +142,136 @@ struct corgissp_machinfo corgi_ssp_machinfo = { | |||
141 | 142 | ||
142 | 143 | ||
143 | /* | 144 | /* |
145 | * LCD/Framebuffer | ||
146 | */ | ||
147 | static void w100_lcdtg_suspend(struct w100fb_par *par) | ||
148 | { | ||
149 | corgi_lcdtg_suspend(); | ||
150 | } | ||
151 | |||
152 | static void w100_lcdtg_init(struct w100fb_par *par) | ||
153 | { | ||
154 | corgi_lcdtg_hw_init(par->xres); | ||
155 | } | ||
156 | |||
157 | |||
158 | static struct w100_tg_info corgi_lcdtg_info = { | ||
159 | .change = w100_lcdtg_init, | ||
160 | .suspend = w100_lcdtg_suspend, | ||
161 | .resume = w100_lcdtg_init, | ||
162 | }; | ||
163 | |||
164 | static struct w100_mem_info corgi_fb_mem = { | ||
165 | .ext_cntl = 0x00040003, | ||
166 | .sdram_mode_reg = 0x00650021, | ||
167 | .ext_timing_cntl = 0x10002a4a, | ||
168 | .io_cntl = 0x7ff87012, | ||
169 | .size = 0x1fffff, | ||
170 | }; | ||
171 | |||
172 | static struct w100_gen_regs corgi_fb_regs = { | ||
173 | .lcd_format = 0x00000003, | ||
174 | .lcdd_cntl1 = 0x01CC0000, | ||
175 | .lcdd_cntl2 = 0x0003FFFF, | ||
176 | .genlcd_cntl1 = 0x00FFFF0D, | ||
177 | .genlcd_cntl2 = 0x003F3003, | ||
178 | .genlcd_cntl3 = 0x000102aa, | ||
179 | }; | ||
180 | |||
181 | static struct w100_gpio_regs corgi_fb_gpio = { | ||
182 | .init_data1 = 0x000000bf, | ||
183 | .init_data2 = 0x00000000, | ||
184 | .gpio_dir1 = 0x00000000, | ||
185 | .gpio_oe1 = 0x03c0feff, | ||
186 | .gpio_dir2 = 0x00000000, | ||
187 | .gpio_oe2 = 0x00000000, | ||
188 | }; | ||
189 | |||
190 | static struct w100_mode corgi_fb_modes[] = { | ||
191 | { | ||
192 | .xres = 480, | ||
193 | .yres = 640, | ||
194 | .left_margin = 0x56, | ||
195 | .right_margin = 0x55, | ||
196 | .upper_margin = 0x03, | ||
197 | .lower_margin = 0x00, | ||
198 | .crtc_ss = 0x82360056, | ||
199 | .crtc_ls = 0xA0280000, | ||
200 | .crtc_gs = 0x80280028, | ||
201 | .crtc_vpos_gs = 0x02830002, | ||
202 | .crtc_rev = 0x00400008, | ||
203 | .crtc_dclk = 0xA0000000, | ||
204 | .crtc_gclk = 0x8015010F, | ||
205 | .crtc_goe = 0x80100110, | ||
206 | .crtc_ps1_active = 0x41060010, | ||
207 | .pll_freq = 75, | ||
208 | .fast_pll_freq = 100, | ||
209 | .sysclk_src = CLK_SRC_PLL, | ||
210 | .sysclk_divider = 0, | ||
211 | .pixclk_src = CLK_SRC_PLL, | ||
212 | .pixclk_divider = 2, | ||
213 | .pixclk_divider_rotated = 6, | ||
214 | },{ | ||
215 | .xres = 240, | ||
216 | .yres = 320, | ||
217 | .left_margin = 0x27, | ||
218 | .right_margin = 0x2e, | ||
219 | .upper_margin = 0x01, | ||
220 | .lower_margin = 0x00, | ||
221 | .crtc_ss = 0x81170027, | ||
222 | .crtc_ls = 0xA0140000, | ||
223 | .crtc_gs = 0xC0140014, | ||
224 | .crtc_vpos_gs = 0x00010141, | ||
225 | .crtc_rev = 0x00400008, | ||
226 | .crtc_dclk = 0xA0000000, | ||
227 | .crtc_gclk = 0x8015010F, | ||
228 | .crtc_goe = 0x80100110, | ||
229 | .crtc_ps1_active = 0x41060010, | ||
230 | .pll_freq = 0, | ||
231 | .fast_pll_freq = 0, | ||
232 | .sysclk_src = CLK_SRC_XTAL, | ||
233 | .sysclk_divider = 0, | ||
234 | .pixclk_src = CLK_SRC_XTAL, | ||
235 | .pixclk_divider = 1, | ||
236 | .pixclk_divider_rotated = 1, | ||
237 | }, | ||
238 | |||
239 | }; | ||
240 | |||
241 | static struct w100fb_mach_info corgi_fb_info = { | ||
242 | .tg = &corgi_lcdtg_info, | ||
243 | .init_mode = INIT_MODE_ROTATED, | ||
244 | .mem = &corgi_fb_mem, | ||
245 | .regs = &corgi_fb_regs, | ||
246 | .modelist = &corgi_fb_modes[0], | ||
247 | .num_modes = 2, | ||
248 | .gpio = &corgi_fb_gpio, | ||
249 | .xtal_freq = 12500000, | ||
250 | .xtal_dbl = 0, | ||
251 | }; | ||
252 | |||
253 | static struct resource corgi_fb_resources[] = { | ||
254 | [0] = { | ||
255 | .start = 0x08000000, | ||
256 | .end = 0x08ffffff, | ||
257 | .flags = IORESOURCE_MEM, | ||
258 | }, | ||
259 | }; | ||
260 | |||
261 | static struct platform_device corgifb_device = { | ||
262 | .name = "w100fb", | ||
263 | .id = -1, | ||
264 | .num_resources = ARRAY_SIZE(corgi_fb_resources), | ||
265 | .resource = corgi_fb_resources, | ||
266 | .dev = { | ||
267 | .platform_data = &corgi_fb_info, | ||
268 | .parent = &corgissp_device.dev, | ||
269 | }, | ||
270 | |||
271 | }; | ||
272 | |||
273 | |||
274 | /* | ||
144 | * Corgi Backlight Device | 275 | * Corgi Backlight Device |
145 | */ | 276 | */ |
146 | static void corgi_bl_kick_battery(void) | 277 | static void corgi_bl_kick_battery(void) |
@@ -154,6 +285,21 @@ static void corgi_bl_kick_battery(void) | |||
154 | } | 285 | } |
155 | } | 286 | } |
156 | 287 | ||
288 | static void corgi_bl_set_intensity(int intensity) | ||
289 | { | ||
290 | if (intensity > 0x10) | ||
291 | intensity += 0x10; | ||
292 | |||
293 | /* Bits 0-4 are accessed via the SSP interface */ | ||
294 | corgi_ssp_blduty_set(intensity & 0x1f); | ||
295 | |||
296 | /* Bit 5 is via SCOOP */ | ||
297 | if (intensity & 0x0020) | ||
298 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT); | ||
299 | else | ||
300 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT); | ||
301 | } | ||
302 | |||
157 | static struct generic_bl_info corgi_bl_machinfo = { | 303 | static struct generic_bl_info corgi_bl_machinfo = { |
158 | .name = "corgi-bl", | 304 | .name = "corgi-bl", |
159 | .max_intensity = 0x2f, | 305 | .max_intensity = 0x2f, |
@@ -190,9 +336,40 @@ static struct platform_device corgiled_device = { | |||
190 | .id = -1, | 336 | .id = -1, |
191 | }; | 337 | }; |
192 | 338 | ||
339 | |||
193 | /* | 340 | /* |
194 | * Corgi Touch Screen Device | 341 | * Corgi Touch Screen Device |
195 | */ | 342 | */ |
343 | static unsigned long (*get_hsync_invperiod)(struct device *dev); | ||
344 | |||
345 | static void inline sharpsl_wait_sync(int gpio) | ||
346 | { | ||
347 | while((GPLR(gpio) & GPIO_bit(gpio)) == 0); | ||
348 | while((GPLR(gpio) & GPIO_bit(gpio)) != 0); | ||
349 | } | ||
350 | |||
351 | static unsigned long corgi_get_hsync_invperiod(void) | ||
352 | { | ||
353 | if (!get_hsync_invperiod) | ||
354 | get_hsync_invperiod = symbol_get(w100fb_get_hsynclen); | ||
355 | if (!get_hsync_invperiod) | ||
356 | return 0; | ||
357 | |||
358 | return get_hsync_invperiod(&corgifb_device.dev); | ||
359 | } | ||
360 | |||
361 | static void corgi_put_hsync(void) | ||
362 | { | ||
363 | if (get_hsync_invperiod) | ||
364 | symbol_put(w100fb_get_hsynclen); | ||
365 | get_hsync_invperiod = NULL; | ||
366 | } | ||
367 | |||
368 | static void corgi_wait_hsync(void) | ||
369 | { | ||
370 | sharpsl_wait_sync(CORGI_GPIO_HSYNC); | ||
371 | } | ||
372 | |||
196 | static struct resource corgits_resources[] = { | 373 | static struct resource corgits_resources[] = { |
197 | [0] = { | 374 | [0] = { |
198 | .start = CORGI_IRQ_GPIO_TP_INT, | 375 | .start = CORGI_IRQ_GPIO_TP_INT, |
@@ -202,9 +379,9 @@ static struct resource corgits_resources[] = { | |||
202 | }; | 379 | }; |
203 | 380 | ||
204 | static struct corgits_machinfo corgi_ts_machinfo = { | 381 | static struct corgits_machinfo corgi_ts_machinfo = { |
205 | .get_hsync_len = corgi_get_hsync_len, | 382 | .get_hsync_invperiod = corgi_get_hsync_invperiod, |
206 | .put_hsync = corgi_put_hsync, | 383 | .put_hsync = corgi_put_hsync, |
207 | .wait_hsync = corgi_wait_hsync, | 384 | .wait_hsync = corgi_wait_hsync, |
208 | }; | 385 | }; |
209 | 386 | ||
210 | static struct platform_device corgits_device = { | 387 | static struct platform_device corgits_device = { |
diff --git a/arch/arm/mach-pxa/corgi_lcd.c b/arch/arm/mach-pxa/corgi_lcd.c index 365b9435f748..9328df37afd1 100644 --- a/arch/arm/mach-pxa/corgi_lcd.c +++ b/arch/arm/mach-pxa/corgi_lcd.c | |||
@@ -173,7 +173,7 @@ static void lcdtg_set_phadadj(int mode) | |||
173 | 173 | ||
174 | static int lcd_inited; | 174 | static int lcd_inited; |
175 | 175 | ||
176 | static void lcdtg_hw_init(int mode) | 176 | void corgi_lcdtg_hw_init(int mode) |
177 | { | 177 | { |
178 | if (!lcd_inited) { | 178 | if (!lcd_inited) { |
179 | int comadj; | 179 | int comadj; |
@@ -254,7 +254,7 @@ static void lcdtg_hw_init(int mode) | |||
254 | } | 254 | } |
255 | } | 255 | } |
256 | 256 | ||
257 | static void lcdtg_suspend(void) | 257 | void corgi_lcdtg_suspend(void) |
258 | { | 258 | { |
259 | /* 60Hz x 2 frame = 16.7msec x 2 = 33.4 msec */ | 259 | /* 60Hz x 2 frame = 16.7msec x 2 = 33.4 msec */ |
260 | mdelay(34); | 260 | mdelay(34); |
@@ -288,298 +288,3 @@ static void lcdtg_suspend(void) | |||
288 | lcd_inited = 0; | 288 | lcd_inited = 0; |
289 | } | 289 | } |
290 | 290 | ||
291 | |||
292 | /* | ||
293 | * Corgi w100 Frame Buffer Device | ||
294 | */ | ||
295 | #ifdef CONFIG_PXA_SHARP_C7xx | ||
296 | |||
297 | #include <video/w100fb.h> | ||
298 | |||
299 | static void w100_lcdtg_suspend(struct w100fb_par *par) | ||
300 | { | ||
301 | lcdtg_suspend(); | ||
302 | } | ||
303 | |||
304 | static void w100_lcdtg_init(struct w100fb_par *par) | ||
305 | { | ||
306 | lcdtg_hw_init(par->xres); | ||
307 | } | ||
308 | |||
309 | |||
310 | static struct w100_tg_info corgi_lcdtg_info = { | ||
311 | .change = w100_lcdtg_init, | ||
312 | .suspend = w100_lcdtg_suspend, | ||
313 | .resume = w100_lcdtg_init, | ||
314 | }; | ||
315 | |||
316 | static struct w100_mem_info corgi_fb_mem = { | ||
317 | .ext_cntl = 0x00040003, | ||
318 | .sdram_mode_reg = 0x00650021, | ||
319 | .ext_timing_cntl = 0x10002a4a, | ||
320 | .io_cntl = 0x7ff87012, | ||
321 | .size = 0x1fffff, | ||
322 | }; | ||
323 | |||
324 | static struct w100_gen_regs corgi_fb_regs = { | ||
325 | .lcd_format = 0x00000003, | ||
326 | .lcdd_cntl1 = 0x01CC0000, | ||
327 | .lcdd_cntl2 = 0x0003FFFF, | ||
328 | .genlcd_cntl1 = 0x00FFFF0D, | ||
329 | .genlcd_cntl2 = 0x003F3003, | ||
330 | .genlcd_cntl3 = 0x000102aa, | ||
331 | }; | ||
332 | |||
333 | static struct w100_gpio_regs corgi_fb_gpio = { | ||
334 | .init_data1 = 0x000000bf, | ||
335 | .init_data2 = 0x00000000, | ||
336 | .gpio_dir1 = 0x00000000, | ||
337 | .gpio_oe1 = 0x03c0feff, | ||
338 | .gpio_dir2 = 0x00000000, | ||
339 | .gpio_oe2 = 0x00000000, | ||
340 | }; | ||
341 | |||
342 | static struct w100_mode corgi_fb_modes[] = { | ||
343 | { | ||
344 | .xres = 480, | ||
345 | .yres = 640, | ||
346 | .left_margin = 0x56, | ||
347 | .right_margin = 0x55, | ||
348 | .upper_margin = 0x03, | ||
349 | .lower_margin = 0x00, | ||
350 | .crtc_ss = 0x82360056, | ||
351 | .crtc_ls = 0xA0280000, | ||
352 | .crtc_gs = 0x80280028, | ||
353 | .crtc_vpos_gs = 0x02830002, | ||
354 | .crtc_rev = 0x00400008, | ||
355 | .crtc_dclk = 0xA0000000, | ||
356 | .crtc_gclk = 0x8015010F, | ||
357 | .crtc_goe = 0x80100110, | ||
358 | .crtc_ps1_active = 0x41060010, | ||
359 | .pll_freq = 75, | ||
360 | .fast_pll_freq = 100, | ||
361 | .sysclk_src = CLK_SRC_PLL, | ||
362 | .sysclk_divider = 0, | ||
363 | .pixclk_src = CLK_SRC_PLL, | ||
364 | .pixclk_divider = 2, | ||
365 | .pixclk_divider_rotated = 6, | ||
366 | },{ | ||
367 | .xres = 240, | ||
368 | .yres = 320, | ||
369 | .left_margin = 0x27, | ||
370 | .right_margin = 0x2e, | ||
371 | .upper_margin = 0x01, | ||
372 | .lower_margin = 0x00, | ||
373 | .crtc_ss = 0x81170027, | ||
374 | .crtc_ls = 0xA0140000, | ||
375 | .crtc_gs = 0xC0140014, | ||
376 | .crtc_vpos_gs = 0x00010141, | ||
377 | .crtc_rev = 0x00400008, | ||
378 | .crtc_dclk = 0xA0000000, | ||
379 | .crtc_gclk = 0x8015010F, | ||
380 | .crtc_goe = 0x80100110, | ||
381 | .crtc_ps1_active = 0x41060010, | ||
382 | .pll_freq = 0, | ||
383 | .fast_pll_freq = 0, | ||
384 | .sysclk_src = CLK_SRC_XTAL, | ||
385 | .sysclk_divider = 0, | ||
386 | .pixclk_src = CLK_SRC_XTAL, | ||
387 | .pixclk_divider = 1, | ||
388 | .pixclk_divider_rotated = 1, | ||
389 | }, | ||
390 | |||
391 | }; | ||
392 | |||
393 | static struct w100fb_mach_info corgi_fb_info = { | ||
394 | .tg = &corgi_lcdtg_info, | ||
395 | .init_mode = INIT_MODE_ROTATED, | ||
396 | .mem = &corgi_fb_mem, | ||
397 | .regs = &corgi_fb_regs, | ||
398 | .modelist = &corgi_fb_modes[0], | ||
399 | .num_modes = 2, | ||
400 | .gpio = &corgi_fb_gpio, | ||
401 | .xtal_freq = 12500000, | ||
402 | .xtal_dbl = 0, | ||
403 | }; | ||
404 | |||
405 | static struct resource corgi_fb_resources[] = { | ||
406 | [0] = { | ||
407 | .start = 0x08000000, | ||
408 | .end = 0x08ffffff, | ||
409 | .flags = IORESOURCE_MEM, | ||
410 | }, | ||
411 | }; | ||
412 | |||
413 | struct platform_device corgifb_device = { | ||
414 | .name = "w100fb", | ||
415 | .id = -1, | ||
416 | .num_resources = ARRAY_SIZE(corgi_fb_resources), | ||
417 | .resource = corgi_fb_resources, | ||
418 | .dev = { | ||
419 | .platform_data = &corgi_fb_info, | ||
420 | .parent = &corgissp_device.dev, | ||
421 | }, | ||
422 | |||
423 | }; | ||
424 | #endif | ||
425 | |||
426 | |||
427 | /* | ||
428 | * Spitz PXA Frame Buffer Device | ||
429 | */ | ||
430 | #ifdef CONFIG_PXA_SHARP_Cxx00 | ||
431 | |||
432 | #include <asm/arch/pxafb.h> | ||
433 | |||
434 | void spitz_lcd_power(int on, struct fb_var_screeninfo *var) | ||
435 | { | ||
436 | if (on) | ||
437 | lcdtg_hw_init(var->xres); | ||
438 | else | ||
439 | lcdtg_suspend(); | ||
440 | } | ||
441 | |||
442 | #endif | ||
443 | |||
444 | |||
445 | /* | ||
446 | * Corgi/Spitz Touchscreen to LCD interface | ||
447 | */ | ||
448 | static unsigned long (*get_hsync_time)(struct device *dev); | ||
449 | |||
450 | static void inline sharpsl_wait_sync(int gpio) | ||
451 | { | ||
452 | while((GPLR(gpio) & GPIO_bit(gpio)) == 0); | ||
453 | while((GPLR(gpio) & GPIO_bit(gpio)) != 0); | ||
454 | } | ||
455 | |||
456 | #ifdef CONFIG_PXA_SHARP_C7xx | ||
457 | unsigned long corgi_get_hsync_len(void) | ||
458 | { | ||
459 | if (!get_hsync_time) | ||
460 | get_hsync_time = symbol_get(w100fb_get_hsynclen); | ||
461 | if (!get_hsync_time) | ||
462 | return 0; | ||
463 | |||
464 | return get_hsync_time(&corgifb_device.dev); | ||
465 | } | ||
466 | |||
467 | void corgi_put_hsync(void) | ||
468 | { | ||
469 | if (get_hsync_time) | ||
470 | symbol_put(w100fb_get_hsynclen); | ||
471 | get_hsync_time = NULL; | ||
472 | } | ||
473 | |||
474 | void corgi_wait_hsync(void) | ||
475 | { | ||
476 | sharpsl_wait_sync(CORGI_GPIO_HSYNC); | ||
477 | } | ||
478 | #endif | ||
479 | |||
480 | #ifdef CONFIG_PXA_SHARP_Cxx00 | ||
481 | static struct device *spitz_pxafb_dev; | ||
482 | |||
483 | static int is_pxafb_device(struct device * dev, void * data) | ||
484 | { | ||
485 | struct platform_device *pdev = container_of(dev, struct platform_device, dev); | ||
486 | |||
487 | return (strncmp(pdev->name, "pxa2xx-fb", 9) == 0); | ||
488 | } | ||
489 | |||
490 | unsigned long spitz_get_hsync_len(void) | ||
491 | { | ||
492 | #ifdef CONFIG_FB_PXA | ||
493 | if (!spitz_pxafb_dev) { | ||
494 | spitz_pxafb_dev = bus_find_device(&platform_bus_type, NULL, NULL, is_pxafb_device); | ||
495 | if (!spitz_pxafb_dev) | ||
496 | return 0; | ||
497 | } | ||
498 | if (!get_hsync_time) | ||
499 | get_hsync_time = symbol_get(pxafb_get_hsync_time); | ||
500 | if (!get_hsync_time) | ||
501 | #endif | ||
502 | return 0; | ||
503 | |||
504 | return pxafb_get_hsync_time(spitz_pxafb_dev); | ||
505 | } | ||
506 | |||
507 | void spitz_put_hsync(void) | ||
508 | { | ||
509 | put_device(spitz_pxafb_dev); | ||
510 | if (get_hsync_time) | ||
511 | symbol_put(pxafb_get_hsync_time); | ||
512 | spitz_pxafb_dev = NULL; | ||
513 | get_hsync_time = NULL; | ||
514 | } | ||
515 | |||
516 | void spitz_wait_hsync(void) | ||
517 | { | ||
518 | sharpsl_wait_sync(SPITZ_GPIO_HSYNC); | ||
519 | } | ||
520 | #endif | ||
521 | |||
522 | /* | ||
523 | * Corgi/Spitz Backlight Power | ||
524 | */ | ||
525 | #ifdef CONFIG_PXA_SHARP_C7xx | ||
526 | void corgi_bl_set_intensity(int intensity) | ||
527 | { | ||
528 | if (intensity > 0x10) | ||
529 | intensity += 0x10; | ||
530 | |||
531 | /* Bits 0-4 are accessed via the SSP interface */ | ||
532 | corgi_ssp_blduty_set(intensity & 0x1f); | ||
533 | |||
534 | /* Bit 5 is via SCOOP */ | ||
535 | if (intensity & 0x0020) | ||
536 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT); | ||
537 | else | ||
538 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT); | ||
539 | } | ||
540 | #endif | ||
541 | |||
542 | |||
543 | #if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI) | ||
544 | void spitz_bl_set_intensity(int intensity) | ||
545 | { | ||
546 | if (intensity > 0x10) | ||
547 | intensity += 0x10; | ||
548 | |||
549 | /* Bits 0-4 are accessed via the SSP interface */ | ||
550 | corgi_ssp_blduty_set(intensity & 0x1f); | ||
551 | |||
552 | /* Bit 5 is via SCOOP */ | ||
553 | if (intensity & 0x0020) | ||
554 | reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT); | ||
555 | else | ||
556 | set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT); | ||
557 | |||
558 | if (intensity) | ||
559 | set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON); | ||
560 | else | ||
561 | reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON); | ||
562 | } | ||
563 | #endif | ||
564 | |||
565 | #ifdef CONFIG_MACH_AKITA | ||
566 | void akita_bl_set_intensity(int intensity) | ||
567 | { | ||
568 | if (intensity > 0x10) | ||
569 | intensity += 0x10; | ||
570 | |||
571 | /* Bits 0-4 are accessed via the SSP interface */ | ||
572 | corgi_ssp_blduty_set(intensity & 0x1f); | ||
573 | |||
574 | /* Bit 5 is via IO-Expander */ | ||
575 | if (intensity & 0x0020) | ||
576 | akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT); | ||
577 | else | ||
578 | akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT); | ||
579 | |||
580 | if (intensity) | ||
581 | akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON); | ||
582 | else | ||
583 | akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON); | ||
584 | } | ||
585 | #endif | ||
diff --git a/arch/arm/mach-pxa/sharpsl.h b/arch/arm/mach-pxa/sharpsl.h index da4769caaf72..047909a76651 100644 --- a/arch/arm/mach-pxa/sharpsl.h +++ b/arch/arm/mach-pxa/sharpsl.h | |||
@@ -26,28 +26,15 @@ void corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo); | |||
26 | 26 | ||
27 | 27 | ||
28 | /* | 28 | /* |
29 | * SharpSL Backlight | 29 | * SharpSL/Corgi LCD Driver |
30 | */ | 30 | */ |
31 | void corgi_bl_set_intensity(int intensity); | 31 | void corgi_lcdtg_suspend(void); |
32 | void spitz_bl_set_intensity(int intensity); | 32 | void corgi_lcdtg_hw_init(int mode); |
33 | void akita_bl_set_intensity(int intensity); | ||
34 | |||
35 | |||
36 | /* | ||
37 | * SharpSL Touchscreen Driver | ||
38 | */ | ||
39 | unsigned long corgi_get_hsync_len(void); | ||
40 | unsigned long spitz_get_hsync_len(void); | ||
41 | void corgi_put_hsync(void); | ||
42 | void spitz_put_hsync(void); | ||
43 | void corgi_wait_hsync(void); | ||
44 | void spitz_wait_hsync(void); | ||
45 | 33 | ||
46 | 34 | ||
47 | /* | 35 | /* |
48 | * SharpSL Battery/PM Driver | 36 | * SharpSL Battery/PM Driver |
49 | */ | 37 | */ |
50 | |||
51 | #define READ_GPIO_BIT(x) (GPLR(x) & GPIO_bit(x)) | 38 | #define READ_GPIO_BIT(x) (GPLR(x) & GPIO_bit(x)) |
52 | 39 | ||
53 | /* MAX1111 Channel Definitions */ | 40 | /* MAX1111 Channel Definitions */ |
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 2d78199d24af..bb4b65d352c9 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
@@ -271,6 +271,55 @@ static struct platform_device spitzled_device = { | |||
271 | /* | 271 | /* |
272 | * Spitz Touch Screen Device | 272 | * Spitz Touch Screen Device |
273 | */ | 273 | */ |
274 | |||
275 | static unsigned long (*get_hsync_invperiod)(struct device *dev); | ||
276 | |||
277 | static void inline sharpsl_wait_sync(int gpio) | ||
278 | { | ||
279 | while((GPLR(gpio) & GPIO_bit(gpio)) == 0); | ||
280 | while((GPLR(gpio) & GPIO_bit(gpio)) != 0); | ||
281 | } | ||
282 | |||
283 | static struct device *spitz_pxafb_dev; | ||
284 | |||
285 | static int is_pxafb_device(struct device * dev, void * data) | ||
286 | { | ||
287 | struct platform_device *pdev = container_of(dev, struct platform_device, dev); | ||
288 | |||
289 | return (strncmp(pdev->name, "pxa2xx-fb", 9) == 0); | ||
290 | } | ||
291 | |||
292 | static unsigned long spitz_get_hsync_invperiod(void) | ||
293 | { | ||
294 | #ifdef CONFIG_FB_PXA | ||
295 | if (!spitz_pxafb_dev) { | ||
296 | spitz_pxafb_dev = bus_find_device(&platform_bus_type, NULL, NULL, is_pxafb_device); | ||
297 | if (!spitz_pxafb_dev) | ||
298 | return 0; | ||
299 | } | ||
300 | if (!get_hsync_invperiod) | ||
301 | get_hsync_invperiod = symbol_get(pxafb_get_hsync_time); | ||
302 | if (!get_hsync_invperiod) | ||
303 | #endif | ||
304 | return 0; | ||
305 | |||
306 | return get_hsync_invperiod(spitz_pxafb_dev); | ||
307 | } | ||
308 | |||
309 | static void spitz_put_hsync(void) | ||
310 | { | ||
311 | put_device(spitz_pxafb_dev); | ||
312 | if (get_hsync_invperiod) | ||
313 | symbol_put(pxafb_get_hsync_time); | ||
314 | spitz_pxafb_dev = NULL; | ||
315 | get_hsync_invperiod = NULL; | ||
316 | } | ||
317 | |||
318 | static void spitz_wait_hsync(void) | ||
319 | { | ||
320 | sharpsl_wait_sync(SPITZ_GPIO_HSYNC); | ||
321 | } | ||
322 | |||
274 | static struct resource spitzts_resources[] = { | 323 | static struct resource spitzts_resources[] = { |
275 | [0] = { | 324 | [0] = { |
276 | .start = SPITZ_IRQ_GPIO_TP_INT, | 325 | .start = SPITZ_IRQ_GPIO_TP_INT, |
@@ -280,9 +329,9 @@ static struct resource spitzts_resources[] = { | |||
280 | }; | 329 | }; |
281 | 330 | ||
282 | static struct corgits_machinfo spitz_ts_machinfo = { | 331 | static struct corgits_machinfo spitz_ts_machinfo = { |
283 | .get_hsync_len = spitz_get_hsync_len, | 332 | .get_hsync_invperiod = spitz_get_hsync_invperiod, |
284 | .put_hsync = spitz_put_hsync, | 333 | .put_hsync = spitz_put_hsync, |
285 | .wait_hsync = spitz_wait_hsync, | 334 | .wait_hsync = spitz_wait_hsync, |
286 | }; | 335 | }; |
287 | 336 | ||
288 | static struct platform_device spitzts_device = { | 337 | static struct platform_device spitzts_device = { |
@@ -423,6 +472,14 @@ static struct pxaficp_platform_data spitz_ficp_platform_data = { | |||
423 | * Spitz PXA Framebuffer | 472 | * Spitz PXA Framebuffer |
424 | */ | 473 | */ |
425 | 474 | ||
475 | static void spitz_lcd_power(int on, struct fb_var_screeninfo *var) | ||
476 | { | ||
477 | if (on) | ||
478 | corgi_lcdtg_hw_init(var->xres); | ||
479 | else | ||
480 | corgi_lcdtg_suspend(); | ||
481 | } | ||
482 | |||
426 | static struct pxafb_mode_info spitz_pxafb_modes[] = { | 483 | static struct pxafb_mode_info spitz_pxafb_modes[] = { |
427 | { | 484 | { |
428 | .pixclock = 19231, | 485 | .pixclock = 19231, |
@@ -520,6 +577,27 @@ static void __init common_init(void) | |||
520 | set_pxa_fb_info(&spitz_pxafb_info); | 577 | set_pxa_fb_info(&spitz_pxafb_info); |
521 | } | 578 | } |
522 | 579 | ||
580 | #if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI) | ||
581 | static void spitz_bl_set_intensity(int intensity) | ||
582 | { | ||
583 | if (intensity > 0x10) | ||
584 | intensity += 0x10; | ||
585 | |||
586 | /* Bits 0-4 are accessed via the SSP interface */ | ||
587 | corgi_ssp_blduty_set(intensity & 0x1f); | ||
588 | |||
589 | /* Bit 5 is via SCOOP */ | ||
590 | if (intensity & 0x0020) | ||
591 | reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT); | ||
592 | else | ||
593 | set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT); | ||
594 | |||
595 | if (intensity) | ||
596 | set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON); | ||
597 | else | ||
598 | reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON); | ||
599 | } | ||
600 | |||
523 | static void __init spitz_init(void) | 601 | static void __init spitz_init(void) |
524 | { | 602 | { |
525 | platform_scoop_config = &spitz_pcmcia_config; | 603 | platform_scoop_config = &spitz_pcmcia_config; |
@@ -530,6 +608,7 @@ static void __init spitz_init(void) | |||
530 | 608 | ||
531 | platform_device_register(&spitzscoop2_device); | 609 | platform_device_register(&spitzscoop2_device); |
532 | } | 610 | } |
611 | #endif | ||
533 | 612 | ||
534 | #ifdef CONFIG_MACH_AKITA | 613 | #ifdef CONFIG_MACH_AKITA |
535 | /* | 614 | /* |
@@ -542,6 +621,26 @@ struct platform_device akitaioexp_device = { | |||
542 | 621 | ||
543 | EXPORT_SYMBOL_GPL(akitaioexp_device); | 622 | EXPORT_SYMBOL_GPL(akitaioexp_device); |
544 | 623 | ||
624 | static void akita_bl_set_intensity(int intensity) | ||
625 | { | ||
626 | if (intensity > 0x10) | ||
627 | intensity += 0x10; | ||
628 | |||
629 | /* Bits 0-4 are accessed via the SSP interface */ | ||
630 | corgi_ssp_blduty_set(intensity & 0x1f); | ||
631 | |||
632 | /* Bit 5 is via IO-Expander */ | ||
633 | if (intensity & 0x0020) | ||
634 | akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT); | ||
635 | else | ||
636 | akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT); | ||
637 | |||
638 | if (intensity) | ||
639 | akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON); | ||
640 | else | ||
641 | akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON); | ||
642 | } | ||
643 | |||
545 | static void __init akita_init(void) | 644 | static void __init akita_init(void) |
546 | { | 645 | { |
547 | spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode; | 646 | spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode; |
@@ -558,7 +657,6 @@ static void __init akita_init(void) | |||
558 | } | 657 | } |
559 | #endif | 658 | #endif |
560 | 659 | ||
561 | |||
562 | static void __init fixup_spitz(struct machine_desc *desc, | 660 | static void __init fixup_spitz(struct machine_desc *desc, |
563 | struct tag *tags, char **cmdline, struct meminfo *mi) | 661 | struct tag *tags, char **cmdline, struct meminfo *mi) |
564 | { | 662 | { |