linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Vasily Khoruzhick <anarsoul@gmail.com>
Cc: arhuaco@freaks-unidos.net, 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: Sun, 21 Feb 2010 23:14:03 -0800	[thread overview]
Message-ID: <20100222071403.GD2095@core.coreip.homeip.net> (raw)
In-Reply-To: <201002220058.52583.anarsoul@gmail.com>

On Mon, Feb 22, 2010 at 12:58:48AM +0200, Vasily Khoruzhick wrote:
> В сообщении от 22 февраля 2010 00:51:25 автор Dmitry Torokhov написал:
> > We do put it in WAIT4INT mode rigtht there though so it looks like we
> > just need to move that call (well the original doing WAIT4INT | INT_UP)
> > before we check for pen state.
> 
> And we need to disable WAIT4INT mode in s3c24xx_ts_schedule_read (actually 
> according to spec we need to disable it right after we got interrupt).
> 

So is the below sufficient to make it work? Even if it works aI think we
need to add socke locking around scheduling reads from irq and
callback...

-- 
Dmitry


Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

---

 drivers/input/touchscreen/s3c2410_ts.c |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)


diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
index 60f18c2..b389648 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -152,9 +152,12 @@ static void s3c24xx_ts_schedule_read(void)
  */
 static irqreturn_t s3c24xx_ts_stylus_irq(int irq, void *dev_id)
 {
-	if (s3c24xx_ts_check_pen_down())
+	if (s3c24xx_ts_check_pen_down()) {
+		/* Reset WAIT4INT state */
+		writel(0, ts.io + S3C2410_ADCTSC);
+
 		s3c24xx_ts_schedule_read();
-	else
+	} else
 		dev_info(ts.dev, "%s: count=%d\n", __func__, ts.count);
 
 	return IRQ_HANDLED;
@@ -211,14 +214,25 @@ static void s3c24xx_ts_select(struct s3c_adc_client *client, unsigned select)
 		/*
 		 * Conversion is complete, we have desired number of samples.
 		 */
+
+		/*
+		 * We need to be in WAIT4INT mode to successfully check for
+		 * pen state.
+		 */
+		writel(WAIT4INT | INT_UP, ts.io + S3C2410_ADCTSC);
+
 		pen_is_down = s3c24xx_ts_check_pen_down();
 
 		s3c24xx_ts_report_state(pen_is_down);
 
-		if (pen_is_down)
+		if (pen_is_down) {
+			/* Reset WAIT4INT state */
+			writel(0, ts.io + S3C2410_ADCTSC);
+
 			s3c24xx_ts_schedule_read();
-		else
+		} else {
 			writel(WAIT4INT | INT_DOWN, ts.io + S3C2410_ADCTSC);
+		}
 	}
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2010-02-22  7:14 UTC|newest]

Thread overview: 17+ 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 ` [PATCH 1/4] Add resources description for s3c24xx ts driver Vasily Khoruzhick
2010-02-18 16:32 ` [PATCH 2/4] s3c24xx_ts: report touch only when stylus is down Vasily Khoruzhick
2010-02-19  9:17   ` Dmitry Torokhov
2010-02-19 10:02     ` Vasily Khoruzhick
2010-02-21  7:35       ` Dmitry Torokhov
2010-02-21  9:05         ` Vasily Khoruzhick
2010-02-21  9:41           ` Dmitry Torokhov
2010-02-21 10:10             ` Vasily Khoruzhick
2010-02-21 10:28               ` Dmitry Torokhov
2010-02-21 10:33                 ` 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 ` [PATCH 4/4] s3c24xx_ts: re-enable IRQ on resume Vasily Khoruzhick
2010-02-19  9:05   ` Dmitry Torokhov
     [not found] ` <201002212344.39633.anarsoul@gmail.com>
     [not found]   ` <20100221225125.GA18604@core.coreip.homeip.net>
     [not found]     ` <201002220058.52583.anarsoul@gmail.com>
2010-02-22  7:14       ` Dmitry Torokhov [this message]
2010-02-22  8:58         ` [PATCH 2/4] s3c24xx_ts: report touch only when stylus is down Vasily Khoruzhick
2010-02-22  9:03         ` Vasily Khoruzhick

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=20100222071403.GD2095@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=anarsoul@gmail.com \
    --cc=arhuaco@freaks-unidos.net \
    --cc=ben-linux@fluff.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).