linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] input: egalax_ts: optmize driver for more fluency touch feelling
@ 2011-12-07  9:10 Zhang Jiejing
  2011-12-12  8:34 ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang Jiejing @ 2011-12-07  9:10 UTC (permalink / raw)
  To: linux-input, Dmitry Torokhov, Henrik Rydberg

egalax_ts use threaded_irq to report touch event, it will wake up the
irq thread and stop the thread irq after process one touch event, so
even user touch the screen very fast, the fastest event report speed
is depends on the scheduler, so the event reported is a uniform speed.

This patch will let thread irq check the gpio's status, if the gpio
is down, means still have more events, it will not exit the irq handler
and continue process another new event, it can improve user experience.

Signed-off-by: Zhang Jiejing <jiejing.zhang@freescale.com>
---
 drivers/input/touchscreen/egalax_ts.c |   63 +++++++++++++++++---------------
 1 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c
index f694535..21bd2ec 100644
--- a/drivers/input/touchscreen/egalax_ts.c
+++ b/drivers/input/touchscreen/egalax_ts.c
@@ -74,45 +74,48 @@ static irqreturn_t egalax_ts_interrupt(int irq, void *dev_id)
 	u8 state;
 
 	do {
-		ret = i2c_master_recv(client, buf, MAX_I2C_DATA_LEN);
-	} while (ret == -EAGAIN && tries++ < EGALAX_MAX_TRIES);
+		do {
+			ret = i2c_master_recv(client, buf, MAX_I2C_DATA_LEN);
+		} while (ret == -EAGAIN && tries++ < EGALAX_MAX_TRIES);
 
-	if (ret < 0)
-		return IRQ_HANDLED;
+		if (ret < 0)
+			return IRQ_HANDLED;
 
-	if (buf[0] != REPORT_MODE_MTTOUCH) {
-		/* ignore mouse events and vendor events */
-		return IRQ_HANDLED;
-	}
+		if (buf[0] != REPORT_MODE_MTTOUCH) {
+			/* ignore mouse events and vendor events */
+			return IRQ_HANDLED;
+		}
 
-	state = buf[1];
-	x = (buf[3] << 8) | buf[2];
-	y = (buf[5] << 8) | buf[4];
-	z = (buf[7] << 8) | buf[6];
+		state = buf[1];
+		x = (buf[3] << 8) | buf[2];
+		y = (buf[5] << 8) | buf[4];
+		z = (buf[7] << 8) | buf[6];
 
-	valid = state & EVENT_VALID_MASK;
-	id = (state & EVENT_ID_MASK) >> EVENT_ID_OFFSET;
-	down = state & EVENT_DOWN_UP;
+		valid = state & EVENT_VALID_MASK;
+		id = (state & EVENT_ID_MASK) >> EVENT_ID_OFFSET;
+		down = state & EVENT_DOWN_UP;
 
-	if (!valid || id > MAX_SUPPORT_POINTS) {
-		dev_dbg(&client->dev, "point invalid\n");
-		return IRQ_HANDLED;
-	}
+		if (!valid || id > MAX_SUPPORT_POINTS) {
+			dev_dbg(&client->dev, "point invalid\n");
+			return IRQ_HANDLED;
+		}
 
-	input_mt_slot(input_dev, id);
-	input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, down);
+		input_mt_slot(input_dev, id);
+		input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, down);
 
-	dev_dbg(&client->dev, "%s id:%d x:%d y:%d z:%d",
-		(down ? "down" : "up"), id, x, y, z);
+		dev_dbg(&client->dev, "%s id:%d x:%d y:%d z:%d",
+			(down ? "down" : "up"), id, x, y, z);
 
-	if (down) {
-		input_report_abs(input_dev, ABS_MT_POSITION_X, x);
-		input_report_abs(input_dev, ABS_MT_POSITION_Y, y);
-		input_report_abs(input_dev, ABS_MT_PRESSURE, z);
-	}
+		if (down) {
+			input_report_abs(input_dev, ABS_MT_POSITION_X, x);
+			input_report_abs(input_dev, ABS_MT_POSITION_Y, y);
+			input_report_abs(input_dev, ABS_MT_PRESSURE, z);
+		}
+
+		input_mt_report_pointer_emulation(input_dev, true);
+		input_sync(input_dev);
+	} while (gpio_get_value(irq_to_gpio(client->irq)) == 0);
 
-	input_mt_report_pointer_emulation(input_dev, true);
-	input_sync(input_dev);
 	return IRQ_HANDLED;
 }
 
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-15  6:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-07  9:10 [PATCH] input: egalax_ts: optmize driver for more fluency touch feelling Zhang Jiejing
2011-12-12  8:34 ` Dmitry Torokhov
     [not found]   ` <CACrgxGAUYW0E3cLradFJ8SAYBjszWjYdsfrFBAZN6R7a0NO41w@mail.gmail.com>
2011-12-15  6:24     ` Jiejing.Zhang 

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).