From patchwork Fri Nov 20 18:50:58 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Machek X-Patchwork-Id: 61707 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAKIpCsT024488 for ; Fri, 20 Nov 2009 18:51:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753437AbZKTSvF (ORCPT ); Fri, 20 Nov 2009 13:51:05 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753868AbZKTSvF (ORCPT ); Fri, 20 Nov 2009 13:51:05 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:35875 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753437AbZKTSvD (ORCPT ); Fri, 20 Nov 2009 13:51:03 -0500 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 4DC68F075A; Fri, 20 Nov 2009 19:51:09 +0100 (CET) Date: Fri, 20 Nov 2009 19:50:58 +0100 From: Pavel Machek To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, kernel list , Andrew Morton Subject: Re: ads7846 touchscreen: fix pressure Message-ID: <20091120185058.GA1472@ucw.cz> References: <20091120182238.GA1344@ucw.cz> <20091120182528.GB16447@core.coreip.homeip.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20091120182528.GB16447@core.coreip.homeip.net> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org --- linux-rc/drivers/input/touchscreen/ads7846.c 2009-10-06 13:49:56.000000000 +0200 +++ linux-rc/drivers/input/touchscreen/ads7846.c 2009-10-06 21:18:25.000000000 +0200 @@ -29,10 +29,14 @@ #include #include +#ifndef VERBOSE +#undef dev_dbg +#define dev_dbg(...) do {} while(0) +#endif /* * This code has been heavily tested on a Nokia 770, and lightly - * tested on other ads7846 devices (OSK/Mistral, Lubbock). + * tested on other ads7846 devices (OSK/Mistral, Lubbock, Spitz). * TSC2046 is just newer ads7846 silicon. * Support for ads7843 tested on Atmel at91sam926x-EK. * Support for ads7845 has only been stubbed in. @@ -43,7 +47,7 @@ * have to maintain our own SW IRQ disabled status. This should be * removed as soon as the affected platform's IRQ handling is fixed. * - * app note sbaa036 talks in more detail about accurate sampling... + * App note sbaa036 talks in more detail about accurate sampling... * that ought to help in situations like LCDs inducing noise (which * can also be helped by using synch signals) and more generally. * This driver tries to utilize the measures described in the app @@ -566,10 +570,8 @@ * once more the measurement */ if (packet->tc.ignore || Rt > ts->pressure_max) { -#ifdef VERBOSE - pr_debug("%s: ignored %d pressure %d\n", - dev_name(&ts->spi->dev), packet->tc.ignore, Rt); -#endif + dev_dbg(&ts->spi->dev, "ignored %d pressure %d\n", + packet->tc.ignore, Rt); hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD), HRTIMER_MODE_REL); return; @@ -584,10 +586,11 @@ Rt = 0; } - /* NOTE: We can't rely on the pressure to determine the pen down - * state, even this controller has a pressure sensor. The pressure - * value can fluctuate for quite a while after lifting the pen and - * in some cases may not even settle at the expected value. + /* NOTE: We can't rely on the pressure to determine the pen + * down state, not even if this controller has a pressure + * sensor. The pressure value can fluctuate for quite a while + * after lifting the pen and in some cases may not even settle + * at the expected value. * * The only safe way to check for the pen up condition is in the * timer by reading the pen signal state (it's a GPIO _and_ IRQ). @@ -598,9 +601,7 @@ if (!ts->pendown) { input_report_key(input, BTN_TOUCH, 1); ts->pendown = 1; -#ifdef VERBOSE dev_dbg(&ts->spi->dev, "DOWN\n"); -#endif } if (ts->swap_xy) @@ -608,12 +609,10 @@ input_report_abs(input, ABS_X, x); input_report_abs(input, ABS_Y, y); - input_report_abs(input, ABS_PRESSURE, Rt); + input_report_abs(input, ABS_PRESSURE, ts->pressure_max-Rt); input_sync(input); -#ifdef VERBOSE dev_dbg(&ts->spi->dev, "%4d/%4d/%4d\n", x, y, Rt); -#endif } hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD), @@ -723,9 +722,7 @@ input_sync(input); ts->pendown = 0; -#ifdef VERBOSE dev_dbg(&ts->spi->dev, "UP\n"); -#endif } /* measurement cycle ended */