Lines Matching refs:wm

156 static void wm9712_phy_init(struct wm97xx *wm)  in wm9712_phy_init()  argument
165 dev_dbg(wm->dev, "setting pen detect pull-up to %d Ohms\n", in wm9712_phy_init()
172 dev_dbg(wm->dev, "setting 5-wire touchscreen mode.\n"); in wm9712_phy_init()
175 dev_warn(wm->dev, "pressure measurement is not " in wm9712_phy_init()
184 dev_dbg(wm->dev, in wm9712_phy_init()
187 dev_dbg(wm->dev, in wm9712_phy_init()
194 dev_dbg(wm->dev, "supplied delay out of range.\n"); in wm9712_phy_init()
199 dev_dbg(wm->dev, "setting adc sample delay to %d u Secs.\n", in wm9712_phy_init()
207 reg = wm97xx_reg_read(wm, AC97_MISC_AFE); in wm9712_phy_init()
208 wm97xx_reg_write(wm, AC97_MISC_AFE, reg | WM97XX_GPIO_4); in wm9712_phy_init()
209 reg = wm97xx_reg_read(wm, AC97_GPIO_CFG); in wm9712_phy_init()
210 wm97xx_reg_write(wm, AC97_GPIO_CFG, reg | WM97XX_GPIO_4); in wm9712_phy_init()
217 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, dig1); in wm9712_phy_init()
218 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, dig2); in wm9712_phy_init()
221 static void wm9712_dig_enable(struct wm97xx *wm, int enable) in wm9712_dig_enable() argument
223 u16 dig2 = wm->dig[2]; in wm9712_dig_enable()
226 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, in wm9712_dig_enable()
228 wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); /* dummy read */ in wm9712_dig_enable()
230 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, in wm9712_dig_enable()
234 static void wm9712_aux_prepare(struct wm97xx *wm) in wm9712_aux_prepare() argument
236 memcpy(wm->dig_save, wm->dig, sizeof(wm->dig)); in wm9712_aux_prepare()
237 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, 0); in wm9712_aux_prepare()
238 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, WM97XX_PRP_DET_DIG); in wm9712_aux_prepare()
241 static void wm9712_dig_restore(struct wm97xx *wm) in wm9712_dig_restore() argument
243 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, wm->dig_save[1]); in wm9712_dig_restore()
244 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, wm->dig_save[2]); in wm9712_dig_restore()
247 static inline int is_pden(struct wm97xx *wm) in is_pden() argument
249 return wm->dig[2] & WM9712_PDEN; in is_pden()
255 static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample) in wm9712_poll_sample() argument
260 if (wants_pen && !wm->pen_probably_down) { in wm9712_poll_sample()
261 u16 data = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9712_poll_sample()
264 wm->pen_probably_down = 1; in wm9712_poll_sample()
268 if (wm->mach_ops && wm->mach_ops->pre_sample) in wm9712_poll_sample()
269 wm->mach_ops->pre_sample(adcsel); in wm9712_poll_sample()
270 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, (adcsel & WM97XX_ADCSEL_MASK) in wm9712_poll_sample()
277 while ((wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER1) & WM97XX_POLL) in wm9712_poll_sample()
285 if (is_pden(wm)) in wm9712_poll_sample()
286 wm->pen_probably_down = 0; in wm9712_poll_sample()
288 dev_dbg(wm->dev, "adc sample timeout\n"); in wm9712_poll_sample()
292 *sample = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9712_poll_sample()
293 if (wm->mach_ops && wm->mach_ops->post_sample) in wm9712_poll_sample()
294 wm->mach_ops->post_sample(adcsel); in wm9712_poll_sample()
298 dev_dbg(wm->dev, "adc wrong sample, wanted %x got %x\n", in wm9712_poll_sample()
306 *sample = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9712_poll_sample()
308 wm->pen_probably_down = 0; in wm9712_poll_sample()
319 static int wm9712_poll_coord(struct wm97xx *wm, struct wm97xx_data *data) in wm9712_poll_coord() argument
323 if (!wm->pen_probably_down) { in wm9712_poll_coord()
324 u16 data_rd = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9712_poll_coord()
327 wm->pen_probably_down = 1; in wm9712_poll_coord()
331 if (wm->mach_ops && wm->mach_ops->pre_sample) in wm9712_poll_coord()
332 wm->mach_ops->pre_sample(WM97XX_ADCSEL_X | WM97XX_ADCSEL_Y); in wm9712_poll_coord()
334 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, in wm9712_poll_coord()
339 data->x = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9712_poll_coord()
341 while ((wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER1) & WM97XX_POLL) in wm9712_poll_coord()
349 if (is_pden(wm)) in wm9712_poll_coord()
350 wm->pen_probably_down = 0; in wm9712_poll_coord()
352 dev_dbg(wm->dev, "adc sample timeout\n"); in wm9712_poll_coord()
357 data->y = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9712_poll_coord()
359 data->p = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9712_poll_coord()
363 if (wm->mach_ops && wm->mach_ops->post_sample) in wm9712_poll_coord()
364 wm->mach_ops->post_sample(WM97XX_ADCSEL_X | WM97XX_ADCSEL_Y); in wm9712_poll_coord()
373 wm->pen_probably_down = 0; in wm9712_poll_coord()
384 static int wm9712_poll_touch(struct wm97xx *wm, struct wm97xx_data *data) in wm9712_poll_touch() argument
389 rc = wm9712_poll_coord(wm, data); in wm9712_poll_touch()
393 rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_X | WM97XX_PEN_DOWN, in wm9712_poll_touch()
398 rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_Y | WM97XX_PEN_DOWN, in wm9712_poll_touch()
404 rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_PRES | WM97XX_PEN_DOWN, in wm9712_poll_touch()
418 static int wm9712_acc_enable(struct wm97xx *wm, int enable) in wm9712_acc_enable() argument
423 dig1 = wm->dig[1]; in wm9712_acc_enable()
424 dig2 = wm->dig[2]; in wm9712_acc_enable()
428 if (wm->mach_ops->acc_startup) { in wm9712_acc_enable()
429 ret = wm->mach_ops->acc_startup(wm); in wm9712_acc_enable()
437 WM97XX_SLT(wm->acc_slot) | in wm9712_acc_enable()
438 WM97XX_RATE(wm->acc_rate); in wm9712_acc_enable()
445 if (wm->mach_ops->acc_shutdown) in wm9712_acc_enable()
446 wm->mach_ops->acc_shutdown(wm); in wm9712_acc_enable()
449 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, dig1); in wm9712_acc_enable()
450 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, dig2); in wm9712_acc_enable()