(Sending to openmoko-kernel ML)

Hi Andy, 
  I created a porting patch for the delay event
scheme of ts driver for stable-tracking branch.
Basically it's the same as that one of
http://git.openmoko.org/?p=kernel.git;a=commit;h=abe8f448547d1bd69ac2963e07e2657f27b79691
 
Cheers, 
Tick
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
index 8e580a8..dd63b65 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -89,6 +89,11 @@ MODULE_LICENSE("GPL");
  * Definitions & global arrays.
  */
 
+#define TOUCH_STANDBY_FLAG 0
+#define TOUCH_PRESSED_FLAG 1
+#define TOUCH_RELEASE_FLAG 2
+
+#define TOUCH_RELEASE_TIMEOUT (HZ >> 4)
 
 static char *s3c2410ts_name = "s3c2410 TouchScreen";
 
@@ -143,23 +148,31 @@ static void ts_input_report(int event)
 	}
 #endif
 }
+
+static void touch_timer_fire(unsigned long data);
+static struct timer_list touch_timer =
+		TIMER_INITIALIZER(touch_timer_fire, 0, 0);
+
 static void touch_timer_fire(unsigned long data)
 {
 	if (ts.tsf[0])
 		(ts.tsf[0]->api->scale)(ts.tsf[0], &ts.coords[0]);
 
-	if (ts.need_to_send_first_touch) {
-		ts.need_to_send_first_touch = 0;
+        if (ts.is_down && ts.need_to_send_first_touch == TOUCH_RELEASE_FLAG)
+            ts.need_to_send_first_touch = TOUCH_PRESSED_FLAG;
+
+	if ( ts.is_down ) {
+            if ( ts.need_to_send_first_touch == TOUCH_STANDBY_FLAG )
 		ts_input_report(IE_DOWN);
-		if (!ts.is_down) { /* Do we need this? I think so. */
-			ts_input_report(IE_UPDATE);
-			ts_input_report(IE_UP);
-		}
-	} else if (ts.is_down) {
-		ts_input_report(IE_UPDATE);
-	} else {
+            else 
+	        ts_input_report(IE_UPDATE);
+	    ts.need_to_send_first_touch = TOUCH_PRESSED_FLAG;
+	} else if (ts.need_to_send_first_touch == TOUCH_RELEASE_FLAG){
 		ts_input_report(IE_UP);
-	}
+	} else {
+            ts.need_to_send_first_touch = TOUCH_RELEASE_FLAG;
+            mod_timer(&touch_timer, jiffies + TOUCH_RELEASE_TIMEOUT);
+        }
 
 	if (ts.is_down) {
 		writel(S3C2410_ADCTSC_PULL_UP_DISABLE | AUTOPST,
@@ -173,9 +186,6 @@ static void touch_timer_fire(unsigned long data)
 	}
 }
 
-static struct timer_list touch_timer =
-		TIMER_INITIALIZER(touch_timer_fire, 0, 0);
-
 static irqreturn_t stylus_updown(int irq, void *dev_id)
 {
 	unsigned long data0;
@@ -188,7 +198,6 @@ static irqreturn_t stylus_updown(int irq, void *dev_id)
 					    (!(data1 & S3C2410_ADCDAT0_UPDOWN));
 
 	if (ts.is_down) {
-		ts.need_to_send_first_touch = 1;
 		writel(S3C2410_ADCTSC_PULL_UP_DISABLE | AUTOPST,
 						      base_addr+S3C2410_ADCTSC);
 		writel(readl(base_addr+S3C2410_ADCCON) |
@@ -316,6 +325,7 @@ static int __init s3c2410ts_probe(struct platform_device *pdev)
 	ts.dev->id.vendor = 0xDEAD;
 	ts.dev->id.product = 0xBEEF;
 	ts.dev->id.version = S3C2410TSVERSION;
+        ts.need_to_send_first_touch = TOUCH_STANDBY_FLAG;
 
 	/* create the filter chain set up for the 2 coordinates we produce */
 	ret = ts_filter_create_chain(

Attachment: signature.asc
Description: Digital signature



Reply via email to