aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2005-09-13 04:25:32 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-13 11:22:31 -0400
commit9fc7896b62b48714fafecf9266d9dc14c1cd6e33 (patch)
treed22c4df945338313bae436df9b3ca8c08d3bed4e
parent50a5de44821352354a3ee804e2c7cbfee5a81c06 (diff)
[PATCH] SharpSL: Add cxx00 support to the Corgi LCD driver
The same LCD is present on both the Sharp Zaurus c7x0 series and the cxx00 but with different framebuffer drivers (w100fb vs. pxafb). This patch adds support for the cxx00 series to the LCD driver. It also adds some LCD to touchscreen interface logic needed by the touchscreen driver to prevent interference problems, the idea being to keep all the ugly code in one place leaving the drivers themselves clean. sharpsl.h is used to provide the abstraction. Signed-Off-by: Richard Purdie <rpurdie@rpsys.net> Cc: Vojtech Pavlik <vojtech@suse.cz> Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/arm/mach-pxa/corgi_lcd.c132
-rw-r--r--arch/arm/mach-pxa/sharpsl.h11
-rw-r--r--include/asm-arm/arch-pxa/sharpsl.h10
3 files changed, 139 insertions, 14 deletions
diff --git a/arch/arm/mach-pxa/corgi_lcd.c b/arch/arm/mach-pxa/corgi_lcd.c
index deac29c00290..bfe5efc11b8a 100644
--- a/arch/arm/mach-pxa/corgi_lcd.c
+++ b/arch/arm/mach-pxa/corgi_lcd.c
@@ -1,10 +1,14 @@
1/* 1/*
2 * linux/drivers/video/w100fb.c 2 * linux/drivers/video/w100fb.c
3 * 3 *
4 * Corgi LCD Specific Code for ATI Imageon w100 (Wallaby) 4 * Corgi/Spitz LCD Specific Code
5 * 5 *
6 * Copyright (C) 2005 Richard Purdie 6 * Copyright (C) 2005 Richard Purdie
7 * 7 *
8 * Connectivity:
9 * Corgi - LCD to ATI Imageon w100 (Wallaby)
10 * Spitz - LCD to PXA Framebuffer
11 *
8 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 13 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
@@ -14,9 +18,17 @@
14#include <linux/delay.h> 18#include <linux/delay.h>
15#include <linux/kernel.h> 19#include <linux/kernel.h>
16#include <linux/device.h> 20#include <linux/device.h>
21#include <linux/module.h>
22#include <asm/mach-types.h>
23#include <asm/arch/akita.h>
17#include <asm/arch/corgi.h> 24#include <asm/arch/corgi.h>
25#include <asm/arch/hardware.h>
26#include <asm/arch/pxa-regs.h>
27#include <asm/arch/sharpsl.h>
28#include <asm/arch/spitz.h>
29#include <asm/hardware/scoop.h>
18#include <asm/mach/sharpsl_param.h> 30#include <asm/mach/sharpsl_param.h>
19#include <video/w100fb.h> 31#include "generic.h"
20 32
21/* Register Addresses */ 33/* Register Addresses */
22#define RESCTL_ADRS 0x00 34#define RESCTL_ADRS 0x00
@@ -134,10 +146,10 @@ static void lcdtg_set_common_voltage(u8 base_data, u8 data)
134} 146}
135 147
136/* Set Phase Adjuct */ 148/* Set Phase Adjuct */
137static void lcdtg_set_phadadj(struct w100fb_par *par) 149static void lcdtg_set_phadadj(int mode)
138{ 150{
139 int adj; 151 int adj;
140 switch(par->xres) { 152 switch(mode) {
141 case 480: 153 case 480:
142 case 640: 154 case 640:
143 /* Setting for VGA */ 155 /* Setting for VGA */
@@ -161,7 +173,7 @@ static void lcdtg_set_phadadj(struct w100fb_par *par)
161 173
162static int lcd_inited; 174static int lcd_inited;
163 175
164static void lcdtg_hw_init(struct w100fb_par *par) 176static void lcdtg_hw_init(int mode)
165{ 177{
166 if (!lcd_inited) { 178 if (!lcd_inited) {
167 int comadj; 179 int comadj;
@@ -215,7 +227,7 @@ static void lcdtg_hw_init(struct w100fb_par *par)
215 corgi_ssp_lcdtg_send(PICTRL_ADRS, 0); 227 corgi_ssp_lcdtg_send(PICTRL_ADRS, 0);
216 228
217 /* Set Phase Adjuct */ 229 /* Set Phase Adjuct */
218 lcdtg_set_phadadj(par); 230 lcdtg_set_phadadj(mode);
219 231
220 /* Initialize for Input Signals from ATI */ 232 /* Initialize for Input Signals from ATI */
221 corgi_ssp_lcdtg_send(POLCTRL_ADRS, POLCTRL_SYNC_POL_RISE | POLCTRL_EN_POL_RISE 233 corgi_ssp_lcdtg_send(POLCTRL_ADRS, POLCTRL_SYNC_POL_RISE | POLCTRL_EN_POL_RISE
@@ -224,10 +236,10 @@ static void lcdtg_hw_init(struct w100fb_par *par)
224 236
225 lcd_inited=1; 237 lcd_inited=1;
226 } else { 238 } else {
227 lcdtg_set_phadadj(par); 239 lcdtg_set_phadadj(mode);
228 } 240 }
229 241
230 switch(par->xres) { 242 switch(mode) {
231 case 480: 243 case 480:
232 case 640: 244 case 640:
233 /* Set Lcd Resolution (VGA) */ 245 /* Set Lcd Resolution (VGA) */
@@ -242,7 +254,7 @@ static void lcdtg_hw_init(struct w100fb_par *par)
242 } 254 }
243} 255}
244 256
245static void lcdtg_suspend(struct w100fb_par *par) 257static void lcdtg_suspend(void)
246{ 258{
247 /* 60Hz x 2 frame = 16.7msec x 2 = 33.4 msec */ 259 /* 60Hz x 2 frame = 16.7msec x 2 = 33.4 msec */
248 mdelay(34); 260 mdelay(34);
@@ -276,15 +288,30 @@ static void lcdtg_suspend(struct w100fb_par *par)
276 lcd_inited = 0; 288 lcd_inited = 0;
277} 289}
278 290
279static struct w100_tg_info corgi_lcdtg_info = {
280 .change=lcdtg_hw_init,
281 .suspend=lcdtg_suspend,
282 .resume=lcdtg_hw_init,
283};
284 291
285/* 292/*
286 * Corgi w100 Frame Buffer Device 293 * Corgi w100 Frame Buffer Device
287 */ 294 */
295#ifdef CONFIG_PXA_SHARP_C7xx
296
297#include <video/w100fb.h>
298
299static void w100_lcdtg_suspend(struct w100fb_par *par)
300{
301 lcdtg_suspend();
302}
303
304static void w100_lcdtg_init(struct w100fb_par *par)
305{
306 lcdtg_hw_init(par->xres);
307}
308
309
310static struct w100_tg_info corgi_lcdtg_info = {
311 .change = w100_lcdtg_init,
312 .suspend = w100_lcdtg_suspend,
313 .resume = w100_lcdtg_init,
314};
288 315
289static struct w100_mem_info corgi_fb_mem = { 316static struct w100_mem_info corgi_fb_mem = {
290 .ext_cntl = 0x00040003, 317 .ext_cntl = 0x00040003,
@@ -394,3 +421,80 @@ struct platform_device corgifb_device = {
394 }, 421 },
395 422
396}; 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
434void spitz_lcd_power(int on)
435{
436 if (on)
437 lcdtg_hw_init(480);
438 else
439 lcdtg_suspend();
440}
441
442#endif
443
444
445/*
446 * Corgi/Spitz Touchscreen to LCD interface
447 */
448static unsigned long (*get_hsync_time)(struct device *dev);
449
450static 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
457unsigned 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
467void corgi_put_hsync(void)
468{
469 if (get_hsync_time)
470 symbol_put(w100fb_get_hsynclen);
471}
472
473void corgi_wait_hsync(void)
474{
475 sharpsl_wait_sync(CORGI_GPIO_HSYNC);
476}
477#endif
478
479#ifdef CONFIG_PXA_SHARP_Cxx00
480unsigned long spitz_get_hsync_len(void)
481{
482 if (!get_hsync_time)
483 get_hsync_time = symbol_get(pxafb_get_hsync_time);
484 if (!get_hsync_time)
485 return 0;
486
487 return pxafb_get_hsync_time(&pxafb_device.dev);
488}
489
490void spitz_put_hsync(void)
491{
492 if (get_hsync_time)
493 symbol_put(pxafb_get_hsync_time);
494}
495
496void spitz_wait_hsync(void)
497{
498 sharpsl_wait_sync(SPITZ_GPIO_HSYNC);
499}
500#endif
diff --git a/arch/arm/mach-pxa/sharpsl.h b/arch/arm/mach-pxa/sharpsl.h
index 672262ee9d2b..7007d8a1c5c5 100644
--- a/arch/arm/mach-pxa/sharpsl.h
+++ b/arch/arm/mach-pxa/sharpsl.h
@@ -13,3 +13,14 @@ struct corgissp_machinfo {
13}; 13};
14 14
15void corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo); 15void corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo);
16
17/*
18 * SharpSL Touchscreen Driver
19 */
20
21unsigned long corgi_get_hsync_len(void);
22unsigned long spitz_get_hsync_len(void);
23void corgi_put_hsync(void);
24void spitz_put_hsync(void);
25void corgi_wait_hsync(void);
26void spitz_wait_hsync(void);
diff --git a/include/asm-arm/arch-pxa/sharpsl.h b/include/asm-arm/arch-pxa/sharpsl.h
index 5ce6d05631e8..1e1d11033940 100644
--- a/include/asm-arm/arch-pxa/sharpsl.h
+++ b/include/asm-arm/arch-pxa/sharpsl.h
@@ -10,3 +10,13 @@ void corgi_ssp_ads7846_unlock(void);
10void corgi_ssp_lcdtg_send (unsigned char adrs, unsigned char data); 10void corgi_ssp_lcdtg_send (unsigned char adrs, unsigned char data);
11void corgi_ssp_blduty_set(int duty); 11void corgi_ssp_blduty_set(int duty);
12int corgi_ssp_max1111_get(unsigned long data); 12int corgi_ssp_max1111_get(unsigned long data);
13
14/*
15 * SharpSL Touchscreen Driver
16 */
17
18struct corgits_machinfo {
19 unsigned long (*get_hsync_len)(void);
20 void (*put_hsync)(void);
21 void (*wait_hsync)(void);
22};