From mboxrd@z Thu Jan 1 00:00:00 1970 From: Markus Pargmann Subject: [PATCH 3/4] Input: wm9712: Fix wrong pen up readings Date: Fri, 8 Mar 2013 17:15:08 +0100 Message-ID: <1362759309-18782-4-git-send-email-mpa@pengutronix.de> References: <1362759309-18782-1-git-send-email-mpa@pengutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from metis.ext.pengutronix.de ([92.198.50.35]:55078 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934352Ab3CHQR5 (ORCPT ); Fri, 8 Mar 2013 11:17:57 -0500 In-Reply-To: <1362759309-18782-1-git-send-email-mpa@pengutronix.de> Sender: linux-input-owner@vger.kernel.org List-Id: linux-input@vger.kernel.org To: Liam Girdwood Cc: Mark Brown , 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 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=C3=A1mez and Christian Hemp. Cc: Teresa G=C3=A1mez Cc: Christian Hemp Cc: stable@vger.kernel.org Signed-off-by: Markus Pargmann --- drivers/input/touchscreen/wm9712.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/wm9712.c b/drivers/input/touchsc= reen/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, i= nt adcsel, int *sample) } =20 if (wants_pen && !(*sample & WM97XX_PEN_DOWN)) { - wm->pen_probably_down =3D 0; - return RC_PENUP; + /* Sometimes it reads a wrong value the first time. */ + *sample =3D wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); + if (!(*sample & WM97XX_PEN_DOWN)) { + wm->pen_probably_down =3D 0; + return RC_PENUP; + } } =20 return RC_VALID; --=20 1.8.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-input" = in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html