From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759028AbbDYKr5 (ORCPT ); Sat, 25 Apr 2015 06:47:57 -0400 Received: from rev33.vpn.fdn.fr ([80.67.179.33]:43611 "EHLO marvin.crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758964AbbDYKry (ORCPT ); Sat, 25 Apr 2015 06:47:54 -0400 From: Paul Cercueil To: Bastien Nocera , Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH] input: goodix: Check the 'data ready' bit before reading data Date: Sat, 25 Apr 2015 12:48:10 +0200 Message-Id: <1429958890-10366-1-git-send-email-paul@crapouillou.net> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The MSB of the first byte read via I2C seems to indicate whether the data is valid (or ready) 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 --- drivers/input/touchscreen/goodix.c | 3 +++ 1 file changed, 3 insertions(+) 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; -- 2.1.4