1 diff -Nur c3000_pre/linux/drivers/char/Config.in c3000_work/linux/drivers/char/Config.in
2 --- c3000_pre/linux/drivers/char/Config.in 2004-08-21 09:48:25.000000000 +0900
3 +++ c3000_work/linux/drivers/char/Config.in 2004-12-06 15:53:46.000000000 +0900
5 if [ "$CONFIG_ARCH_SHARP_SL" = "y" ]; then
6 bool ' SL-series serial port support' CONFIG_SERIAL_SL_SERIES
8 + bool ' SL-series touchscreen pressure value read (EXPERIMENTAL)' CONFIG_SL_TS_PRESSURE
9 + dep_bool ' Boot On touchscreen pressure value read' CONFIG_BOOT_PRESSURE_ON $CONFIG_SL_TS_PRESSURE
10 if [ "$CONFIG_SERIAL_SL_SERIES" = "y" ]; then
11 bool ' SL-series Bluetooth support' CONFIG_BLUETOOTH_SL
13 diff -Nur c3000_pre/linux/drivers/char/ads7846_ts.c c3000_work/linux/drivers/char/ads7846_ts.c
14 --- c3000_pre/linux/drivers/char/ads7846_ts.c 2004-11-16 15:31:06.000000000 +0900
15 +++ c3000_work/linux/drivers/char/ads7846_ts.c 2004-12-06 15:50:06.000000000 +0900
17 static DECLARE_WAIT_QUEUE_HEAD(queue);
18 static int head, tail, sample;
19 static char pendown = 0;
20 -unsigned long Pressure;
21 +static unsigned long Pressure;
22 +#if defined(CONFIG_SL_TS_PRESSURE)
23 +#include <linux/proc_fs.h>
26 +#if defined(CONFIG_SL_TS_PRESSURE)
27 +static unsigned long tsPressure;
28 +#if defined(CONFIG_BOOT_PRESSURE_ON)
29 +static unsigned int tspressure_mode = 1;
31 +static unsigned int tspressure_mode = 0;
34 +static ssize_t tspressure_read_params(struct file *file, char *buf,
35 + size_t nbytes, loff_t *ppos)
40 + if (*ppos>0) /* Assume reading completed in previous read*/
42 + count = sprintf(outputbuf, "%d\n", (unsigned int)tspressure_mode);
45 + if (count>nbytes) /* Assume output can be read at one time */
47 + if (copy_to_user(buf, outputbuf, count+1))
52 +static ssize_t tspressure_write_params(struct file *file, const char *buf,
53 + size_t nbytes, loff_t *ppos)
55 + unsigned int param=0;
57 + sscanf(buf,"%d",¶m);
58 + if (tspressure_mode != param) {
59 + tspressure_mode = param;
60 + printk("tspressure = %d\n", tspressure_mode);
65 +static struct file_operations proc_tspressure_operations = {
66 + read: tspressure_read_params,
67 + write: tspressure_write_params,
70 #if defined(CONFIG_ARCH_PXA_CORGI)
71 static char ispass = 1;
74 ((int)((x)-(y))<(int)(d)) && \
75 ((int)((y)-(x))<(int)(d)) )
77 +#if defined(CONFIG_SL_TS_PRESSURE)
78 + unsigned int t,x,y,z[2],z2,dummy;
80 unsigned int t,x,y,z[2];
86 (3u << ADSCTRL_ADR_SH) | (1u << ADSCTRL_STS_SH);
88 z[i] = ads7846_rw(cmd);
91 +#if defined(CONFIG_SL_TS_PRESSURE)
92 + if (tspressure_mode) {
94 + cmd = (1u << ADSCTRL_PD0_SH) | (1u << ADSCTRL_PD1_SH) |
95 + (4u << ADSCTRL_ADR_SH) | (1u << ADSCTRL_STS_SH);
96 + dummy = ads7846_rw(cmd);
98 + z2 = ads7846_rw(cmd);
109 +#if defined(CONFIG_SL_TS_PRESSURE)
110 + if (tspressure_mode)
111 + if (z[1]) tsPressure = (15000 - x * (z2 - z[1]) / z[1]) >> 4;
116 @@ -528,12 +595,19 @@
118 // printk("x=%d,y=%d\n",tp->xd,tp->yd);
122 Pressure = Rx * (tp->xd) * ((10*z2/z1) - 1*10) >> 10;
124 +#if defined(CONFIG_SL_TS_PRESSURE)
125 + if (tspressure_mode)
126 + tsPressure = (15000 - x[3] * (z2 - z1) / z1) >> 4;
130 +#if defined(CONFIG_SL_TS_PRESSURE)
131 + tsPressure = Pressure = 0;
137 cmd = (1u << ADSCTRL_PD0_SH) | (1u << ADSCTRL_PD1_SH) |
138 (4u << ADSCTRL_ADR_SH) | (1u << ADSCTRL_STS_SH);
139 /* Power-Down Enable */
140 @@ -612,11 +686,25 @@
141 // printk("fail %d\n", fail);
143 if (fail == TOUCH_PANEL_AVERAGE) {
144 +#if defined(CONFIG_SL_TS_PRESSURE)
145 + tsPressure = Pressure = 0;
149 // printk("pen up\n");
152 +#if defined(CONFIG_SL_TS_PRESSURE)
153 + if (tspressure_mode) {
155 + tsPressure = Pressure = (15000 - x * (z2 - z1) / z1) >> 4;
157 + tsPressure = Pressure = 0;
159 + tsPressure = Pressure = 1;
163 tp->xd = tx / (TOUCH_PANEL_AVERAGE - fail);
164 tp->yd = ty / (TOUCH_PANEL_AVERAGE - fail);
165 // printk("pen position (%d,%d)\n", tx, ty);
168 static void new_data(void)
170 +#if !defined(CONFIG_ARCH_PXA_CORGI) && !defined(CONFIG_ARCH_PXA_POODLE)
171 +#if !defined(CONFIG_POODLE_TR0)
172 int diff0, diff1, diff2, diff3;
177 if( PowerDownMode != PMPD_MODE_ACTIVE )
178 @@ -956,11 +1048,26 @@
179 lock_FCS(POWER_MODE_TOUCH, 1); // not enter FCS mode.
181 if( pos_dt.xd && pos_dt.yd && Pressure ) {
182 +#if defined(CONFIG_SL_TS_PRESSURE)
183 + if (tspressure_mode)
184 + tc.pressure = Pressure;
192 if( pos_dt.xd && pos_dt.yd ){
193 +#if defined(CONFIG_SL_TS_PRESSURE)
194 + if (tspressure_mode)
195 + tc.pressure = Pressure;
205 @@ -1005,6 +1112,16 @@
206 static void ts_hardware_init(void)
210 +#if defined(CONFIG_SL_TS_PRESSURE)
211 + struct proc_dir_entry *tspressure_proc;
214 +#if defined(CONFIG_SL_TS_PRESSURE)
215 + tspressure_proc = create_proc_entry("zaurus/tspressure", 0, NULL);
216 + if (tspressure_proc)
217 + tspressure_proc->proc_fops = &proc_tspressure_operations;
220 #if defined(CONFIG_ARCH_PXA_POODLE) || defined(CONFIG_ARCH_PXA_CORGI)
222 @@ -1283,6 +1400,13 @@
223 case 17: /* Clear all buffer data */
226 +#if defined(CONFIG_SL_TS_PRESSURE)
227 + case 64: /* read Pressure */
228 + if (tspressure_mode) {
229 + copy_to_user((void *)arg, &tsPressure, sizeof(tsPressure));