Lines Matching refs:wm
156 static void wm9713_phy_init(struct wm97xx *wm) in wm9713_phy_init() argument
168 dev_info(wm->dev, "setting pen detect pull-up to %d Ohms\n", in wm9713_phy_init()
175 dev_info(wm->dev, "setting 5-wire touchscreen mode."); in wm9713_phy_init()
178 dev_warn(wm->dev, in wm9713_phy_init()
188 dev_info(wm->dev, in wm9713_phy_init()
191 dev_info(wm->dev, in wm9713_phy_init()
198 dev_info(wm->dev, "supplied delay out of range."); in wm9713_phy_init()
200 dev_info(wm->dev, "setting adc sample delay to %d u Secs.", in wm9713_phy_init()
211 wm->misc = wm97xx_reg_read(wm, 0x5a); in wm9713_phy_init()
213 wm97xx_reg_write(wm, AC97_WM9713_DIG1, dig1); in wm9713_phy_init()
214 wm97xx_reg_write(wm, AC97_WM9713_DIG2, dig2); in wm9713_phy_init()
215 wm97xx_reg_write(wm, AC97_WM9713_DIG3, dig3); in wm9713_phy_init()
216 wm97xx_reg_write(wm, AC97_GPIO_STICKY, 0x0); in wm9713_phy_init()
219 static void wm9713_dig_enable(struct wm97xx *wm, int enable) in wm9713_dig_enable() argument
224 val = wm97xx_reg_read(wm, AC97_EXTENDED_MID); in wm9713_dig_enable()
225 wm97xx_reg_write(wm, AC97_EXTENDED_MID, val & 0x7fff); in wm9713_dig_enable()
226 wm97xx_reg_write(wm, AC97_WM9713_DIG3, wm->dig[2] | in wm9713_dig_enable()
228 wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); /* dummy read */ in wm9713_dig_enable()
230 wm97xx_reg_write(wm, AC97_WM9713_DIG3, wm->dig[2] & in wm9713_dig_enable()
232 val = wm97xx_reg_read(wm, AC97_EXTENDED_MID); in wm9713_dig_enable()
233 wm97xx_reg_write(wm, AC97_EXTENDED_MID, val | 0x8000); in wm9713_dig_enable()
237 static void wm9713_dig_restore(struct wm97xx *wm) in wm9713_dig_restore() argument
239 wm97xx_reg_write(wm, AC97_WM9713_DIG1, wm->dig_save[0]); in wm9713_dig_restore()
240 wm97xx_reg_write(wm, AC97_WM9713_DIG2, wm->dig_save[1]); in wm9713_dig_restore()
241 wm97xx_reg_write(wm, AC97_WM9713_DIG3, wm->dig_save[2]); in wm9713_dig_restore()
244 static void wm9713_aux_prepare(struct wm97xx *wm) in wm9713_aux_prepare() argument
246 memcpy(wm->dig_save, wm->dig, sizeof(wm->dig)); in wm9713_aux_prepare()
247 wm97xx_reg_write(wm, AC97_WM9713_DIG1, 0); in wm9713_aux_prepare()
248 wm97xx_reg_write(wm, AC97_WM9713_DIG2, 0); in wm9713_aux_prepare()
249 wm97xx_reg_write(wm, AC97_WM9713_DIG3, WM97XX_PRP_DET_DIG); in wm9713_aux_prepare()
252 static inline int is_pden(struct wm97xx *wm) in is_pden() argument
254 return wm->dig[2] & WM9713_PDEN; in is_pden()
260 static int wm9713_poll_sample(struct wm97xx *wm, int adcsel, int *sample) in wm9713_poll_sample() argument
266 if (wants_pen && !wm->pen_probably_down) { in wm9713_poll_sample()
267 u16 data = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9713_poll_sample()
270 wm->pen_probably_down = 1; in wm9713_poll_sample()
274 dig1 = wm97xx_reg_read(wm, AC97_WM9713_DIG1); in wm9713_poll_sample()
279 if (wm->mach_ops && wm->mach_ops->pre_sample) in wm9713_poll_sample()
280 wm->mach_ops->pre_sample(adcsel); in wm9713_poll_sample()
281 wm97xx_reg_write(wm, AC97_WM9713_DIG1, dig1 | WM9713_POLL); in wm9713_poll_sample()
287 while ((wm97xx_reg_read(wm, AC97_WM9713_DIG1) & WM9713_POLL) && in wm9713_poll_sample()
295 if (is_pden(wm)) in wm9713_poll_sample()
296 wm->pen_probably_down = 0; in wm9713_poll_sample()
298 dev_dbg(wm->dev, "adc sample timeout"); in wm9713_poll_sample()
302 *sample = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9713_poll_sample()
303 if (wm->mach_ops && wm->mach_ops->post_sample) in wm9713_poll_sample()
304 wm->mach_ops->post_sample(adcsel); in wm9713_poll_sample()
308 dev_dbg(wm->dev, "adc wrong sample, wanted %x got %x", in wm9713_poll_sample()
315 wm->pen_probably_down = 0; in wm9713_poll_sample()
325 static int wm9713_poll_coord(struct wm97xx *wm, struct wm97xx_data *data) in wm9713_poll_coord() argument
330 if (!wm->pen_probably_down) { in wm9713_poll_coord()
331 u16 val = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9713_poll_coord()
334 wm->pen_probably_down = 1; in wm9713_poll_coord()
338 dig1 = wm97xx_reg_read(wm, AC97_WM9713_DIG1); in wm9713_poll_coord()
343 if (wm->mach_ops && wm->mach_ops->pre_sample) in wm9713_poll_coord()
344 wm->mach_ops->pre_sample(WM97XX_ADCSEL_X | WM97XX_ADCSEL_Y); in wm9713_poll_coord()
345 wm97xx_reg_write(wm, AC97_WM9713_DIG1, in wm9713_poll_coord()
350 data->x = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9713_poll_coord()
352 while ((wm97xx_reg_read(wm, AC97_WM9713_DIG1) & WM9713_POLL) in wm9713_poll_coord()
360 if (is_pden(wm)) in wm9713_poll_coord()
361 wm->pen_probably_down = 0; in wm9713_poll_coord()
363 dev_dbg(wm->dev, "adc sample timeout"); in wm9713_poll_coord()
368 data->y = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9713_poll_coord()
370 data->p = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9713_poll_coord()
374 if (wm->mach_ops && wm->mach_ops->post_sample) in wm9713_poll_coord()
375 wm->mach_ops->post_sample(WM97XX_ADCSEL_X | WM97XX_ADCSEL_Y); in wm9713_poll_coord()
384 wm->pen_probably_down = 0; in wm9713_poll_coord()
395 static int wm9713_poll_touch(struct wm97xx *wm, struct wm97xx_data *data) in wm9713_poll_touch() argument
400 rc = wm9713_poll_coord(wm, data); in wm9713_poll_touch()
404 rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_X | WM97XX_PEN_DOWN, &data->x); in wm9713_poll_touch()
407 rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_Y | WM97XX_PEN_DOWN, &data->y); in wm9713_poll_touch()
411 rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_PRES | WM97XX_PEN_DOWN, in wm9713_poll_touch()
425 static int wm9713_acc_enable(struct wm97xx *wm, int enable) in wm9713_acc_enable() argument
430 dig1 = wm->dig[0]; in wm9713_acc_enable()
431 dig2 = wm->dig[1]; in wm9713_acc_enable()
432 dig3 = wm->dig[2]; in wm9713_acc_enable()
436 if (wm->mach_ops->acc_startup && in wm9713_acc_enable()
437 (ret = wm->mach_ops->acc_startup(wm)) < 0) in wm9713_acc_enable()
448 WM97XX_SLT(wm->acc_slot) | WM97XX_RATE(wm->acc_rate); in wm9713_acc_enable()
454 if (wm->mach_ops->acc_shutdown) in wm9713_acc_enable()
455 wm->mach_ops->acc_shutdown(wm); in wm9713_acc_enable()
458 wm97xx_reg_write(wm, AC97_WM9713_DIG1, dig1); in wm9713_acc_enable()
459 wm97xx_reg_write(wm, AC97_WM9713_DIG2, dig2); in wm9713_acc_enable()
460 wm97xx_reg_write(wm, AC97_WM9713_DIG3, dig3); in wm9713_acc_enable()