summaryrefslogtreecommitdiff
path: root/packages/linux/linux-rp-2.6.23/tosa-lcdnoise-r1-fix-r0.patch
blob: 02dd6a74eb27677d8ac0bc6a02c886f081e3b680 (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
From eada869814636157956641ba1503f0d6cc04e2b7 Mon Sep 17 00:00:00 2001
From: Dmitry Baryshkov <dbaryshkov@gmail.com>
Date: Fri, 19 Oct 2007 17:43:51 +0400
Subject: [PATCH] tosa-lcdnoise-r1.patch fixes

---
 arch/arm/mach-pxa/tosa_lcd.c        |   34 ++++++++++++++++++++++++++++++++++
 drivers/input/touchscreen/tosa_ts.c |    9 +--------
 include/asm-arm/arch-pxa/tosa.h     |    5 +++++
 3 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-pxa/tosa_lcd.c b/arch/arm/mach-pxa/tosa_lcd.c
index d52f63f..447ca86 100644
--- a/arch/arm/mach-pxa/tosa_lcd.c
+++ b/arch/arm/mach-pxa/tosa_lcd.c
@@ -59,6 +59,8 @@ static int bl_intensity;
 static struct ssp_dev tosa_nssp_dev;
 static struct ssp_state tosa_nssp_state;
 static spinlock_t tosa_nssp_lock;
+static int blanked;
+static unsigned long hsync_time;
 
 static unsigned short normal_i2c[] = {
 	DAC_BASE,
@@ -130,6 +132,17 @@ static void tosa_lcd_tg_init(struct device *dev)
 	pxa_nssp_output(TG_GPOSR,0x02);		/* GPOS0=powercontrol, GPOS1=GPIO, GPOS2=TCTL */
 }
 
+static unsigned long calc_hsync_time(const struct fb_videomode *mode) {
+    /* The 25 and 44 'magic numbers' are from Sharp's 2.4 patches */
+    if (mode->yres == 640) {
+        return 25;
+    }
+    if (mode->yres == 320) {
+        return 44;
+    }
+    return 0;
+}
+
 static void tosa_lcd_tg_on(struct device *dev, const struct fb_videomode *mode)
 {
 	const int value = TG_REG0_COLOR | TG_REG0_UD | TG_REG0_LR;
@@ -154,6 +167,8 @@ static void tosa_lcd_tg_on(struct device *dev, const struct fb_videomode *mode)
 		/* set common voltage */
 		i2c_smbus_write_byte_data(tosa_i2c_dac, DAC_CH1, comadj);
 
+    blanked = 0;
+    hsync_time = calc_hsync_time(mode);
 }
 
 static void tosa_lcd_tg_off(struct device *dev)
@@ -172,6 +187,8 @@ static void tosa_lcd_tg_off(struct device *dev)
 	
 	/* L3V Off */
 	reset_scoop_gpio( &tosascoop_jc_device.dev,TOSA_SCOOP_JC_TC3693_L3V_ON); 
+
+    blanked = 1;
 }
 
 static int tosa_detect_client(struct i2c_adapter* adapter, int address, int kind) {
@@ -238,6 +255,23 @@ static int tosa_detach_client(struct i2c_client* client) {
 	return 0;
 }
 
+unsigned long tosa_lcd_get_hsync_time(void)
+{
+/* This method should eventually contain the correct algorithm for calculating
+   the hsync_time */
+    if (blanked)
+        return 0;
+    else
+        return hsync_time;
+}
+
+void tosa_lcd_wait_hsync(void)
+{
+    /* Waits for a rising edge on the VGA line */
+    while((GPLR(TOSA_GPIO_VGA_LINE) & GPIO_bit(TOSA_GPIO_VGA_LINE)) == 0);
+    while((GPLR(TOSA_GPIO_VGA_LINE) & GPIO_bit(TOSA_GPIO_VGA_LINE)) != 0);
+}
+
 static struct i2c_driver tosa_driver={
 	.id		= TOSA_LCD_I2C_DEVICEID,
 	.attach_adapter	= tosa_attach_adapter,
diff --git a/drivers/input/touchscreen/tosa_ts.c b/drivers/input/touchscreen/tosa_ts.c
index bc733e9..134f8ce 100644
--- a/drivers/input/touchscreen/tosa_ts.c
+++ b/drivers/input/touchscreen/tosa_ts.c
@@ -25,13 +25,6 @@
 #define CCNT_ON()   asm("mcr p14, 0, %0, C0, C0, 0" : : "r"(1))
 #define CCNT_OFF()  asm("mcr p14, 0, %0, C0, C0, 0" : : "r"(1))
 
-static inline void tosa_lcd_wait_hsync(void)
-{
-	/* Waits for a rising edge on the VGA line */
-	while((GPLR(TOSA_GPIO_VGA_LINE) & GPIO_bit(TOSA_GPIO_VGA_LINE)) == 0);
-	while((GPLR(TOSA_GPIO_VGA_LINE) & GPIO_bit(TOSA_GPIO_VGA_LINE)) != 0);
-}
-
 /* On the Sharp SL-6000 (Tosa), due to a noisy LCD, we need to perform a wait
  * before sampling the Y axis of the touchscreen */
 void tosa_lcd_sync_on(int adcsel) {
@@ -54,7 +47,7 @@ void tosa_lcd_sync_on(int adcsel) {
 	}
 }
 
-void tosa_lcd_sync_off(void) {
+void tosa_lcd_sync_off(int adcsel) {
 	CCNT_OFF();
 }
 
diff --git a/include/asm-arm/arch-pxa/tosa.h b/include/asm-arm/arch-pxa/tosa.h
index ce7322d..7f446fd 100644
--- a/include/asm-arm/arch-pxa/tosa.h
+++ b/include/asm-arm/arch-pxa/tosa.h
@@ -1,6 +1,7 @@
 /*
  * Hardware specific definitions for Sharp SL-C6000x series of PDAs
  *
+ * Copyright (c) 2006 Wolfson Microelectronics PLC.
  * Copyright (c) 2005 Dirk Opfer
  *
  * Based on Sharp's 2.4 kernel patches
@@ -187,4 +188,8 @@
 extern struct platform_device tosascoop_jc_device;
 extern struct platform_device tosascoop_device;
 extern struct platform_device tc6393_device;
+
+unsigned long tosa_lcd_get_hsync_time(void);
+void tosa_lcd_wait_hsync(void);
+
 #endif /* _ASM_ARCH_TOSA_H_ */
-- 
1.4.4.4

From eada869814636157956641ba1503f0d6cc04e2b7 Mon Sep 17 00:00:00 2001
From: Dmitry Baryshkov <dbaryshkov@gmail.com>
Date: Fri, 19 Oct 2007 17:43:51 +0400
Subject: [PATCH] tosa-lcdnoise-r1.patch fixes

---
 arch/arm/mach-pxa/tosa_lcd.c        |   34 ++++++++++++++++++++++++++++++++++
 drivers/input/touchscreen/tosa_ts.c |    9 +--------
 include/asm-arm/arch-pxa/tosa.h     |    5 +++++
 3 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-pxa/tosa_lcd.c b/arch/arm/mach-pxa/tosa_lcd.c
index d52f63f..447ca86 100644
--- a/arch/arm/mach-pxa/tosa_lcd.c
+++ b/arch/arm/mach-pxa/tosa_lcd.c
@@ -59,6 +59,8 @@ static int bl_intensity;
 static struct ssp_dev tosa_nssp_dev;
 static struct ssp_state tosa_nssp_state;
 static spinlock_t tosa_nssp_lock;
+static int blanked;
+static unsigned long hsync_time;
 
 static unsigned short normal_i2c[] = {
 	DAC_BASE,
@@ -130,6 +132,17 @@ static void tosa_lcd_tg_init(struct device *dev)
 	pxa_nssp_output(TG_GPOSR,0x02);		/* GPOS0=powercontrol, GPOS1=GPIO, GPOS2=TCTL */
 }
 
+static unsigned long calc_hsync_time(const struct fb_videomode *mode) {
+    /* The 25 and 44 'magic numbers' are from Sharp's 2.4 patches */
+    if (mode->yres == 640) {
+        return 25;
+    }
+    if (mode->yres == 320) {
+        return 44;
+    }
+    return 0;
+}
+
 static void tosa_lcd_tg_on(struct device *dev, const struct fb_videomode *mode)
 {
 	const int value = TG_REG0_COLOR | TG_REG0_UD | TG_REG0_LR;
@@ -154,6 +167,8 @@ static void tosa_lcd_tg_on(struct device *dev, const struct fb_videomode *mode)
 		/* set common voltage */
 		i2c_smbus_write_byte_data(tosa_i2c_dac, DAC_CH1, comadj);
 
+    blanked = 0;
+    hsync_time = calc_hsync_time(mode);
 }
 
 static void tosa_lcd_tg_off(struct device *dev)
@@ -172,6 +187,8 @@ static void tosa_lcd_tg_off(struct device *dev)
 	
 	/* L3V Off */
 	reset_scoop_gpio( &tosascoop_jc_device.dev,TOSA_SCOOP_JC_TC3693_L3V_ON); 
+
+    blanked = 1;
 }
 
 static int tosa_detect_client(struct i2c_adapter* adapter, int address, int kind) {
@@ -238,6 +255,23 @@ static int tosa_detach_client(struct i2c_client* client) {
 	return 0;
 }
 
+unsigned long tosa_lcd_get_hsync_time(void)
+{
+/* This method should eventually contain the correct algorithm for calculating
+   the hsync_time */
+    if (blanked)
+        return 0;
+    else
+        return hsync_time;
+}
+
+void tosa_lcd_wait_hsync(void)
+{
+    /* Waits for a rising edge on the VGA line */
+    while((GPLR(TOSA_GPIO_VGA_LINE) & GPIO_bit(TOSA_GPIO_VGA_LINE)) == 0);
+    while((GPLR(TOSA_GPIO_VGA_LINE) & GPIO_bit(TOSA_GPIO_VGA_LINE)) != 0);
+}
+
 static struct i2c_driver tosa_driver={
 	.id		= TOSA_LCD_I2C_DEVICEID,
 	.attach_adapter	= tosa_attach_adapter,
diff --git a/drivers/input/touchscreen/tosa_ts.c b/drivers/input/touchscreen/tosa_ts.c
index bc733e9..134f8ce 100644
--- a/drivers/input/touchscreen/tosa_ts.c
+++ b/drivers/input/touchscreen/tosa_ts.c
@@ -25,13 +25,6 @@
 #define CCNT_ON()   asm("mcr p14, 0, %0, C0, C0, 0" : : "r"(1))
 #define CCNT_OFF()  asm("mcr p14, 0, %0, C0, C0, 0" : : "r"(1))
 
-static inline void tosa_lcd_wait_hsync(void)
-{
-	/* Waits for a rising edge on the VGA line */
-	while((GPLR(TOSA_GPIO_VGA_LINE) & GPIO_bit(TOSA_GPIO_VGA_LINE)) == 0);
-	while((GPLR(TOSA_GPIO_VGA_LINE) & GPIO_bit(TOSA_GPIO_VGA_LINE)) != 0);
-}
-
 /* On the Sharp SL-6000 (Tosa), due to a noisy LCD, we need to perform a wait
  * before sampling the Y axis of the touchscreen */
 void tosa_lcd_sync_on(int adcsel) {
@@ -54,7 +47,7 @@ void tosa_lcd_sync_on(int adcsel) {
 	}
 }
 
-void tosa_lcd_sync_off(void) {
+void tosa_lcd_sync_off(int adcsel) {
 	CCNT_OFF();
 }
 
diff --git a/include/asm-arm/arch-pxa/tosa.h b/include/asm-arm/arch-pxa/tosa.h
index ce7322d..7f446fd 100644
--- a/include/asm-arm/arch-pxa/tosa.h
+++ b/include/asm-arm/arch-pxa/tosa.h
@@ -1,6 +1,7 @@
 /*
  * Hardware specific definitions for Sharp SL-C6000x series of PDAs
  *
+ * Copyright (c) 2006 Wolfson Microelectronics PLC.
  * Copyright (c) 2005 Dirk Opfer
  *
  * Based on Sharp's 2.4 kernel patches
@@ -187,4 +188,8 @@
 extern struct platform_device tosascoop_jc_device;
 extern struct platform_device tosascoop_device;
 extern struct platform_device tc6393_device;
+
+unsigned long tosa_lcd_get_hsync_time(void);
+void tosa_lcd_wait_hsync(void);
+
 #endif /* _ASM_ARCH_TOSA_H_ */
-- 
1.4.4.4