38 #include <linux/module.h>
39 #include <linux/kernel.h>
41 #include <linux/errno.h>
45 #include <linux/input.h>
52 static unsigned int mk712_io = 0x260;
56 static unsigned int mk712_irq = 10;
61 #define MK712_STATUS 0
64 #define MK712_CONTROL 6
68 #define MK712_STATUS_TOUCH 0x10
69 #define MK712_CONVERSION_COMPLETE 0x80
72 #define MK712_ENABLE_INT 0x01
73 #define MK712_INT_ON_CONVERSION_COMPLETE 0x02
74 #define MK712_INT_ON_CHANGE_IN_TOUCH_STATUS 0x04
75 #define MK712_ENABLE_PERIODIC_CONVERSIONS 0x10
76 #define MK712_READ_ONE_POINT 0x20
77 #define MK712_POWERUP 0x40
79 static struct input_dev *mk712_dev;
85 static int debounce = 1;
86 static unsigned short last_x;
87 static unsigned short last_y;
89 spin_lock(&mk712_lock);
100 input_report_key(mk712_dev,
BTN_TOUCH, 0);
109 input_report_key(mk712_dev,
BTN_TOUCH, 1);
110 input_report_abs(mk712_dev,
ABS_X, last_x);
111 input_report_abs(mk712_dev,
ABS_Y, last_y);
116 input_sync(mk712_dev);
117 spin_unlock(&mk712_lock);
121 static int mk712_open(
struct input_dev *
dev)
136 spin_unlock_irqrestore(&mk712_lock, flags);
141 static void mk712_close(
struct input_dev *
dev)
149 spin_unlock_irqrestore(&mk712_lock, flags);
152 static int __init mk712_init(
void)
171 mk712_dev = input_allocate_device();
178 mk712_dev->name =
"ICS MicroClock MK712 TouchScreen";
179 mk712_dev->phys =
"isa0260/input0";
180 mk712_dev->id.bustype =
BUS_ISA;
181 mk712_dev->id.vendor = 0x0005;
182 mk712_dev->id.product = 0x0001;
183 mk712_dev->id.version = 0x0100;
185 mk712_dev->open = mk712_open;
186 mk712_dev->close = mk712_close;
190 input_set_abs_params(mk712_dev,
ABS_X, 0, 0xfff, 88, 0);
191 input_set_abs_params(mk712_dev,
ABS_Y, 0, 0xfff, 88, 0);
193 if (
request_irq(mk712_irq, mk712_interrupt, 0,
"mk712", mk712_dev)) {
199 err = input_register_device(mk712_dev);
205 fail2:
free_irq(mk712_irq, mk712_dev);
206 fail1: input_free_device(mk712_dev);
211 static void __exit mk712_exit(
void)
213 input_unregister_device(mk712_dev);