From patchwork Tue Sep 22 13:45:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmljaGFyZCBSw4PCtmpmb3Jz?= X-Patchwork-Id: 49291 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 n8MECg5S023700 for ; Tue, 22 Sep 2009 14:12:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756636AbZIVOMF (ORCPT ); Tue, 22 Sep 2009 10:12:05 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756635AbZIVOMF (ORCPT ); Tue, 22 Sep 2009 10:12:05 -0400 Received: from av12-2-sn2.hy.skanova.net ([81.228.8.186]:50985 "EHLO av12-2-sn2.hy.skanova.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756666AbZIVOMD (ORCPT ); Tue, 22 Sep 2009 10:12:03 -0400 X-Greylist: delayed 1575 seconds by postgrey-1.27 at vger.kernel.org; Tue, 22 Sep 2009 10:12:02 EDT Received: by av12-2-sn2.hy.skanova.net (Postfix, from userid 502) id DE8AD38064; Tue, 22 Sep 2009 15:45:50 +0200 (CEST) Received: from smtp4-1-sn2.hy.skanova.net (smtp4-1-sn2.hy.skanova.net [81.228.8.92]) by av12-2-sn2.hy.skanova.net (Postfix) with ESMTP id B75C73805E; Tue, 22 Sep 2009 15:45:50 +0200 (CEST) Received: from [10.0.1.199] (81-231-246-25-no35.business.telia.com [81.231.246.25]) by smtp4-1-sn2.hy.skanova.net (Postfix) with ESMTP id 846AF37E51; Tue, 22 Sep 2009 15:45:50 +0200 (CEST) Message-ID: <4AB8D50D.5040204@mocean-labs.com> Date: Tue, 22 Sep 2009 15:45:49 +0200 From: =?ISO-8859-1?Q?Richard_R=F6jfors?= User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090701) MIME-Version: 1.0 To: linux-input@vger.kernel.org Cc: Dmitry Torokhov , kwangwoo.lee@gmail.com, Thierry Reding , Trilok Soni Subject: [PATCH] tsc2007: ignore IRQ:s provoked when reading values X-Enigmail-Version: 0.95.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org This patch ignores IRQ:s provoked when reading values from the controller, when the get_pendown_state callback is not implement. If this interrupt is not ignored the driver ends up polling the device, since the driver provokes new interrupts while reading values. Signed-off-by: Richard Röjfors --- -- 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 diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c index 4c51cb4..e594479 100644 --- a/drivers/input/touchscreen/tsc2007.c +++ b/drivers/input/touchscreen/tsc2007.c @@ -77,6 +77,7 @@ struct tsc2007 { u16 x_plate_ohms; bool pendown; + bool ignore_next_irq; int irq; int (*get_pendown_state)(void); @@ -228,14 +229,35 @@ static void tsc2007_work(struct work_struct *work) if (ts->pendown) schedule_delayed_work(&ts->work, msecs_to_jiffies(TS_POLL_PERIOD)); - else + else { + /* if we don't have the get pen down state callback we + * ignore the next IRQ because it is provoked when we checked + * the touch pressure. + * If the user really touches the screen we will get a new + * interrupt anyway so it is safe to ignore it + * + * This is basically implementing this part of the manual: + * "In both cases previously listed, it is recommended that + * whenever the host writes to the TSC2007, the master + * processor masks the interrupt associated to PENIRQ. + * This masking prevents false triggering of interrupts when + * the PENIRQ line is disabled in the cases previously listed." + */ + if (!ts->get_pendown_state) + ts->ignore_next_irq = true; enable_irq(ts->irq); + } } static irqreturn_t tsc2007_irq(int irq, void *handle) { struct tsc2007 *ts = handle; + if (ts->ignore_next_irq) { + ts->ignore_next_irq = false; + return IRQ_HANDLED; + } + if (!ts->get_pendown_state || likely(ts->get_pendown_state())) { disable_irq_nosync(ts->irq); schedule_delayed_work(&ts->work,