18 #include <linux/errno.h>
19 #include <linux/kernel.h>
20 #include <linux/module.h>
21 #include <linux/slab.h>
22 #include <linux/input.h>
23 #include <linux/serio.h>
26 #define DRIVER_DESC "Sahara TouchIT-213 serial touchscreen driver"
60 #define T213_FORMAT_TOUCH_BIT 0x01
61 #define T213_FORMAT_STATUS_BYTE 0x80
62 #define T213_FORMAT_STATUS_MASK ~T213_FORMAT_TOUCH_BIT
70 #define T213_MAX_XC 0x07ff
72 #define T213_MAX_YC 0x07ff
79 struct input_dev *
dev;
91 struct input_dev *
dev = touchit213->
dev;
95 switch (touchit213->
idx++) {
99 pr_debug(
"unsynchronized data: 0x%02x\n", data);
106 input_report_abs(dev,
ABS_X,
107 (touchit213->
data[1] << 7) | touchit213->
data[2]);
108 input_report_abs(dev,
ABS_Y,
109 (touchit213->
data[3] << 7) | touchit213->
data[4]);
123 static void touchit213_disconnect(
struct serio *
serio)
127 input_get_device(touchit213->
dev);
128 input_unregister_device(touchit213->
dev);
130 serio_set_drvdata(serio,
NULL);
131 input_put_device(touchit213->
dev);
144 struct input_dev *input_dev;
147 touchit213 = kzalloc(
sizeof(
struct touchit213),
GFP_KERNEL);
148 input_dev = input_allocate_device();
149 if (!touchit213 || !input_dev) {
154 touchit213->
serio = serio;
155 touchit213->
dev = input_dev;
157 "%s/input0", serio->
phys);
159 input_dev->name =
"Sahara Touch-iT213 Serial TouchScreen";
160 input_dev->phys = touchit213->
phys;
163 input_dev->id.product = 0;
164 input_dev->id.version = 0x0100;
165 input_dev->dev.parent = &serio->
dev;
168 input_set_abs_params(touchit213->
dev,
ABS_X,
170 input_set_abs_params(touchit213->
dev,
ABS_Y,
173 serio_set_drvdata(serio, touchit213);
179 err = input_register_device(touchit213->
dev);
186 fail2: serio_set_drvdata(serio,
NULL);
187 fail1: input_free_device(input_dev);
210 .name =
"touchit213",
213 .id_table = touchit213_serio_ids,
214 .interrupt = touchit213_interrupt,
215 .connect = touchit213_connect,
216 .disconnect = touchit213_disconnect,