diff options
author | Semih Hazar <semih.hazar@indefia.com> | 2007-07-18 00:36:04 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2007-07-18 00:36:04 -0400 |
commit | 1d25891f3241103d14ea78236504474a138b8ada (patch) | |
tree | caeef0ea5f41eae2a005b6eab642e823d4791a0f /drivers/input/touchscreen/ads7846.c | |
parent | e4f48861993294c27849076741eb0c090482560b (diff) |
Input: ads7846 - re-check pendown status before reporting events
Pendown status from the PENIRQ pin is currently read only at the beginning
of a sample set. If the pen is lifted just after sampling has began then
sampled values become wrong.
This patch adds an optional platform penirq_recheck_delay attribute. If
non-zero, samples are only reported to the input subsystem if PENIRQ is
still active that long after the samples taken.
Signed-off-by: Semih Hazar <semih.hazar@indefia.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen/ads7846.c')
-rw-r--r-- | drivers/input/touchscreen/ads7846.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 103ee6ad299e..96581d08774f 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -107,6 +107,8 @@ struct ads7846 { | |||
107 | u16 debounce_tol; | 107 | u16 debounce_tol; |
108 | u16 debounce_rep; | 108 | u16 debounce_rep; |
109 | 109 | ||
110 | u16 penirq_recheck_delay_usecs; | ||
111 | |||
110 | spinlock_t lock; | 112 | spinlock_t lock; |
111 | struct hrtimer timer; | 113 | struct hrtimer timer; |
112 | unsigned pendown:1; /* P: lock */ | 114 | unsigned pendown:1; /* P: lock */ |
@@ -553,6 +555,15 @@ static void ads7846_rx(void *ads) | |||
553 | return; | 555 | return; |
554 | } | 556 | } |
555 | 557 | ||
558 | /* Maybe check the pendown state before reporting. This discards | ||
559 | * false readings when the pen is lifted. | ||
560 | */ | ||
561 | if (ts->penirq_recheck_delay_usecs) { | ||
562 | udelay(ts->penirq_recheck_delay_usecs); | ||
563 | if (!ts->get_pendown_state()) | ||
564 | Rt = 0; | ||
565 | } | ||
566 | |||
556 | /* NOTE: We can't rely on the pressure to determine the pen down | 567 | /* NOTE: We can't rely on the pressure to determine the pen down |
557 | * state, even this controller has a pressure sensor. The pressure | 568 | * state, even this controller has a pressure sensor. The pressure |
558 | * value can fluctuate for quite a while after lifting the pen and | 569 | * value can fluctuate for quite a while after lifting the pen and |
@@ -896,6 +907,10 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
896 | ts->filter = ads7846_no_filter; | 907 | ts->filter = ads7846_no_filter; |
897 | ts->get_pendown_state = pdata->get_pendown_state; | 908 | ts->get_pendown_state = pdata->get_pendown_state; |
898 | 909 | ||
910 | if (pdata->penirq_recheck_delay_usecs) | ||
911 | ts->penirq_recheck_delay_usecs = | ||
912 | pdata->penirq_recheck_delay_usecs; | ||
913 | |||
899 | snprintf(ts->phys, sizeof(ts->phys), "%s/input0", spi->dev.bus_id); | 914 | snprintf(ts->phys, sizeof(ts->phys), "%s/input0", spi->dev.bus_id); |
900 | 915 | ||
901 | input_dev->name = "ADS784x Touchscreen"; | 916 | input_dev->name = "ADS784x Touchscreen"; |