aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/wm9713.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/touchscreen/wm9713.c')
-rw-r--r--drivers/input/touchscreen/wm9713.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/input/touchscreen/wm9713.c b/drivers/input/touchscreen/wm9713.c
index a7558015429b..7405353199d7 100644
--- a/drivers/input/touchscreen/wm9713.c
+++ b/drivers/input/touchscreen/wm9713.c
@@ -261,8 +261,9 @@ static int wm9713_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
261{ 261{
262 u16 dig1; 262 u16 dig1;
263 int timeout = 5 * delay; 263 int timeout = 5 * delay;
264 bool wants_pen = adcsel & WM97XX_PEN_DOWN;
264 265
265 if (!wm->pen_probably_down) { 266 if (wants_pen && !wm->pen_probably_down) {
266 u16 data = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); 267 u16 data = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD);
267 if (!(data & WM97XX_PEN_DOWN)) 268 if (!(data & WM97XX_PEN_DOWN))
268 return RC_PENUP; 269 return RC_PENUP;
@@ -310,7 +311,7 @@ static int wm9713_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
310 return RC_PENUP; 311 return RC_PENUP;
311 } 312 }
312 313
313 if (!(*sample & WM97XX_PEN_DOWN)) { 314 if (wants_pen && !(*sample & WM97XX_PEN_DOWN)) {
314 wm->pen_probably_down = 0; 315 wm->pen_probably_down = 0;
315 return RC_PENUP; 316 return RC_PENUP;
316 } 317 }
@@ -400,14 +401,14 @@ static int wm9713_poll_touch(struct wm97xx *wm, struct wm97xx_data *data)
400 if (rc != RC_VALID) 401 if (rc != RC_VALID)
401 return rc; 402 return rc;
402 } else { 403 } else {
403 rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_X, &data->x); 404 rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_X | WM97XX_PEN_DOWN, &data->x);
404 if (rc != RC_VALID) 405 if (rc != RC_VALID)
405 return rc; 406 return rc;
406 rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_Y, &data->y); 407 rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_Y | WM97XX_PEN_DOWN, &data->y);
407 if (rc != RC_VALID) 408 if (rc != RC_VALID)
408 return rc; 409 return rc;
409 if (pil) { 410 if (pil) {
410 rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_PRES, 411 rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_PRES | WM97XX_PEN_DOWN,
411 &data->p); 412 &data->p);
412 if (rc != RC_VALID) 413 if (rc != RC_VALID)
413 return rc; 414 return rc;