diff options
author | Wolfram Sang <w.sang@pengutronix.de> | 2011-07-04 22:22:01 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-07-04 22:31:47 -0400 |
commit | 77da38387e1c6f473744afccd83795805f506498 (patch) | |
tree | 7f64688e3a44b75aaf418d000444409cacac863b /drivers/input/touchscreen/wm9712.c | |
parent | c8f205258bc8942e79cd37ebc1c8ec4652a1a501 (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/wm9712.c')
-rw-r--r-- | drivers/input/touchscreen/wm9712.c | 13 |
1 files changed, 8 insertions, 5 deletions
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) | |||
255 | static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample) | 255 | static 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; |