summaryrefslogtreecommitdiff
path: root/drivers/input/touchscreen/wm9713.c
diff options
context:
space:
mode:
authorWolfram Sang <w.sang@pengutronix.de>2011-07-05 06:22:01 +0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2011-07-05 06:31:47 +0400
commit77da38387e1c6f473744afccd83795805f506498 (patch)
tree7f64688e3a44b75aaf418d000444409cacac863b /drivers/input/touchscreen/wm9713.c
parentc8f205258bc8942e79cd37ebc1c8ec4652a1a501 (diff)
downloadlinux-77da38387e1c6f473744afccd83795805f506498.tar.xz
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/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)
{
u16 dig1;
int timeout = 5 * delay;
+ bool wants_pen = adcsel & WM97XX_PEN_DOWN;
- if (!wm->pen_probably_down) {
+ if (wants_pen && !wm->pen_probably_down) {
u16 data = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD);
if (!(data & WM97XX_PEN_DOWN))
return RC_PENUP;
@@ -310,7 +311,7 @@ static int wm9713_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
return RC_PENUP;
}
- if (!(*sample & WM97XX_PEN_DOWN)) {
+ if (wants_pen && !(*sample & WM97XX_PEN_DOWN)) {
wm->pen_probably_down = 0;
return RC_PENUP;
}
@@ -400,14 +401,14 @@ static int wm9713_poll_touch(struct wm97xx *wm, struct wm97xx_data *data)
if (rc != RC_VALID)
return rc;
} else {
- rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_X, &data->x);
+ rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_X | WM97XX_PEN_DOWN, &data->x);
if (rc != RC_VALID)
return rc;
- rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_Y, &data->y);
+ rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_Y | WM97XX_PEN_DOWN, &data->y);
if (rc != RC_VALID)
return rc;
if (pil) {
- rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_PRES,
+ rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_PRES | WM97XX_PEN_DOWN,
&data->p);
if (rc != RC_VALID)
return rc;