From patchwork Fri May 1 12:40:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 6309471 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 85CCDBEEE1 for ; Fri, 1 May 2015 12:40:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7703120219 for ; Fri, 1 May 2015 12:40:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5F0BE20218 for ; Fri, 1 May 2015 12:40:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753546AbbEAMkA (ORCPT ); Fri, 1 May 2015 08:40:00 -0400 Received: from rev33.vpn.fdn.fr ([80.67.179.33]:53334 "EHLO marvin.crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751311AbbEAMkA (ORCPT ); Fri, 1 May 2015 08:40:00 -0400 Received: from [95.91.238.31] (helo=debian.hitronhub.home) by marvin.crapouillou.net with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA256:128) (Exim 4.80) (envelope-from ) id 1YoAEU-0000iD-W9; Fri, 01 May 2015 14:39:55 +0200 From: Paul Cercueil To: Bastien Nocera , Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v2] input: goodix: Check the 'buffer status' bit before reading data Date: Fri, 1 May 2015 14:40:36 +0200 Message-Id: <1430484036-17541-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 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 Signed-off-by: Bastien Nocera --- v2: Fix commit message 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;