11 #include <linux/errno.h>
12 #include <linux/kernel.h>
13 #include <linux/module.h>
14 #include <linux/input.h>
27 #define HTCPEN_PORT_IRQ_CLEAR 0x068
28 #define HTCPEN_PORT_INIT 0x06c
29 #define HTCPEN_PORT_INDEX 0x0250
30 #define HTCPEN_PORT_DATA 0x0251
33 #define DEVICE_ENABLE 0xa2
34 #define DEVICE_DISABLE 0xa3
38 #define TOUCH_INDEX 0xb
39 #define LSB_XY_INDEX 0xc
40 #define X_AXIS_MAX 2040
41 #define Y_AXIS_MAX 2040
52 struct input_dev *htcpen_dev =
handle;
53 unsigned short x,
y, xy;
59 input_report_key(htcpen_dev,
BTN_TOUCH, 0);
71 x =
X_AXIS_MAX - ((x * 8) + ((xy >> 4) & 0xf));
72 y = (y * 8) + (xy & 0xf);
79 input_report_key(htcpen_dev,
BTN_TOUCH, 1);
80 input_report_abs(htcpen_dev,
ABS_X, x);
81 input_report_abs(htcpen_dev,
ABS_Y, y);
85 input_sync(htcpen_dev);
92 static int htcpen_open(
struct input_dev *
dev)
99 static void htcpen_close(
struct input_dev *
dev)
107 struct input_dev *htcpen_dev;
113 goto request_region1_failed;
119 goto request_region2_failed;
125 goto request_region3_failed;
128 htcpen_dev = input_allocate_device();
132 goto input_alloc_failed;
135 htcpen_dev->name =
"HTC Shift EC TouchScreen";
136 htcpen_dev->id.bustype =
BUS_ISA;
143 htcpen_dev->open = htcpen_open;
144 htcpen_dev->close = htcpen_close;
150 goto request_irq_failed;
155 err = input_register_device(htcpen_dev);
157 goto input_register_failed;
163 input_register_failed:
166 input_free_device(htcpen_dev);
169 request_region3_failed:
171 request_region2_failed:
173 request_region1_failed:
177 static int __devexit htcpen_isa_remove(
struct device *dev,
unsigned int id)
181 input_unregister_device(htcpen_dev);
195 static int htcpen_isa_suspend(
struct device *dev,
unsigned int n,
203 static int htcpen_isa_resume(
struct device *dev,
unsigned int n)
211 static struct isa_driver htcpen_isa_driver = {
212 .probe = htcpen_isa_probe,
215 .suspend = htcpen_isa_suspend,
216 .resume = htcpen_isa_resume,
236 static int __init htcpen_isa_init(
void)
244 static void __exit htcpen_isa_exit(
void)