ALSA: fix hda AZX_DCAPS_NO_TCSEL quirk check in driver_caps
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / hid / hid-multitouch.c
blobecd4d2db9e800ca2397c3ad18945d30b2080a028
1 /*
2 * HID driver for multitouch panels
4 * Copyright (c) 2010-2011 Stephane Chatty <chatty@enac.fr>
5 * Copyright (c) 2010-2011 Benjamin Tissoires <benjamin.tissoires@gmail.com>
6 * Copyright (c) 2010-2011 Ecole Nationale de l'Aviation Civile, France
8 * This code is partly based on hid-egalax.c:
10 * Copyright (c) 2010 Stephane Chatty <chatty@enac.fr>
11 * Copyright (c) 2010 Henrik Rydberg <rydberg@euromail.se>
12 * Copyright (c) 2010 Canonical, Ltd.
14 * This code is partly based on hid-3m-pct.c:
16 * Copyright (c) 2009-2010 Stephane Chatty <chatty@enac.fr>
17 * Copyright (c) 2010 Henrik Rydberg <rydberg@euromail.se>
18 * Copyright (c) 2010 Canonical, Ltd.
23 * This program is free software; you can redistribute it and/or modify it
24 * under the terms of the GNU General Public License as published by the Free
25 * Software Foundation; either version 2 of the License, or (at your option)
26 * any later version.
29 #include <linux/device.h>
30 #include <linux/hid.h>
31 #include <linux/module.h>
32 #include <linux/slab.h>
33 #include <linux/usb.h>
34 #include <linux/input/mt.h>
35 #include "usbhid/usbhid.h"
38 MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>");
39 MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>");
40 MODULE_DESCRIPTION("HID multitouch panels");
41 MODULE_LICENSE("GPL");
43 #include "hid-ids.h"
45 /* quirks to control the device */
46 #define MT_QUIRK_NOT_SEEN_MEANS_UP (1 << 0)
47 #define MT_QUIRK_SLOT_IS_CONTACTID (1 << 1)
48 #define MT_QUIRK_CYPRESS (1 << 2)
49 #define MT_QUIRK_SLOT_IS_CONTACTNUMBER (1 << 3)
50 #define MT_QUIRK_VALID_IS_INRANGE (1 << 4)
51 #define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 5)
52 #define MT_QUIRK_EGALAX_XYZ_FIXUP (1 << 6)
53 #define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE (1 << 7)
55 struct mt_slot {
56 __s32 x, y, p, w, h;
57 __s32 contactid; /* the device ContactID assigned to this slot */
58 bool touch_state; /* is the touch valid? */
59 bool seen_in_this_frame;/* has this slot been updated */
62 struct mt_device {
63 struct mt_slot curdata; /* placeholder of incoming data */
64 struct mt_class *mtclass; /* our mt device class */
65 unsigned last_field_index; /* last field index of the report */
66 unsigned last_slot_field; /* the last field of a slot */
67 __s8 inputmode; /* InputMode HID feature, -1 if non-existent */
68 __u8 num_received; /* how many contacts we received */
69 __u8 num_expected; /* expected last contact index */
70 __u8 maxcontacts;
71 bool curvalid; /* is the current contact valid? */
72 struct mt_slot *slots;
75 struct mt_class {
76 __s32 name; /* MT_CLS */
77 __s32 quirks;
78 __s32 sn_move; /* Signal/noise ratio for move events */
79 __s32 sn_width; /* Signal/noise ratio for width events */
80 __s32 sn_height; /* Signal/noise ratio for height events */
81 __s32 sn_pressure; /* Signal/noise ratio for pressure events */
82 __u8 maxcontacts;
85 /* classes of device behavior */
86 #define MT_CLS_DEFAULT 0x0001
88 #define MT_CLS_CONFIDENCE 0x0002
89 #define MT_CLS_CONFIDENCE_MINUS_ONE 0x0003
90 #define MT_CLS_DUAL_INRANGE_CONTACTID 0x0004
91 #define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0005
92 #define MT_CLS_DUAL_NSMU_CONTACTID 0x0006
94 /* vendor specific classes */
95 #define MT_CLS_3M 0x0101
96 #define MT_CLS_CYPRESS 0x0102
97 #define MT_CLS_EGALAX 0x0103
99 #define MT_DEFAULT_MAXCONTACT 10
102 * these device-dependent functions determine what slot corresponds
103 * to a valid contact that was just read.
106 static int cypress_compute_slot(struct mt_device *td)
108 if (td->curdata.contactid != 0 || td->num_received == 0)
109 return td->curdata.contactid;
110 else
111 return -1;
114 static int find_slot_from_contactid(struct mt_device *td)
116 int i;
117 for (i = 0; i < td->maxcontacts; ++i) {
118 if (td->slots[i].contactid == td->curdata.contactid &&
119 td->slots[i].touch_state)
120 return i;
122 for (i = 0; i < td->maxcontacts; ++i) {
123 if (!td->slots[i].seen_in_this_frame &&
124 !td->slots[i].touch_state)
125 return i;
127 /* should not occurs. If this happens that means
128 * that the device sent more touches that it says
129 * in the report descriptor. It is ignored then. */
130 return -1;
133 struct mt_class mt_classes[] = {
134 { .name = MT_CLS_DEFAULT,
135 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP },
136 { .name = MT_CLS_CONFIDENCE,
137 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE },
138 { .name = MT_CLS_CONFIDENCE_MINUS_ONE,
139 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
140 MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE },
141 { .name = MT_CLS_DUAL_INRANGE_CONTACTID,
142 .quirks = MT_QUIRK_VALID_IS_INRANGE |
143 MT_QUIRK_SLOT_IS_CONTACTID,
144 .maxcontacts = 2 },
145 { .name = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
146 .quirks = MT_QUIRK_VALID_IS_INRANGE |
147 MT_QUIRK_SLOT_IS_CONTACTNUMBER,
148 .maxcontacts = 2 },
149 { .name = MT_CLS_DUAL_NSMU_CONTACTID,
150 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
151 MT_QUIRK_SLOT_IS_CONTACTID,
152 .maxcontacts = 2 },
155 * vendor specific classes
157 { .name = MT_CLS_3M,
158 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
159 MT_QUIRK_SLOT_IS_CONTACTID,
160 .sn_move = 2048,
161 .sn_width = 128,
162 .sn_height = 128 },
163 { .name = MT_CLS_CYPRESS,
164 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
165 MT_QUIRK_CYPRESS,
166 .maxcontacts = 10 },
167 { .name = MT_CLS_EGALAX,
168 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
169 MT_QUIRK_VALID_IS_INRANGE |
170 MT_QUIRK_EGALAX_XYZ_FIXUP,
171 .maxcontacts = 2,
172 .sn_move = 4096,
173 .sn_pressure = 32,
179 static void mt_feature_mapping(struct hid_device *hdev,
180 struct hid_field *field, struct hid_usage *usage)
182 struct mt_device *td = hid_get_drvdata(hdev);
184 switch (usage->hid) {
185 case HID_DG_INPUTMODE:
186 td->inputmode = field->report->id;
187 break;
188 case HID_DG_CONTACTMAX:
189 td->maxcontacts = field->value[0];
190 if (td->mtclass->maxcontacts)
191 /* check if the maxcontacts is given by the class */
192 td->maxcontacts = td->mtclass->maxcontacts;
194 break;
198 static void set_abs(struct input_dev *input, unsigned int code,
199 struct hid_field *field, int snratio)
201 int fmin = field->logical_minimum;
202 int fmax = field->logical_maximum;
203 int fuzz = snratio ? (fmax - fmin) / snratio : 0;
204 input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
207 static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
208 struct hid_field *field, struct hid_usage *usage,
209 unsigned long **bit, int *max)
211 struct mt_device *td = hid_get_drvdata(hdev);
212 struct mt_class *cls = td->mtclass;
213 __s32 quirks = cls->quirks;
215 switch (usage->hid & HID_USAGE_PAGE) {
217 case HID_UP_GENDESK:
218 switch (usage->hid) {
219 case HID_GD_X:
220 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
221 field->logical_maximum = 32760;
222 hid_map_usage(hi, usage, bit, max,
223 EV_ABS, ABS_MT_POSITION_X);
224 set_abs(hi->input, ABS_MT_POSITION_X, field,
225 cls->sn_move);
226 /* touchscreen emulation */
227 set_abs(hi->input, ABS_X, field, cls->sn_move);
228 td->last_slot_field = usage->hid;
229 td->last_field_index = field->index;
230 return 1;
231 case HID_GD_Y:
232 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
233 field->logical_maximum = 32760;
234 hid_map_usage(hi, usage, bit, max,
235 EV_ABS, ABS_MT_POSITION_Y);
236 set_abs(hi->input, ABS_MT_POSITION_Y, field,
237 cls->sn_move);
238 /* touchscreen emulation */
239 set_abs(hi->input, ABS_Y, field, cls->sn_move);
240 td->last_slot_field = usage->hid;
241 td->last_field_index = field->index;
242 return 1;
244 return 0;
246 case HID_UP_DIGITIZER:
247 switch (usage->hid) {
248 case HID_DG_INRANGE:
249 td->last_slot_field = usage->hid;
250 td->last_field_index = field->index;
251 return 1;
252 case HID_DG_CONFIDENCE:
253 td->last_slot_field = usage->hid;
254 td->last_field_index = field->index;
255 return 1;
256 case HID_DG_TIPSWITCH:
257 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
258 input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
259 td->last_slot_field = usage->hid;
260 td->last_field_index = field->index;
261 return 1;
262 case HID_DG_CONTACTID:
263 input_mt_init_slots(hi->input, td->maxcontacts);
264 td->last_slot_field = usage->hid;
265 td->last_field_index = field->index;
266 return 1;
267 case HID_DG_WIDTH:
268 hid_map_usage(hi, usage, bit, max,
269 EV_ABS, ABS_MT_TOUCH_MAJOR);
270 set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
271 cls->sn_width);
272 td->last_slot_field = usage->hid;
273 td->last_field_index = field->index;
274 return 1;
275 case HID_DG_HEIGHT:
276 hid_map_usage(hi, usage, bit, max,
277 EV_ABS, ABS_MT_TOUCH_MINOR);
278 set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
279 cls->sn_height);
280 input_set_abs_params(hi->input,
281 ABS_MT_ORIENTATION, 0, 1, 0, 0);
282 td->last_slot_field = usage->hid;
283 td->last_field_index = field->index;
284 return 1;
285 case HID_DG_TIPPRESSURE:
286 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
287 field->logical_minimum = 0;
288 hid_map_usage(hi, usage, bit, max,
289 EV_ABS, ABS_MT_PRESSURE);
290 set_abs(hi->input, ABS_MT_PRESSURE, field,
291 cls->sn_pressure);
292 /* touchscreen emulation */
293 set_abs(hi->input, ABS_PRESSURE, field,
294 cls->sn_pressure);
295 td->last_slot_field = usage->hid;
296 td->last_field_index = field->index;
297 return 1;
298 case HID_DG_CONTACTCOUNT:
299 td->last_field_index = field->index;
300 return 1;
301 case HID_DG_CONTACTMAX:
302 /* we don't set td->last_slot_field as contactcount and
303 * contact max are global to the report */
304 td->last_field_index = field->index;
305 return -1;
307 /* let hid-input decide for the others */
308 return 0;
310 case 0xff000000:
311 /* we do not want to map these: no input-oriented meaning */
312 return -1;
315 return 0;
318 static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
319 struct hid_field *field, struct hid_usage *usage,
320 unsigned long **bit, int *max)
322 if (usage->type == EV_KEY || usage->type == EV_ABS)
323 set_bit(usage->type, hi->input->evbit);
325 return -1;
328 static int mt_compute_slot(struct mt_device *td)
330 __s32 quirks = td->mtclass->quirks;
332 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID)
333 return td->curdata.contactid;
335 if (quirks & MT_QUIRK_CYPRESS)
336 return cypress_compute_slot(td);
338 if (quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER)
339 return td->num_received;
341 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE)
342 return td->curdata.contactid - 1;
344 return find_slot_from_contactid(td);
348 * this function is called when a whole contact has been processed,
349 * so that it can assign it to a slot and store the data there
351 static void mt_complete_slot(struct mt_device *td)
353 td->curdata.seen_in_this_frame = true;
354 if (td->curvalid) {
355 int slotnum = mt_compute_slot(td);
357 if (slotnum >= 0 && slotnum < td->maxcontacts)
358 td->slots[slotnum] = td->curdata;
360 td->num_received++;
365 * this function is called when a whole packet has been received and processed,
366 * so that it can decide what to send to the input layer.
368 static void mt_emit_event(struct mt_device *td, struct input_dev *input)
370 int i;
372 for (i = 0; i < td->maxcontacts; ++i) {
373 struct mt_slot *s = &(td->slots[i]);
374 if ((td->mtclass->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) &&
375 !s->seen_in_this_frame) {
376 s->touch_state = false;
379 input_mt_slot(input, i);
380 input_mt_report_slot_state(input, MT_TOOL_FINGER,
381 s->touch_state);
382 if (s->touch_state) {
383 /* this finger is on the screen */
384 int wide = (s->w > s->h);
385 /* divided by two to match visual scale of touch */
386 int major = max(s->w, s->h) >> 1;
387 int minor = min(s->w, s->h) >> 1;
389 input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
390 input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
391 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
392 input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p);
393 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
394 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
396 s->seen_in_this_frame = false;
400 input_mt_report_pointer_emulation(input, true);
401 input_sync(input);
402 td->num_received = 0;
407 static int mt_event(struct hid_device *hid, struct hid_field *field,
408 struct hid_usage *usage, __s32 value)
410 struct mt_device *td = hid_get_drvdata(hid);
411 __s32 quirks = td->mtclass->quirks;
413 if (hid->claimed & HID_CLAIMED_INPUT && td->slots) {
414 switch (usage->hid) {
415 case HID_DG_INRANGE:
416 if (quirks & MT_QUIRK_VALID_IS_INRANGE)
417 td->curvalid = value;
418 break;
419 case HID_DG_TIPSWITCH:
420 if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
421 td->curvalid = value;
422 td->curdata.touch_state = value;
423 break;
424 case HID_DG_CONFIDENCE:
425 if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE)
426 td->curvalid = value;
427 break;
428 case HID_DG_CONTACTID:
429 td->curdata.contactid = value;
430 break;
431 case HID_DG_TIPPRESSURE:
432 td->curdata.p = value;
433 break;
434 case HID_GD_X:
435 td->curdata.x = value;
436 break;
437 case HID_GD_Y:
438 td->curdata.y = value;
439 break;
440 case HID_DG_WIDTH:
441 td->curdata.w = value;
442 break;
443 case HID_DG_HEIGHT:
444 td->curdata.h = value;
445 break;
446 case HID_DG_CONTACTCOUNT:
448 * Includes multi-packet support where subsequent
449 * packets are sent with zero contactcount.
451 if (value)
452 td->num_expected = value;
453 break;
455 default:
456 /* fallback to the generic hidinput handling */
457 return 0;
460 if (usage->hid == td->last_slot_field) {
461 mt_complete_slot(td);
464 if (field->index == td->last_field_index
465 && td->num_received >= td->num_expected)
466 mt_emit_event(td, field->hidinput->input);
470 /* we have handled the hidinput part, now remains hiddev */
471 if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
472 hid->hiddev_hid_event(hid, field, usage, value);
474 return 1;
477 static void mt_set_input_mode(struct hid_device *hdev)
479 struct mt_device *td = hid_get_drvdata(hdev);
480 struct hid_report *r;
481 struct hid_report_enum *re;
483 if (td->inputmode < 0)
484 return;
486 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
487 r = re->report_id_hash[td->inputmode];
488 if (r) {
489 r->field[0]->value[0] = 0x02;
490 usbhid_submit_report(hdev, r, USB_DIR_OUT);
494 static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
496 int ret, i;
497 struct mt_device *td;
498 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
500 for (i = 0; mt_classes[i].name ; i++) {
501 if (id->driver_data == mt_classes[i].name) {
502 mtclass = &(mt_classes[i]);
503 break;
507 /* This allows the driver to correctly support devices
508 * that emit events over several HID messages.
510 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
512 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
513 if (!td) {
514 dev_err(&hdev->dev, "cannot allocate multitouch data\n");
515 return -ENOMEM;
517 td->mtclass = mtclass;
518 td->inputmode = -1;
519 hid_set_drvdata(hdev, td);
521 ret = hid_parse(hdev);
522 if (ret != 0)
523 goto fail;
525 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
526 if (ret)
527 goto fail;
529 if (!td->maxcontacts)
530 td->maxcontacts = MT_DEFAULT_MAXCONTACT;
532 td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
533 GFP_KERNEL);
534 if (!td->slots) {
535 dev_err(&hdev->dev, "cannot allocate multitouch slots\n");
536 hid_hw_stop(hdev);
537 ret = -ENOMEM;
538 goto fail;
541 mt_set_input_mode(hdev);
543 return 0;
545 fail:
546 kfree(td);
547 return ret;
550 #ifdef CONFIG_PM
551 static int mt_reset_resume(struct hid_device *hdev)
553 mt_set_input_mode(hdev);
554 return 0;
556 #endif
558 static void mt_remove(struct hid_device *hdev)
560 struct mt_device *td = hid_get_drvdata(hdev);
561 hid_hw_stop(hdev);
562 kfree(td->slots);
563 kfree(td);
564 hid_set_drvdata(hdev, NULL);
567 static const struct hid_device_id mt_devices[] = {
569 /* 3M panels */
570 { .driver_data = MT_CLS_3M,
571 HID_USB_DEVICE(USB_VENDOR_ID_3M,
572 USB_DEVICE_ID_3M1968) },
573 { .driver_data = MT_CLS_3M,
574 HID_USB_DEVICE(USB_VENDOR_ID_3M,
575 USB_DEVICE_ID_3M2256) },
577 /* ActionStar panels */
578 { .driver_data = MT_CLS_DEFAULT,
579 HID_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR,
580 USB_DEVICE_ID_ACTIONSTAR_1011) },
582 /* Cando panels */
583 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
584 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
585 USB_DEVICE_ID_CANDO_MULTI_TOUCH) },
586 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
587 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
588 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) },
589 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
590 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
591 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) },
592 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
593 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
594 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },
596 /* CVTouch panels */
597 { .driver_data = MT_CLS_DEFAULT,
598 HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH,
599 USB_DEVICE_ID_CVTOUCH_SCREEN) },
601 /* Cypress panel */
602 { .driver_data = MT_CLS_CYPRESS,
603 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS,
604 USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
606 /* eGalax devices (resistive) */
607 { .driver_data = MT_CLS_EGALAX,
608 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
609 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) },
610 { .driver_data = MT_CLS_EGALAX,
611 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
612 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3) },
614 /* eGalax devices (capacitive) */
615 { .driver_data = MT_CLS_EGALAX,
616 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
617 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) },
618 { .driver_data = MT_CLS_EGALAX,
619 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
620 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2) },
621 { .driver_data = MT_CLS_EGALAX,
622 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
623 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4) },
625 /* Elo TouchSystems IntelliTouch Plus panel */
626 { .driver_data = MT_CLS_DUAL_NSMU_CONTACTID,
627 HID_USB_DEVICE(USB_VENDOR_ID_ELO,
628 USB_DEVICE_ID_ELO_TS2515) },
630 /* GeneralTouch panel */
631 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
632 HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
633 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) },
635 /* GoodTouch panels */
636 { .driver_data = MT_CLS_DEFAULT,
637 HID_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH,
638 USB_DEVICE_ID_GOODTOUCH_000f) },
640 /* Ilitek dual touch panel */
641 { .driver_data = MT_CLS_DEFAULT,
642 HID_USB_DEVICE(USB_VENDOR_ID_ILITEK,
643 USB_DEVICE_ID_ILITEK_MULTITOUCH) },
645 /* IRTOUCH panels */
646 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
647 HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS,
648 USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
650 /* Lumio panels */
651 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
652 HID_USB_DEVICE(USB_VENDOR_ID_LUMIO,
653 USB_DEVICE_ID_CRYSTALTOUCH) },
655 /* MosArt panels */
656 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
657 HID_USB_DEVICE(USB_VENDOR_ID_ASUS,
658 USB_DEVICE_ID_ASUS_T91MT)},
659 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
660 HID_USB_DEVICE(USB_VENDOR_ID_ASUS,
661 USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) },
662 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
663 HID_USB_DEVICE(USB_VENDOR_ID_TURBOX,
664 USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) },
666 /* PenMount panels */
667 { .driver_data = MT_CLS_CONFIDENCE,
668 HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT,
669 USB_DEVICE_ID_PENMOUNT_PCI) },
671 /* PixCir-based panels */
672 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
673 HID_USB_DEVICE(USB_VENDOR_ID_HANVON,
674 USB_DEVICE_ID_HANVON_MULTITOUCH) },
675 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
676 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
677 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
679 /* Stantum panels */
680 { .driver_data = MT_CLS_CONFIDENCE,
681 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM,
682 USB_DEVICE_ID_MTP)},
683 { .driver_data = MT_CLS_CONFIDENCE,
684 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM,
685 USB_DEVICE_ID_MTP_STM)},
686 { .driver_data = MT_CLS_CONFIDENCE,
687 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM,
688 USB_DEVICE_ID_MTP_SITRONIX)},
690 /* Touch International panels */
691 { .driver_data = MT_CLS_DEFAULT,
692 HID_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL,
693 USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) },
695 /* Unitec panels */
696 { .driver_data = MT_CLS_DEFAULT,
697 HID_USB_DEVICE(USB_VENDOR_ID_UNITEC,
698 USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) },
699 { .driver_data = MT_CLS_DEFAULT,
700 HID_USB_DEVICE(USB_VENDOR_ID_UNITEC,
701 USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) },
705 MODULE_DEVICE_TABLE(hid, mt_devices);
707 static const struct hid_usage_id mt_grabbed_usages[] = {
708 { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
709 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
712 static struct hid_driver mt_driver = {
713 .name = "hid-multitouch",
714 .id_table = mt_devices,
715 .probe = mt_probe,
716 .remove = mt_remove,
717 .input_mapping = mt_input_mapping,
718 .input_mapped = mt_input_mapped,
719 .feature_mapping = mt_feature_mapping,
720 .usage_table = mt_grabbed_usages,
721 .event = mt_event,
722 #ifdef CONFIG_PM
723 .reset_resume = mt_reset_resume,
724 #endif
727 static int __init mt_init(void)
729 return hid_register_driver(&mt_driver);
732 static void __exit mt_exit(void)
734 hid_unregister_driver(&mt_driver);
737 module_init(mt_init);
738 module_exit(mt_exit);