All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vasily Khoruzhick <anarsoul@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org, ben-linux@fluff.org,
	linux-input@vger.kernel.org
Subject: Re: [PATCH 2/4] s3c24xx_ts: report touch only when stylus is down
Date: Fri, 19 Feb 2010 12:02:10 +0200	[thread overview]
Message-ID: <201002191202.16384.anarsoul@gmail.com> (raw)
In-Reply-To: <20100219091755.GB2856@core.coreip.homeip.net>


[-- Attachment #1.1: Type: Text/Plain, Size: 813 bytes --]

Hi Dmitry,

В сообщении от 19 февраля 2010 11:17:55 автор Dmitry Torokhov написал:

> I do not think this is right. Here you reset sampling data regardless
> of whether you got the right number of samples or not. You should repeat
> s3c_adc_start only if you got (1 << ts.shift) samples. But I think I see
> why touchpad may stop reporintg sometimes - if timer fires before you
> get the needed number of samples nothing will happen as timer is not
> gettign rearmed.

Problem is driver reports "stylus down" event when stylus is already up, 
anyway I agree that samples should not be discarded.

> >  	} else {
> >  	
> >  		ts.count = 0;
> 
> I also think this branch is missing ts.xp = ts.yp = 0;

Ok.

Fixed version is in attachment

Thanks for review.

[-- Attachment #1.2: 0002-s3c24xx_ts-report-touch-only-when-stylus-is-down.patch --]
[-- Type: text/x-patch, Size: 1969 bytes --]

From 3edbe60fdb0cd2c2d91046557fcd9ad4f8c3b69d Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick <anarsoul@gmail.com>
Date: Fri, 19 Feb 2010 11:48:56 +0200
Subject: [PATCH 2/4] s3c24xx_ts: report touch only when stylus is down

By default, driver reports touches when it gots (1 << ts.shift)
samples, even if stylus is up. This behavior looks wrong to me.
Patch makes driver to report touches only when stylus is down.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 drivers/input/touchscreen/s3c2410_ts.c |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
index 6386b44..14afa0e 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -128,27 +128,29 @@ static void touch_timer_fire(unsigned long data)
 
 	down = get_down(data0, data1);
 
-	if (ts.count == (1 << ts.shift)) {
-		ts.xp >>= ts.shift;
-		ts.yp >>= ts.shift;
+	if (down) {
+		if (ts.count == (1 << ts.shift)) {
+			ts.xp >>= ts.shift;
+			ts.yp >>= ts.shift;
 
-		dev_dbg(ts.dev, "%s: X=%lu, Y=%lu, count=%d\n",
-			__func__, ts.xp, ts.yp, ts.count);
+			dev_dbg(ts.dev, "%s: X=%lu, Y=%lu, count=%d\n",
+				__func__, ts.xp, ts.yp, ts.count);
 
-		input_report_abs(ts.input, ABS_X, ts.xp);
-		input_report_abs(ts.input, ABS_Y, ts.yp);
+			input_report_abs(ts.input, ABS_X, ts.xp);
+			input_report_abs(ts.input, ABS_Y, ts.yp);
 
-		input_report_key(ts.input, BTN_TOUCH, 1);
-		input_sync(ts.input);
+			input_report_key(ts.input, BTN_TOUCH, 1);
+			input_sync(ts.input);
 
-		ts.xp = 0;
-		ts.yp = 0;
-		ts.count = 0;
-	}
+			ts.xp = 0;
+			ts.yp = 0;
+			ts.count = 0;
+		}
 
-	if (down) {
 		s3c_adc_start(ts.client, 0, 1 << ts.shift);
 	} else {
+		ts.xp = 0;
+		ts.yp = 0;
 		ts.count = 0;
 
 		input_report_key(ts.input, BTN_TOUCH, 0);
-- 
1.7.0


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: anarsoul@gmail.com (Vasily Khoruzhick)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] s3c24xx_ts: report touch only when stylus is down
Date: Fri, 19 Feb 2010 12:02:10 +0200	[thread overview]
Message-ID: <201002191202.16384.anarsoul@gmail.com> (raw)
In-Reply-To: <20100219091755.GB2856@core.coreip.homeip.net>

Hi Dmitry,

? ????????? ?? 19 ??????? 2010 11:17:55 ????? Dmitry Torokhov ???????:

> I do not think this is right. Here you reset sampling data regardless
> of whether you got the right number of samples or not. You should repeat
> s3c_adc_start only if you got (1 << ts.shift) samples. But I think I see
> why touchpad may stop reporintg sometimes - if timer fires before you
> get the needed number of samples nothing will happen as timer is not
> gettign rearmed.

Problem is driver reports "stylus down" event when stylus is already up, 
anyway I agree that samples should not be discarded.

> >  	} else {
> >  	
> >  		ts.count = 0;
> 
> I also think this branch is missing ts.xp = ts.yp = 0;

Ok.

Fixed version is in attachment

Thanks for review.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-s3c24xx_ts-report-touch-only-when-stylus-is-down.patch
Type: text/x-patch
Size: 1904 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100219/506975f2/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100219/506975f2/attachment.sig>

  reply	other threads:[~2010-02-19 10:02 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-18 16:32 [PATCH 0/4] s3c24xx_ts driver fixes Vasily Khoruzhick
2010-02-18 16:32 ` Vasily Khoruzhick
2010-02-18 16:32 ` [PATCH 1/4] Add resources description for s3c24xx ts driver Vasily Khoruzhick
2010-02-18 16:32   ` Vasily Khoruzhick
2010-02-21 23:12   ` Ben Dooks
2010-02-18 16:32 ` [PATCH 2/4] s3c24xx_ts: report touch only when stylus is down Vasily Khoruzhick
2010-02-18 16:32   ` Vasily Khoruzhick
2010-02-19  9:17   ` Dmitry Torokhov
2010-02-19  9:17     ` Dmitry Torokhov
2010-02-19 10:02     ` Vasily Khoruzhick [this message]
2010-02-19 10:02       ` Vasily Khoruzhick
2010-02-21  7:35       ` Dmitry Torokhov
2010-02-21  7:35         ` Dmitry Torokhov
2010-02-21  9:05         ` Vasily Khoruzhick
2010-02-21  9:05           ` Vasily Khoruzhick
2010-02-21  9:41           ` Dmitry Torokhov
2010-02-21  9:41             ` Dmitry Torokhov
2010-02-21 10:10             ` Vasily Khoruzhick
2010-02-21 10:10               ` Vasily Khoruzhick
2010-02-21 10:28               ` Dmitry Torokhov
2010-02-21 10:28                 ` Dmitry Torokhov
2010-02-21 10:33                 ` Vasily Khoruzhick
2010-02-21 10:33                   ` Vasily Khoruzhick
2010-02-21 14:27               ` Nelson Castillo
2010-02-21 21:44                 ` Vasily Khoruzhick
2010-02-21 22:51                   ` Dmitry Torokhov
2010-02-21 22:58                     ` Vasily Khoruzhick
2010-02-22  7:14                       ` Dmitry Torokhov
2010-02-22  7:14                         ` Dmitry Torokhov
2010-02-22  8:58                         ` Vasily Khoruzhick
2010-02-22  8:58                           ` Vasily Khoruzhick
2010-02-22  9:03                         ` Vasily Khoruzhick
2010-02-22  9:03                           ` Vasily Khoruzhick
2010-02-18 16:32 ` [PATCH 3/4] s3c24xx_adc: disable/enable IRQ on suspend/resume Vasily Khoruzhick
2010-02-18 16:32   ` Vasily Khoruzhick
2010-02-21 23:12   ` Ben Dooks
2010-02-18 16:32 ` [PATCH 4/4] s3c24xx_ts: re-enable IRQ on resume Vasily Khoruzhick
2010-02-18 16:32   ` Vasily Khoruzhick
2010-02-19  9:05   ` Dmitry Torokhov
2010-02-19  9:05     ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201002191202.16384.anarsoul@gmail.com \
    --to=anarsoul@gmail.com \
    --cc=ben-linux@fluff.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.