From patchwork Fri Jun 11 12:36:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?UmljaGFyZCBSw4PCtmpmb3Jz?= X-Patchwork-Id: 105569 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5BCgmOa014930 for ; Fri, 11 Jun 2010 12:42:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755080Ab0FKMms (ORCPT ); Fri, 11 Jun 2010 08:42:48 -0400 Received: from smtp-gw11.han.skanova.net ([81.236.55.20]:40762 "EHLO smtp-gw11.han.skanova.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754326Ab0FKMmr (ORCPT ); Fri, 11 Jun 2010 08:42:47 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 11 Jun 2010 12:42:49 +0000 (UTC) X-Greylist: delayed 348 seconds by postgrey-1.27 at vger.kernel.org; Fri, 11 Jun 2010 08:42:47 EDT Received: from [10.8.36.156] (194.237.7.146) by smtp-gw11.han.skanova.net (8.5.114) id 4C061AA70018640C; Fri, 11 Jun 2010 14:36:57 +0200 Subject: [PATCH] tsc2007: Add z1 lower threshold From: Richard =?ISO-8859-1?Q?R=F6jfors?= To: linux-input@vger.kernel.org Cc: dmitry.torokhov@gmail.com, kwangwoo.lee@gmail.com, thierry.reding@avionic-design.de, soni.trilok@gmail.com Date: Fri, 11 Jun 2010 14:36:56 +0200 Message-ID: <1276259816.12874.5.camel@debian> Mime-Version: 1.0 X-Mailer: Evolution 2.30.1.2 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c index be23780..fffa448 100644 --- a/drivers/input/touchscreen/tsc2007.c +++ b/drivers/input/touchscreen/tsc2007.c @@ -75,6 +75,7 @@ struct tsc2007 { u16 model; u16 x_plate_ohms; + u16 z1_low_threshold; bool pendown; int irq; @@ -129,7 +130,7 @@ static u32 tsc2007_calculate_pressure(struct tsc2007 *tsc, struct ts_event *tc) if (tc->x == MAX_12BIT) tc->x = 0; - if (likely(tc->x && tc->z1)) { + if (likely(tc->x && (tc->z1 > tsc->z1_low_threshold))) { /* compute touch pressure resistance using equation #1 */ rt = tc->z2 - tc->z1; rt *= tc->x; @@ -292,6 +293,7 @@ static int __devinit tsc2007_probe(struct i2c_client *client, ts->model = pdata->model; ts->x_plate_ohms = pdata->x_plate_ohms; + ts->z1_low_threshold = pdata->z1_low_threshold; ts->get_pendown_state = pdata->get_pendown_state; ts->clear_penirq = pdata->clear_penirq; diff --git a/include/linux/i2c/tsc2007.h b/include/linux/i2c/tsc2007.h index c6361fb..75b75fb 100644 --- a/include/linux/i2c/tsc2007.h +++ b/include/linux/i2c/tsc2007.h @@ -3,13 +3,27 @@ /* linux/i2c/tsc2007.h */ +/** + * struct tsc2007_platform_data - Platform data of the TSC2007 driver + * + * @model: Touch controller model, currently 2003 or 2007. + * @x_plate_ohms: X-Plate resistance. + * @z1_low_threshold: All measured Z1 values below or equal to the threshold + * are regarded as 0. + * @get_pendown_state: Optional callback used to check if the film is touched. + * Can be useful since the pressure value can fluctuate for + * quite a while after lifting the pen. + * @clear_penirq: Optional callback clear 2nd level interrupt source. + * @init_platform_hw: Optional callback to initialise the hardware. + * @exit_platform_hw: Optional callback to de-initialise the hardware. + */ struct tsc2007_platform_data { - u16 model; /* 2007. */ + u16 model; u16 x_plate_ohms; + u16 z1_low_threshold; int (*get_pendown_state)(void); - void (*clear_penirq)(void); /* If needed, clear 2nd level - interrupt source */ + void (*clear_penirq)(void); int (*init_platform_hw)(void); void (*exit_platform_hw)(void); };