summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorPedro Perez de Heredia <pedro.perez@digi.com>2010-04-24 21:13:07 +0200
committerPedro Perez de Heredia <pedro.perez@digi.com>2010-04-24 21:13:07 +0200
commite48c2d698321b17402aba686e6347020f29f535e (patch)
treec684dc09e52cbb349807a57f254c10bae0d629f0 /drivers/input
parentc01f2f9e2a95cdcef490534f681048d5332c37f9 (diff)
mxc_ts: improved wait on irq support, avoding a race condition
This commit improves (but not fixes) a problem detected with the touch driver, that was missing an interrupt condition (a pen down after a pen up) and was causing that the driver were not able to detect additional interrupts if the pen was down, because there were no new interrupts generated. Thsi workarounds the problem by forcing the driver to wait on interrupts only after 2 consecutive pen-up samples. This seems to fix the problem, but its not 100 sure because the problem has not been analyzed with enough detail. Signed-off-by: Pedro Perez de Heredia <pedro.perez@digi.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/mxc_ts.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/input/touchscreen/mxc_ts.c b/drivers/input/touchscreen/mxc_ts.c
index b354d81c5465..d60cd51a535e 100644
--- a/drivers/input/touchscreen/mxc_ts.c
+++ b/drivers/input/touchscreen/mxc_ts.c
@@ -44,14 +44,17 @@ static u32 input_ts_installed;
static int ts_thread(void *arg)
{
t_touch_screen ts_sample;
- s32 wait = 0;
+ s32 wait = 0, wait2 = 0;
daemonize("mxc_ts");
while (input_ts_installed) {
try_to_freeze();
memset(&ts_sample, 0, sizeof(t_touch_screen));
- if (0 != pmic_adc_get_touch_sample(&ts_sample, !wait))
+
+ /* After 2 consecutive samples with the pen up, enable irq waiting */
+ if (0 != pmic_adc_get_touch_sample(&ts_sample, !(wait + wait2))) {
continue;
+ }
if (!(ts_sample.contact_resistance || wait))
continue;
@@ -60,7 +63,7 @@ static int ts_thread(void *arg)
input_report_abs(mxc_inputdev, ABS_PRESSURE,
ts_sample.contact_resistance);
input_sync(mxc_inputdev);
-
+ wait2 = wait;
wait = ts_sample.contact_resistance;
msleep(20);
}