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 WM9712_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 wm9712_phy_init(
struct wm97xx *wm)
165 dev_dbg(wm->
dev,
"setting pen detect pull-up to %d Ohms",
172 dev_dbg(wm->
dev,
"setting 5-wire touchscreen mode.");
176 "supported in 5-wire mode\n");
185 "setting pressure measurement current to 400uA.");
188 "setting pressure measurement current to 200uA.");
193 if (delay < 0 || delay > 15) {
194 dev_dbg(wm->
dev,
"supplied delay out of range.");
199 dev_dbg(wm->
dev,
"setting adc sample delay to %d u Secs.",
203 dig2 |= ((
mask & 0x3) << 6);
221 static void wm9712_dig_enable(
struct wm97xx *wm,
int enable)
234 static void wm9712_aux_prepare(
struct wm97xx *wm)
241 static void wm9712_dig_restore(
struct wm97xx *wm)
247 static inline int is_pden(
struct wm97xx *wm)
255 static int wm9712_poll_sample(
struct wm97xx *wm,
int adcsel,
int *
sample)
262 if (!(data & WM97XX_PEN_DOWN))
297 if ((*sample ^ adcsel) & WM97XX_ADCSEL_MASK) {
298 dev_dbg(wm->
dev,
"adc wrong sample, wanted %x got %x",
299 adcsel & WM97XX_ADCSEL_MASK,
300 *sample & WM97XX_ADCSEL_MASK);
304 if (wants_pen && !(*sample & WM97XX_PEN_DOWN)) {
317 int timeout = 5 *
delay;
321 if (!(data_rd & WM97XX_PEN_DOWN))
368 if (!(data->
x & WM97XX_PEN_DOWN) || !(data->
y & WM97XX_PEN_DOWN)) {
385 rc = wm9712_poll_coord(wm, data);
399 if (pil && !five_wire) {
414 static int wm9712_acc_enable(
struct wm97xx *wm,
int enable)
425 ret = wm->
mach_ops->acc_startup(wm);
454 .poll_sample = wm9712_poll_sample,
455 .poll_touch = wm9712_poll_touch,
456 .acc_enable = wm9712_acc_enable,
457 .phy_init = wm9712_phy_init,
458 .dig_enable = wm9712_dig_enable,
459 .dig_restore = wm9712_dig_restore,
460 .aux_prepare = wm9712_aux_prepare,