From: Paul Cercueil Date: Wed, 6 May 2015 23:52:13 +0000 (-0700) Subject: Input: goodix - check the 'buffer status' bit before reading data X-Git-Tag: v4.2-rc1~126^2^2~51 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5f6f117c12a3fb25ecadd6dfcdd1a3a431269ade;p=karo-tx-linux.git Input: goodix - check the 'buffer status' bit before reading data 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 Acked-by: Bastien Nocera Signed-off-by: Dmitry Torokhov --- diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index 3af16984d57c..0d93b1e5e28e 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -101,6 +101,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 > ts->max_touch_num) return -EPROTO;