From patchwork Mon May 16 08:33:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 787172 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4G8X92D005946 for ; Mon, 16 May 2011 08:33:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752339Ab1EPIdI (ORCPT ); Mon, 16 May 2011 04:33:08 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:58189 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752404Ab1EPIdH (ORCPT ); Mon, 16 May 2011 04:33:07 -0400 Received: from localhost (p548E0028.dip0.t-ipconnect.de [84.142.0.40]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0Luahc-1PdeW948OG-010BFP; Mon, 16 May 2011 10:33:06 +0200 From: Thierry Reding To: linux-input@vger.kernel.org Cc: Dmitry Torokhov , Kwangwoo Lee Subject: [PATCH 2/5] tsc2007: Add max_rt module parameter. Date: Mon, 16 May 2011 10:33:00 +0200 Message-Id: <1305534783-4917-2-git-send-email-thierry.reding@avionic-design.de> X-Mailer: git-send-email 1.7.5.1 In-Reply-To: <1305534783-4917-1-git-send-email-thierry.reding@avionic-design.de> References: <1305534783-4917-1-git-send-email-thierry.reding@avionic-design.de> X-Provags-ID: V02:K0:R6Le4SggWLspQYPrNZU3okaTfQlEjo6ygnHREK+wSO8 XXj1spzypQCqdQNsokKfLZne0zHE/8zcO7ut5+Fjxtb94FKyeH Z828Ar924DK7GTQ/ziGV7jnmyyVHDePS/+fg38zFa1TNyR084Z HJuWRsJYWqQlZcTb6yCoFPxALvUtce2aEO4Z75VaimQ80m+u1I p+SwTD+OM2RDLaVEQGXiCw998RPjT38SlrIvz1cuUYPk7VWRGk Kqjl1tJ0xztRw Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 16 May 2011 08:33:10 +0000 (UTC) Finger touch events or very quick stylus events on low-quality panels can cause the tsc2007 to read bogus values. Looking at oscilloscope snapshots, this seems to be caused by the touch event disappearing during the measurements. These bogus values result in misclicks, where the X and Y values deviate from the real position. Most of these misclicks can be filtered out by setting a low enough threshold for the maximum resistance (which is loosely the inverse of the pressure) allowed to consider a set of values valid. Since this behaviour is largely dependent on the type and quality of the panel, this commit introduces the max_rt parameter. The default value is kept at MAX_12BIT. Cc: Dmitry Torokhov Cc: Kwangwoo Lee Signed-off-by: Thierry Reding --- drivers/input/touchscreen/tsc2007.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c index df4ae35..95d619c 100644 --- a/drivers/input/touchscreen/tsc2007.c +++ b/drivers/input/touchscreen/tsc2007.c @@ -83,6 +83,10 @@ struct tsc2007 { void (*clear_penirq)(void); }; +static int max_rt = MAX_12BIT; +module_param(max_rt, int, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(max_rt, "Maximum resistance above which samples are ignored"); + static inline int tsc2007_xfer(struct tsc2007 *tsc, u8 cmd) { s32 data; @@ -185,7 +189,7 @@ static void tsc2007_work(struct work_struct *work) tsc2007_read_values(ts, &tc); rt = tsc2007_calculate_pressure(ts, &tc); - if (rt > MAX_12BIT) { + if (rt > max_rt) { /* * Sample found inconsistent by debouncing or pressure is * beyond the maximum. Don't report it to user space,