aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/linux/linux/simpad/linux-2.6.27-SIMpad-ucb1x00-ts-supend-and-accuracy.patch
blob: ef40cd05ef78899474d685940cadac62355b8ee1 (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
Index: linux-2.6.27/drivers/mfd/ucb1x00-ts.c
===================================================================
--- linux-2.6.27.orig/drivers/mfd/ucb1x00-ts.c	2008-10-10 00:13:53.000000000 +0200
+++ linux-2.6.27/drivers/mfd/ucb1x00-ts.c	2008-12-04 01:27:04.168672848 +0100
@@ -16,6 +16,10 @@
  * It is important to note that the signal connected to the ADCSYNC
  * pin should provide pulses even when the LCD is blanked, otherwise
  * a pen touch needed to unblank the LCD will never be read.
+ *
+ * mrdata: -added some accuracy improvement based on thesings collie patch
+ *         -added suspend fix
+ *
  */
 #include <linux/module.h>
 #include <linux/moduleparam.h>
@@ -103,6 +107,8 @@
 				  UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_GND |
 				  UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA);
 
+		udelay(55);
+
 		return ucb1x00_adc_read(ts->ucb, UCB_ADC_INP_TSPY, ts->adcsync);
 	}
 }
@@ -129,7 +135,7 @@
 			UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW |
 			UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA);
 
-	udelay(55);
+	udelay(165);
 
 	return ucb1x00_adc_read(ts->ucb, UCB_ADC_INP_TSPY, ts->adcsync);
 }
@@ -157,7 +163,7 @@
 			UCB_TS_CR_TSMY_GND | UCB_TS_CR_TSPY_POW |
 			UCB_TS_CR_MODE_POS | UCB_TS_CR_BIAS_ENA);
 
-	udelay(55);
+	udelay(165);
 
 	return ucb1x00_adc_read(ts->ucb, UCB_ADC_INP_TSPX, ts->adcsync);
 }
@@ -218,7 +224,11 @@
 		ucb1x00_adc_enable(ts->ucb);
 
 		x = ucb1x00_ts_read_xpos(ts);
+		ucb1x00_adc_disable(ts->ucb);
+		ucb1x00_adc_enable(ts->ucb);
 		y = ucb1x00_ts_read_ypos(ts);
+		ucb1x00_adc_disable(ts->ucb);
+		ucb1x00_adc_enable(ts->ucb);
 		p = ucb1x00_ts_read_pressure(ts);
 
 		/*
@@ -229,8 +239,11 @@
 
 		msleep(10);
 
-		ucb1x00_enable(ts->ucb);
+		if ((x < 60) || (y < 60)) {
+                       p = 0;
+                }
 
+		ucb1x00_enable(ts->ucb);
 
 		if (ucb1x00_ts_pen_down(ts)) {
 			set_current_state(TASK_INTERRUPTIBLE);
@@ -248,7 +261,9 @@
 			}
 
 			timeout = MAX_SCHEDULE_TIMEOUT;
+
 		} else {
+
 			ucb1x00_disable(ts->ucb);
 
 			/*
@@ -267,6 +282,14 @@
 
 		try_to_freeze();
 
+		/*
+		 * While suspend the ktsd-thread goes sleep -> try_to_freeze()
+		 * While resume the ktsd-thread do wakup and must rune one time
+		 * again to do a clean re-setup -> enable_irq: UCB_IRQ_TSPX
+		 */
+		if(ts->restart)
+			timeout = HZ / 100;
+
 		schedule_timeout(timeout);
 	}
 
@@ -349,8 +372,12 @@
 		 * TS interrupt mode is set up again
 		 * after sleep.
 		 */
+
 		ts->restart = 1;
 		wake_up(&ts->irq_wait);
+
+		printk(KERN_INFO "ucb1x00-ts.c -> ucb1x00_ts_resume() ktsd - restart *DONE*\n");
+
 	}
 	return 0;
 }