From 6d2c293d6578048e7b71e0c44897144f15f350ae Mon Sep 17 00:00:00 2001 From: merging other branches Date: Wed, 26 Nov 2008 16:07:01 +0000 Subject: MERGE-via-balaji-tracking-hist-MERGE-via-stable-tracking-hist-MERGE-via-mokopatches-tracking-via-master-s3c-hsmmc-clean balaji-tracking-hist top was efb2d57c0e0ed62324d79d6c5793fe797c157266 --- drivers/input/touchscreen/s3c2410_ts.c | 38 +++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 14 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 8e580a833e5..253dc5b7eac 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; - ts_input_report(IE_DOWN); - if (!ts.is_down) { /* Do we need this? I think so. */ + 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); + else ts_input_report(IE_UPDATE); - ts_input_report(IE_UP); - } - } else if (ts.is_down) { - ts_input_report(IE_UPDATE); - } else { + 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( -- cgit v1.2.3