[PATCH 1/2] Input: tsc2007 - Disable irq when the irq thread is handling data
From: Feng Tang
Date: Tue Nov 29 2011 - 02:48:42 EST
The TSC2007 data sheet say in some case the HW may fire some false
interrrupt, which I also met during integrating one TSC2007 device.
Most of the tsc2007 platforms including ours are using a gpio line as
tsc2007's irq line, so calling disable_irq_nosync() to actually
prevent the gpio controller from firing IRQ for tsc2007 in such case.
Signed-off-by: Feng Tang <feng.tang@xxxxxxxxx>
---
drivers/input/touchscreen/tsc2007.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c
index 1f674cb..03c1961 100644
--- a/drivers/input/touchscreen/tsc2007.c
+++ b/drivers/input/touchscreen/tsc2007.c
@@ -171,6 +171,18 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
struct ts_event tc;
u32 rt;
+ /*
+ * Disable the irq, as it may fire several other IRQs during
+ * this thread is handling data, as suggested by the TSC2007
+ * datasheet, p19, "Touch Detect" chapter.
+ *
+ * Most of the tsc2007 platforms are using a gpio line as
+ * tsc2007's irq line, so calling disable_irq_nosync() will
+ * actually prevent the gpio controller from firing IRQ for
+ * this tsc2007 line in such case.
+ */
+ disable_irq_nosync(irq);
+
while (!ts->stopped && tsc2007_is_pen_down(ts)) {
/* pen is down, continue with the measurement */
@@ -221,6 +233,7 @@ static irqreturn_t tsc2007_soft_irq(int irq, void *handle)
if (ts->clear_penirq)
ts->clear_penirq();
+ enable_irq(irq);
return IRQ_HANDLED;
}
--
1.7.1
>
> Thanks.
>
> >
> > Signed-off-by: Feng Tang <feng.tang@xxxxxxxxx>
> > ---
> > drivers/input/touchscreen/tsc2007.c | 8 ++++++++
> > 1 files changed, 8 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/input/touchscreen/tsc2007.c
> > b/drivers/input/touchscreen/tsc2007.c index 1f674cb..789f216 100644
> > --- a/drivers/input/touchscreen/tsc2007.c
> > +++ b/drivers/input/touchscreen/tsc2007.c
> > @@ -171,6 +171,13 @@ static irqreturn_t tsc2007_soft_irq(int irq,
> > void *handle) struct ts_event tc;
> > u32 rt;
> >
> > + /*
> > + * Disable the irq, as it may fire several other IRQs
> > during
> > + * this thread is handling data, as suggested by the
> > TSC2007
> > + * datasheet, p19, "Touch Detect" chapter
> > + */
> > + disable_irq_nosync(irq);
> > +
> > while (!ts->stopped && tsc2007_is_pen_down(ts)) {
> >
> > /* pen is down, continue with the measurement */
> > @@ -221,6 +228,7 @@ static irqreturn_t tsc2007_soft_irq(int irq,
> > void *handle) if (ts->clear_penirq)
> > ts->clear_penirq();
> >
> > + enable_irq(irq);
> > return IRQ_HANDLED;
> > }
> >
> > --
> > 1.7.1
> >
> >
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/