Lines Matching +full:touchscreen +full:- +full:y +full:- +full:plate +full:- +full:ohms

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * wm9713.c -- Codec touch driver for Wolfson WM9713 AC97 Codec.
32 * i.e. pull up resistance = 64k Ohms / rpu.
69 * touchpanel plate and the ADC sampling the signal.
81 * Set five_wire = 1 to use a 5 wire touchscreen.
87 MODULE_PARM_DESC(five_wire, "Set to '1' to use 5-wire touchscreen.");
109 * Set to 1 to enable coordinate polling. e.g. x,y[,p] is sampled together
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()
221 wm97xx_reg_write(wm, AC97_WM9713_DIG3, wm->dig[2] | in wm9713_dig_enable()
225 wm97xx_reg_write(wm, AC97_WM9713_DIG3, wm->dig[2] & in wm9713_dig_enable()
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()
241 memcpy(wm->dig_save, wm->dig, sizeof(wm->dig)); in wm9713_aux_prepare()
249 return wm->dig[2] & WM9713_PDEN; in is_pden()
261 if (wants_pen && !wm->pen_probably_down) { in wm9713_poll_sample()
265 wm->pen_probably_down = 1; 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()
285 timeout--; 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()
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()
325 if (!wm->pen_probably_down) { in wm9713_poll_coord()
329 wm->pen_probably_down = 1; 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()
345 data->x = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); in wm9713_poll_coord()
350 timeout--; 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()
367 data->p = DEFAULT_PRESSURE; 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()
373 if (!(data->x & WM97XX_ADCSEL_X) || !(data->y & WM97XX_ADCSEL_Y)) in wm9713_poll_coord()
375 if (pil && !(data->p & WM97XX_ADCSEL_PRES)) in wm9713_poll_coord()
378 if (!(data->x & WM97XX_PEN_DOWN) || !(data->y & WM97XX_PEN_DOWN)) { in wm9713_poll_coord()
379 wm->pen_probably_down = 0; in wm9713_poll_coord()
388 * Sample the WM9713 touchscreen in polling mode
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()
407 &data->p); in wm9713_poll_touch()
411 data->p = DEFAULT_PRESSURE; in wm9713_poll_touch()
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()