aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/wm9705.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/touchscreen/wm9705.c')
-rw-r--r--drivers/input/touchscreen/wm9705.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/input/touchscreen/wm9705.c b/drivers/input/touchscreen/wm9705.c
index 363d61dbe83c..adc13a523ab5 100644
--- a/drivers/input/touchscreen/wm9705.c
+++ b/drivers/input/touchscreen/wm9705.c
@@ -215,8 +215,9 @@ static inline int is_pden(struct wm97xx *wm)
215static int wm9705_poll_sample(struct wm97xx *wm, int adcsel, int *sample) 215static int wm9705_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
216{ 216{
217 int timeout = 5 * delay; 217 int timeout = 5 * delay;
218 bool wants_pen = adcsel & WM97XX_PEN_DOWN;
218 219
219 if (!wm->pen_probably_down) { 220 if (wants_pen && !wm->pen_probably_down) {
220 u16 data = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); 221 u16 data = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD);
221 if (!(data & WM97XX_PEN_DOWN)) 222 if (!(data & WM97XX_PEN_DOWN))
222 return RC_PENUP; 223 return RC_PENUP;
@@ -260,7 +261,7 @@ static int wm9705_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
260 return RC_PENUP; 261 return RC_PENUP;
261 } 262 }
262 263
263 if (!(*sample & WM97XX_PEN_DOWN)) { 264 if (wants_pen && !(*sample & WM97XX_PEN_DOWN)) {
264 wm->pen_probably_down = 0; 265 wm->pen_probably_down = 0;
265 return RC_PENUP; 266 return RC_PENUP;
266 } 267 }
@@ -275,14 +276,14 @@ static int wm9705_poll_touch(struct wm97xx *wm, struct wm97xx_data *data)
275{ 276{
276 int rc; 277 int rc;
277 278
278 rc = wm9705_poll_sample(wm, WM97XX_ADCSEL_X, &data->x); 279 rc = wm9705_poll_sample(wm, WM97XX_ADCSEL_X | WM97XX_PEN_DOWN, &data->x);
279 if (rc != RC_VALID) 280 if (rc != RC_VALID)
280 return rc; 281 return rc;
281 rc = wm9705_poll_sample(wm, WM97XX_ADCSEL_Y, &data->y); 282 rc = wm9705_poll_sample(wm, WM97XX_ADCSEL_Y | WM97XX_PEN_DOWN, &data->y);
282 if (rc != RC_VALID) 283 if (rc != RC_VALID)
283 return rc; 284 return rc;
284 if (pil) { 285 if (pil) {
285 rc = wm9705_poll_sample(wm, WM97XX_ADCSEL_PRES, &data->p); 286 rc = wm9705_poll_sample(wm, WM97XX_ADCSEL_PRES | WM97XX_PEN_DOWN, &data->p);
286 if (rc != RC_VALID) 287 if (rc != RC_VALID)
287 return rc; 288 return rc;
288 } else 289 } else