Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 260764
b: refs/heads/master
c: c8f2052
h: refs/heads/master
v: v3
  • Loading branch information
Wolfram Sang authored and Dmitry Torokhov committed Jul 5, 2011
1 parent 60e5716 commit 7b0110b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 32 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2456689b3b11ddecc091cd5f00b9adea6a9854cf
refs/heads/master: c8f205258bc8942e79cd37ebc1c8ec4652a1a501
14 changes: 6 additions & 8 deletions trunk/drivers/input/touchscreen/wm9705.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,10 @@ static int wm9705_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
}

/* set up digitiser */
if (adcsel & 0x8000)
adcsel = ((adcsel & 0x7fff) + 3) << 12;

if (wm->mach_ops && wm->mach_ops->pre_sample)
wm->mach_ops->pre_sample(adcsel);
wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1,
adcsel | WM97XX_POLL | WM97XX_DELAY(delay));
wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, (adcsel & WM97XX_ADCSEL_MASK)
| WM97XX_POLL | WM97XX_DELAY(delay));

/* wait 3 AC97 time slots + delay for conversion */
poll_delay(delay);
Expand All @@ -256,9 +253,10 @@ static int wm9705_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
wm->mach_ops->post_sample(adcsel);

/* check we have correct sample */
if ((*sample & WM97XX_ADCSEL_MASK) != adcsel) {
dev_dbg(wm->dev, "adc wrong sample, read %x got %x", adcsel,
*sample & WM97XX_ADCSEL_MASK);
if ((*sample ^ adcsel) & WM97XX_ADCSEL_MASK) {
dev_dbg(wm->dev, "adc wrong sample, wanted %x got %x",
adcsel & WM97XX_ADCSEL_MASK,
*sample & WM97XX_ADCSEL_MASK);
return RC_PENUP;
}

Expand Down
14 changes: 6 additions & 8 deletions trunk/drivers/input/touchscreen/wm9712.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,10 @@ static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
}

/* set up digitiser */
if (adcsel & 0x8000)
adcsel = ((adcsel & 0x7fff) + 3) << 12;

if (wm->mach_ops && wm->mach_ops->pre_sample)
wm->mach_ops->pre_sample(adcsel);
wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1,
adcsel | WM97XX_POLL | WM97XX_DELAY(delay));
wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, (adcsel & WM97XX_ADCSEL_MASK)
| WM97XX_POLL | WM97XX_DELAY(delay));

/* wait 3 AC97 time slots + delay for conversion */
poll_delay(delay);
Expand All @@ -296,9 +293,10 @@ static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
wm->mach_ops->post_sample(adcsel);

/* check we have correct sample */
if ((*sample & WM97XX_ADCSEL_MASK) != adcsel) {
dev_dbg(wm->dev, "adc wrong sample, read %x got %x", adcsel,
*sample & WM97XX_ADCSEL_MASK);
if ((*sample ^ adcsel) & WM97XX_ADCSEL_MASK) {
dev_dbg(wm->dev, "adc wrong sample, wanted %x got %x",
adcsel & WM97XX_ADCSEL_MASK,
*sample & WM97XX_ADCSEL_MASK);
return RC_PENUP;
}

Expand Down
18 changes: 9 additions & 9 deletions trunk/drivers/input/touchscreen/wm9713.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,14 @@ static int wm9713_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
}

/* set up digitiser */
if (adcsel & 0x8000)
adcsel = 1 << ((adcsel & 0x7fff) + 3);

dig1 = wm97xx_reg_read(wm, AC97_WM9713_DIG1);
dig1 &= ~WM9713_ADCSEL_MASK;
/* WM97XX_ADCSEL_* channels need to be converted to WM9713 format */
dig1 |= 1 << ((adcsel & WM97XX_ADCSEL_MASK) >> 12);

if (wm->mach_ops && wm->mach_ops->pre_sample)
wm->mach_ops->pre_sample(adcsel);
wm97xx_reg_write(wm, AC97_WM9713_DIG1, dig1 | adcsel | WM9713_POLL);
wm97xx_reg_write(wm, AC97_WM9713_DIG1, dig1 | WM9713_POLL);

/* wait 3 AC97 time slots + delay for conversion */
poll_delay(delay);
Expand All @@ -304,8 +303,9 @@ static int wm9713_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
wm->mach_ops->post_sample(adcsel);

/* check we have correct sample */
if ((*sample & WM97XX_ADCSEL_MASK) != ffs(adcsel >> 1) << 12) {
dev_dbg(wm->dev, "adc wrong sample, read %x got %x", adcsel,
if ((*sample ^ adcsel) & WM97XX_ADCSEL_MASK) {
dev_dbg(wm->dev, "adc wrong sample, wanted %x got %x",
adcsel & WM97XX_ADCSEL_MASK,
*sample & WM97XX_ADCSEL_MASK);
return RC_PENUP;
}
Expand Down Expand Up @@ -400,14 +400,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, WM9713_ADCSEL_X, &data->x);
rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_X, &data->x);
if (rc != RC_VALID)
return rc;
rc = wm9713_poll_sample(wm, WM9713_ADCSEL_Y, &data->y);
rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_Y, &data->y);
if (rc != RC_VALID)
return rc;
if (pil) {
rc = wm9713_poll_sample(wm, WM9713_ADCSEL_PRES,
rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_PRES,
&data->p);
if (rc != RC_VALID)
return rc;
Expand Down
10 changes: 4 additions & 6 deletions trunk/include/linux/wm97xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
#define WM97XX_ADCSEL_X 0x1000 /* x coord measurement */
#define WM97XX_ADCSEL_Y 0x2000 /* y coord measurement */
#define WM97XX_ADCSEL_PRES 0x3000 /* pressure measurement */
#define WM97XX_AUX_ID1 0x4000
#define WM97XX_AUX_ID2 0x5000
#define WM97XX_AUX_ID3 0x6000
#define WM97XX_AUX_ID4 0x7000
#define WM97XX_ADCSEL_MASK 0x7000 /* ADC selection mask */
#define WM97XX_COO 0x0800 /* enable coordinate mode */
#define WM97XX_CTC 0x0400 /* enable continuous mode */
Expand All @@ -62,12 +66,6 @@
#define WM97XX_RPR 0x2000 /* wake up on pen down */
#define WM97XX_PEN_DOWN 0x8000 /* pen is down */

#define WM97XX_AUX_ID1 0x8001
#define WM97XX_AUX_ID2 0x8002
#define WM97XX_AUX_ID3 0x8003
#define WM97XX_AUX_ID4 0x8004


/* WM9712 Bits */
#define WM9712_45W 0x1000 /* set for 5-wire touchscreen */
#define WM9712_PDEN 0x0800 /* measure only when pen down */
Expand Down

0 comments on commit 7b0110b

Please sign in to comment.