13 #include <linux/module.h>
16 #include <linux/string.h>
17 #include <linux/slab.h>
22 #include <linux/input.h>
34 #define SAMPLE_DELAY 20
37 #define X_AXIS_MAX 1023
38 #define Y_AXIS_MAX X_AXIS_MAX
39 #define Y_AXIS_MIN X_AXIS_MIN
40 #define PRESSURE_MAX X_AXIS_MAX
41 #define PRESSURE_MIN X_AXIS_MIN
43 static void pcap_ts_read_xy(
void *
data,
u16 res[2])
68 input_report_abs(pcap_ts->
input,
ABS_X, pcap_ts->
x);
69 input_report_abs(pcap_ts->
input,
ABS_Y, pcap_ts->
y);
79 input_sync(pcap_ts->
input);
83 "pcap_ts: Warning, unhandled read_state %d\n",
105 pcap_ts_read_xy, pcap_ts);
110 struct pcap_ts *pcap_ts =
data;
119 static int pcap_ts_open(
struct input_dev *
dev)
121 struct pcap_ts *pcap_ts = input_get_drvdata(dev);
129 static void pcap_ts_close(
struct input_dev *
dev)
131 struct pcap_ts *pcap_ts = input_get_drvdata(dev);
142 struct input_dev *input_dev;
143 struct pcap_ts *pcap_ts;
146 pcap_ts = kzalloc(
sizeof(*pcap_ts),
GFP_KERNEL);
151 platform_set_drvdata(pdev, pcap_ts);
153 input_dev = input_allocate_device();
163 pcap_ts->
input = input_dev;
164 input_set_drvdata(input_dev, pcap_ts);
166 input_dev->name =
"pcap-touchscreen";
167 input_dev->phys =
"pcap_ts/input0";
169 input_dev->id.vendor = 0x0001;
170 input_dev->id.product = 0x0002;
171 input_dev->id.version = 0x0100;
172 input_dev->dev.parent = &pdev->
dev;
173 input_dev->open = pcap_ts_open;
174 input_dev->close = pcap_ts_close;
183 err = input_register_device(pcap_ts->
input);
188 pcap_ts_event_touch, 0,
"Touch Screen", pcap_ts);
195 input_unregister_device(input_dev);
198 input_free_device(input_dev);
207 struct pcap_ts *pcap_ts = platform_get_drvdata(pdev);
212 input_unregister_device(pcap_ts->
input);
220 static int pcap_ts_suspend(
struct device *
dev)
228 static int pcap_ts_resume(
struct device *
dev)
237 static const struct dev_pm_ops pcap_ts_pm_ops = {
239 .resume = pcap_ts_resume,
241 #define PCAP_TS_PM_OPS (&pcap_ts_pm_ops)
243 #define PCAP_TS_PM_OPS NULL
247 .probe = pcap_ts_probe,