Input: wm831x-ts - fix races with IRQ management
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Thu, 28 Apr 2011 06:08:34 +0000 (23:08 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 28 Apr 2011 06:12:12 +0000 (23:12 -0700)
commitf5346668150c37094b42cc2d07ec5fd1451eb980
tree23fb800e00acd2142ed8e4da2df9361de3397084
parentc36b58e8a9112017c2bcc322cc98e71241814303
Input: wm831x-ts - fix races with IRQ management

If the WM831x pen down and data IRQs run in parallel it is possible for the
data and pen down IRQs to deadlock themselves as one is part way through
disabling its operation while the other is part way through enabling. Fix
this by always disabling the pen down interrupt while data is active and
vice versa.  When a changeover is required we disable the IRQ that is to
be stopped then schedule work that will enable the new IRQ.

We need to handle the data flow in the data IRQ as the readback from the
device needs to be ordered correctly with the IRQ for robust operation.

This also fixes an issue when using the built in IRQs due to enable_irq()
not being valid from interrupt context on an interrupt controller with bus
operations like the built in IRQ controller - this issue may also have
affected other interrupt controllers.  We can't rely on having the data
and pen down IRQs available via GPIOs on the CPU on every system.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
drivers/input/touchscreen/wm831x-ts.c