17 #include <linux/module.h>
19 #include <linux/kernel.h>
20 #include <linux/input.h>
22 #include <linux/bitops.h>
25 #define TS_NAME "wm97xx"
26 #define WM9713_VERSION "1.00"
27 #define DEFAULT_PRESSURE 0xb0c0
124 static const int delay_table[] = {
148 static inline void poll_delay(
int d)
156 static void wm9713_phy_init(
struct wm97xx *wm)
158 u16 dig1 = 0, dig2, dig3;
168 dev_info(wm->
dev,
"setting pen detect pull-up to %d Ohms\n",
175 dev_info(wm->
dev,
"setting 5-wire touchscreen mode.");
179 "Pressure measurement not supported in 5 "
180 "wire mode, disabling\n");
189 "setting pressure measurement current to 400uA.");
192 "setting pressure measurement current to 200uA.");
197 if (delay < 0 || delay > 15) {
200 dev_info(wm->
dev,
"setting adc sample delay to %d u Secs.",
207 dig3 |= ((
mask & 0x3) << 4);
219 static void wm9713_dig_enable(
struct wm97xx *wm,
int enable)
237 static void wm9713_dig_restore(
struct wm97xx *wm)
244 static void wm9713_aux_prepare(
struct wm97xx *wm)
252 static inline int is_pden(
struct wm97xx *wm)
260 static int wm9713_poll_sample(
struct wm97xx *wm,
int adcsel,
int *
sample)
268 if (!(data & WM97XX_PEN_DOWN))
308 dev_dbg(wm->
dev,
"adc wrong sample, wanted %x got %x",
309 adcsel & WM97XX_ADCSEL_MASK,
310 *sample & WM97XX_ADCSEL_MASK);
314 if (wants_pen && !(*sample & WM97XX_PEN_DOWN)) {
328 int timeout = 5 *
delay;
332 if (!(val & WM97XX_PEN_DOWN))
383 if (!(data->
x & WM97XX_PEN_DOWN) || !(data->
y & WM97XX_PEN_DOWN)) {
400 rc = wm9713_poll_coord(wm, data);
425 static int wm9713_acc_enable(
struct wm97xx *wm,
int enable)
427 u16 dig1, dig2, dig3;
437 (ret = wm->
mach_ops->acc_startup(wm)) < 0)
468 .poll_sample = wm9713_poll_sample,
469 .poll_touch = wm9713_poll_touch,
470 .acc_enable = wm9713_acc_enable,
471 .phy_init = wm9713_phy_init,
472 .dig_enable = wm9713_dig_enable,
473 .dig_restore = wm9713_dig_restore,
474 .aux_prepare = wm9713_aux_prepare,