aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen
diff options
context:
space:
mode:
authorWolfram Sang <w.sang@pengutronix.de>2011-07-04 22:22:01 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2011-07-04 22:31:47 -0400
commit77da38387e1c6f473744afccd83795805f506498 (patch)
tree7f64688e3a44b75aaf418d000444409cacac863b /drivers/input/touchscreen
parentc8f205258bc8942e79cd37ebc1c8ec4652a1a501 (diff)
Input: wm97xx - mark channels which need pen_down
Currently, battery drivers also use poll_sample() provided by the wm97xx-core but this code always checks if the pen is down. Mark the channels which really need this (i.e. for the touchscreen) with the PEN_DOWN bit, and skip the checks otherwise. Now, the battery channels can always be read. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r--drivers/input/touchscreen/wm9705.c11
-rw-r--r--drivers/input/touchscreen/wm9712.c13
-rw-r--r--drivers/input/touchscreen/wm9713.c11
3 files changed, 20 insertions, 15 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
diff --git a/drivers/input/touchscreen/wm9712.c b/drivers/input/touchscreen/wm9712.c
index d26093f479d1..6e743e3dfda4 100644
--- a/drivers/input/touchscreen/wm9712.c
+++ b/drivers/input/touchscreen/wm9712.c
@@ -255,8 +255,9 @@ static inline int is_pden(struct wm97xx *wm)
255static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample) 255static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
256{ 256{
257 int timeout = 5 * delay; 257 int timeout = 5 * delay;
258 bool wants_pen = adcsel & WM97XX_PEN_DOWN;
258 259
259 if (!wm->pen_probably_down) { 260 if (wants_pen && !wm->pen_probably_down) {
260 u16 data = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); 261 u16 data = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD);
261 if (!(data & WM97XX_PEN_DOWN)) 262 if (!(data & WM97XX_PEN_DOWN))
262 return RC_PENUP; 263 return RC_PENUP;
@@ -300,7 +301,7 @@ static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
300 return RC_PENUP; 301 return RC_PENUP;
301 } 302 }
302 303
303 if (!(*sample & WM97XX_PEN_DOWN)) { 304 if (wants_pen && !(*sample & WM97XX_PEN_DOWN)) {
304 wm->pen_probably_down = 0; 305 wm->pen_probably_down = 0;
305 return RC_PENUP; 306 return RC_PENUP;
306 } 307 }
@@ -385,16 +386,18 @@ static int wm9712_poll_touch(struct wm97xx *wm, struct wm97xx_data *data)
385 if (rc != RC_VALID) 386 if (rc != RC_VALID)
386 return rc; 387 return rc;
387 } else { 388 } else {
388 rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_X, &data->x); 389 rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_X | WM97XX_PEN_DOWN,
390 &data->x);
389 if (rc != RC_VALID) 391 if (rc != RC_VALID)
390 return rc; 392 return rc;
391 393
392 rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_Y, &data->y); 394 rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_Y | WM97XX_PEN_DOWN,
395 &data->y);
393 if (rc != RC_VALID) 396 if (rc != RC_VALID)
394 return rc; 397 return rc;
395 398
396 if (pil && !five_wire) { 399 if (pil && !five_wire) {
397 rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_PRES, 400 rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_PRES | WM97XX_PEN_DOWN,
398 &data->p); 401 &data->p);
399 if (rc != RC_VALID) 402 if (rc != RC_VALID)
400 return rc; 403 return rc;
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;