mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-24 17:23:25 -05:00
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>
This commit is contained in:
parent
c8f205258b
commit
77da38387e
3 changed files with 20 additions and 15 deletions
|
@ -215,8 +215,9 @@ static inline int is_pden(struct wm97xx *wm)
|
||||||
static int wm9705_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
|
static int wm9705_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
|
||||||
{
|
{
|
||||||
int timeout = 5 * delay;
|
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);
|
u16 data = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD);
|
||||||
if (!(data & WM97XX_PEN_DOWN))
|
if (!(data & WM97XX_PEN_DOWN))
|
||||||
return RC_PENUP;
|
return RC_PENUP;
|
||||||
|
@ -260,7 +261,7 @@ static int wm9705_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
|
||||||
return RC_PENUP;
|
return RC_PENUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(*sample & WM97XX_PEN_DOWN)) {
|
if (wants_pen && !(*sample & WM97XX_PEN_DOWN)) {
|
||||||
wm->pen_probably_down = 0;
|
wm->pen_probably_down = 0;
|
||||||
return RC_PENUP;
|
return RC_PENUP;
|
||||||
}
|
}
|
||||||
|
@ -275,14 +276,14 @@ static int wm9705_poll_touch(struct wm97xx *wm, struct wm97xx_data *data)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = wm9705_poll_sample(wm, WM97XX_ADCSEL_X, &data->x);
|
rc = wm9705_poll_sample(wm, WM97XX_ADCSEL_X | WM97XX_PEN_DOWN, &data->x);
|
||||||
if (rc != RC_VALID)
|
if (rc != RC_VALID)
|
||||||
return rc;
|
return rc;
|
||||||
rc = wm9705_poll_sample(wm, WM97XX_ADCSEL_Y, &data->y);
|
rc = wm9705_poll_sample(wm, WM97XX_ADCSEL_Y | WM97XX_PEN_DOWN, &data->y);
|
||||||
if (rc != RC_VALID)
|
if (rc != RC_VALID)
|
||||||
return rc;
|
return rc;
|
||||||
if (pil) {
|
if (pil) {
|
||||||
rc = wm9705_poll_sample(wm, WM97XX_ADCSEL_PRES, &data->p);
|
rc = wm9705_poll_sample(wm, WM97XX_ADCSEL_PRES | WM97XX_PEN_DOWN, &data->p);
|
||||||
if (rc != RC_VALID)
|
if (rc != RC_VALID)
|
||||||
return rc;
|
return rc;
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -255,8 +255,9 @@ static inline int is_pden(struct wm97xx *wm)
|
||||||
static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
|
static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
|
||||||
{
|
{
|
||||||
int timeout = 5 * delay;
|
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);
|
u16 data = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD);
|
||||||
if (!(data & WM97XX_PEN_DOWN))
|
if (!(data & WM97XX_PEN_DOWN))
|
||||||
return RC_PENUP;
|
return RC_PENUP;
|
||||||
|
@ -300,7 +301,7 @@ static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
|
||||||
return RC_PENUP;
|
return RC_PENUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(*sample & WM97XX_PEN_DOWN)) {
|
if (wants_pen && !(*sample & WM97XX_PEN_DOWN)) {
|
||||||
wm->pen_probably_down = 0;
|
wm->pen_probably_down = 0;
|
||||||
return RC_PENUP;
|
return RC_PENUP;
|
||||||
}
|
}
|
||||||
|
@ -385,16 +386,18 @@ static int wm9712_poll_touch(struct wm97xx *wm, struct wm97xx_data *data)
|
||||||
if (rc != RC_VALID)
|
if (rc != RC_VALID)
|
||||||
return rc;
|
return rc;
|
||||||
} else {
|
} else {
|
||||||
rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_X, &data->x);
|
rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_X | WM97XX_PEN_DOWN,
|
||||||
|
&data->x);
|
||||||
if (rc != RC_VALID)
|
if (rc != RC_VALID)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_Y, &data->y);
|
rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_Y | WM97XX_PEN_DOWN,
|
||||||
|
&data->y);
|
||||||
if (rc != RC_VALID)
|
if (rc != RC_VALID)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
if (pil && !five_wire) {
|
if (pil && !five_wire) {
|
||||||
rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_PRES,
|
rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_PRES | WM97XX_PEN_DOWN,
|
||||||
&data->p);
|
&data->p);
|
||||||
if (rc != RC_VALID)
|
if (rc != RC_VALID)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
|
@ -261,8 +261,9 @@ static int wm9713_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
|
||||||
{
|
{
|
||||||
u16 dig1;
|
u16 dig1;
|
||||||
int timeout = 5 * delay;
|
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);
|
u16 data = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD);
|
||||||
if (!(data & WM97XX_PEN_DOWN))
|
if (!(data & WM97XX_PEN_DOWN))
|
||||||
return RC_PENUP;
|
return RC_PENUP;
|
||||||
|
@ -310,7 +311,7 @@ static int wm9713_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
|
||||||
return RC_PENUP;
|
return RC_PENUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(*sample & WM97XX_PEN_DOWN)) {
|
if (wants_pen && !(*sample & WM97XX_PEN_DOWN)) {
|
||||||
wm->pen_probably_down = 0;
|
wm->pen_probably_down = 0;
|
||||||
return RC_PENUP;
|
return RC_PENUP;
|
||||||
}
|
}
|
||||||
|
@ -400,14 +401,14 @@ static int wm9713_poll_touch(struct wm97xx *wm, struct wm97xx_data *data)
|
||||||
if (rc != RC_VALID)
|
if (rc != RC_VALID)
|
||||||
return rc;
|
return rc;
|
||||||
} else {
|
} 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)
|
if (rc != RC_VALID)
|
||||||
return rc;
|
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)
|
if (rc != RC_VALID)
|
||||||
return rc;
|
return rc;
|
||||||
if (pil) {
|
if (pil) {
|
||||||
rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_PRES,
|
rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_PRES | WM97XX_PEN_DOWN,
|
||||||
&data->p);
|
&data->p);
|
||||||
if (rc != RC_VALID)
|
if (rc != RC_VALID)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
Loading…
Add table
Reference in a new issue