aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/wm9712.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/touchscreen/wm9712.c')
-rw-r--r--drivers/input/touchscreen/wm9712.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/input/touchscreen/wm9712.c b/drivers/input/touchscreen/wm9712.c
index 6e743e3dfda4..16b52115c27f 100644
--- a/drivers/input/touchscreen/wm9712.c
+++ b/drivers/input/touchscreen/wm9712.c
@@ -162,14 +162,14 @@ static void wm9712_phy_init(struct wm97xx *wm)
162 if (rpu) { 162 if (rpu) {
163 dig2 &= 0xffc0; 163 dig2 &= 0xffc0;
164 dig2 |= WM9712_RPU(rpu); 164 dig2 |= WM9712_RPU(rpu);
165 dev_dbg(wm->dev, "setting pen detect pull-up to %d Ohms", 165 dev_dbg(wm->dev, "setting pen detect pull-up to %d Ohms\n",
166 64000 / rpu); 166 64000 / rpu);
167 } 167 }
168 168
169 /* WM9712 five wire */ 169 /* WM9712 five wire */
170 if (five_wire) { 170 if (five_wire) {
171 dig2 |= WM9712_45W; 171 dig2 |= WM9712_45W;
172 dev_dbg(wm->dev, "setting 5-wire touchscreen mode."); 172 dev_dbg(wm->dev, "setting 5-wire touchscreen mode.\n");
173 173
174 if (pil) { 174 if (pil) {
175 dev_warn(wm->dev, "pressure measurement is not " 175 dev_warn(wm->dev, "pressure measurement is not "
@@ -182,21 +182,21 @@ static void wm9712_phy_init(struct wm97xx *wm)
182 if (pil == 2) { 182 if (pil == 2) {
183 dig2 |= WM9712_PIL; 183 dig2 |= WM9712_PIL;
184 dev_dbg(wm->dev, 184 dev_dbg(wm->dev,
185 "setting pressure measurement current to 400uA."); 185 "setting pressure measurement current to 400uA.\n");
186 } else if (pil) 186 } else if (pil)
187 dev_dbg(wm->dev, 187 dev_dbg(wm->dev,
188 "setting pressure measurement current to 200uA."); 188 "setting pressure measurement current to 200uA.\n");
189 if (!pil) 189 if (!pil)
190 pressure = 0; 190 pressure = 0;
191 191
192 /* polling mode sample settling delay */ 192 /* polling mode sample settling delay */
193 if (delay < 0 || delay > 15) { 193 if (delay < 0 || delay > 15) {
194 dev_dbg(wm->dev, "supplied delay out of range."); 194 dev_dbg(wm->dev, "supplied delay out of range.\n");
195 delay = 4; 195 delay = 4;
196 } 196 }
197 dig1 &= 0xff0f; 197 dig1 &= 0xff0f;
198 dig1 |= WM97XX_DELAY(delay); 198 dig1 |= WM97XX_DELAY(delay);
199 dev_dbg(wm->dev, "setting adc sample delay to %d u Secs.", 199 dev_dbg(wm->dev, "setting adc sample delay to %d u Secs.\n",
200 delay_table[delay]); 200 delay_table[delay]);
201 201
202 /* mask */ 202 /* mask */
@@ -285,7 +285,7 @@ static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
285 if (is_pden(wm)) 285 if (is_pden(wm))
286 wm->pen_probably_down = 0; 286 wm->pen_probably_down = 0;
287 else 287 else
288 dev_dbg(wm->dev, "adc sample timeout"); 288 dev_dbg(wm->dev, "adc sample timeout\n");
289 return RC_PENUP; 289 return RC_PENUP;
290 } 290 }
291 291
@@ -295,15 +295,19 @@ static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
295 295
296 /* check we have correct sample */ 296 /* check we have correct sample */
297 if ((*sample ^ adcsel) & WM97XX_ADCSEL_MASK) { 297 if ((*sample ^ adcsel) & WM97XX_ADCSEL_MASK) {
298 dev_dbg(wm->dev, "adc wrong sample, wanted %x got %x", 298 dev_dbg(wm->dev, "adc wrong sample, wanted %x got %x\n",
299 adcsel & WM97XX_ADCSEL_MASK, 299 adcsel & WM97XX_ADCSEL_MASK,
300 *sample & WM97XX_ADCSEL_MASK); 300 *sample & WM97XX_ADCSEL_MASK);
301 return RC_PENUP; 301 return RC_AGAIN;
302 } 302 }
303 303
304 if (wants_pen && !(*sample & WM97XX_PEN_DOWN)) { 304 if (wants_pen && !(*sample & WM97XX_PEN_DOWN)) {
305 wm->pen_probably_down = 0; 305 /* Sometimes it reads a wrong value the first time. */
306 return RC_PENUP; 306 *sample = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD);
307 if (!(*sample & WM97XX_PEN_DOWN)) {
308 wm->pen_probably_down = 0;
309 return RC_PENUP;
310 }
307 } 311 }
308 312
309 return RC_VALID; 313 return RC_VALID;
@@ -345,7 +349,7 @@ static int wm9712_poll_coord(struct wm97xx *wm, struct wm97xx_data *data)
345 if (is_pden(wm)) 349 if (is_pden(wm))
346 wm->pen_probably_down = 0; 350 wm->pen_probably_down = 0;
347 else 351 else
348 dev_dbg(wm->dev, "adc sample timeout"); 352 dev_dbg(wm->dev, "adc sample timeout\n");
349 return RC_PENUP; 353 return RC_PENUP;
350 } 354 }
351 355