13 #include <linux/module.h>
17 #include <linux/input.h>
19 #include <linux/slab.h>
22 #define ADC_DELAY 0xf00
24 #define ADC_TSC_Y (0x01 << 8)
25 #define ADC_TSC_X (0x00 << 8)
26 #define TSC_FOURWIRE (~(0x03 << 1))
27 #define ADC_CLK_EN (0x01 << 28)
28 #define ADC_READ_CON (0x01 << 12)
29 #define ADC_CONV (0x01 << 13)
30 #define ADC_SEMIAUTO (0x01 << 14)
31 #define ADC_WAITTRIG (0x03 << 14)
32 #define ADC_RST1 (0x01 << 16)
33 #define ADC_RST0 (0x00 << 16)
34 #define ADC_EN (0x01 << 17)
35 #define ADC_INT (0x01 << 18)
36 #define WT_INT (0x01 << 20)
37 #define ADC_INT_EN (0x01 << 21)
38 #define LVD_INT_EN (0x01 << 22)
39 #define WT_INT_EN (0x01 << 23)
40 #define ADC_DIV (0x04 << 1)
61 struct input_dev *
dev = w90p910_ts->
input;
64 input_report_abs(dev,
ABS_X,
66 input_report_abs(dev,
ABS_Y,
102 unsigned long ctlreg;
119 switch (w90p910_ts->
state) {
126 w90p910_prepare_x_reading(w90p910_ts);
131 w90p910_prepare_y_reading(w90p910_ts);
135 w90p910_report_event(w90p910_ts,
true);
136 w90p910_prepare_next_packet(w90p910_ts);
144 spin_unlock_irqrestore(&w90p910_ts->
lock, flags);
149 static void w90p910_check_pen_up(
unsigned long data)
151 struct w90p910_ts *w90p910_ts = (
struct w90p910_ts *) data;
159 w90p910_report_event(w90p910_ts,
false);
162 spin_unlock_irqrestore(&w90p910_ts->
lock, flags);
165 static int w90p910_open(
struct input_dev *
dev)
167 struct w90p910_ts *w90p910_ts = input_get_drvdata(dev);
194 static void w90p910_close(
struct input_dev *
dev)
196 struct w90p910_ts *w90p910_ts = input_get_drvdata(dev);
201 spin_lock_irq(&w90p910_ts->
lock);
209 spin_unlock_irq(&w90p910_ts->
lock);
220 struct w90p910_ts *w90p910_ts;
221 struct input_dev *input_dev;
225 w90p910_ts = kzalloc(
sizeof(
struct w90p910_ts),
GFP_KERNEL);
226 input_dev = input_allocate_device();
227 if (!w90p910_ts || !input_dev) {
232 w90p910_ts->
input = input_dev;
236 (
unsigned long)w90p910_ts);
251 if (!w90p910_ts->
ts_reg) {
257 if (IS_ERR(w90p910_ts->
clk)) {
258 err = PTR_ERR(w90p910_ts->
clk);
262 input_dev->name =
"W90P910 TouchScreen";
263 input_dev->phys =
"w90p910ts/event0";
265 input_dev->id.vendor = 0x0005;
266 input_dev->id.product = 0x0001;
267 input_dev->id.version = 0x0100;
268 input_dev->dev.parent = &pdev->
dev;
269 input_dev->open = w90p910_open;
270 input_dev->close = w90p910_close;
275 input_set_abs_params(input_dev,
ABS_X, 0, 0x400, 0, 0);
276 input_set_abs_params(input_dev,
ABS_Y, 0, 0x400, 0, 0);
278 input_set_drvdata(input_dev, w90p910_ts);
282 0,
"w90p910ts", w90p910_ts)) {
287 err = input_register_device(w90p910_ts->
input);
291 platform_set_drvdata(pdev, w90p910_ts);
299 fail1: input_free_device(input_dev);
306 struct w90p910_ts *w90p910_ts = platform_get_drvdata(pdev);
318 input_unregister_device(w90p910_ts->
input);
321 platform_set_drvdata(pdev,
NULL);
327 .probe = w90x900ts_probe,