[PATCH 3/3] Remove skip filter

Nelson Castillo nelsoneci at gmail.com
Mon Dec 8 04:49:46 CET 2008


With more reliable points median and mean filters perform a better job.
We no longer need this filter.

Signed-off-by: Nelson Castillo <nelsoneci at gmail.com>
---

 0 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
index bc3ba60..8e6bc0a 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -104,9 +104,6 @@ static char *s3c2410ts_name = "s3c2410 TouchScreen";
 #define TS_STATE_RELEASE_PENDING 2
 #define TS_STATE_RELEASE 3
 
-#define SKIP_NHEAD 2
-#define SKIP_NTAIL 1
-
 /*
  * Per-touchscreen data.
  */
@@ -182,92 +179,8 @@ static void ts_input_report(int event, int coords[])
 	input_sync(ts.dev);
 }
 
-
 /*
- * Skip filter for touchscreen values.
- *
- * Problem: The first and the last sample might be unreliable. We provide
- * this filter as a separate function in order to keep the event_send_timer_f
- * function simple. This filter:
- *
- * - Skips NHEAD points after IE_DOWN
- * - Skips NTAIL points before IE_UP
- * - Ignores a click if we have less than (NHEAD + NTAILl + 1) points
- */
-
-struct skip_filter_event {
-	int coords[2];
-};
-
-struct skip_filter {
-	unsigned N;
-	unsigned M;
-	int sent;
-	struct skip_filter_event buf[SKIP_NTAIL];
-};
-
-struct skip_filter ts_skip;
-
-static void ts_skip_filter_reset(void)
-{
-	ts_skip.N = 0;
-	ts_skip.M = 0;
-	ts_skip.sent = 0;
-}
-
-static void ts_skip_filter(int event, int coords[])
-{
-	/* skip the first N samples */
-	if (ts_skip.N < SKIP_NHEAD) {
-		if (IE_UP == event)
-			ts_skip_filter_reset();
-		else
-			ts_skip.N++;
-		return;
-	}
-
-	/* We didn't send DOWN -- Ignore UP */
-	if (IE_UP == event && !ts_skip.sent) {
-		ts_skip_filter_reset();
-		return;
-	}
-
-	/* Just accept the event if NTAIL == 0 */
-	if (!SKIP_NTAIL) {
-		ts_input_report(event, coords);
-		if (IE_UP == event)
-			ts_skip_filter_reset();
-		else
-			ts_skip.sent = 1;
-		return;
-	}
-
-	/* NTAIL > 0,  Queue current point if we need to */
-	if (!ts_skip.sent && ts_skip.M < SKIP_NTAIL) {
-		memcpy(&ts_skip.buf[ts_skip.M++].coords[0], &coords[0],
-		       sizeof(int) * 2);
-		return;
-	}
-
-	/* queue full: accept one, queue one */
-
-	if (ts_skip.M >= SKIP_NTAIL)
-		ts_skip.M = 0;
-
-	ts_input_report(event, ts_skip.buf[ts_skip.M].coords);
-
-	if (event == IE_UP) {
-		ts_skip_filter_reset();
-	} else {
-		memcpy(&ts_skip.buf[ts_skip.M++].coords[0], &coords[0],
-		       sizeof(int) * 2);
-		ts_skip.sent = 1;
-	}
-}
-
-
-/*
- * Manage the state of the touchscreen. Send events to the skip filter.
+ * Manage the state of the touchscreen.
  */
 
 static void event_send_timer_f(unsigned long data);
@@ -312,7 +225,7 @@ static void event_send_timer_f(unsigned long data)
 				     != sizeof(int) * 2))
 				goto ts_exit_error;
 
-			ts_skip_filter(IE_DOWN, buf);
+			ts_input_report(IE_DOWN, buf);
 			ts.state = TS_STATE_PRESSED;
 			break;
 
@@ -330,7 +243,7 @@ static void event_send_timer_f(unsigned long data)
 			 * while to avoid jitter. If we get a DOWN
 			 * event we do not send it. */
 
-			ts_skip_filter(IE_UP, NULL);
+			ts_input_report(IE_UP, NULL);
 			ts.state = TS_STATE_STANDBY;
 
 			if (ts.tsf[0])
@@ -515,8 +428,6 @@ static int __init s3c2410ts_probe(struct platform_device *pdev)
 	ts.dev->id.version = S3C2410TSVERSION;
 	ts.state = TS_STATE_STANDBY;
 
-	ts_skip_filter_reset();
-
 	/* create the filter chain set up for the 2 coordinates we produce */
 	ret = ts_filter_create_chain(
 		(struct ts_filter_api **)&info->filter_sequence,




More information about the openmoko-kernel mailing list