aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/da9034-ts.c
diff options
context:
space:
mode:
authorEric Miao <eric.y.miao@gmail.com>2009-04-14 13:38:35 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-04-15 11:58:22 -0400
commit7f6d5ff22b06d0c4db7b3b1eae336a19e88f808c (patch)
tree398a0a72a95d0db453fa702e20c8e8654eaf034a /drivers/input/touchscreen/da9034-ts.c
parent93ff27c66de5c9eb0ead1e6f979afa97cbcf1e9d (diff)
Input: da9034-ts - make pen {down,up} events more reliable
PEN_{UP/DOWN} events are expected to be available soon after stopping TSI auto measurement, but this is found not always be true. Work around this by adding delay and simulating such an event (according to pen down status bit). Signed-off-by: Bin Yang <bin.yang@marvell.com> Signed-off-by: Eric Miao <eric.miao@marvell.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen/da9034-ts.c')
-rw-r--r--drivers/input/touchscreen/da9034-ts.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/input/touchscreen/da9034-ts.c b/drivers/input/touchscreen/da9034-ts.c
index 666a6e74be40..3ffd4c4b170c 100644
--- a/drivers/input/touchscreen/da9034-ts.c
+++ b/drivers/input/touchscreen/da9034-ts.c
@@ -176,6 +176,16 @@ static void da9034_event_handler(struct da9034_touch *touch, int event)
176 goto err_reset; 176 goto err_reset;
177 177
178 touch->state = STATE_STOP; 178 touch->state = STATE_STOP;
179
180 /* FIXME: PEN_{UP/DOWN} events are expected to be
181 * available by stopping TSI, but this is found not
182 * always true, delay and simulate such an event
183 * here is more reliable
184 */
185 mdelay(1);
186 da9034_event_handler(touch,
187 is_pen_down(touch) ? EVENT_PEN_DOWN :
188 EVENT_PEN_UP);
179 break; 189 break;
180 190
181 case STATE_STOP: 191 case STATE_STOP:
@@ -190,8 +200,6 @@ static void da9034_event_handler(struct da9034_touch *touch, int event)
190 report_pen_up(touch); 200 report_pen_up(touch);
191 touch->state = STATE_IDLE; 201 touch->state = STATE_IDLE;
192 } 202 }
193
194 input_sync(touch->input_dev);
195 break; 203 break;
196 204
197 case STATE_WAIT: 205 case STATE_WAIT:
@@ -201,8 +209,10 @@ static void da9034_event_handler(struct da9034_touch *touch, int event)
201 if (is_pen_down(touch)) { 209 if (is_pen_down(touch)) {
202 start_tsi(touch); 210 start_tsi(touch);
203 touch->state = STATE_BUSY; 211 touch->state = STATE_BUSY;
204 } else 212 } else {
213 report_pen_up(touch);
205 touch->state = STATE_IDLE; 214 touch->state = STATE_IDLE;
215 }
206 break; 216 break;
207 } 217 }
208 return; 218 return;
@@ -227,16 +237,12 @@ static int da9034_touch_notifier(struct notifier_block *nb,
227 struct da9034_touch *touch = 237 struct da9034_touch *touch =
228 container_of(nb, struct da9034_touch, notifier); 238 container_of(nb, struct da9034_touch, notifier);
229 239
230 if (event & DA9034_EVENT_PEN_DOWN) {
231 if (is_pen_down(touch))
232 da9034_event_handler(touch, EVENT_PEN_DOWN);
233 else
234 da9034_event_handler(touch, EVENT_PEN_UP);
235 }
236
237 if (event & DA9034_EVENT_TSI_READY) 240 if (event & DA9034_EVENT_TSI_READY)
238 da9034_event_handler(touch, EVENT_TSI_READY); 241 da9034_event_handler(touch, EVENT_TSI_READY);
239 242
243 if ((event & DA9034_EVENT_PEN_DOWN) && touch->state == STATE_IDLE)
244 da9034_event_handler(touch, EVENT_PEN_DOWN);
245
240 return 0; 246 return 0;
241} 247}
242 248