blob: 59c8b5c1d2de62b9a1d5a910dfa7f3ad5e470c51 [file] [log] [blame]
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001/*
2 * HID driver for multitouch panels
3 *
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +01004 * Copyright (c) 2010-2012 Stephane Chatty <chatty@enac.fr>
5 * Copyright (c) 2010-2012 Benjamin Tissoires <benjamin.tissoires@gmail.com>
6 * Copyright (c) 2010-2012 Ecole Nationale de l'Aviation Civile, France
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01007 *
Richard Nauber4875ac12011-03-09 06:20:57 +01008 * 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 *
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +010014 * 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 *
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010020 */
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 <linux/input/mt.h>
35#include "usbhid/usbhid.h"
36
37
38MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>");
Benjamin Tissoiresef2fafb2011-01-31 11:28:21 +010039MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>");
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010040MODULE_DESCRIPTION("HID multitouch panels");
41MODULE_LICENSE("GPL");
42
43#include "hid-ids.h"
44
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)
Benjamin Tissoires2d936662011-01-11 16:45:54 +010048#define MT_QUIRK_CYPRESS (1 << 2)
Benjamin Tissoires5572da02011-01-07 23:47:27 +010049#define MT_QUIRK_SLOT_IS_CONTACTNUMBER (1 << 3)
Stephane Chattya062cc52011-09-17 22:27:30 +020050#define MT_QUIRK_ALWAYS_VALID (1 << 4)
51#define MT_QUIRK_VALID_IS_INRANGE (1 << 5)
52#define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 6)
Stephane Chattya062cc52011-09-17 22:27:30 +020053#define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE (1 << 8)
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010054
55struct 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 */
60};
61
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010062struct mt_class {
Benjamin Tissoires2d936662011-01-11 16:45:54 +010063 __s32 name; /* MT_CLS */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010064 __s32 quirks;
65 __s32 sn_move; /* Signal/noise ratio for move events */
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +010066 __s32 sn_width; /* Signal/noise ratio for width events */
67 __s32 sn_height; /* Signal/noise ratio for height events */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010068 __s32 sn_pressure; /* Signal/noise ratio for pressure events */
69 __u8 maxcontacts;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +010070 bool is_indirect; /* true for touchpads */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010071};
72
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +020073struct mt_fields {
74 unsigned usages[HID_MAX_FIELDS];
75 unsigned int length;
76};
77
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010078struct mt_device {
79 struct mt_slot curdata; /* placeholder of incoming data */
Benjamin Tissoireseec29e32011-11-23 10:54:28 +010080 struct mt_class mtclass; /* our mt device class */
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +020081 struct mt_fields *fields; /* temporary placeholder for storing the
82 multitouch fields */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010083 unsigned last_field_index; /* last field index of the report */
84 unsigned last_slot_field; /* the last field of a slot */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010085 __s8 inputmode; /* InputMode HID feature, -1 if non-existent */
Benjamin Tissoires4aceed32012-06-19 14:39:52 +020086 __s8 inputmode_index; /* InputMode HID feature index in the report */
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +010087 __s8 maxcontact_report_id; /* Maximum Contact Number HID feature,
88 -1 if non-existent */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010089 __u8 num_received; /* how many contacts we received */
90 __u8 num_expected; /* expected last contact index */
91 __u8 maxcontacts;
Benjamin Tissoires9e87f222012-03-06 17:57:06 +010092 __u8 touches_by_report; /* how many touches are present in one report:
93 * 1 means we should use a serial protocol
94 * > 1 means hybrid (multitouch) protocol */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010095 bool curvalid; /* is the current contact valid? */
96 struct mt_slot *slots;
97};
98
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010099/* classes of device behavior */
Benjamin Tissoires22408282011-05-20 15:59:34 +0200100#define MT_CLS_DEFAULT 0x0001
101
Stephane Chattya062cc52011-09-17 22:27:30 +0200102#define MT_CLS_SERIAL 0x0002
103#define MT_CLS_CONFIDENCE 0x0003
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100104#define MT_CLS_CONFIDENCE_CONTACT_ID 0x0004
105#define MT_CLS_CONFIDENCE_MINUS_ONE 0x0005
106#define MT_CLS_DUAL_INRANGE_CONTACTID 0x0006
107#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0007
108#define MT_CLS_DUAL_NSMU_CONTACTID 0x0008
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800109#define MT_CLS_INRANGE_CONTACTNUMBER 0x0009
Benjamin Tissoires22408282011-05-20 15:59:34 +0200110
111/* vendor specific classes */
112#define MT_CLS_3M 0x0101
113#define MT_CLS_CYPRESS 0x0102
114#define MT_CLS_EGALAX 0x0103
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100115#define MT_CLS_EGALAX_SERIAL 0x0104
Benjamin Tissoires847672c2012-02-04 17:08:50 +0100116#define MT_CLS_TOPSEED 0x0105
Denis Kovalev2258e862012-02-14 00:50:33 -0800117#define MT_CLS_PANASONIC 0x0106
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100118
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100119#define MT_DEFAULT_MAXCONTACT 10
120
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200121#define MT_USB_DEVICE(v, p) HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH, v, p)
122#define MT_BT_DEVICE(v, p) HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_MULTITOUCH, v, p)
123
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100124/*
125 * these device-dependent functions determine what slot corresponds
126 * to a valid contact that was just read.
127 */
128
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100129static int cypress_compute_slot(struct mt_device *td)
130{
131 if (td->curdata.contactid != 0 || td->num_received == 0)
132 return td->curdata.contactid;
133 else
134 return -1;
135}
136
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100137static int find_slot_from_contactid(struct mt_device *td)
138{
139 int i;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100140 for (i = 0; i < td->maxcontacts; ++i) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100141 if (td->slots[i].contactid == td->curdata.contactid &&
142 td->slots[i].touch_state)
143 return i;
144 }
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100145 for (i = 0; i < td->maxcontacts; ++i) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100146 if (!td->slots[i].seen_in_this_frame &&
147 !td->slots[i].touch_state)
148 return i;
149 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100150 /* should not occurs. If this happens that means
151 * that the device sent more touches that it says
152 * in the report descriptor. It is ignored then. */
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100153 return -1;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100154}
155
Jiri Kosinab3c21d22011-11-22 23:23:37 +0100156static struct mt_class mt_classes[] = {
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100157 { .name = MT_CLS_DEFAULT,
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100158 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP },
Stephane Chattya062cc52011-09-17 22:27:30 +0200159 { .name = MT_CLS_SERIAL,
160 .quirks = MT_QUIRK_ALWAYS_VALID},
Benjamin Tissoires22408282011-05-20 15:59:34 +0200161 { .name = MT_CLS_CONFIDENCE,
162 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE },
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100163 { .name = MT_CLS_CONFIDENCE_CONTACT_ID,
164 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
165 MT_QUIRK_SLOT_IS_CONTACTID },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200166 { .name = MT_CLS_CONFIDENCE_MINUS_ONE,
167 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
168 MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE },
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100169 { .name = MT_CLS_DUAL_INRANGE_CONTACTID,
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100170 .quirks = MT_QUIRK_VALID_IS_INRANGE |
171 MT_QUIRK_SLOT_IS_CONTACTID,
172 .maxcontacts = 2 },
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100173 { .name = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100174 .quirks = MT_QUIRK_VALID_IS_INRANGE |
175 MT_QUIRK_SLOT_IS_CONTACTNUMBER,
176 .maxcontacts = 2 },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200177 { .name = MT_CLS_DUAL_NSMU_CONTACTID,
178 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
179 MT_QUIRK_SLOT_IS_CONTACTID,
180 .maxcontacts = 2 },
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800181 { .name = MT_CLS_INRANGE_CONTACTNUMBER,
182 .quirks = MT_QUIRK_VALID_IS_INRANGE |
183 MT_QUIRK_SLOT_IS_CONTACTNUMBER },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200184
185 /*
186 * vendor specific classes
187 */
188 { .name = MT_CLS_3M,
189 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
190 MT_QUIRK_SLOT_IS_CONTACTID,
191 .sn_move = 2048,
192 .sn_width = 128,
193 .sn_height = 128 },
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100194 { .name = MT_CLS_CYPRESS,
195 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
196 MT_QUIRK_CYPRESS,
197 .maxcontacts = 10 },
Richard Nauber4875ac12011-03-09 06:20:57 +0100198 { .name = MT_CLS_EGALAX,
199 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
Benjamin Tissoires2261bb92011-11-23 10:54:29 +0100200 MT_QUIRK_VALID_IS_INRANGE,
Richard Nauber4875ac12011-03-09 06:20:57 +0100201 .sn_move = 4096,
202 .sn_pressure = 32,
203 },
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100204 { .name = MT_CLS_EGALAX_SERIAL,
205 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
206 MT_QUIRK_ALWAYS_VALID,
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100207 .sn_move = 4096,
208 .sn_pressure = 32,
209 },
Benjamin Tissoires847672c2012-02-04 17:08:50 +0100210 { .name = MT_CLS_TOPSEED,
211 .quirks = MT_QUIRK_ALWAYS_VALID,
212 .is_indirect = true,
213 .maxcontacts = 2,
214 },
Denis Kovalev2258e862012-02-14 00:50:33 -0800215 { .name = MT_CLS_PANASONIC,
216 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP,
217 .maxcontacts = 4 },
Benjamin Tissoires043b4032011-03-18 14:27:53 +0100218
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100219 { }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100220};
221
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100222static ssize_t mt_show_quirks(struct device *dev,
223 struct device_attribute *attr,
224 char *buf)
225{
226 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
227 struct mt_device *td = hid_get_drvdata(hdev);
228
229 return sprintf(buf, "%u\n", td->mtclass.quirks);
230}
231
232static ssize_t mt_set_quirks(struct device *dev,
233 struct device_attribute *attr,
234 const char *buf, size_t count)
235{
236 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
237 struct mt_device *td = hid_get_drvdata(hdev);
238
239 unsigned long val;
240
241 if (kstrtoul(buf, 0, &val))
242 return -EINVAL;
243
244 td->mtclass.quirks = val;
245
246 return count;
247}
248
249static DEVICE_ATTR(quirks, S_IWUSR | S_IRUGO, mt_show_quirks, mt_set_quirks);
250
251static struct attribute *sysfs_attrs[] = {
252 &dev_attr_quirks.attr,
253 NULL
254};
255
256static struct attribute_group mt_attribute_group = {
257 .attrs = sysfs_attrs
258};
259
Henrik Rydbergf635bd12011-02-24 19:30:59 +0100260static void mt_feature_mapping(struct hid_device *hdev,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100261 struct hid_field *field, struct hid_usage *usage)
262{
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100263 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoires4aceed32012-06-19 14:39:52 +0200264 int i;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100265
266 switch (usage->hid) {
267 case HID_DG_INPUTMODE:
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100268 td->inputmode = field->report->id;
Benjamin Tissoires4aceed32012-06-19 14:39:52 +0200269 td->inputmode_index = 0; /* has to be updated below */
270
271 for (i=0; i < field->maxusage; i++) {
272 if (field->usage[i].hid == usage->hid) {
273 td->inputmode_index = i;
274 break;
275 }
276 }
277
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100278 break;
279 case HID_DG_CONTACTMAX:
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100280 td->maxcontact_report_id = field->report->id;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100281 td->maxcontacts = field->value[0];
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100282 if (td->mtclass.maxcontacts)
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100283 /* check if the maxcontacts is given by the class */
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100284 td->maxcontacts = td->mtclass.maxcontacts;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100285
286 break;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100287 }
288}
289
290static void set_abs(struct input_dev *input, unsigned int code,
291 struct hid_field *field, int snratio)
292{
293 int fmin = field->logical_minimum;
294 int fmax = field->logical_maximum;
295 int fuzz = snratio ? (fmax - fmin) / snratio : 0;
296 input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
297}
298
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200299static void mt_store_field(struct hid_usage *usage, struct mt_device *td,
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100300 struct hid_input *hi)
301{
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200302 struct mt_fields *f = td->fields;
303
304 if (f->length >= HID_MAX_FIELDS)
305 return;
306
307 f->usages[f->length++] = usage->hid;
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100308}
309
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100310static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
311 struct hid_field *field, struct hid_usage *usage,
312 unsigned long **bit, int *max)
313{
314 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100315 struct mt_class *cls = &td->mtclass;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100316 int code;
Richard Nauber4875ac12011-03-09 06:20:57 +0100317
Jeff Brown658d4aed592011-08-15 16:44:28 -0700318 /* Only map fields from TouchScreen or TouchPad collections.
Denis Kovalev2258e862012-02-14 00:50:33 -0800319 * We need to ignore fields that belong to other collections
320 * such as Mouse that might have the same GenericDesktop usages. */
Jeff Brown658d4aed592011-08-15 16:44:28 -0700321 if (field->application == HID_DG_TOUCHSCREEN)
322 set_bit(INPUT_PROP_DIRECT, hi->input->propbit);
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100323 else if (field->application != HID_DG_TOUCHPAD)
Jeff Brown658d4aed592011-08-15 16:44:28 -0700324 return 0;
325
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100326 /* In case of an indirect device (touchpad), we need to add
327 * specific BTN_TOOL_* to be handled by the synaptics xorg
328 * driver.
329 * We also consider that touchscreens providing buttons are touchpads.
330 */
331 if (field->application == HID_DG_TOUCHPAD ||
332 (usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON ||
333 cls->is_indirect) {
334 set_bit(INPUT_PROP_POINTER, hi->input->propbit);
335 set_bit(BTN_TOOL_FINGER, hi->input->keybit);
336 set_bit(BTN_TOOL_DOUBLETAP, hi->input->keybit);
337 set_bit(BTN_TOOL_TRIPLETAP, hi->input->keybit);
338 set_bit(BTN_TOOL_QUADTAP, hi->input->keybit);
339 }
340
Benjamin Tissoires2261bb92011-11-23 10:54:29 +0100341 /* eGalax devices provide a Digitizer.Stylus input which overrides
342 * the correct Digitizers.Finger X/Y ranges.
343 * Let's just ignore this input. */
344 if (field->physical == HID_DG_STYLUS)
345 return -1;
346
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100347 switch (usage->hid & HID_USAGE_PAGE) {
348
349 case HID_UP_GENDESK:
350 switch (usage->hid) {
351 case HID_GD_X:
352 hid_map_usage(hi, usage, bit, max,
353 EV_ABS, ABS_MT_POSITION_X);
354 set_abs(hi->input, ABS_MT_POSITION_X, field,
355 cls->sn_move);
356 /* touchscreen emulation */
357 set_abs(hi->input, ABS_X, field, cls->sn_move);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200358 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100359 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100360 return 1;
361 case HID_GD_Y:
362 hid_map_usage(hi, usage, bit, max,
363 EV_ABS, ABS_MT_POSITION_Y);
364 set_abs(hi->input, ABS_MT_POSITION_Y, field,
365 cls->sn_move);
366 /* touchscreen emulation */
367 set_abs(hi->input, ABS_Y, field, cls->sn_move);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200368 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100369 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100370 return 1;
371 }
372 return 0;
373
374 case HID_UP_DIGITIZER:
375 switch (usage->hid) {
376 case HID_DG_INRANGE:
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200377 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100378 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100379 return 1;
380 case HID_DG_CONFIDENCE:
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200381 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100382 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100383 return 1;
384 case HID_DG_TIPSWITCH:
385 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
386 input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200387 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100388 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100389 return 1;
390 case HID_DG_CONTACTID:
Benjamin Tissoires50bc03a2011-06-21 15:01:53 +0200391 if (!td->maxcontacts)
392 td->maxcontacts = MT_DEFAULT_MAXCONTACT;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100393 input_mt_init_slots(hi->input, td->maxcontacts);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200394 mt_store_field(usage, td, hi);
Benjamin Tissoires2955cae2011-04-21 14:15:59 +0200395 td->last_field_index = field->index;
Benjamin Tissoires9e87f222012-03-06 17:57:06 +0100396 td->touches_by_report++;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100397 return 1;
398 case HID_DG_WIDTH:
399 hid_map_usage(hi, usage, bit, max,
400 EV_ABS, ABS_MT_TOUCH_MAJOR);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100401 set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
402 cls->sn_width);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200403 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100404 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100405 return 1;
406 case HID_DG_HEIGHT:
407 hid_map_usage(hi, usage, bit, max,
408 EV_ABS, ABS_MT_TOUCH_MINOR);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100409 set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
410 cls->sn_height);
Benjamin Tissoires1e648a12011-03-18 14:27:55 +0100411 input_set_abs_params(hi->input,
412 ABS_MT_ORIENTATION, 0, 1, 0, 0);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200413 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100414 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100415 return 1;
416 case HID_DG_TIPPRESSURE:
417 hid_map_usage(hi, usage, bit, max,
418 EV_ABS, ABS_MT_PRESSURE);
419 set_abs(hi->input, ABS_MT_PRESSURE, field,
420 cls->sn_pressure);
421 /* touchscreen emulation */
422 set_abs(hi->input, ABS_PRESSURE, field,
423 cls->sn_pressure);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200424 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100425 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100426 return 1;
427 case HID_DG_CONTACTCOUNT:
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100428 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100429 return 1;
430 case HID_DG_CONTACTMAX:
431 /* we don't set td->last_slot_field as contactcount and
432 * contact max are global to the report */
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100433 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100434 return -1;
435 }
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100436 case HID_DG_TOUCH:
437 /* Legacy devices use TIPSWITCH and not TOUCH.
438 * Let's just ignore this field. */
439 return -1;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100440 /* let hid-input decide for the others */
441 return 0;
442
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100443 case HID_UP_BUTTON:
444 code = BTN_MOUSE + ((usage->hid - 1) & HID_USAGE);
445 hid_map_usage(hi, usage, bit, max, EV_KEY, code);
446 input_set_capability(hi->input, EV_KEY, code);
447 return 1;
448
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100449 case 0xff000000:
450 /* we do not want to map these: no input-oriented meaning */
451 return -1;
452 }
453
454 return 0;
455}
456
457static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
458 struct hid_field *field, struct hid_usage *usage,
459 unsigned long **bit, int *max)
460{
461 if (usage->type == EV_KEY || usage->type == EV_ABS)
462 set_bit(usage->type, hi->input->evbit);
463
464 return -1;
465}
466
467static int mt_compute_slot(struct mt_device *td)
468{
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100469 __s32 quirks = td->mtclass.quirks;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100470
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100471 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID)
472 return td->curdata.contactid;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100473
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100474 if (quirks & MT_QUIRK_CYPRESS)
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100475 return cypress_compute_slot(td);
476
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100477 if (quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER)
478 return td->num_received;
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100479
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200480 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE)
481 return td->curdata.contactid - 1;
482
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100483 return find_slot_from_contactid(td);
484}
485
486/*
487 * this function is called when a whole contact has been processed,
488 * so that it can assign it to a slot and store the data there
489 */
490static void mt_complete_slot(struct mt_device *td)
491{
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100492 td->curdata.seen_in_this_frame = true;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100493 if (td->curvalid) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100494 int slotnum = mt_compute_slot(td);
495
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100496 if (slotnum >= 0 && slotnum < td->maxcontacts)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100497 td->slots[slotnum] = td->curdata;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100498 }
499 td->num_received++;
500}
501
502
503/*
504 * this function is called when a whole packet has been received and processed,
505 * so that it can decide what to send to the input layer.
506 */
507static void mt_emit_event(struct mt_device *td, struct input_dev *input)
508{
509 int i;
510
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100511 for (i = 0; i < td->maxcontacts; ++i) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100512 struct mt_slot *s = &(td->slots[i]);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100513 if ((td->mtclass.quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) &&
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100514 !s->seen_in_this_frame) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100515 s->touch_state = false;
516 }
517
518 input_mt_slot(input, i);
519 input_mt_report_slot_state(input, MT_TOOL_FINGER,
520 s->touch_state);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100521 if (s->touch_state) {
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100522 /* this finger is on the screen */
523 int wide = (s->w > s->h);
524 /* divided by two to match visual scale of touch */
525 int major = max(s->w, s->h) >> 1;
526 int minor = min(s->w, s->h) >> 1;
527
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100528 input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
529 input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100530 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100531 input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100532 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
533 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100534 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100535 s->seen_in_this_frame = false;
536
537 }
538
539 input_mt_report_pointer_emulation(input, true);
540 input_sync(input);
541 td->num_received = 0;
542}
543
544
545
546static int mt_event(struct hid_device *hid, struct hid_field *field,
547 struct hid_usage *usage, __s32 value)
548{
549 struct mt_device *td = hid_get_drvdata(hid);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100550 __s32 quirks = td->mtclass.quirks;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100551
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100552 if (hid->claimed & HID_CLAIMED_INPUT && td->slots) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100553 switch (usage->hid) {
554 case HID_DG_INRANGE:
Stephane Chattya062cc52011-09-17 22:27:30 +0200555 if (quirks & MT_QUIRK_ALWAYS_VALID)
556 td->curvalid = true;
557 else if (quirks & MT_QUIRK_VALID_IS_INRANGE)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100558 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100559 break;
560 case HID_DG_TIPSWITCH:
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100561 if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
562 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100563 td->curdata.touch_state = value;
564 break;
565 case HID_DG_CONFIDENCE:
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100566 if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE)
567 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100568 break;
569 case HID_DG_CONTACTID:
570 td->curdata.contactid = value;
571 break;
572 case HID_DG_TIPPRESSURE:
573 td->curdata.p = value;
574 break;
575 case HID_GD_X:
576 td->curdata.x = value;
577 break;
578 case HID_GD_Y:
579 td->curdata.y = value;
580 break;
581 case HID_DG_WIDTH:
582 td->curdata.w = value;
583 break;
584 case HID_DG_HEIGHT:
585 td->curdata.h = value;
586 break;
587 case HID_DG_CONTACTCOUNT:
588 /*
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100589 * Includes multi-packet support where subsequent
590 * packets are sent with zero contactcount.
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100591 */
592 if (value)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100593 td->num_expected = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100594 break;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100595 case HID_DG_TOUCH:
596 /* do nothing */
597 break;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100598
599 default:
600 /* fallback to the generic hidinput handling */
601 return 0;
602 }
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100603
Denis Kovalev2258e862012-02-14 00:50:33 -0800604 if (usage->hid == td->last_slot_field)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100605 mt_complete_slot(td);
606
607 if (field->index == td->last_field_index
608 && td->num_received >= td->num_expected)
609 mt_emit_event(td, field->hidinput->input);
610
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100611 }
612
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100613 /* we have handled the hidinput part, now remains hiddev */
614 if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
615 hid->hiddev_hid_event(hid, field, usage, value);
616
617 return 1;
618}
619
620static void mt_set_input_mode(struct hid_device *hdev)
621{
622 struct mt_device *td = hid_get_drvdata(hdev);
623 struct hid_report *r;
624 struct hid_report_enum *re;
625
626 if (td->inputmode < 0)
627 return;
628
629 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
630 r = re->report_id_hash[td->inputmode];
631 if (r) {
Benjamin Tissoires4aceed32012-06-19 14:39:52 +0200632 r->field[0]->value[td->inputmode_index] = 0x02;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100633 usbhid_submit_report(hdev, r, USB_DIR_OUT);
634 }
635}
636
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100637static void mt_set_maxcontacts(struct hid_device *hdev)
638{
639 struct mt_device *td = hid_get_drvdata(hdev);
640 struct hid_report *r;
641 struct hid_report_enum *re;
642 int fieldmax, max;
643
644 if (td->maxcontact_report_id < 0)
645 return;
646
647 if (!td->mtclass.maxcontacts)
648 return;
649
650 re = &hdev->report_enum[HID_FEATURE_REPORT];
651 r = re->report_id_hash[td->maxcontact_report_id];
652 if (r) {
653 max = td->mtclass.maxcontacts;
654 fieldmax = r->field[0]->logical_maximum;
655 max = min(fieldmax, max);
656 if (r->field[0]->value[0] != max) {
657 r->field[0]->value[0] = max;
658 usbhid_submit_report(hdev, r, USB_DIR_OUT);
659 }
660 }
661}
662
Henrik Rydberg4fa3a582012-05-01 08:40:01 +0200663static void mt_post_parse_default_settings(struct mt_device *td)
664{
665 __s32 quirks = td->mtclass.quirks;
666
667 /* unknown serial device needs special quirks */
668 if (td->touches_by_report == 1) {
669 quirks |= MT_QUIRK_ALWAYS_VALID;
670 quirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP;
671 quirks &= ~MT_QUIRK_VALID_IS_INRANGE;
672 quirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE;
673 }
674
675 td->mtclass.quirks = quirks;
676}
677
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200678static void mt_post_parse(struct mt_device *td)
679{
680 struct mt_fields *f = td->fields;
681
682 if (td->touches_by_report > 0) {
683 int field_count_per_touch = f->length / td->touches_by_report;
684 td->last_slot_field = f->usages[field_count_per_touch - 1];
685 }
686}
687
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100688static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
689{
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100690 int ret, i;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100691 struct mt_device *td;
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100692 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
693
Benjamin Tissoires8d179a92012-03-06 17:57:04 +0100694 if (id) {
695 for (i = 0; mt_classes[i].name ; i++) {
696 if (id->driver_data == mt_classes[i].name) {
697 mtclass = &(mt_classes[i]);
698 break;
699 }
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100700 }
701 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100702
Henrik Rydbergd682bd72011-11-01 15:26:31 +0100703 /* This allows the driver to correctly support devices
704 * that emit events over several HID messages.
705 */
706 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100707
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100708 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100709 if (!td) {
710 dev_err(&hdev->dev, "cannot allocate multitouch data\n");
711 return -ENOMEM;
712 }
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100713 td->mtclass = *mtclass;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100714 td->inputmode = -1;
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100715 td->maxcontact_report_id = -1;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100716 hid_set_drvdata(hdev, td);
717
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200718 td->fields = kzalloc(sizeof(struct mt_fields), GFP_KERNEL);
719 if (!td->fields) {
720 dev_err(&hdev->dev, "cannot allocate multitouch fields data\n");
721 ret = -ENOMEM;
722 goto fail;
723 }
724
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100725 ret = hid_parse(hdev);
726 if (ret != 0)
727 goto fail;
728
729 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100730 if (ret)
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100731 goto fail;
732
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200733 mt_post_parse(td);
734
Henrik Rydberg4fa3a582012-05-01 08:40:01 +0200735 if (id->vendor == HID_ANY_ID && id->product == HID_ANY_ID)
736 mt_post_parse_default_settings(td);
Benjamin Tissoires9e87f222012-03-06 17:57:06 +0100737
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100738 td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
739 GFP_KERNEL);
740 if (!td->slots) {
741 dev_err(&hdev->dev, "cannot allocate multitouch slots\n");
742 hid_hw_stop(hdev);
743 ret = -ENOMEM;
744 goto fail;
745 }
746
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100747 ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group);
748
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100749 mt_set_maxcontacts(hdev);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100750 mt_set_input_mode(hdev);
751
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200752 kfree(td->fields);
753 td->fields = NULL;
754
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100755 return 0;
756
757fail:
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200758 kfree(td->fields);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100759 kfree(td);
760 return ret;
761}
762
763#ifdef CONFIG_PM
764static int mt_reset_resume(struct hid_device *hdev)
765{
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100766 mt_set_maxcontacts(hdev);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100767 mt_set_input_mode(hdev);
768 return 0;
769}
770#endif
771
772static void mt_remove(struct hid_device *hdev)
773{
774 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100775 sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100776 hid_hw_stop(hdev);
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100777 kfree(td->slots);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100778 kfree(td);
779 hid_set_drvdata(hdev, NULL);
780}
781
782static const struct hid_device_id mt_devices[] = {
783
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100784 /* 3M panels */
785 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200786 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100787 USB_DEVICE_ID_3M1968) },
788 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200789 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100790 USB_DEVICE_ID_3M2256) },
Benjamin Tissoiresc4fad872011-12-23 15:41:00 +0100791 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200792 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresc4fad872011-12-23 15:41:00 +0100793 USB_DEVICE_ID_3M3266) },
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100794
Benjamin Tissoirese6aac342011-05-19 14:18:13 +0200795 /* ActionStar panels */
796 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200797 MT_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR,
Benjamin Tissoirese6aac342011-05-19 14:18:13 +0200798 USB_DEVICE_ID_ACTIONSTAR_1011) },
799
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100800 /* Atmel panels */
801 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200802 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL,
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100803 USB_DEVICE_ID_ATMEL_MULTITOUCH) },
Benjamin Tissoires841cb152012-03-06 10:53:45 +0100804 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200805 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL,
Benjamin Tissoires841cb152012-03-06 10:53:45 +0100806 USB_DEVICE_ID_ATMEL_MXT_DIGITIZER) },
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100807
Jiri Kosina9ed32692012-04-20 12:15:44 +0200808 /* Baanto multitouch devices */
809 { .driver_data = MT_CLS_DEFAULT,
Jiri Kosina16b79bb2012-05-05 23:32:54 +0200810 MT_USB_DEVICE(USB_VENDOR_ID_BAANTO,
Jiri Kosina9ed32692012-04-20 12:15:44 +0200811 USB_DEVICE_ID_BAANTO_MT_190W2) },
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100812 /* Cando panels */
813 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200814 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100815 USB_DEVICE_ID_CANDO_MULTI_TOUCH) },
816 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200817 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100818 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) },
819 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200820 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100821 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) },
822 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200823 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100824 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },
825
Austin Zhang942fd422011-05-28 02:03:47 +0800826 /* Chunghwa Telecom touch panels */
827 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200828 MT_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT,
Austin Zhang942fd422011-05-28 02:03:47 +0800829 USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) },
830
Benjamin Tissoires79603dc2011-05-19 14:18:14 +0200831 /* CVTouch panels */
832 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200833 MT_USB_DEVICE(USB_VENDOR_ID_CVTOUCH,
Benjamin Tissoires79603dc2011-05-19 14:18:14 +0200834 USB_DEVICE_ID_CVTOUCH_SCREEN) },
835
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100836 /* Cypress panel */
837 { .driver_data = MT_CLS_CYPRESS,
838 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS,
839 USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
840
Benjamin Tissoires22408282011-05-20 15:59:34 +0200841 /* eGalax devices (resistive) */
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100842 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200843 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100844 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) },
845 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200846 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100847 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200848
849 /* eGalax devices (capacitive) */
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100850 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200851 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100852 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100853 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200854 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100855 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7207) },
856 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200857 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100858 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E) },
859 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200860 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100861 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224) },
Benjamin Tissoires2ce09df2012-03-06 17:57:02 +0100862 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200863 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoires2ce09df2012-03-06 17:57:02 +0100864 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_722A) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100865 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200866 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100867 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100868 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200869 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100870 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7262) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100871 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200872 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100873 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100874 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200875 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100876 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72AA) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100877 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200878 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoires66f06122011-11-23 10:54:33 +0100879 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA) },
880 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200881 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Marek Vasutbb9ff212011-11-23 10:54:32 +0100882 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) },
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100883 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200884 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100885 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349) },
886 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200887 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100888 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200889
Benjamin Tissoiresc04abee2011-05-19 11:37:29 +0200890 /* Elo TouchSystems IntelliTouch Plus panel */
891 { .driver_data = MT_CLS_DUAL_NSMU_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200892 MT_USB_DEVICE(USB_VENDOR_ID_ELO,
Benjamin Tissoiresc04abee2011-05-19 11:37:29 +0200893 USB_DEVICE_ID_ELO_TS2515) },
894
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100895 /* GeneralTouch panel */
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100896 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200897 MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100898 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) },
899
Andreas Nielsen4d5df5d2012-03-19 15:41:03 +0100900 /* Gametel game controller */
901 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200902 MT_BT_DEVICE(USB_VENDOR_ID_FRUCTEL,
Andreas Nielsen4d5df5d2012-03-19 15:41:03 +0100903 USB_DEVICE_ID_GAMETEL_MT_MODE) },
904
Benjamin Tissoiresee0fbd12011-05-19 14:18:15 +0200905 /* GoodTouch panels */
906 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200907 MT_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH,
Benjamin Tissoiresee0fbd12011-05-19 14:18:15 +0200908 USB_DEVICE_ID_GOODTOUCH_000f) },
909
Benjamin Tissoires54580362011-11-29 13:13:12 +0100910 /* Hanvon panels */
911 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200912 MT_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT,
Benjamin Tissoires54580362011-11-29 13:13:12 +0100913 USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) },
914
Stephane Chattya062cc52011-09-17 22:27:30 +0200915 /* Ideacom panel */
916 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200917 MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
Stephane Chattya062cc52011-09-17 22:27:30 +0200918 USB_DEVICE_ID_IDEACOM_IDC6650) },
Benjamin Tissoires71078b02012-03-06 10:53:46 +0100919 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200920 MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
Benjamin Tissoires71078b02012-03-06 10:53:46 +0100921 USB_DEVICE_ID_IDEACOM_IDC6651) },
Stephane Chattya062cc52011-09-17 22:27:30 +0200922
Austin Zhang4e61f0d2011-05-09 23:54:14 +0800923 /* Ilitek dual touch panel */
924 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200925 MT_USB_DEVICE(USB_VENDOR_ID_ILITEK,
Austin Zhang4e61f0d2011-05-09 23:54:14 +0800926 USB_DEVICE_ID_ILITEK_MULTITOUCH) },
927
Benjamin Tissoires4dfcced2011-01-31 11:28:22 +0100928 /* IRTOUCH panels */
929 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200930 MT_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS,
Benjamin Tissoires4dfcced2011-01-31 11:28:22 +0100931 USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
932
Jeff Brownc50bb1a2011-08-15 21:12:09 -0700933 /* LG Display panels */
934 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200935 MT_USB_DEVICE(USB_VENDOR_ID_LG,
Jeff Brownc50bb1a2011-08-15 21:12:09 -0700936 USB_DEVICE_ID_LG_MULTITOUCH) },
937
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200938 /* Lumio panels */
939 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200940 MT_USB_DEVICE(USB_VENDOR_ID_LUMIO,
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200941 USB_DEVICE_ID_CRYSTALTOUCH) },
Benjamin Tissoiresc3ead6d2011-06-21 15:01:55 +0200942 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200943 MT_USB_DEVICE(USB_VENDOR_ID_LUMIO,
Benjamin Tissoiresc3ead6d2011-06-21 15:01:55 +0200944 USB_DEVICE_ID_CRYSTALTOUCH_DUAL) },
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200945
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200946 /* MosArt panels */
947 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200948 MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200949 USB_DEVICE_ID_ASUS_T91MT)},
950 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200951 MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200952 USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) },
953 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200954 MT_USB_DEVICE(USB_VENDOR_ID_TURBOX,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200955 USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) },
956
Denis Kovalev2258e862012-02-14 00:50:33 -0800957 /* Panasonic panels */
958 { .driver_data = MT_CLS_PANASONIC,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200959 MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
Denis Kovalev2258e862012-02-14 00:50:33 -0800960 USB_DEVICE_ID_PANABOARD_UBT780) },
961 { .driver_data = MT_CLS_PANASONIC,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200962 MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
Denis Kovalev2258e862012-02-14 00:50:33 -0800963 USB_DEVICE_ID_PANABOARD_UBT880) },
964
Austin Hendrix4db703e2012-06-04 15:27:51 -0700965 /* Novatek Panel */
966 { .driver_data = MT_CLS_DEFAULT,
Jiri Kosina4380d812012-06-06 16:28:33 +0200967 MT_USB_DEVICE(USB_VENDOR_ID_NOVATEK,
Austin Hendrix4db703e2012-06-04 15:27:51 -0700968 USB_DEVICE_ID_NOVATEK_PCT) },
969
John Sung6ab3a9a2011-04-21 16:21:52 +0200970 /* PenMount panels */
971 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200972 MT_USB_DEVICE(USB_VENDOR_ID_PENMOUNT,
John Sung6ab3a9a2011-04-21 16:21:52 +0200973 USB_DEVICE_ID_PENMOUNT_PCI) },
974
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800975 /* PixArt optical touch screen */
976 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200977 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800978 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN) },
979 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200980 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800981 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1) },
982 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200983 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800984 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2) },
985
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100986 /* PixCir-based panels */
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100987 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200988 MT_USB_DEVICE(USB_VENDOR_ID_HANVON,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100989 USB_DEVICE_ID_HANVON_MULTITOUCH) },
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100990 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200991 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100992 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
993
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100994 /* Quanta-based panels */
995 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200996 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100997 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) },
998 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200999 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +01001000 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001) },
1001 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001002 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +01001003 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008) },
1004
Benjamin Tissoires043b4032011-03-18 14:27:53 +01001005 /* Stantum panels */
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +02001006 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001007 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM,
Benjamin Tissoires043b4032011-03-18 14:27:53 +01001008 USB_DEVICE_ID_MTP)},
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +02001009 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001010 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM,
Benjamin Tissoires043b4032011-03-18 14:27:53 +01001011 USB_DEVICE_ID_MTP_STM)},
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +02001012 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001013 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX,
Benjamin Tissoires043b4032011-03-18 14:27:53 +01001014 USB_DEVICE_ID_MTP_SITRONIX)},
1015
Benjamin Tissoires847672c2012-02-04 17:08:50 +01001016 /* TopSeed panels */
1017 { .driver_data = MT_CLS_TOPSEED,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001018 MT_USB_DEVICE(USB_VENDOR_ID_TOPSEED2,
Benjamin Tissoires847672c2012-02-04 17:08:50 +01001019 USB_DEVICE_ID_TOPSEED2_PERIPAD_701) },
1020
Benjamin Tissoires5e74e562011-05-19 14:18:16 +02001021 /* Touch International panels */
1022 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001023 MT_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL,
Benjamin Tissoires5e74e562011-05-19 14:18:16 +02001024 USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) },
1025
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001026 /* Unitec panels */
1027 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001028 MT_USB_DEVICE(USB_VENDOR_ID_UNITEC,
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001029 USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) },
1030 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001031 MT_USB_DEVICE(USB_VENDOR_ID_UNITEC,
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001032 USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) },
ice chienbc8a2a92011-07-15 16:58:06 +08001033 /* XAT */
1034 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001035 MT_USB_DEVICE(USB_VENDOR_ID_XAT,
ice chienbc8a2a92011-07-15 16:58:06 +08001036 USB_DEVICE_ID_XAT_CSR) },
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001037
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001038 /* Xiroku */
1039 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001040 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001041 USB_DEVICE_ID_XIROKU_SPX) },
1042 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001043 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001044 USB_DEVICE_ID_XIROKU_MPX) },
1045 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001046 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001047 USB_DEVICE_ID_XIROKU_CSR) },
1048 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001049 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001050 USB_DEVICE_ID_XIROKU_SPX1) },
1051 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001052 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001053 USB_DEVICE_ID_XIROKU_MPX1) },
1054 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001055 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001056 USB_DEVICE_ID_XIROKU_CSR1) },
1057 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001058 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001059 USB_DEVICE_ID_XIROKU_SPX2) },
1060 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001061 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001062 USB_DEVICE_ID_XIROKU_MPX2) },
1063 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001064 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001065 USB_DEVICE_ID_XIROKU_CSR2) },
1066
Benjamin Tissoires82d06982012-06-19 14:39:54 +02001067 /* Zytronic panels */
1068 { .driver_data = MT_CLS_SERIAL,
1069 MT_USB_DEVICE(USB_VENDOR_ID_ZYTRONIC,
1070 USB_DEVICE_ID_ZYTRONIC_ZXY100) },
1071
Henrik Rydberg4fa3a582012-05-01 08:40:01 +02001072 /* Generic MT device */
1073 { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) },
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001074 { }
1075};
1076MODULE_DEVICE_TABLE(hid, mt_devices);
1077
1078static const struct hid_usage_id mt_grabbed_usages[] = {
1079 { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
1080 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
1081};
1082
1083static struct hid_driver mt_driver = {
1084 .name = "hid-multitouch",
1085 .id_table = mt_devices,
1086 .probe = mt_probe,
1087 .remove = mt_remove,
1088 .input_mapping = mt_input_mapping,
1089 .input_mapped = mt_input_mapped,
1090 .feature_mapping = mt_feature_mapping,
1091 .usage_table = mt_grabbed_usages,
1092 .event = mt_event,
1093#ifdef CONFIG_PM
1094 .reset_resume = mt_reset_resume,
1095#endif
1096};
1097
1098static int __init mt_init(void)
1099{
1100 return hid_register_driver(&mt_driver);
1101}
1102
1103static void __exit mt_exit(void)
1104{
1105 hid_unregister_driver(&mt_driver);
1106}
1107
1108module_init(mt_init);
1109module_exit(mt_exit);