summaryrefslogtreecommitdiff
path: root/usr/src/dkms_source_tree/hid-multitouch.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/dkms_source_tree/hid-multitouch.c')
-rw-r--r--usr/src/dkms_source_tree/hid-multitouch.c660
1 files changed, 660 insertions, 0 deletions
diff --git a/usr/src/dkms_source_tree/hid-multitouch.c b/usr/src/dkms_source_tree/hid-multitouch.c
new file mode 100644
index 0000000..02a6675
--- /dev/null
+++ b/usr/src/dkms_source_tree/hid-multitouch.c
@@ -0,0 +1,660 @@
1/*
2 * HID driver for multitouch panels
3 *
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
7 *
8 * This code is partly based on hid-egalax.c:
9 *
10 * Copyright (c) 2010 Stephane Chatty <chatty@enac.fr>
11 * Copyright (c) 2010 Henrik Rydberg <rydberg@euromail.se>
12 * Copyright (c) 2010 Canonical, Ltd.
13 *
14 * This code is partly based on hid-3m-pct.c:
15 *
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.
19 *
20 */
21
22/*
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.
27 */
28
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 "input-mt.h"
35#include "usbhid.h"
36
37MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>");
38MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>");
39MODULE_DESCRIPTION("HID multitouch panels");
40MODULE_LICENSE("GPL");
41
42#include "hid-ids.h"
43
44/* quirks to control the device */
45#define MT_QUIRK_NOT_SEEN_MEANS_UP (1 << 0)
46#define MT_QUIRK_SLOT_IS_CONTACTID (1 << 1)
47#define MT_QUIRK_CYPRESS (1 << 2)
48#define MT_QUIRK_SLOT_IS_CONTACTNUMBER (1 << 3)
49#define MT_QUIRK_VALID_IS_INRANGE (1 << 4)
50#define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 5)
51#define MT_QUIRK_EGALAX_XYZ_FIXUP (1 << 6)
52
53struct mt_slot {
54 __s32 x, y, p, w, h;
55 __s32 contactid; /* the device ContactID assigned to this slot */
56 bool touch_state; /* is the touch valid? */
57 bool seen_in_this_frame;/* has this slot been updated */
58};
59
60struct mt_device {
61 struct mt_slot curdata; /* placeholder of incoming data */
62 struct mt_class *mtclass; /* our mt device class */
63 unsigned last_field_index; /* last field index of the report */
64 unsigned last_slot_field; /* the last field of a slot */
65 __s8 inputmode; /* InputMode HID feature, -1 if non-existent */
66 __u8 num_received; /* how many contacts we received */
67 __u8 num_expected; /* expected last contact index */
68 __u8 maxcontacts;
69 bool curvalid; /* is the current contact valid? */
70 struct mt_slot *slots;
71};
72
73struct mt_class {
74 __s32 name; /* MT_CLS */
75 __s32 quirks;
76 __s32 sn_move; /* Signal/noise ratio for move events */
77 __s32 sn_width; /* Signal/noise ratio for width events */
78 __s32 sn_height; /* Signal/noise ratio for height events */
79 __s32 sn_pressure; /* Signal/noise ratio for pressure events */
80 __u8 maxcontacts;
81};
82
83/* classes of device behavior */
84#define MT_CLS_DEFAULT 1
85#define MT_CLS_DUAL_INRANGE_CONTACTID 2
86#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 3
87#define MT_CLS_CYPRESS 4
88#define MT_CLS_EGALAX 5
89#define MT_CLS_STANTUM 6
90#define MT_CLS_3M 7
91
92#define MT_DEFAULT_MAXCONTACT 10
93
94/*
95 * these device-dependent functions determine what slot corresponds
96 * to a valid contact that was just read.
97 */
98
99static int cypress_compute_slot(struct mt_device *td)
100{
101 if (td->curdata.contactid != 0 || td->num_received == 0)
102 return td->curdata.contactid;
103 else
104 return -1;
105}
106
107static int find_slot_from_contactid(struct mt_device *td)
108{
109 int i;
110 for (i = 0; i < td->maxcontacts; ++i) {
111 if (td->slots[i].contactid == td->curdata.contactid &&
112 td->slots[i].touch_state)
113 return i;
114 }
115 for (i = 0; i < td->maxcontacts; ++i) {
116 if (!td->slots[i].seen_in_this_frame &&
117 !td->slots[i].touch_state)
118 return i;
119 }
120 /* should not occurs. If this happens that means
121 * that the device sent more touches that it says
122 * in the report descriptor. It is ignored then. */
123 return -1;
124}
125
126struct mt_class mt_classes[] = {
127 { .name = MT_CLS_DEFAULT,
128 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP },
129 { .name = MT_CLS_DUAL_INRANGE_CONTACTID,
130 .quirks = MT_QUIRK_VALID_IS_INRANGE |
131 MT_QUIRK_SLOT_IS_CONTACTID,
132 .maxcontacts = 2 },
133 { .name = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
134 .quirks = MT_QUIRK_VALID_IS_INRANGE |
135 MT_QUIRK_SLOT_IS_CONTACTNUMBER,
136 .maxcontacts = 2 },
137 { .name = MT_CLS_CYPRESS,
138 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
139 MT_QUIRK_CYPRESS,
140 .maxcontacts = 10 },
141
142 { .name = MT_CLS_EGALAX,
143 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
144 MT_QUIRK_VALID_IS_INRANGE |
145 MT_QUIRK_EGALAX_XYZ_FIXUP,
146 .maxcontacts = 2,
147 .sn_move = 4096,
148 .sn_pressure = 32,
149 },
150 { .name = MT_CLS_STANTUM,
151 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE },
152 { .name = MT_CLS_3M,
153 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
154 MT_QUIRK_SLOT_IS_CONTACTID,
155 .sn_move = 2048,
156 .sn_width = 128,
157 .sn_height = 128 },
158
159 { }
160};
161
162static void mt_feature_mapping(struct hid_device *hdev,
163 struct hid_field *field, struct hid_usage *usage)
164{
165 struct mt_device *td = hid_get_drvdata(hdev);
166
167 switch (usage->hid) {
168 case HID_DG_INPUTMODE:
169 td->inputmode = field->report->id;
170 break;
171 case HID_DG_CONTACTMAX:
172 td->maxcontacts = field->value[0];
173 if (td->mtclass->maxcontacts)
174 /* check if the maxcontacts is given by the class */
175 td->maxcontacts = td->mtclass->maxcontacts;
176
177 break;
178 }
179}
180
181static void set_abs(struct input_dev *input, unsigned int code,
182 struct hid_field *field, int snratio)
183{
184 int fmin = field->logical_minimum;
185 int fmax = field->logical_maximum;
186 int fuzz = snratio ? (fmax - fmin) / snratio : 0;
187 input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
188}
189
190static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
191 struct hid_field *field, struct hid_usage *usage,
192 unsigned long **bit, int *max)
193{
194 struct mt_device *td = hid_get_drvdata(hdev);
195 struct mt_class *cls = td->mtclass;
196 __s32 quirks = cls->quirks;
197
198 switch (usage->hid & HID_USAGE_PAGE) {
199
200 case HID_UP_GENDESK:
201 switch (usage->hid) {
202 case HID_GD_X:
203 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
204 field->logical_maximum = 32760;
205 hid_map_usage(hi, usage, bit, max,
206 EV_ABS, ABS_MT_POSITION_X);
207 set_abs(hi->input, ABS_MT_POSITION_X, field,
208 cls->sn_move);
209 /* touchscreen emulation */
210 set_abs(hi->input, ABS_X, field, cls->sn_move);
211 td->last_slot_field = usage->hid;
212 return 1;
213 case HID_GD_Y:
214 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
215 field->logical_maximum = 32760;
216 hid_map_usage(hi, usage, bit, max,
217 EV_ABS, ABS_MT_POSITION_Y);
218 set_abs(hi->input, ABS_MT_POSITION_Y, field,
219 cls->sn_move);
220 /* touchscreen emulation */
221 set_abs(hi->input, ABS_Y, field, cls->sn_move);
222 td->last_slot_field = usage->hid;
223 return 1;
224 }
225 return 0;
226
227 case HID_UP_DIGITIZER:
228 switch (usage->hid) {
229 case HID_DG_INRANGE:
230 td->last_slot_field = usage->hid;
231 return 1;
232 case HID_DG_CONFIDENCE:
233 td->last_slot_field = usage->hid;
234 return 1;
235 case HID_DG_TIPSWITCH:
236 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
237 input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
238 td->last_slot_field = usage->hid;
239 return 1;
240 case HID_DG_CONTACTID:
241 input_mt_init_slots(hi->input, td->maxcontacts);
242 td->last_slot_field = usage->hid;
243 return 1;
244 case HID_DG_WIDTH:
245 hid_map_usage(hi, usage, bit, max,
246 EV_ABS, ABS_MT_TOUCH_MAJOR);
247 set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
248 cls->sn_width);
249 td->last_slot_field = usage->hid;
250 return 1;
251 case HID_DG_HEIGHT:
252 hid_map_usage(hi, usage, bit, max,
253 EV_ABS, ABS_MT_TOUCH_MINOR);
254 set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
255 cls->sn_height);
256 input_set_abs_params(hi->input,
257 ABS_MT_ORIENTATION, 0, 1, 0, 0);
258 td->last_slot_field = usage->hid;
259 return 1;
260 case HID_DG_TIPPRESSURE:
261 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
262 field->logical_minimum = 0;
263 hid_map_usage(hi, usage, bit, max,
264 EV_ABS, ABS_MT_PRESSURE);
265 set_abs(hi->input, ABS_MT_PRESSURE, field,
266 cls->sn_pressure);
267 /* touchscreen emulation */
268 set_abs(hi->input, ABS_PRESSURE, field,
269 cls->sn_pressure);
270 td->last_slot_field = usage->hid;
271 return 1;
272 case HID_DG_CONTACTCOUNT:
273 td->last_field_index = field->report->maxfield - 1;
274 return 1;
275 case HID_DG_CONTACTMAX:
276 /* we don't set td->last_slot_field as contactcount and
277 * contact max are global to the report */
278 return -1;
279 }
280 /* let hid-input decide for the others */
281 return 0;
282
283 case 0xff000000:
284 /* we do not want to map these: no input-oriented meaning */
285 return -1;
286 }
287
288 return 0;
289}
290
291static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
292 struct hid_field *field, struct hid_usage *usage,
293 unsigned long **bit, int *max)
294{
295 if (usage->type == EV_KEY || usage->type == EV_ABS)
296 set_bit(usage->type, hi->input->evbit);
297
298 return -1;
299}
300
301static int mt_compute_slot(struct mt_device *td)
302{
303 __s32 quirks = td->mtclass->quirks;
304
305 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID)
306 return td->curdata.contactid;
307
308 if (quirks & MT_QUIRK_CYPRESS)
309 return cypress_compute_slot(td);
310
311 if (quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER)
312 return td->num_received;
313
314 return find_slot_from_contactid(td);
315}
316
317/*
318 * this function is called when a whole contact has been processed,
319 * so that it can assign it to a slot and store the data there
320 */
321static void mt_complete_slot(struct mt_device *td)
322{
323 td->curdata.seen_in_this_frame = true;
324 if (td->curvalid) {
325 int slotnum = mt_compute_slot(td);
326
327 if (slotnum >= 0 && slotnum < td->maxcontacts)
328 td->slots[slotnum] = td->curdata;
329 }
330 td->num_received++;
331}
332
333
334/*
335 * this function is called when a whole packet has been received and processed,
336 * so that it can decide what to send to the input layer.
337 */
338static void mt_emit_event(struct mt_device *td, struct input_dev *input)
339{
340 int i;
341
342 for (i = 0; i < td->maxcontacts; ++i) {
343 struct mt_slot *s = &(td->slots[i]);
344 if ((td->mtclass->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) &&
345 !s->seen_in_this_frame) {
346 s->touch_state = false;
347 }
348
349 input_mt_slot(input, i);
350 input_mt_report_slot_state(input, MT_TOOL_FINGER,
351 s->touch_state);
352 if (s->touch_state) {
353 /* this finger is on the screen */
354 int wide = (s->w > s->h);
355 /* divided by two to match visual scale of touch */
356 int major = max(s->w, s->h) >> 1;
357 int minor = min(s->w, s->h) >> 1;
358
359 input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
360 input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
361 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
362 input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p);
363 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
364 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
365 }
366 s->seen_in_this_frame = false;
367
368 }
369
370 input_mt_report_pointer_emulation(input, true);
371 input_sync(input);
372 td->num_received = 0;
373}
374
375
376
377static int mt_event(struct hid_device *hid, struct hid_field *field,
378 struct hid_usage *usage, __s32 value)
379{
380 struct mt_device *td = hid_get_drvdata(hid);
381 __s32 quirks = td->mtclass->quirks;
382
383 if (hid->claimed & HID_CLAIMED_INPUT && td->slots) {
384 switch (usage->hid) {
385 case HID_DG_INRANGE:
386 if (quirks & MT_QUIRK_VALID_IS_INRANGE)
387 td->curvalid = value;
388 break;
389 case HID_DG_TIPSWITCH:
390 if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
391 td->curvalid = value;
392 td->curdata.touch_state = value;
393 break;
394 case HID_DG_CONFIDENCE:
395 if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE)
396 td->curvalid = value;
397 break;
398 case HID_DG_CONTACTID:
399 td->curdata.contactid = value;
400 break;
401 case HID_DG_TIPPRESSURE:
402 td->curdata.p = value;
403 break;
404 case HID_GD_X:
405 td->curdata.x = value;
406 break;
407 case HID_GD_Y:
408 td->curdata.y = value;
409 break;
410 case HID_DG_WIDTH:
411 td->curdata.w = value;
412 break;
413 case HID_DG_HEIGHT:
414 td->curdata.h = value;
415 break;
416 case HID_DG_CONTACTCOUNT:
417 /*
418 * Includes multi-packet support where subsequent
419 * packets are sent with zero contactcount.
420 */
421 if (value)
422 td->num_expected = value;
423 break;
424
425 default:
426 if (td->last_field_index
427 && field->index == td->last_field_index)
428 /* we reach here when the last field in the
429 * report is not related to multitouch.
430 * This is not good. As a temporary solution,
431 * we trigger our mt event completion and
432 * ignore the field.
433 */
434 break;
435 /* fallback to the generic hidinput handling */
436 return 0;
437 }
438
439 if (usage->hid == td->last_slot_field) {
440 mt_complete_slot(td);
441 if (!td->last_field_index)
442 mt_emit_event(td, field->hidinput->input);
443 }
444
445 if (field->index == td->last_field_index
446 && td->num_received >= td->num_expected)
447 mt_emit_event(td, field->hidinput->input);
448
449 }
450
451 /* we have handled the hidinput part, now remains hiddev */
452 if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
453 hid->hiddev_hid_event(hid, field, usage, value);
454
455 return 1;
456}
457
458static void mt_set_input_mode(struct hid_device *hdev)
459{
460 struct mt_device *td = hid_get_drvdata(hdev);
461 struct hid_report *r;
462 struct hid_report_enum *re;
463
464 if (td->inputmode < 0)
465 return;
466
467 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
468 r = re->report_id_hash[td->inputmode];
469 if (r) {
470 r->field[0]->value[0] = 0x02;
471 usbhid_submit_report(hdev, r, USB_DIR_OUT);
472 }
473}
474
475static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
476{
477 int ret, i;
478 struct mt_device *td;
479 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
480
481 for (i = 0; mt_classes[i].name ; i++) {
482 if (id->driver_data == mt_classes[i].name) {
483 mtclass = &(mt_classes[i]);
484 break;
485 }
486 }
487
488 /* This allows the driver to correctly support devices
489 * that emit events over several HID messages.
490 */
491 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
492
493 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
494 if (!td) {
495 dev_err(&hdev->dev, "cannot allocate multitouch data\n");
496 return -ENOMEM;
497 }
498 td->mtclass = mtclass;
499 td->inputmode = -1;
500 hid_set_drvdata(hdev, td);
501
502 ret = hid_parse(hdev);
503 if (ret != 0)
504 goto fail;
505
506 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
507 if (ret)
508 goto fail;
509
510 if (!td->maxcontacts)
511 td->maxcontacts = MT_DEFAULT_MAXCONTACT;
512
513 td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
514 GFP_KERNEL);
515 if (!td->slots) {
516 dev_err(&hdev->dev, "cannot allocate multitouch slots\n");
517 hid_hw_stop(hdev);
518 ret = -ENOMEM;
519 goto fail;
520 }
521
522 mt_set_input_mode(hdev);
523
524 return 0;
525
526fail:
527 kfree(td);
528 return ret;
529}
530
531#ifdef CONFIG_PM
532static int mt_reset_resume(struct hid_device *hdev)
533{
534 mt_set_input_mode(hdev);
535 return 0;
536}
537#endif
538
539static void mt_remove(struct hid_device *hdev)
540{
541 struct mt_device *td = hid_get_drvdata(hdev);
542 hid_hw_stop(hdev);
543 kfree(td->slots);
544 kfree(td);
545 hid_set_drvdata(hdev, NULL);
546}
547
548static const struct hid_device_id mt_devices[] = {
549
550 /* 3M panels */
551 { .driver_data = MT_CLS_3M,
552 HID_USB_DEVICE(USB_VENDOR_ID_3M,
553 USB_DEVICE_ID_3M1968) },
554 { .driver_data = MT_CLS_3M,
555 HID_USB_DEVICE(USB_VENDOR_ID_3M,
556 USB_DEVICE_ID_3M2256) },
557
558 /* Cando panels */
559 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
560 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
561 USB_DEVICE_ID_CANDO_MULTI_TOUCH) },
562 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
563 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
564 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) },
565 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
566 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
567 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) },
568 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
569 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
570 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },
571
572 /* Cypress panel */
573 { .driver_data = MT_CLS_CYPRESS,
574 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS,
575 USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
576
577 /* GeneralTouch panel */
578 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
579 HID_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
580 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) },
581
582 /* IRTOUCH panels */
583 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
584 HID_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS,
585 USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
586
587 /* PixCir-based panels */
588 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
589 HID_USB_DEVICE(USB_VENDOR_ID_HANVON,
590 USB_DEVICE_ID_HANVON_MULTITOUCH) },
591 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
592 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
593 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
594
595 /* Resistive eGalax devices */
596 { .driver_data = MT_CLS_EGALAX,
597 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
598 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) },
599 { .driver_data = MT_CLS_EGALAX,
600 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
601 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3) },
602
603 /* Capacitive eGalax devices */
604 { .driver_data = MT_CLS_EGALAX,
605 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
606 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) },
607 { .driver_data = MT_CLS_EGALAX,
608 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
609 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2) },
610 { .driver_data = MT_CLS_EGALAX,
611 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
612 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4) },
613
614 /* Stantum panels */
615 { .driver_data = MT_CLS_STANTUM,
616 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM,
617 USB_DEVICE_ID_MTP)},
618 { .driver_data = MT_CLS_STANTUM,
619 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM,
620 USB_DEVICE_ID_MTP_STM)},
621 { .driver_data = MT_CLS_STANTUM,
622 HID_USB_DEVICE(USB_VENDOR_ID_STANTUM,
623 USB_DEVICE_ID_MTP_SITRONIX)},
624
625 { }
626};
627MODULE_DEVICE_TABLE(hid, mt_devices);
628
629static const struct hid_usage_id mt_grabbed_usages[] = {
630 { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
631 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
632};
633
634static struct hid_driver mt_driver = {
635 .name = "hid-multitouch",
636 .id_table = mt_devices,
637 .probe = mt_probe,
638 .remove = mt_remove,
639 .input_mapping = mt_input_mapping,
640 .input_mapped = mt_input_mapped,
641 .feature_mapping = mt_feature_mapping,
642 .usage_table = mt_grabbed_usages,
643 .event = mt_event,
644#ifdef CONFIG_PM
645 .reset_resume = mt_reset_resume,
646#endif
647};
648
649static int __init mt_init(void)
650{
651 return hid_register_driver(&mt_driver);
652}
653
654static void __exit mt_exit(void)
655{
656 hid_unregister_driver(&mt_driver);
657}
658
659module_init(mt_init);
660module_exit(mt_exit);