From patchwork Sat Apr 25 10:48:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 6274251 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 573F29F1C4 for ; Sat, 25 Apr 2015 11:08:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 550E320259 for ; Sat, 25 Apr 2015 11:08:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5EE5C201DD for ; Sat, 25 Apr 2015 11:08:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759099AbbDYLIw (ORCPT ); Sat, 25 Apr 2015 07:08:52 -0400 Received: from rev33.vpn.fdn.fr ([80.67.179.33]:44179 "EHLO marvin.crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759098AbbDYLIw (ORCPT ); Sat, 25 Apr 2015 07:08:52 -0400 X-Greylist: delayed 1258 seconds by postgrey-1.27 at vger.kernel.org; Sat, 25 Apr 2015 07:08:51 EDT Received: from [95.90.198.161] (helo=debian.hitronhub.home) by marvin.crapouillou.net with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA256:128) (Exim 4.80) (envelope-from ) id 1Ylxcj-0006ls-G5; Sat, 25 Apr 2015 12:47:49 +0200 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-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Bastien Nocera --- 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;