diff mbox

[v2] input: goodix: Check the 'buffer status' bit before reading data

Message ID 1430484036-17541-1-git-send-email-paul@crapouillou.net (mailing list archive)
State New, archived
Headers show

Commit Message

Paul Cercueil May 1, 2015, 12:40 p.m. UTC
The MSB of the first byte read via I2C at the coordinates address
indicates whether the data is valid or ready (called "buffer status" in
the datasheets) when an interrupt is raised. Previously, this bit was
ignored, which resulted in a lot of incorrect detections of "finger
removed" events.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
v2: Fix commit message

 drivers/input/touchscreen/goodix.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Bastien Nocera May 1, 2015, 2:13 p.m. UTC | #1
On Fri, 2015-05-01 at 14:40 +0200, Paul Cercueil wrote:
> The MSB of the first byte read via I2C at the coordinates address
> indicates whether the data is valid or ready (called "buffer status" 
> in
> the datasheets) when an interrupt is raised. Previously, this bit was
> ignored, which resulted in a lot of incorrect detections of "finger
> removed" events.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>

Signed-off-by: Bastien Nocera <hadess@hadess.net>
--
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
Dmitry Torokhov May 6, 2015, 11:54 p.m. UTC | #2
On Fri, May 01, 2015 at 04:13:55PM +0200, Bastien Nocera wrote:
> On Fri, 2015-05-01 at 14:40 +0200, Paul Cercueil wrote:
> > The MSB of the first byte read via I2C at the coordinates address
> > indicates whether the data is valid or ready (called "buffer status" 
> > in
> > the datasheets) when an interrupt is raised. Previously, this bit was
> > ignored, which resulted in a lot of incorrect detections of "finger
> > removed" events.
> > 
> > Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> 
> Signed-off-by: Bastien Nocera <hadess@hadess.net>

Applied, thank you.
diff mbox

Patch

diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index ca19668..9fa6c5f 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -98,6 +98,9 @@  static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data)
 		return error;
 	}
 
+	if (!(data[0] & 0x80))
+		return -EAGAIN;
+
 	touch_num = data[0] & 0x0f;
 	if (touch_num > GOODIX_MAX_CONTACTS)
 		return -EPROTO;