Lines Matching refs:wm
151 static void wm9712_phy_init(struct wm97xx *wm) in wm9712_phy_init() argument
160 dev_dbg(wm->dev, "setting pen detect pull-up to %d Ohms\n", in wm9712_phy_init()
167 dev_dbg(wm->dev, "setting 5-wire touchscreen mode.\n"); in wm9712_phy_init()
170 dev_warn(wm->dev, "pressure measurement is not " in wm9712_phy_init()
179 dev_dbg(wm->dev, in wm9712_phy_init()
182 dev_dbg(wm->dev, in wm9712_phy_init()
189 dev_dbg(wm->dev, "supplied delay out of range.\n"); in wm9712_phy_init()
194 dev_dbg(wm->dev, "setting adc sample delay to %d u Secs.\n", in wm9712_phy_init()
202 reg = wm97xx_reg_read(wm, AC97_MISC_AFE); in wm9712_phy_init()
203 wm97xx_reg_write(wm, AC97_MISC_AFE, reg | WM97XX_GPIO_4); in wm9712_phy_init()
204 reg = wm97xx_reg_read(wm, AC97_GPIO_CFG); in wm9712_phy_init()
205 wm97xx_reg_write(wm, AC97_GPIO_CFG, reg | WM97XX_GPIO_4); in wm9712_phy_init()
212 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, dig1); in wm9712_phy_init()
213 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, dig2); in wm9712_phy_init()
216 static void wm9712_dig_enable(struct wm97xx *wm, int enable) in wm9712_dig_enable() argument
218 u16 dig2 = wm->dig[2]; in wm9712_dig_enable()
221 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, in wm9712_dig_enable()
223 wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); /* dummy read */ in wm9712_dig_enable()
225 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, in wm9712_dig_enable()
229 static void wm9712_aux_prepare(struct wm97xx *wm) in wm9712_aux_prepare() argument
231 memcpy(wm->dig_save, wm->dig, sizeof(wm->dig)); in wm9712_aux_prepare()
232 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, 0); in wm9712_aux_prepare()
233 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, WM97XX_PRP_DET_DIG); in wm9712_aux_prepare()
236 static void wm9712_dig_restore(struct wm97xx *wm) in wm9712_dig_restore() argument
238 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, wm->dig_save[1]); in wm9712_dig_restore()
239 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, wm->dig_save[2]); in wm9712_dig_restore()
242 static inline int is_pden(struct wm97xx *wm) in is_pden() argument
244 return wm->dig[2] & WM9712_PDEN; in is_pden()
250 static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample) in wm9712_poll_sample() argument
255 if (wants_pen && !wm->pen_probably_down) { in wm9712_poll_sample()
256 u16 data = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9712_poll_sample()
259 wm->pen_probably_down = 1; in wm9712_poll_sample()
263 if (wm->mach_ops && wm->mach_ops->pre_sample) in wm9712_poll_sample()
264 wm->mach_ops->pre_sample(adcsel); in wm9712_poll_sample()
265 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, (adcsel & WM97XX_ADCSEL_MASK) in wm9712_poll_sample()
272 while ((wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER1) & WM97XX_POLL) in wm9712_poll_sample()
280 if (is_pden(wm)) in wm9712_poll_sample()
281 wm->pen_probably_down = 0; in wm9712_poll_sample()
283 dev_dbg(wm->dev, "adc sample timeout\n"); in wm9712_poll_sample()
287 *sample = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9712_poll_sample()
288 if (wm->mach_ops && wm->mach_ops->post_sample) in wm9712_poll_sample()
289 wm->mach_ops->post_sample(adcsel); in wm9712_poll_sample()
293 dev_dbg(wm->dev, "adc wrong sample, wanted %x got %x\n", in wm9712_poll_sample()
301 *sample = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9712_poll_sample()
303 wm->pen_probably_down = 0; in wm9712_poll_sample()
314 static int wm9712_poll_coord(struct wm97xx *wm, struct wm97xx_data *data) in wm9712_poll_coord() argument
318 if (!wm->pen_probably_down) { in wm9712_poll_coord()
319 u16 data_rd = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9712_poll_coord()
322 wm->pen_probably_down = 1; in wm9712_poll_coord()
326 if (wm->mach_ops && wm->mach_ops->pre_sample) in wm9712_poll_coord()
327 wm->mach_ops->pre_sample(WM97XX_ADCSEL_X | WM97XX_ADCSEL_Y); in wm9712_poll_coord()
329 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, in wm9712_poll_coord()
334 data->x = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9712_poll_coord()
336 while ((wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER1) & WM97XX_POLL) in wm9712_poll_coord()
344 if (is_pden(wm)) in wm9712_poll_coord()
345 wm->pen_probably_down = 0; in wm9712_poll_coord()
347 dev_dbg(wm->dev, "adc sample timeout\n"); in wm9712_poll_coord()
352 data->y = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9712_poll_coord()
354 data->p = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9712_poll_coord()
358 if (wm->mach_ops && wm->mach_ops->post_sample) in wm9712_poll_coord()
359 wm->mach_ops->post_sample(WM97XX_ADCSEL_X | WM97XX_ADCSEL_Y); in wm9712_poll_coord()
368 wm->pen_probably_down = 0; in wm9712_poll_coord()
379 static int wm9712_poll_touch(struct wm97xx *wm, struct wm97xx_data *data) in wm9712_poll_touch() argument
384 rc = wm9712_poll_coord(wm, data); in wm9712_poll_touch()
388 rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_X | WM97XX_PEN_DOWN, in wm9712_poll_touch()
393 rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_Y | WM97XX_PEN_DOWN, in wm9712_poll_touch()
399 rc = wm9712_poll_sample(wm, WM97XX_ADCSEL_PRES | WM97XX_PEN_DOWN, in wm9712_poll_touch()
413 static int wm9712_acc_enable(struct wm97xx *wm, int enable) in wm9712_acc_enable() argument
418 dig1 = wm->dig[1]; in wm9712_acc_enable()
419 dig2 = wm->dig[2]; in wm9712_acc_enable()
423 if (wm->mach_ops->acc_startup) { in wm9712_acc_enable()
424 ret = wm->mach_ops->acc_startup(wm); in wm9712_acc_enable()
432 WM97XX_SLT(wm->acc_slot) | in wm9712_acc_enable()
433 WM97XX_RATE(wm->acc_rate); in wm9712_acc_enable()
440 if (wm->mach_ops->acc_shutdown) in wm9712_acc_enable()
441 wm->mach_ops->acc_shutdown(wm); in wm9712_acc_enable()
444 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, dig1); in wm9712_acc_enable()
445 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, dig2); in wm9712_acc_enable()