Lines Matching refs:wm

138 static void wm9705_phy_init(struct wm97xx *wm)  in wm9705_phy_init()  argument
146 wm97xx_reg_write(wm, AC97_AUX, 0x8000); in wm9705_phy_init()
147 wm97xx_reg_write(wm, AC97_VIDEO, 0x8000); in wm9705_phy_init()
152 dev_dbg(wm->dev, in wm9705_phy_init()
155 dev_dbg(wm->dev, in wm9705_phy_init()
163 dev_dbg(wm->dev, "supplied delay out of range."); in wm9705_phy_init()
169 dev_dbg(wm->dev, "setting adc sample delay to %d u Secs.", in wm9705_phy_init()
174 dev_dbg(wm->dev, "setting pdd to Vmid/%d", 1 - (pdd & 0x000f)); in wm9705_phy_init()
179 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, dig1); in wm9705_phy_init()
180 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, dig2); in wm9705_phy_init()
183 static void wm9705_dig_enable(struct wm97xx *wm, int enable) in wm9705_dig_enable() argument
186 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, in wm9705_dig_enable()
187 wm->dig[2] | WM97XX_PRP_DET_DIG); in wm9705_dig_enable()
188 wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); /* dummy read */ in wm9705_dig_enable()
190 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, in wm9705_dig_enable()
191 wm->dig[2] & ~WM97XX_PRP_DET_DIG); in wm9705_dig_enable()
194 static void wm9705_aux_prepare(struct wm97xx *wm) in wm9705_aux_prepare() argument
196 memcpy(wm->dig_save, wm->dig, sizeof(wm->dig)); in wm9705_aux_prepare()
197 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, 0); in wm9705_aux_prepare()
198 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, WM97XX_PRP_DET_DIG); in wm9705_aux_prepare()
201 static void wm9705_dig_restore(struct wm97xx *wm) in wm9705_dig_restore() argument
203 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, wm->dig_save[1]); in wm9705_dig_restore()
204 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, wm->dig_save[2]); in wm9705_dig_restore()
207 static inline int is_pden(struct wm97xx *wm) in is_pden() argument
209 return wm->dig[2] & WM9705_PDEN; in is_pden()
215 static int wm9705_poll_sample(struct wm97xx *wm, int adcsel, int *sample) in wm9705_poll_sample() argument
220 if (wants_pen && !wm->pen_probably_down) { in wm9705_poll_sample()
221 u16 data = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9705_poll_sample()
224 wm->pen_probably_down = 1; in wm9705_poll_sample()
228 if (wm->mach_ops && wm->mach_ops->pre_sample) in wm9705_poll_sample()
229 wm->mach_ops->pre_sample(adcsel); in wm9705_poll_sample()
230 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, (adcsel & WM97XX_ADCSEL_MASK) in wm9705_poll_sample()
237 while ((wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER1) & WM97XX_POLL) in wm9705_poll_sample()
245 if (is_pden(wm)) in wm9705_poll_sample()
246 wm->pen_probably_down = 0; in wm9705_poll_sample()
248 dev_dbg(wm->dev, "adc sample timeout"); in wm9705_poll_sample()
252 *sample = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9705_poll_sample()
253 if (wm->mach_ops && wm->mach_ops->post_sample) in wm9705_poll_sample()
254 wm->mach_ops->post_sample(adcsel); in wm9705_poll_sample()
258 dev_dbg(wm->dev, "adc wrong sample, wanted %x got %x", in wm9705_poll_sample()
265 wm->pen_probably_down = 0; in wm9705_poll_sample()
275 static int wm9705_poll_touch(struct wm97xx *wm, struct wm97xx_data *data) in wm9705_poll_touch() argument
279 rc = wm9705_poll_sample(wm, WM97XX_ADCSEL_X | WM97XX_PEN_DOWN, &data->x); in wm9705_poll_touch()
282 rc = wm9705_poll_sample(wm, WM97XX_ADCSEL_Y | WM97XX_PEN_DOWN, &data->y); in wm9705_poll_touch()
286 rc = wm9705_poll_sample(wm, WM97XX_ADCSEL_PRES | WM97XX_PEN_DOWN, &data->p); in wm9705_poll_touch()
299 static int wm9705_acc_enable(struct wm97xx *wm, int enable) in wm9705_acc_enable() argument
304 dig1 = wm->dig[1]; in wm9705_acc_enable()
305 dig2 = wm->dig[2]; in wm9705_acc_enable()
309 if (wm->mach_ops->acc_startup && in wm9705_acc_enable()
310 (ret = wm->mach_ops->acc_startup(wm)) < 0) in wm9705_acc_enable()
316 WM97XX_SLT(wm->acc_slot) | in wm9705_acc_enable()
317 WM97XX_RATE(wm->acc_rate); in wm9705_acc_enable()
324 if (wm->mach_ops->acc_shutdown) in wm9705_acc_enable()
325 wm->mach_ops->acc_shutdown(wm); in wm9705_acc_enable()
328 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, dig1); in wm9705_acc_enable()
329 wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, dig2); in wm9705_acc_enable()