From 1bfcb6881cb4ea120894ef4e032fa3ca7d311b35 Mon Sep 17 00:00:00 2001 From: merge Date: Thu, 4 Dec 2008 21:30:41 +0000 Subject: MERGE-via-pending-tracking-hist-MERGE-via-stable-tracking-cleanup-add-internal-functions-1228426177 pending-tracking-hist top was MERGE-via-stable-tracking-cleanup-add-internal-functions-1228426177 / cf9f1f4a754f2db71f829a8b07ac455e053b3d1f ... parent commitmessage: From: merge MERGE-via-stable-tracking-hist-cleanup-add-internal-functions stable-tracking-hist top was cleanup-add-internal-functions / 251b632aa7be6c6307a6938a59793e205da5b326 ... parent commitmessage: From: Nelson Castillo Cleanup - Add internal functions for clearing filters This patch adds the following functions: * ts_filter_mean_clear_internal * ts_filter_median_clear_internal The idea: avoid calling the clean function of other filters when we initialize one. Also: * modify messages for consistency. * remove an unneeded else. Signed-off-by: Nelson Castillo --- drivers/input/touchscreen/s3c2410_ts.c | 45 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'drivers/input/touchscreen/s3c2410_ts.c') diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c index a880163059a..ea0f58aaf32 100644 --- a/drivers/input/touchscreen/s3c2410_ts.c +++ b/drivers/input/touchscreen/s3c2410_ts.c @@ -103,7 +103,7 @@ static char *s3c2410ts_name = "s3c2410 TouchScreen"; #define TS_STATE_RELEASE 4 #define SKIP_NHEAD 2 -#define SKIP_NTAIL 2 +#define SKIP_NTAIL 1 /* * Per-touchscreen data. @@ -392,27 +392,28 @@ static irqreturn_t stylus_action(int irq, void *dev_id) ts.coords[1] = readl(base_addr + S3C2410_ADCDAT1) & S3C2410_ADCDAT1_YPDATA_MASK; - if (!ts.tsf[0]) /* filtering is disabled then use raw directly */ - goto real_sample; - - /* send it to the chain of filters */ - if ((ts.tsf[0]->api->process)(ts.tsf[0], &ts.coords[0])) - goto real_sample; - - /* - * no real sample came out of processing yet, - * get another raw result to feed it - */ - - s3c2410_ts_start_adc_conversion(); - - return IRQ_HANDLED; - -real_sample: - - if (ts.tsf[0]) - (ts.tsf[0]->api->scale)(ts.tsf[0], &ts.coords[0]); + if (ts.tsf[0]) { /* filtering is enabled, don't use raw directly */ + switch ((ts.tsf[0]->api->process)(ts.tsf[0], &ts.coords[0])) { + case 0: /* + * no real sample came out of processing yet, + * get another raw result to feed it + */ + s3c2410_ts_start_adc_conversion(); + return IRQ_HANDLED; + case 1: /* filters are ready to deliver a sample */ + (ts.tsf[0]->api->scale)(ts.tsf[0], &ts.coords[0]); + break; + case -1: + /* error in filters, ignore the event */ + (ts.tsf[0]->api->clear)(ts.tsf[0]); + writel(WAIT4INT(1), base_addr + S3C2410_ADCTSC); + return IRQ_HANDLED; + default: + printk(KERN_ERR":stylus_action error\n"); + } + } + /* We use a buffer because want an atomic operation */ buf[0] = 'P'; buf[1] = ts.coords[0]; buf[2] = ts.coords[1]; @@ -420,7 +421,7 @@ real_sample: if (unlikely(__kfifo_put(ts.event_fifo, (unsigned char *)buf, sizeof(int) * 3) != sizeof(int) * 3)) /* should not happen */ - printk(KERN_ERR __FILE__": stylus_action lost event!\n"); + printk(KERN_ERR":stylus_action error\n"); writel(WAIT4INT(1), base_addr + S3C2410_ADCTSC); mod_timer(&event_send_timer, jiffies + 1); -- cgit v1.2.3