Lines Matching refs:wm
151 static void wm9713_phy_init(struct wm97xx *wm) in wm9713_phy_init() argument
163 dev_info(wm->dev, "setting pen detect pull-up to %d Ohms\n", in wm9713_phy_init()
170 dev_info(wm->dev, "setting 5-wire touchscreen mode."); in wm9713_phy_init()
173 dev_warn(wm->dev, in wm9713_phy_init()
183 dev_info(wm->dev, in wm9713_phy_init()
186 dev_info(wm->dev, in wm9713_phy_init()
193 dev_info(wm->dev, "supplied delay out of range."); in wm9713_phy_init()
195 dev_info(wm->dev, "setting adc sample delay to %d u Secs.", in wm9713_phy_init()
206 wm->misc = wm97xx_reg_read(wm, 0x5a); in wm9713_phy_init()
208 wm97xx_reg_write(wm, AC97_WM9713_DIG1, dig1); in wm9713_phy_init()
209 wm97xx_reg_write(wm, AC97_WM9713_DIG2, dig2); in wm9713_phy_init()
210 wm97xx_reg_write(wm, AC97_WM9713_DIG3, dig3); in wm9713_phy_init()
211 wm97xx_reg_write(wm, AC97_GPIO_STICKY, 0x0); in wm9713_phy_init()
214 static void wm9713_dig_enable(struct wm97xx *wm, int enable) in wm9713_dig_enable() argument
219 val = wm97xx_reg_read(wm, AC97_EXTENDED_MID); in wm9713_dig_enable()
220 wm97xx_reg_write(wm, AC97_EXTENDED_MID, val & 0x7fff); in wm9713_dig_enable()
221 wm97xx_reg_write(wm, AC97_WM9713_DIG3, wm->dig[2] | in wm9713_dig_enable()
223 wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); /* dummy read */ in wm9713_dig_enable()
225 wm97xx_reg_write(wm, AC97_WM9713_DIG3, wm->dig[2] & in wm9713_dig_enable()
227 val = wm97xx_reg_read(wm, AC97_EXTENDED_MID); in wm9713_dig_enable()
228 wm97xx_reg_write(wm, AC97_EXTENDED_MID, val | 0x8000); in wm9713_dig_enable()
232 static void wm9713_dig_restore(struct wm97xx *wm) in wm9713_dig_restore() argument
234 wm97xx_reg_write(wm, AC97_WM9713_DIG1, wm->dig_save[0]); in wm9713_dig_restore()
235 wm97xx_reg_write(wm, AC97_WM9713_DIG2, wm->dig_save[1]); in wm9713_dig_restore()
236 wm97xx_reg_write(wm, AC97_WM9713_DIG3, wm->dig_save[2]); in wm9713_dig_restore()
239 static void wm9713_aux_prepare(struct wm97xx *wm) in wm9713_aux_prepare() argument
241 memcpy(wm->dig_save, wm->dig, sizeof(wm->dig)); in wm9713_aux_prepare()
242 wm97xx_reg_write(wm, AC97_WM9713_DIG1, 0); in wm9713_aux_prepare()
243 wm97xx_reg_write(wm, AC97_WM9713_DIG2, 0); in wm9713_aux_prepare()
244 wm97xx_reg_write(wm, AC97_WM9713_DIG3, WM97XX_PRP_DET_DIG); in wm9713_aux_prepare()
247 static inline int is_pden(struct wm97xx *wm) in is_pden() argument
249 return wm->dig[2] & WM9713_PDEN; in is_pden()
255 static int wm9713_poll_sample(struct wm97xx *wm, int adcsel, int *sample) in wm9713_poll_sample() argument
261 if (wants_pen && !wm->pen_probably_down) { in wm9713_poll_sample()
262 u16 data = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9713_poll_sample()
265 wm->pen_probably_down = 1; in wm9713_poll_sample()
269 dig1 = wm97xx_reg_read(wm, AC97_WM9713_DIG1); in wm9713_poll_sample()
274 if (wm->mach_ops && wm->mach_ops->pre_sample) in wm9713_poll_sample()
275 wm->mach_ops->pre_sample(adcsel); in wm9713_poll_sample()
276 wm97xx_reg_write(wm, AC97_WM9713_DIG1, dig1 | WM9713_POLL); in wm9713_poll_sample()
282 while ((wm97xx_reg_read(wm, AC97_WM9713_DIG1) & WM9713_POLL) && in wm9713_poll_sample()
290 if (is_pden(wm)) in wm9713_poll_sample()
291 wm->pen_probably_down = 0; in wm9713_poll_sample()
293 dev_dbg(wm->dev, "adc sample timeout"); in wm9713_poll_sample()
297 *sample = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9713_poll_sample()
298 if (wm->mach_ops && wm->mach_ops->post_sample) in wm9713_poll_sample()
299 wm->mach_ops->post_sample(adcsel); in wm9713_poll_sample()
303 dev_dbg(wm->dev, "adc wrong sample, wanted %x got %x", in wm9713_poll_sample()
310 wm->pen_probably_down = 0; in wm9713_poll_sample()
320 static int wm9713_poll_coord(struct wm97xx *wm, struct wm97xx_data *data) in wm9713_poll_coord() argument
325 if (!wm->pen_probably_down) { in wm9713_poll_coord()
326 u16 val = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9713_poll_coord()
329 wm->pen_probably_down = 1; in wm9713_poll_coord()
333 dig1 = wm97xx_reg_read(wm, AC97_WM9713_DIG1); in wm9713_poll_coord()
338 if (wm->mach_ops && wm->mach_ops->pre_sample) in wm9713_poll_coord()
339 wm->mach_ops->pre_sample(WM97XX_ADCSEL_X | WM97XX_ADCSEL_Y); in wm9713_poll_coord()
340 wm97xx_reg_write(wm, AC97_WM9713_DIG1, in wm9713_poll_coord()
345 data->x = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9713_poll_coord()
347 while ((wm97xx_reg_read(wm, AC97_WM9713_DIG1) & WM9713_POLL) in wm9713_poll_coord()
355 if (is_pden(wm)) in wm9713_poll_coord()
356 wm->pen_probably_down = 0; in wm9713_poll_coord()
358 dev_dbg(wm->dev, "adc sample timeout"); in wm9713_poll_coord()
363 data->y = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9713_poll_coord()
365 data->p = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9713_poll_coord()
369 if (wm->mach_ops && wm->mach_ops->post_sample) in wm9713_poll_coord()
370 wm->mach_ops->post_sample(WM97XX_ADCSEL_X | WM97XX_ADCSEL_Y); in wm9713_poll_coord()
379 wm->pen_probably_down = 0; in wm9713_poll_coord()
390 static int wm9713_poll_touch(struct wm97xx *wm, struct wm97xx_data *data) in wm9713_poll_touch() argument
395 rc = wm9713_poll_coord(wm, data); in wm9713_poll_touch()
399 rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_X | WM97XX_PEN_DOWN, &data->x); in wm9713_poll_touch()
402 rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_Y | WM97XX_PEN_DOWN, &data->y); in wm9713_poll_touch()
406 rc = wm9713_poll_sample(wm, WM97XX_ADCSEL_PRES | WM97XX_PEN_DOWN, in wm9713_poll_touch()
420 static int wm9713_acc_enable(struct wm97xx *wm, int enable) in wm9713_acc_enable() argument
425 dig1 = wm->dig[0]; in wm9713_acc_enable()
426 dig2 = wm->dig[1]; in wm9713_acc_enable()
427 dig3 = wm->dig[2]; in wm9713_acc_enable()
431 if (wm->mach_ops->acc_startup && in wm9713_acc_enable()
432 (ret = wm->mach_ops->acc_startup(wm)) < 0) in wm9713_acc_enable()
443 WM97XX_SLT(wm->acc_slot) | WM97XX_RATE(wm->acc_rate); in wm9713_acc_enable()
449 if (wm->mach_ops->acc_shutdown) in wm9713_acc_enable()
450 wm->mach_ops->acc_shutdown(wm); in wm9713_acc_enable()
453 wm97xx_reg_write(wm, AC97_WM9713_DIG1, dig1); in wm9713_acc_enable()
454 wm97xx_reg_write(wm, AC97_WM9713_DIG2, dig2); in wm9713_acc_enable()
455 wm97xx_reg_write(wm, AC97_WM9713_DIG3, dig3); in wm9713_acc_enable()