diff options
Diffstat (limited to 'meta/packages/linux/linux-rp-2.6.19+2.6.20-rc4/wm97xx-lcdnoise-r0.patch')
-rw-r--r-- | meta/packages/linux/linux-rp-2.6.19+2.6.20-rc4/wm97xx-lcdnoise-r0.patch | 208 |
1 files changed, 208 insertions, 0 deletions
diff --git a/meta/packages/linux/linux-rp-2.6.19+2.6.20-rc4/wm97xx-lcdnoise-r0.patch b/meta/packages/linux/linux-rp-2.6.19+2.6.20-rc4/wm97xx-lcdnoise-r0.patch new file mode 100644 index 0000000000..191de3af22 --- /dev/null +++ b/meta/packages/linux/linux-rp-2.6.19+2.6.20-rc4/wm97xx-lcdnoise-r0.patch | |||
@@ -0,0 +1,208 @@ | |||
1 | Index: linux-tosa/drivers/input/touchscreen/wm9712.c | ||
2 | =================================================================== | ||
3 | --- linux-tosa.orig/drivers/input/touchscreen/wm9712.c 2006-08-29 16:52:36.008543280 +0100 | ||
4 | +++ linux-tosa/drivers/input/touchscreen/wm9712.c 2006-08-29 16:52:50.923275896 +0100 | ||
5 | @@ -1,7 +1,7 @@ | ||
6 | /* | ||
7 | * wm9712.c -- Codec driver for Wolfson WM9712 AC97 Codecs. | ||
8 | * | ||
9 | - * Copyright 2003, 2004, 2005 Wolfson Microelectronics PLC. | ||
10 | + * Copyright 2003, 2004, 2005, 2006 Wolfson Microelectronics PLC. | ||
11 | * Author: Liam Girdwood | ||
12 | * liam.girdwood@wolfsonmicro.com or linux@wolfsonmicro.com | ||
13 | * Parts Copyright : Ian Molton <spyro@f2s.com> | ||
14 | @@ -13,6 +13,12 @@ | ||
15 | * Free Software Foundation; either version 2 of the License, or (at your | ||
16 | * option) any later version. | ||
17 | * | ||
18 | + * Revision history | ||
19 | + * 4th Jul 2005 Initial version. | ||
20 | + * 29th Aug 2006 Mike Arthur <mike@mikearthur.co.uk> | ||
21 | + * Added fixes for Sharp SL-6000 (Tosa) LCD noise causing | ||
22 | + * touchscreen interference. | ||
23 | + * | ||
24 | */ | ||
25 | |||
26 | #include <linux/module.h> | ||
27 | @@ -28,6 +34,10 @@ | ||
28 | #define WM9705_VERSION "0.60" | ||
29 | #define DEFAULT_PRESSURE 0xb0c0 | ||
30 | |||
31 | +#define CCNT(a) asm volatile ("mrc p14, 0, %0, C1, C1, 0" : "=r"(a)) | ||
32 | +#define CCNT_ON() asm("mcr p14, 0, %0, C0, C0, 0" : : "r"(1)) | ||
33 | +#define CCNT_OFF() asm("mcr p14, 0, %0, C0, C0, 0" : : "r"(1)) | ||
34 | + | ||
35 | /* | ||
36 | * Debug | ||
37 | */ | ||
38 | @@ -243,6 +253,36 @@ | ||
39 | return wm->dig[2] & WM9712_PDEN; | ||
40 | } | ||
41 | |||
42 | + | ||
43 | +#ifdef CONFIG_MACH_TOSA | ||
44 | +/* On the Sharp SL-6000 (Tosa), due to a noisy LCD, we need to perform a wait | ||
45 | + * before sampling the Y axis of the touchscreen */ | ||
46 | +static inline void wm9712_lcd_sync_on(struct wm97xx* wm, int adcsel) { | ||
47 | + unsigned long timer1 = 0, timer2 = 0, wait_time = 0; | ||
48 | + if (adcsel == WM97XX_ADCSEL_Y) { | ||
49 | + wait_time = wm97xx_calc_lcd_waittime(wm); | ||
50 | + | ||
51 | + CCNT_ON(); | ||
52 | + | ||
53 | + if (wait_time) { | ||
54 | + /* wait for LCD rising edge */ | ||
55 | + wm_machinfo->wait_hsync(); | ||
56 | + /* get clock */ | ||
57 | + CCNT(timer1); | ||
58 | + CCNT(timer2); | ||
59 | + | ||
60 | + while ((timer2 - timer1) < wait_time) { | ||
61 | + CCNT(timer2); | ||
62 | + } | ||
63 | + } | ||
64 | + } | ||
65 | +} | ||
66 | + | ||
67 | +static inline void wm9712_lcd_sync_off(void) { | ||
68 | + CCNT_OFF(); | ||
69 | +} | ||
70 | +#endif | ||
71 | + | ||
72 | /* | ||
73 | * Read a sample from the WM9712 adc in polling mode. | ||
74 | */ | ||
75 | @@ -260,6 +300,9 @@ | ||
76 | /* set up digitiser */ | ||
77 | if (adcsel & 0x8000) | ||
78 | adcsel = ((adcsel & 0x7fff) + 3) << 12; | ||
79 | + #ifdef CONFIG_MACH_TOSA | ||
80 | + wm9712_lcd_sync_on(wm, adcsel); | ||
81 | + #endif | ||
82 | wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, adcsel | WM97XX_POLL | WM97XX_DELAY(delay)); | ||
83 | |||
84 | /* wait 3 AC97 time slots + delay for conversion */ | ||
85 | @@ -282,6 +325,10 @@ | ||
86 | |||
87 | *sample = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); | ||
88 | |||
89 | + #ifdef CONFIG_MACH_TOSA | ||
90 | + wm9712_lcd_sync_off(); | ||
91 | + #endif | ||
92 | + | ||
93 | /* check we have correct sample */ | ||
94 | if ((*sample & WM97XX_ADCSEL_MASK) != adcsel) { | ||
95 | dbg ("adc wrong sample, read %x got %x", adcsel, | ||
96 | @@ -303,11 +350,12 @@ | ||
97 | static int wm9712_poll_touch(struct wm97xx* wm, struct wm97xx_data *data) | ||
98 | { | ||
99 | int rc; | ||
100 | - | ||
101 | if ((rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_X, &data->x)) != RC_VALID) | ||
102 | return rc; | ||
103 | + | ||
104 | if ((rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_Y, &data->y)) != RC_VALID) | ||
105 | return rc; | ||
106 | + | ||
107 | if (pil && !five_wire) { | ||
108 | if ((rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_PRES, &data->p)) != RC_VALID) | ||
109 | return rc; | ||
110 | Index: linux-tosa/drivers/input/touchscreen/wm97xx-core.c | ||
111 | =================================================================== | ||
112 | --- linux-tosa.orig/drivers/input/touchscreen/wm97xx-core.c 2006-08-29 16:52:36.008543280 +0100 | ||
113 | +++ linux-tosa/drivers/input/touchscreen/wm97xx-core.c 2006-08-29 16:52:50.924275744 +0100 | ||
114 | @@ -2,7 +2,7 @@ | ||
115 | * wm97xx-core.c -- Touch screen driver core for Wolfson WM9705, WM9712 | ||
116 | * and WM9713 AC97 Codecs. | ||
117 | * | ||
118 | - * Copyright 2003, 2004, 2005 Wolfson Microelectronics PLC. | ||
119 | + * Copyright 2003, 2004, 2005, 2006 Wolfson Microelectronics PLC. | ||
120 | * Author: Liam Girdwood | ||
121 | * liam.girdwood@wolfsonmicro.com or linux@wolfsonmicro.com | ||
122 | * Parts Copyright : Ian Molton <spyro@f2s.com> | ||
123 | @@ -67,6 +67,9 @@ | ||
124 | * GPIOs) and 2.6 power management. | ||
125 | * 29th Nov 2004 Added WM9713 support. | ||
126 | * 4th Jul 2005 Moved codec specific code out to seperate files. | ||
127 | + * 29th Aug 2006 Mike Arthur <mike@mikearthur.co.uk> | ||
128 | + * Added fixes for Sharp SL-6000 (Tosa) LCD noise causing | ||
129 | + * touchscreen interference. | ||
130 | */ | ||
131 | |||
132 | #include <linux/module.h> | ||
133 | @@ -94,6 +97,7 @@ | ||
134 | static DECLARE_MUTEX(gpio_sem); | ||
135 | static LIST_HEAD(wm97xx_misc_list); | ||
136 | static struct wm97xx* wm_codec = NULL; | ||
137 | +struct wm97xx_machinfo *wm_machinfo; | ||
138 | |||
139 | /* | ||
140 | * WM97xx - enable/disable AUX ADC sysfs | ||
141 | @@ -832,6 +836,23 @@ | ||
142 | mdev->remove(wm_codec); | ||
143 | } | ||
144 | |||
145 | +#ifdef CONFIG_MACH_TOSA | ||
146 | +/* On the Sharp SL-6000 (Tosa), due to a noisy LCD, we need to perform a wait | ||
147 | + * before sampling the Y axis of the touchscreen */ | ||
148 | +unsigned long wm97xx_calc_lcd_waittime(struct wm97xx *wm) { | ||
149 | + unsigned long hsync_time = wm_machinfo->get_hsync_time(); | ||
150 | + return hsync_time; | ||
151 | +} | ||
152 | + | ||
153 | +void wm97xx_set_machinfo(struct wm97xx_machinfo *machinfo) { | ||
154 | + wm_machinfo = machinfo; | ||
155 | +} | ||
156 | + | ||
157 | +void wm97xx_unset_machinfo() { | ||
158 | + wm_machinfo = NULL; | ||
159 | +} | ||
160 | +#endif | ||
161 | + | ||
162 | static struct device_driver wm97xx_driver = { | ||
163 | .name = "ac97", | ||
164 | .bus = &ac97_bus_type, | ||
165 | @@ -861,6 +882,9 @@ | ||
166 | EXPORT_SYMBOL_GPL(wm97xx_reg_write); | ||
167 | EXPORT_SYMBOL_GPL(wm97xx_register_misc_dev); | ||
168 | EXPORT_SYMBOL_GPL(wm97xx_unregister_misc_dev); | ||
169 | +EXPORT_SYMBOL_GPL(wm97xx_calc_lcd_waittime); | ||
170 | +EXPORT_SYMBOL_GPL(wm97xx_set_machinfo); | ||
171 | +EXPORT_SYMBOL_GPL(wm97xx_unset_machinfo); | ||
172 | |||
173 | module_init(wm97xx_init); | ||
174 | module_exit(wm97xx_exit); | ||
175 | Index: linux-tosa/include/linux/wm97xx.h | ||
176 | =================================================================== | ||
177 | --- linux-tosa.orig/include/linux/wm97xx.h 2006-08-29 16:52:36.008543280 +0100 | ||
178 | +++ linux-tosa/include/linux/wm97xx.h 2006-08-29 16:52:50.924275744 +0100 | ||
179 | @@ -207,6 +207,7 @@ | ||
180 | |||
181 | struct wm97xx; | ||
182 | extern struct wm97xx_codec_drv wm97xx_codec; | ||
183 | +extern struct wm97xx_machinfo *wm_machinfo; | ||
184 | |||
185 | /* | ||
186 | * Codec driver interface - allows mapping to WM9705/12/13 and newer codecs | ||
187 | @@ -253,6 +254,11 @@ | ||
188 | struct list_head list; | ||
189 | }; | ||
190 | |||
191 | +struct wm97xx_machinfo { | ||
192 | + unsigned long (*get_hsync_time)(void); | ||
193 | + void (*wait_hsync)(void); | ||
194 | +}; | ||
195 | + | ||
196 | int wm97xx_register_misc_dev(struct wm97xx_misc_dev* mdev); | ||
197 | void wm97xx_unregister_misc_dev(struct wm97xx_misc_dev* mdev); | ||
198 | |||
199 | @@ -281,4 +287,9 @@ | ||
200 | int wm97xx_acc_startup(struct wm97xx* wm); | ||
201 | void wm97xx_acc_shutdown(struct wm97xx* wm); | ||
202 | |||
203 | + | ||
204 | +unsigned long wm97xx_calc_lcd_waittime(struct wm97xx *wm); | ||
205 | +void wm97xx_set_machinfo(struct wm97xx_machinfo *machinfo); | ||
206 | +void wm97xx_unset_machinfo(void); | ||
207 | + | ||
208 | #endif | ||