From patchwork Tue May 17 08:56:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 791002 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4H8uIRH027039 for ; Tue, 17 May 2011 08:56:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752359Ab1EQI4S (ORCPT ); Tue, 17 May 2011 04:56:18 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:58508 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752294Ab1EQI4R (ORCPT ); Tue, 17 May 2011 04:56:17 -0400 Received: from localhost (p548E0077.dip0.t-ipconnect.de [84.142.0.119]) by mrelayeu.kundenserver.de (node=mreu4) with ESMTP (Nemesis) id 0MUgUR-1QDDnY0caJ-00RLOH; Tue, 17 May 2011 10:56:15 +0200 From: Thierry Reding To: linux-input@vger.kernel.org Cc: Dmitry Torokhov , Kwangwoo Lee Subject: [PATCH v2 4/5] tsc2007: Add poll_period parameter to platform data. Date: Tue, 17 May 2011 10:56:11 +0200 Message-Id: <1305622572-3154-4-git-send-email-thierry.reding@avionic-design.de> X-Mailer: git-send-email 1.7.5.1 X-Provags-ID: V02:K0:zSEVx6H9doBHxFeNEkoDPV8vFPeAayO0ojE/C9ciDYF HlremefP/bP9MMA+wYqHk9YUKhlk4Fp0Pp33mmTTWftv3IOpE/ Y6kL6qxp1P3ytqMFjpe4ngJNTwfLht1J114YeW7jKOsTe8qcn4 VH5S0JkdEciTJsNGfwy/3s6czikaAVmmAsJ1bRCCaSM4K8PxvW 4xKn+FPpjN46JHQinh4A4EXDXukPYLA/zfPr2nrsYA= 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 (demeter2.kernel.org [140.211.167.43]); Tue, 17 May 2011 08:56:19 +0000 (UTC) This new parameter allows the polling frequency to be configured while keeping the default of once every millisecond. Changes in v2: - Move poll_period parameter to platform data. Cc: Dmitry Torokhov Cc: Kwangwoo Lee Signed-off-by: Thierry Reding --- drivers/input/touchscreen/tsc2007.c | 6 +++--- include/linux/i2c/tsc2007.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c index faa82dd..87c40c7 100644 --- a/drivers/input/touchscreen/tsc2007.c +++ b/drivers/input/touchscreen/tsc2007.c @@ -27,8 +27,6 @@ #include #include -#define TS_POLL_PERIOD 1 /* ms delay between samples */ - #define TSC2007_MEASURE_TEMP0 (0x0 << 4) #define TSC2007_MEASURE_AUX (0x2 << 4) #define TSC2007_MEASURE_TEMP1 (0x4 << 4) @@ -76,6 +74,7 @@ struct tsc2007 { u16 x_plate_ohms; u16 max_rt; unsigned long poll_delay; + unsigned long poll_period; bool pendown; int irq; @@ -230,7 +229,7 @@ static void tsc2007_work(struct work_struct *work) out: if (ts->pendown || debounced) schedule_delayed_work(&ts->work, - msecs_to_jiffies(TS_POLL_PERIOD)); + msecs_to_jiffies(ts->poll_period)); else enable_irq(ts->irq); } @@ -297,6 +296,7 @@ static int __devinit tsc2007_probe(struct i2c_client *client, ts->x_plate_ohms = pdata->x_plate_ohms; ts->max_rt = pdata->max_rt ? : MAX_12BIT; ts->poll_delay = pdata->poll_delay ? : 1; + ts->poll_period = pdata->poll_period ? : 1; 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 342b130..a51dac0 100644 --- a/include/linux/i2c/tsc2007.h +++ b/include/linux/i2c/tsc2007.h @@ -9,6 +9,7 @@ struct tsc2007_platform_data { u16 max_rt; /* max. resistance above which samples are ignored */ unsigned long poll_delay; /* delay (in ms) after pen-down event before polling starts */ + unsigned long poll_period; /* time (in ms) between samples */ int (*get_pendown_state)(void); void (*clear_penirq)(void); /* If needed, clear 2nd level