summaryrefslogtreecommitdiff
path: root/packages/linux/openzaurus-pxa27x-2.4.20-rmk2-embedix20050228/P06-C3000-WRITETS_041206.patch
blob: 25dda93cd14b54f8de7233aaafcbc2ebe937d79b (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
diff -Nur c3000_pre/linux/drivers/char/Config.in c3000_work/linux/drivers/char/Config.in
--- c3000_pre/linux/drivers/char/Config.in	2004-12-06 16:38:50.000000000 +0900
+++ c3000_work/linux/drivers/char/Config.in	2004-12-06 16:41:03.000000000 +0900
@@ -166,6 +166,7 @@
    fi
    bool '  SL-series touchscreen pressure value read (EXPERIMENTAL)' CONFIG_SL_TS_PRESSURE
    dep_bool '    Boot On touchscreen pressure value read' CONFIG_BOOT_PRESSURE_ON $CONFIG_SL_TS_PRESSURE
+   bool '  SL-series write ts data (EXPERIMENTAL)' CONFIG_SL_WRITE_TS
    if [ "$CONFIG_SERIAL_SL_SERIES" = "y" ]; then
       bool '   SL-series Bluetooth support' CONFIG_BLUETOOTH_SL
    fi
diff -Nur c3000_pre/linux/drivers/char/ads7846_ts.c c3000_work/linux/drivers/char/ads7846_ts.c
--- c3000_pre/linux/drivers/char/ads7846_ts.c	2004-12-06 16:38:50.000000000 +0900
+++ c3000_work/linux/drivers/char/ads7846_ts.c	2004-12-06 16:50:50.000000000 +0900
@@ -87,7 +87,7 @@
 static int head, tail, sample;
 static char pendown = 0;
 static unsigned long Pressure;
-#if defined(CONFIG_SL_TS_PRESSURE)
+#if defined(CONFIG_SL_TS_PRESSURE) ||  defined(CONFIG_SL_WRITE_TS)
 #include <linux/proc_fs.h>
 #endif
 
@@ -1000,6 +1000,24 @@
 }
 #endif
 
+/// write ts data
+#if defined(CONFIG_SL_WRITE_TS)
+static void write_new_data(TS_EVENT write_data)
+{
+	write_data.millisecs = jiffies;
+	tbuf[head++] = write_data;
+
+	if (head >= BUFSIZE) { head = 0; }
+
+	if (head == tail && ++tail >= BUFSIZE) { tail = 0; }
+
+	if (fasync)
+		kill_fasync(&fasync, SIGIO, POLL_IN);
+
+	wake_up_interruptible(&queue);
+}
+#endif
+
 static void cotulla_main_ts_timer(unsigned long irq)
 {
 //	ts_interrupt(irq, NULL, NULL);
@@ -1346,10 +1364,54 @@
 static ssize_t	ts_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
 {
 #if defined(CONFIG_ARCH_PXA_CORGI)
-	unsigned long param;
-	char *endp;
-	wait_after_sync_hs = simple_strtoul(buffer, &endp, 0);
-	return count+endp-buffer;
+ 	char *endp;
+#if defined(CONFIG_SL_WRITE_TS)
+
+	static TS_EVENT data, raw_data;
+	char tmp[50];
+	int len;
+	len=49;
+	if(len>count) len=count;
+	copy_from_user(tmp,buffer,len);
+	tmp[len]='\0';
+
+	if (sscanf(tmp,"%d %d %d %d",&data.pressure, &data.x, &data.y, &data.millisecs) == 4) {
+//		printk("pressure= %d : x= %d : y= %d : millosecs= %d\n", data.pressure, data.x, data.y, data.millisecs);
+
+		if (cal_ok) {
+                        raw_data.x = (x_rev) ? raw_max_x - ((raw_max_x - raw_min_x) * data.x) / res_x
+		 		             : raw_min_x + ((raw_max_x - raw_min_x) * data.x) / res_x;
+
+			raw_data.y = (y_rev) ? raw_max_y - ((raw_max_y - raw_min_y) * data.y) / res_y
+		 		             : raw_min_y + ((raw_max_y - raw_min_y) * data.y) / res_y;
+
+		} else {
+			raw_data.x = data.x;
+			raw_data.y = data.y;
+		}
+
+		if (xyswap) {
+		    short tmp = raw_data.x;
+		    raw_data.x = raw_data.y;
+		    raw_data.y = tmp;
+		}
+
+		raw_data.pressure = data.pressure;
+		raw_data.millisecs = data.millisecs;
+
+		write_new_data(raw_data);
+		return count;
+
+	}else {
+#endif
+	wait_after_sync_hs = simple_strtol(buffer, &endp, 0);
+	printk("Wait_after_sync_hs: %d\n",(int) wait_after_sync_hs);
+ 	return count+endp-buffer;
+
+#if defined(CONFIG_SL_WRITE_TS)
+	}
+#endif
+
 #else
 	return 0;
 #endif