From patchwork Sat Mar 9 17:05:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Pargmann X-Patchwork-Id: 2241971 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 7E4833FCF2 for ; Sat, 9 Mar 2013 17:08:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932444Ab3CIRID (ORCPT ); Sat, 9 Mar 2013 12:08:03 -0500 Received: from metis.ext.pengutronix.de ([92.198.50.35]:36646 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760369Ab3CIRIB (ORCPT ); Sat, 9 Mar 2013 12:08:01 -0500 Received: from dude.hi.pengutronix.de ([2001:6f8:1178:2:21e:67ff:fe11:9c5c]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1UENFE-00011G-Ca; Sat, 09 Mar 2013 18:07:40 +0100 Received: from mpa by dude.hi.pengutronix.de with local (Exim 4.80) (envelope-from ) id 1UENFD-0004lT-JH; Sat, 09 Mar 2013 18:07:39 +0100 From: Markus Pargmann To: Mark Brown , Liam Girdwood Cc: Dmitry Torokhov , patches@opensource.wolfsonmicro.com, linux-input@vger.kernel.org, kernel@pengutronix.de, Markus Pargmann , =?UTF-8?q?Teresa=20G=C3=A1mez?= , Christian Hemp , stable@vger.kernel.org Subject: [PATCH v2 3/4] Input: wm9712: Fix wrong pen up readings Date: Sat, 9 Mar 2013 18:05:52 +0100 Message-Id: <1362848753-6725-4-git-send-email-mpa@pengutronix.de> X-Mailer: git-send-email 1.8.2.rc2 In-Reply-To: <1362848753-6725-1-git-send-email-mpa@pengutronix.de> References: <1362848753-6725-1-git-send-email-mpa@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:6f8:1178:2:21e:67ff:fe11:9c5c X-SA-Exim-Mail-From: mpa@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-input@vger.kernel.org Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Often a reading can be wrong. This patch assures that this is really a pen up event and not a false reading. Based on wm9712: pen up by Teresa Gámez and Christian Hemp. Cc: Teresa Gámez Cc: Christian Hemp Cc: stable@vger.kernel.org Signed-off-by: Markus Pargmann Acked-by: Mark Brown --- drivers/input/touchscreen/wm9712.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/wm9712.c b/drivers/input/touchscreen/wm9712.c index a983da1..3b4eed4 100644 --- a/drivers/input/touchscreen/wm9712.c +++ b/drivers/input/touchscreen/wm9712.c @@ -302,8 +302,12 @@ static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample) } if (wants_pen && !(*sample & WM97XX_PEN_DOWN)) { - wm->pen_probably_down = 0; - return RC_PENUP; + /* Sometimes it reads a wrong value the first time. */ + *sample = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); + if (!(*sample & WM97XX_PEN_DOWN)) { + wm->pen_probably_down = 0; + return RC_PENUP; + } } return RC_VALID;