[PATCH 2/4] s3c24xx_ts: report touch only when stylus is down

Dmitry Torokhov dmitry.torokhov at gmail.com
Mon Feb 22 02:14:03 EST 2010


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 at 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);
+		}
 	}
 }
 



More information about the linux-arm-kernel mailing list