diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-27 12:24:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-27 12:24:56 -0400 |
commit | 70a3eff5768350c0313a9ae70a15da113171d0ab (patch) | |
tree | 9c2558f92e567bcb35c79f59bc7ebc9cf6fdc9d3 /drivers/input/touchscreen/wm9712.c | |
parent | 9ed3689bdceb0064ee6faf0e76f6467122794970 (diff) | |
parent | aa7eb8e78d8ecd6cd0475d86ea8385ff9cb47ece (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (53 commits)
Input: synaptics - fix reporting of min coordinates
Input: tegra-kbc - enable key autorepeat
Input: kxtj9 - fix locking typo in kxtj9_set_poll()
Input: kxtj9 - fix bug in probe()
Input: intel-mid-touch - remove pointless checking for variable 'found'
Input: hp_sdc - staticize hp_sdc_kicker()
Input: pmic8xxx-keypad - fix a leak of the IRQ during init failure
Input: cy8ctmg110_ts - set reset_pin and irq_pin from platform data
Input: cy8ctmg110_ts - constify i2c_device_id table
Input: cy8ctmg110_ts - fix checking return value of i2c_master_send
Input: lifebook - make dmi callback functions return 1
Input: atkbd - make dmi callback functions return 1
Input: gpio_keys - switch to using SIMPLE_DEV_PM_OPS
Input: gpio_keys - add support for device-tree platform data
Input: aiptek - remove double define
Input: synaptics - set minimum coordinates as reported by firmware
Input: synaptics - process button bits in AGM packets
Input: synaptics - rename set_slot to be more descriptive
Input: synaptics - fuzz position for touchpad with reduced filtering
Input: synaptics - set resolution for MT_POSITION_X/Y axes
...
Diffstat (limited to 'drivers/input/touchscreen/wm9712.c')
-rw-r--r-- | drivers/input/touchscreen/wm9712.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/input/touchscreen/wm9712.c b/drivers/input/touchscreen/wm9712.c index 2bc2fb801009..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; |
@@ -264,13 +265,10 @@ static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample) | |||
264 | } | 265 | } |
265 | 266 | ||
266 | /* set up digitiser */ | 267 | /* set up digitiser */ |
267 | if (adcsel & 0x8000) | ||
268 | adcsel = ((adcsel & 0x7fff) + 3) << 12; | ||
269 | |||
270 | if (wm->mach_ops && wm->mach_ops->pre_sample) | 268 | if (wm->mach_ops && wm->mach_ops->pre_sample) |
271 | wm->mach_ops->pre_sample(adcsel); | 269 | wm->mach_ops->pre_sample(adcsel); |
272 | wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, | 270 | wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, (adcsel & WM97XX_ADCSEL_MASK) |
273 | adcsel | WM97XX_POLL | WM97XX_DELAY(delay)); | 271 | | WM97XX_POLL | WM97XX_DELAY(delay)); |
274 | 272 | ||
275 | /* wait 3 AC97 time slots + delay for conversion */ | 273 | /* wait 3 AC97 time slots + delay for conversion */ |
276 | poll_delay(delay); | 274 | poll_delay(delay); |
@@ -296,13 +294,14 @@ static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample) | |||
296 | wm->mach_ops->post_sample(adcsel); | 294 | wm->mach_ops->post_sample(adcsel); |
297 | 295 | ||
298 | /* check we have correct sample */ | 296 | /* check we have correct sample */ |
299 | if ((*sample & WM97XX_ADCSEL_MASK) != adcsel) { | 297 | if ((*sample ^ adcsel) & WM97XX_ADCSEL_MASK) { |
300 | dev_dbg(wm->dev, "adc wrong sample, read %x got %x", adcsel, | 298 | dev_dbg(wm->dev, "adc wrong sample, wanted %x got %x", |
301 | *sample & WM97XX_ADCSEL_MASK); | 299 | adcsel & WM97XX_ADCSEL_MASK, |
300 | *sample & WM97XX_ADCSEL_MASK); | ||
302 | return RC_PENUP; | 301 | return RC_PENUP; |
303 | } | 302 | } |
304 | 303 | ||
305 | if (!(*sample & WM97XX_PEN_DOWN)) { | 304 | if (wants_pen && !(*sample & WM97XX_PEN_DOWN)) { |
306 | wm->pen_probably_down = 0; | 305 | wm->pen_probably_down = 0; |
307 | return RC_PENUP; | 306 | return RC_PENUP; |
308 | } | 307 | } |
@@ -387,16 +386,18 @@ static int wm9712_poll_touch(struct wm97xx *wm, struct wm97xx_data *data) | |||
387 | if (rc != RC_VALID) | 386 | if (rc != RC_VALID) |
388 | return rc; | 387 | return rc; |
389 | } else { | 388 | } else { |
390 | 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); | ||
391 | if (rc != RC_VALID) | 391 | if (rc != RC_VALID) |
392 | return rc; | 392 | return rc; |
393 | 393 | ||
394 | 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); | ||
395 | if (rc != RC_VALID) | 396 | if (rc != RC_VALID) |
396 | return rc; | 397 | return rc; |
397 | 398 | ||
398 | if (pil && !five_wire) { | 399 | if (pil && !five_wire) { |
399 | rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_PRES, | 400 | rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_PRES | WM97XX_PEN_DOWN, |
400 | &data->p); | 401 | &data->p); |
401 | if (rc != RC_VALID) | 402 | if (rc != RC_VALID) |
402 | return rc; | 403 | return rc; |