blob: fae08dfd18bf06a9aa2bdf94dd726ba399fe955e [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 Tissoires3ac36d152012-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 Tissoires3ac36d152012-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 Tissoires31ae9bd2012-02-04 17:08:49 +010086 __s8 maxcontact_report_id; /* Maximum Contact Number HID feature,
87 -1 if non-existent */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010088 __u8 num_received; /* how many contacts we received */
89 __u8 num_expected; /* expected last contact index */
90 __u8 maxcontacts;
Benjamin Tissoires9e87f222012-03-06 17:57:06 +010091 __u8 touches_by_report; /* how many touches are present in one report:
92 * 1 means we should use a serial protocol
93 * > 1 means hybrid (multitouch) protocol */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010094 bool curvalid; /* is the current contact valid? */
95 struct mt_slot *slots;
96};
97
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010098/* classes of device behavior */
Benjamin Tissoires22408282011-05-20 15:59:34 +020099#define MT_CLS_DEFAULT 0x0001
100
Stephane Chattya062cc52011-09-17 22:27:30 +0200101#define MT_CLS_SERIAL 0x0002
102#define MT_CLS_CONFIDENCE 0x0003
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100103#define MT_CLS_CONFIDENCE_CONTACT_ID 0x0004
104#define MT_CLS_CONFIDENCE_MINUS_ONE 0x0005
105#define MT_CLS_DUAL_INRANGE_CONTACTID 0x0006
106#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0007
107#define MT_CLS_DUAL_NSMU_CONTACTID 0x0008
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800108#define MT_CLS_INRANGE_CONTACTNUMBER 0x0009
Benjamin Tissoires22408282011-05-20 15:59:34 +0200109
110/* vendor specific classes */
111#define MT_CLS_3M 0x0101
112#define MT_CLS_CYPRESS 0x0102
113#define MT_CLS_EGALAX 0x0103
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100114#define MT_CLS_EGALAX_SERIAL 0x0104
Benjamin Tissoires847672c2012-02-04 17:08:50 +0100115#define MT_CLS_TOPSEED 0x0105
Denis Kovalev2258e862012-02-14 00:50:33 -0800116#define MT_CLS_PANASONIC 0x0106
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100117
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100118#define MT_DEFAULT_MAXCONTACT 10
119
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200120#define MT_USB_DEVICE(v, p) HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH, v, p)
121#define MT_BT_DEVICE(v, p) HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_MULTITOUCH, v, p)
122
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100123/*
124 * these device-dependent functions determine what slot corresponds
125 * to a valid contact that was just read.
126 */
127
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100128static int cypress_compute_slot(struct mt_device *td)
129{
130 if (td->curdata.contactid != 0 || td->num_received == 0)
131 return td->curdata.contactid;
132 else
133 return -1;
134}
135
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100136static int find_slot_from_contactid(struct mt_device *td)
137{
138 int i;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100139 for (i = 0; i < td->maxcontacts; ++i) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100140 if (td->slots[i].contactid == td->curdata.contactid &&
141 td->slots[i].touch_state)
142 return i;
143 }
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100144 for (i = 0; i < td->maxcontacts; ++i) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100145 if (!td->slots[i].seen_in_this_frame &&
146 !td->slots[i].touch_state)
147 return i;
148 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100149 /* should not occurs. If this happens that means
150 * that the device sent more touches that it says
151 * in the report descriptor. It is ignored then. */
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100152 return -1;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100153}
154
Jiri Kosinab3c21d22011-11-22 23:23:37 +0100155static struct mt_class mt_classes[] = {
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100156 { .name = MT_CLS_DEFAULT,
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100157 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP },
Stephane Chattya062cc52011-09-17 22:27:30 +0200158 { .name = MT_CLS_SERIAL,
159 .quirks = MT_QUIRK_ALWAYS_VALID},
Benjamin Tissoires22408282011-05-20 15:59:34 +0200160 { .name = MT_CLS_CONFIDENCE,
161 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE },
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100162 { .name = MT_CLS_CONFIDENCE_CONTACT_ID,
163 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
164 MT_QUIRK_SLOT_IS_CONTACTID },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200165 { .name = MT_CLS_CONFIDENCE_MINUS_ONE,
166 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
167 MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE },
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100168 { .name = MT_CLS_DUAL_INRANGE_CONTACTID,
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100169 .quirks = MT_QUIRK_VALID_IS_INRANGE |
170 MT_QUIRK_SLOT_IS_CONTACTID,
171 .maxcontacts = 2 },
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100172 { .name = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100173 .quirks = MT_QUIRK_VALID_IS_INRANGE |
174 MT_QUIRK_SLOT_IS_CONTACTNUMBER,
175 .maxcontacts = 2 },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200176 { .name = MT_CLS_DUAL_NSMU_CONTACTID,
177 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
178 MT_QUIRK_SLOT_IS_CONTACTID,
179 .maxcontacts = 2 },
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800180 { .name = MT_CLS_INRANGE_CONTACTNUMBER,
181 .quirks = MT_QUIRK_VALID_IS_INRANGE |
182 MT_QUIRK_SLOT_IS_CONTACTNUMBER },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200183
184 /*
185 * vendor specific classes
186 */
187 { .name = MT_CLS_3M,
188 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
189 MT_QUIRK_SLOT_IS_CONTACTID,
190 .sn_move = 2048,
191 .sn_width = 128,
192 .sn_height = 128 },
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100193 { .name = MT_CLS_CYPRESS,
194 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
195 MT_QUIRK_CYPRESS,
196 .maxcontacts = 10 },
Richard Nauber4875ac12011-03-09 06:20:57 +0100197 { .name = MT_CLS_EGALAX,
198 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
Benjamin Tissoires2261bb92011-11-23 10:54:29 +0100199 MT_QUIRK_VALID_IS_INRANGE,
Richard Nauber4875ac12011-03-09 06:20:57 +0100200 .sn_move = 4096,
201 .sn_pressure = 32,
202 },
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100203 { .name = MT_CLS_EGALAX_SERIAL,
204 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
205 MT_QUIRK_ALWAYS_VALID,
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100206 .sn_move = 4096,
207 .sn_pressure = 32,
208 },
Benjamin Tissoires847672c2012-02-04 17:08:50 +0100209 { .name = MT_CLS_TOPSEED,
210 .quirks = MT_QUIRK_ALWAYS_VALID,
211 .is_indirect = true,
212 .maxcontacts = 2,
213 },
Denis Kovalev2258e862012-02-14 00:50:33 -0800214 { .name = MT_CLS_PANASONIC,
215 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP,
216 .maxcontacts = 4 },
Benjamin Tissoires043b4032011-03-18 14:27:53 +0100217
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100218 { }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100219};
220
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100221static ssize_t mt_show_quirks(struct device *dev,
222 struct device_attribute *attr,
223 char *buf)
224{
225 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
226 struct mt_device *td = hid_get_drvdata(hdev);
227
228 return sprintf(buf, "%u\n", td->mtclass.quirks);
229}
230
231static ssize_t mt_set_quirks(struct device *dev,
232 struct device_attribute *attr,
233 const char *buf, size_t count)
234{
235 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
236 struct mt_device *td = hid_get_drvdata(hdev);
237
238 unsigned long val;
239
240 if (kstrtoul(buf, 0, &val))
241 return -EINVAL;
242
243 td->mtclass.quirks = val;
244
245 return count;
246}
247
248static DEVICE_ATTR(quirks, S_IWUSR | S_IRUGO, mt_show_quirks, mt_set_quirks);
249
250static struct attribute *sysfs_attrs[] = {
251 &dev_attr_quirks.attr,
252 NULL
253};
254
255static struct attribute_group mt_attribute_group = {
256 .attrs = sysfs_attrs
257};
258
Henrik Rydbergf635bd12011-02-24 19:30:59 +0100259static void mt_feature_mapping(struct hid_device *hdev,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100260 struct hid_field *field, struct hid_usage *usage)
261{
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100262 struct mt_device *td = hid_get_drvdata(hdev);
263
264 switch (usage->hid) {
265 case HID_DG_INPUTMODE:
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100266 td->inputmode = field->report->id;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100267 break;
268 case HID_DG_CONTACTMAX:
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100269 td->maxcontact_report_id = field->report->id;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100270 td->maxcontacts = field->value[0];
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100271 if (td->mtclass.maxcontacts)
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100272 /* check if the maxcontacts is given by the class */
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100273 td->maxcontacts = td->mtclass.maxcontacts;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100274
275 break;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100276 }
277}
278
279static void set_abs(struct input_dev *input, unsigned int code,
280 struct hid_field *field, int snratio)
281{
282 int fmin = field->logical_minimum;
283 int fmax = field->logical_maximum;
284 int fuzz = snratio ? (fmax - fmin) / snratio : 0;
285 input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
286}
287
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200288static void mt_store_field(struct hid_usage *usage, struct mt_device *td,
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100289 struct hid_input *hi)
290{
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200291 struct mt_fields *f = td->fields;
292
293 if (f->length >= HID_MAX_FIELDS)
294 return;
295
296 f->usages[f->length++] = usage->hid;
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100297}
298
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100299static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
300 struct hid_field *field, struct hid_usage *usage,
301 unsigned long **bit, int *max)
302{
303 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100304 struct mt_class *cls = &td->mtclass;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100305 int code;
Richard Nauber4875ac12011-03-09 06:20:57 +0100306
Jeff Brown658d4aed592011-08-15 16:44:28 -0700307 /* Only map fields from TouchScreen or TouchPad collections.
Denis Kovalev2258e862012-02-14 00:50:33 -0800308 * We need to ignore fields that belong to other collections
309 * such as Mouse that might have the same GenericDesktop usages. */
Jeff Brown658d4aed592011-08-15 16:44:28 -0700310 if (field->application == HID_DG_TOUCHSCREEN)
311 set_bit(INPUT_PROP_DIRECT, hi->input->propbit);
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100312 else if (field->application != HID_DG_TOUCHPAD)
Jeff Brown658d4aed592011-08-15 16:44:28 -0700313 return 0;
314
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100315 /* In case of an indirect device (touchpad), we need to add
316 * specific BTN_TOOL_* to be handled by the synaptics xorg
317 * driver.
318 * We also consider that touchscreens providing buttons are touchpads.
319 */
320 if (field->application == HID_DG_TOUCHPAD ||
321 (usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON ||
322 cls->is_indirect) {
323 set_bit(INPUT_PROP_POINTER, hi->input->propbit);
324 set_bit(BTN_TOOL_FINGER, hi->input->keybit);
325 set_bit(BTN_TOOL_DOUBLETAP, hi->input->keybit);
326 set_bit(BTN_TOOL_TRIPLETAP, hi->input->keybit);
327 set_bit(BTN_TOOL_QUADTAP, hi->input->keybit);
328 }
329
Benjamin Tissoires2261bb92011-11-23 10:54:29 +0100330 /* eGalax devices provide a Digitizer.Stylus input which overrides
331 * the correct Digitizers.Finger X/Y ranges.
332 * Let's just ignore this input. */
333 if (field->physical == HID_DG_STYLUS)
334 return -1;
335
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100336 switch (usage->hid & HID_USAGE_PAGE) {
337
338 case HID_UP_GENDESK:
339 switch (usage->hid) {
340 case HID_GD_X:
341 hid_map_usage(hi, usage, bit, max,
342 EV_ABS, ABS_MT_POSITION_X);
343 set_abs(hi->input, ABS_MT_POSITION_X, field,
344 cls->sn_move);
345 /* touchscreen emulation */
346 set_abs(hi->input, ABS_X, field, cls->sn_move);
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200347 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100348 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100349 return 1;
350 case HID_GD_Y:
351 hid_map_usage(hi, usage, bit, max,
352 EV_ABS, ABS_MT_POSITION_Y);
353 set_abs(hi->input, ABS_MT_POSITION_Y, field,
354 cls->sn_move);
355 /* touchscreen emulation */
356 set_abs(hi->input, ABS_Y, field, cls->sn_move);
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200357 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100358 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100359 return 1;
360 }
361 return 0;
362
363 case HID_UP_DIGITIZER:
364 switch (usage->hid) {
365 case HID_DG_INRANGE:
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200366 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100367 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100368 return 1;
369 case HID_DG_CONFIDENCE:
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200370 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100371 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100372 return 1;
373 case HID_DG_TIPSWITCH:
374 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
375 input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200376 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100377 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100378 return 1;
379 case HID_DG_CONTACTID:
Benjamin Tissoires50bc03a2011-06-21 15:01:53 +0200380 if (!td->maxcontacts)
381 td->maxcontacts = MT_DEFAULT_MAXCONTACT;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100382 input_mt_init_slots(hi->input, td->maxcontacts);
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200383 mt_store_field(usage, td, hi);
Benjamin Tissoires2955cae2011-04-21 14:15:59 +0200384 td->last_field_index = field->index;
Benjamin Tissoires9e87f222012-03-06 17:57:06 +0100385 td->touches_by_report++;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100386 return 1;
387 case HID_DG_WIDTH:
388 hid_map_usage(hi, usage, bit, max,
389 EV_ABS, ABS_MT_TOUCH_MAJOR);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100390 set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
391 cls->sn_width);
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200392 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100393 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100394 return 1;
395 case HID_DG_HEIGHT:
396 hid_map_usage(hi, usage, bit, max,
397 EV_ABS, ABS_MT_TOUCH_MINOR);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100398 set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
399 cls->sn_height);
Benjamin Tissoires1e648a12011-03-18 14:27:55 +0100400 input_set_abs_params(hi->input,
401 ABS_MT_ORIENTATION, 0, 1, 0, 0);
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200402 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100403 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100404 return 1;
405 case HID_DG_TIPPRESSURE:
406 hid_map_usage(hi, usage, bit, max,
407 EV_ABS, ABS_MT_PRESSURE);
408 set_abs(hi->input, ABS_MT_PRESSURE, field,
409 cls->sn_pressure);
410 /* touchscreen emulation */
411 set_abs(hi->input, ABS_PRESSURE, field,
412 cls->sn_pressure);
Benjamin Tissoires3ac36d152012-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_CONTACTCOUNT:
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100417 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100418 return 1;
419 case HID_DG_CONTACTMAX:
420 /* we don't set td->last_slot_field as contactcount and
421 * contact max are global to the report */
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100422 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100423 return -1;
424 }
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100425 case HID_DG_TOUCH:
426 /* Legacy devices use TIPSWITCH and not TOUCH.
427 * Let's just ignore this field. */
428 return -1;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100429 /* let hid-input decide for the others */
430 return 0;
431
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100432 case HID_UP_BUTTON:
433 code = BTN_MOUSE + ((usage->hid - 1) & HID_USAGE);
434 hid_map_usage(hi, usage, bit, max, EV_KEY, code);
435 input_set_capability(hi->input, EV_KEY, code);
436 return 1;
437
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100438 case 0xff000000:
439 /* we do not want to map these: no input-oriented meaning */
440 return -1;
441 }
442
443 return 0;
444}
445
446static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
447 struct hid_field *field, struct hid_usage *usage,
448 unsigned long **bit, int *max)
449{
450 if (usage->type == EV_KEY || usage->type == EV_ABS)
451 set_bit(usage->type, hi->input->evbit);
452
453 return -1;
454}
455
456static int mt_compute_slot(struct mt_device *td)
457{
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100458 __s32 quirks = td->mtclass.quirks;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100459
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100460 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID)
461 return td->curdata.contactid;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100462
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100463 if (quirks & MT_QUIRK_CYPRESS)
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100464 return cypress_compute_slot(td);
465
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100466 if (quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER)
467 return td->num_received;
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100468
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200469 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE)
470 return td->curdata.contactid - 1;
471
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100472 return find_slot_from_contactid(td);
473}
474
475/*
476 * this function is called when a whole contact has been processed,
477 * so that it can assign it to a slot and store the data there
478 */
479static void mt_complete_slot(struct mt_device *td)
480{
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100481 td->curdata.seen_in_this_frame = true;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100482 if (td->curvalid) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100483 int slotnum = mt_compute_slot(td);
484
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100485 if (slotnum >= 0 && slotnum < td->maxcontacts)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100486 td->slots[slotnum] = td->curdata;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100487 }
488 td->num_received++;
489}
490
491
492/*
493 * this function is called when a whole packet has been received and processed,
494 * so that it can decide what to send to the input layer.
495 */
496static void mt_emit_event(struct mt_device *td, struct input_dev *input)
497{
498 int i;
499
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100500 for (i = 0; i < td->maxcontacts; ++i) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100501 struct mt_slot *s = &(td->slots[i]);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100502 if ((td->mtclass.quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) &&
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100503 !s->seen_in_this_frame) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100504 s->touch_state = false;
505 }
506
507 input_mt_slot(input, i);
508 input_mt_report_slot_state(input, MT_TOOL_FINGER,
509 s->touch_state);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100510 if (s->touch_state) {
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100511 /* this finger is on the screen */
512 int wide = (s->w > s->h);
513 /* divided by two to match visual scale of touch */
514 int major = max(s->w, s->h) >> 1;
515 int minor = min(s->w, s->h) >> 1;
516
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100517 input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
518 input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100519 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100520 input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100521 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
522 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100523 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100524 s->seen_in_this_frame = false;
525
526 }
527
528 input_mt_report_pointer_emulation(input, true);
529 input_sync(input);
530 td->num_received = 0;
531}
532
533
534
535static int mt_event(struct hid_device *hid, struct hid_field *field,
536 struct hid_usage *usage, __s32 value)
537{
538 struct mt_device *td = hid_get_drvdata(hid);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100539 __s32 quirks = td->mtclass.quirks;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100540
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100541 if (hid->claimed & HID_CLAIMED_INPUT && td->slots) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100542 switch (usage->hid) {
543 case HID_DG_INRANGE:
Stephane Chattya062cc52011-09-17 22:27:30 +0200544 if (quirks & MT_QUIRK_ALWAYS_VALID)
545 td->curvalid = true;
546 else if (quirks & MT_QUIRK_VALID_IS_INRANGE)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100547 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100548 break;
549 case HID_DG_TIPSWITCH:
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100550 if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
551 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100552 td->curdata.touch_state = value;
553 break;
554 case HID_DG_CONFIDENCE:
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100555 if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE)
556 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100557 break;
558 case HID_DG_CONTACTID:
559 td->curdata.contactid = value;
560 break;
561 case HID_DG_TIPPRESSURE:
562 td->curdata.p = value;
563 break;
564 case HID_GD_X:
565 td->curdata.x = value;
566 break;
567 case HID_GD_Y:
568 td->curdata.y = value;
569 break;
570 case HID_DG_WIDTH:
571 td->curdata.w = value;
572 break;
573 case HID_DG_HEIGHT:
574 td->curdata.h = value;
575 break;
576 case HID_DG_CONTACTCOUNT:
577 /*
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100578 * Includes multi-packet support where subsequent
579 * packets are sent with zero contactcount.
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100580 */
581 if (value)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100582 td->num_expected = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100583 break;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100584 case HID_DG_TOUCH:
585 /* do nothing */
586 break;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100587
588 default:
589 /* fallback to the generic hidinput handling */
590 return 0;
591 }
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100592
Denis Kovalev2258e862012-02-14 00:50:33 -0800593 if (usage->hid == td->last_slot_field)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100594 mt_complete_slot(td);
595
596 if (field->index == td->last_field_index
597 && td->num_received >= td->num_expected)
598 mt_emit_event(td, field->hidinput->input);
599
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100600 }
601
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100602 /* we have handled the hidinput part, now remains hiddev */
603 if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
604 hid->hiddev_hid_event(hid, field, usage, value);
605
606 return 1;
607}
608
609static void mt_set_input_mode(struct hid_device *hdev)
610{
611 struct mt_device *td = hid_get_drvdata(hdev);
612 struct hid_report *r;
613 struct hid_report_enum *re;
614
615 if (td->inputmode < 0)
616 return;
617
618 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
619 r = re->report_id_hash[td->inputmode];
620 if (r) {
621 r->field[0]->value[0] = 0x02;
622 usbhid_submit_report(hdev, r, USB_DIR_OUT);
623 }
624}
625
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100626static void mt_set_maxcontacts(struct hid_device *hdev)
627{
628 struct mt_device *td = hid_get_drvdata(hdev);
629 struct hid_report *r;
630 struct hid_report_enum *re;
631 int fieldmax, max;
632
633 if (td->maxcontact_report_id < 0)
634 return;
635
636 if (!td->mtclass.maxcontacts)
637 return;
638
639 re = &hdev->report_enum[HID_FEATURE_REPORT];
640 r = re->report_id_hash[td->maxcontact_report_id];
641 if (r) {
642 max = td->mtclass.maxcontacts;
643 fieldmax = r->field[0]->logical_maximum;
644 max = min(fieldmax, max);
645 if (r->field[0]->value[0] != max) {
646 r->field[0]->value[0] = max;
647 usbhid_submit_report(hdev, r, USB_DIR_OUT);
648 }
649 }
650}
651
Henrik Rydberg4fa3a582012-05-01 08:40:01 +0200652static void mt_post_parse_default_settings(struct mt_device *td)
653{
654 __s32 quirks = td->mtclass.quirks;
655
656 /* unknown serial device needs special quirks */
657 if (td->touches_by_report == 1) {
658 quirks |= MT_QUIRK_ALWAYS_VALID;
659 quirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP;
660 quirks &= ~MT_QUIRK_VALID_IS_INRANGE;
661 quirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE;
662 }
663
664 td->mtclass.quirks = quirks;
665}
666
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200667static void mt_post_parse(struct mt_device *td)
668{
669 struct mt_fields *f = td->fields;
670
671 if (td->touches_by_report > 0) {
672 int field_count_per_touch = f->length / td->touches_by_report;
673 td->last_slot_field = f->usages[field_count_per_touch - 1];
674 }
675}
676
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100677static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
678{
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100679 int ret, i;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100680 struct mt_device *td;
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100681 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
682
Benjamin Tissoires8d179a92012-03-06 17:57:04 +0100683 if (id) {
684 for (i = 0; mt_classes[i].name ; i++) {
685 if (id->driver_data == mt_classes[i].name) {
686 mtclass = &(mt_classes[i]);
687 break;
688 }
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100689 }
690 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100691
Henrik Rydbergd682bd72011-11-01 15:26:31 +0100692 /* This allows the driver to correctly support devices
693 * that emit events over several HID messages.
694 */
695 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100696
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100697 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100698 if (!td) {
699 dev_err(&hdev->dev, "cannot allocate multitouch data\n");
700 return -ENOMEM;
701 }
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100702 td->mtclass = *mtclass;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100703 td->inputmode = -1;
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100704 td->maxcontact_report_id = -1;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100705 hid_set_drvdata(hdev, td);
706
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200707 td->fields = kzalloc(sizeof(struct mt_fields), GFP_KERNEL);
708 if (!td->fields) {
709 dev_err(&hdev->dev, "cannot allocate multitouch fields data\n");
710 ret = -ENOMEM;
711 goto fail;
712 }
713
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100714 ret = hid_parse(hdev);
715 if (ret != 0)
716 goto fail;
717
718 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100719 if (ret)
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100720 goto fail;
721
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200722 mt_post_parse(td);
723
Henrik Rydberg4fa3a582012-05-01 08:40:01 +0200724 if (id->vendor == HID_ANY_ID && id->product == HID_ANY_ID)
725 mt_post_parse_default_settings(td);
Benjamin Tissoires9e87f222012-03-06 17:57:06 +0100726
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100727 td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
728 GFP_KERNEL);
729 if (!td->slots) {
730 dev_err(&hdev->dev, "cannot allocate multitouch slots\n");
731 hid_hw_stop(hdev);
732 ret = -ENOMEM;
733 goto fail;
734 }
735
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100736 ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group);
737
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100738 mt_set_maxcontacts(hdev);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100739 mt_set_input_mode(hdev);
740
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200741 kfree(td->fields);
742 td->fields = NULL;
743
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100744 return 0;
745
746fail:
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200747 kfree(td->fields);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100748 kfree(td);
749 return ret;
750}
751
752#ifdef CONFIG_PM
753static int mt_reset_resume(struct hid_device *hdev)
754{
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100755 mt_set_maxcontacts(hdev);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100756 mt_set_input_mode(hdev);
757 return 0;
758}
759#endif
760
761static void mt_remove(struct hid_device *hdev)
762{
763 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100764 sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100765 hid_hw_stop(hdev);
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100766 kfree(td->slots);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100767 kfree(td);
768 hid_set_drvdata(hdev, NULL);
769}
770
771static const struct hid_device_id mt_devices[] = {
772
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100773 /* 3M panels */
774 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200775 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100776 USB_DEVICE_ID_3M1968) },
777 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200778 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100779 USB_DEVICE_ID_3M2256) },
Benjamin Tissoiresc4fad872011-12-23 15:41:00 +0100780 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200781 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresc4fad872011-12-23 15:41:00 +0100782 USB_DEVICE_ID_3M3266) },
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100783
Benjamin Tissoirese6aac342011-05-19 14:18:13 +0200784 /* ActionStar panels */
785 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200786 MT_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR,
Benjamin Tissoirese6aac342011-05-19 14:18:13 +0200787 USB_DEVICE_ID_ACTIONSTAR_1011) },
788
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100789 /* Atmel panels */
790 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200791 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL,
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100792 USB_DEVICE_ID_ATMEL_MULTITOUCH) },
Benjamin Tissoires841cb152012-03-06 10:53:45 +0100793 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200794 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL,
Benjamin Tissoires841cb152012-03-06 10:53:45 +0100795 USB_DEVICE_ID_ATMEL_MXT_DIGITIZER) },
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100796
Jiri Kosina9ed32692012-04-20 12:15:44 +0200797 /* Baanto multitouch devices */
798 { .driver_data = MT_CLS_DEFAULT,
Jiri Kosina16b79bb2012-05-05 23:32:54 +0200799 MT_USB_DEVICE(USB_VENDOR_ID_BAANTO,
Jiri Kosina9ed32692012-04-20 12:15:44 +0200800 USB_DEVICE_ID_BAANTO_MT_190W2) },
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100801 /* Cando panels */
802 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200803 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100804 USB_DEVICE_ID_CANDO_MULTI_TOUCH) },
805 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200806 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100807 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) },
808 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200809 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100810 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) },
811 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200812 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100813 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },
814
Austin Zhang942fd422011-05-28 02:03:47 +0800815 /* Chunghwa Telecom touch panels */
816 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200817 MT_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT,
Austin Zhang942fd422011-05-28 02:03:47 +0800818 USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) },
819
Benjamin Tissoires79603dc2011-05-19 14:18:14 +0200820 /* CVTouch panels */
821 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200822 MT_USB_DEVICE(USB_VENDOR_ID_CVTOUCH,
Benjamin Tissoires79603dc2011-05-19 14:18:14 +0200823 USB_DEVICE_ID_CVTOUCH_SCREEN) },
824
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100825 /* Cypress panel */
826 { .driver_data = MT_CLS_CYPRESS,
827 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS,
828 USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
829
Benjamin Tissoires22408282011-05-20 15:59:34 +0200830 /* eGalax devices (resistive) */
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100831 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200832 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100833 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) },
834 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200835 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100836 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200837
838 /* eGalax devices (capacitive) */
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100839 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200840 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100841 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100842 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200843 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100844 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7207) },
845 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200846 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100847 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E) },
848 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200849 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100850 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224) },
Benjamin Tissoires2ce09df2012-03-06 17:57:02 +0100851 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200852 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoires2ce09df2012-03-06 17:57:02 +0100853 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_722A) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100854 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200855 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100856 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100857 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200858 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100859 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7262) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100860 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200861 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100862 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100863 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200864 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100865 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72AA) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100866 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200867 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoires66f06122011-11-23 10:54:33 +0100868 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA) },
869 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200870 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Marek Vasutbb9ff212011-11-23 10:54:32 +0100871 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) },
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100872 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200873 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100874 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349) },
875 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200876 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100877 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200878
Benjamin Tissoiresc04abee2011-05-19 11:37:29 +0200879 /* Elo TouchSystems IntelliTouch Plus panel */
880 { .driver_data = MT_CLS_DUAL_NSMU_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200881 MT_USB_DEVICE(USB_VENDOR_ID_ELO,
Benjamin Tissoiresc04abee2011-05-19 11:37:29 +0200882 USB_DEVICE_ID_ELO_TS2515) },
883
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100884 /* GeneralTouch panel */
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100885 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200886 MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100887 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) },
888
Andreas Nielsen4d5df5d2012-03-19 15:41:03 +0100889 /* Gametel game controller */
890 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200891 MT_BT_DEVICE(USB_VENDOR_ID_FRUCTEL,
Andreas Nielsen4d5df5d2012-03-19 15:41:03 +0100892 USB_DEVICE_ID_GAMETEL_MT_MODE) },
893
Benjamin Tissoiresee0fbd12011-05-19 14:18:15 +0200894 /* GoodTouch panels */
895 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200896 MT_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH,
Benjamin Tissoiresee0fbd12011-05-19 14:18:15 +0200897 USB_DEVICE_ID_GOODTOUCH_000f) },
898
Benjamin Tissoires54580362011-11-29 13:13:12 +0100899 /* Hanvon panels */
900 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200901 MT_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT,
Benjamin Tissoires54580362011-11-29 13:13:12 +0100902 USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) },
903
Stephane Chattya062cc52011-09-17 22:27:30 +0200904 /* Ideacom panel */
905 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200906 MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
Stephane Chattya062cc52011-09-17 22:27:30 +0200907 USB_DEVICE_ID_IDEACOM_IDC6650) },
Benjamin Tissoires71078b02012-03-06 10:53:46 +0100908 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200909 MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
Benjamin Tissoires71078b02012-03-06 10:53:46 +0100910 USB_DEVICE_ID_IDEACOM_IDC6651) },
Stephane Chattya062cc52011-09-17 22:27:30 +0200911
Austin Zhang4e61f0d2011-05-09 23:54:14 +0800912 /* Ilitek dual touch panel */
913 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200914 MT_USB_DEVICE(USB_VENDOR_ID_ILITEK,
Austin Zhang4e61f0d2011-05-09 23:54:14 +0800915 USB_DEVICE_ID_ILITEK_MULTITOUCH) },
916
Benjamin Tissoires4dfcced2011-01-31 11:28:22 +0100917 /* IRTOUCH panels */
918 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200919 MT_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS,
Benjamin Tissoires4dfcced2011-01-31 11:28:22 +0100920 USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
921
Jeff Brownc50bb1a2011-08-15 21:12:09 -0700922 /* LG Display panels */
923 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200924 MT_USB_DEVICE(USB_VENDOR_ID_LG,
Jeff Brownc50bb1a2011-08-15 21:12:09 -0700925 USB_DEVICE_ID_LG_MULTITOUCH) },
926
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200927 /* Lumio panels */
928 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200929 MT_USB_DEVICE(USB_VENDOR_ID_LUMIO,
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200930 USB_DEVICE_ID_CRYSTALTOUCH) },
Benjamin Tissoiresc3ead6d2011-06-21 15:01:55 +0200931 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200932 MT_USB_DEVICE(USB_VENDOR_ID_LUMIO,
Benjamin Tissoiresc3ead6d2011-06-21 15:01:55 +0200933 USB_DEVICE_ID_CRYSTALTOUCH_DUAL) },
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200934
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200935 /* MosArt panels */
936 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200937 MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200938 USB_DEVICE_ID_ASUS_T91MT)},
939 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200940 MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200941 USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) },
942 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200943 MT_USB_DEVICE(USB_VENDOR_ID_TURBOX,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200944 USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) },
945
Denis Kovalev2258e862012-02-14 00:50:33 -0800946 /* Panasonic panels */
947 { .driver_data = MT_CLS_PANASONIC,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200948 MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
Denis Kovalev2258e862012-02-14 00:50:33 -0800949 USB_DEVICE_ID_PANABOARD_UBT780) },
950 { .driver_data = MT_CLS_PANASONIC,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200951 MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
Denis Kovalev2258e862012-02-14 00:50:33 -0800952 USB_DEVICE_ID_PANABOARD_UBT880) },
953
Austin Hendrix4db703e2012-06-04 15:27:51 -0700954 /* Novatek Panel */
955 { .driver_data = MT_CLS_DEFAULT,
956 HID_USB_DEVICE(USB_VENDOR_ID_NOVATEK,
957 USB_DEVICE_ID_NOVATEK_PCT) },
958
John Sung6ab3a9a2011-04-21 16:21:52 +0200959 /* PenMount panels */
960 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200961 MT_USB_DEVICE(USB_VENDOR_ID_PENMOUNT,
John Sung6ab3a9a2011-04-21 16:21:52 +0200962 USB_DEVICE_ID_PENMOUNT_PCI) },
963
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800964 /* PixArt optical touch screen */
965 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200966 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800967 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN) },
968 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200969 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800970 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1) },
971 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200972 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800973 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2) },
974
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100975 /* PixCir-based panels */
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100976 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200977 MT_USB_DEVICE(USB_VENDOR_ID_HANVON,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100978 USB_DEVICE_ID_HANVON_MULTITOUCH) },
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100979 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200980 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100981 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
982
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100983 /* Quanta-based panels */
984 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200985 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100986 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) },
987 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200988 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100989 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001) },
990 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200991 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100992 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008) },
993
Benjamin Tissoires043b4032011-03-18 14:27:53 +0100994 /* Stantum panels */
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +0200995 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200996 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM,
Benjamin Tissoires043b4032011-03-18 14:27:53 +0100997 USB_DEVICE_ID_MTP)},
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +0200998 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200999 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM,
Benjamin Tissoires043b4032011-03-18 14:27:53 +01001000 USB_DEVICE_ID_MTP_STM)},
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +02001001 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001002 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX,
Benjamin Tissoires043b4032011-03-18 14:27:53 +01001003 USB_DEVICE_ID_MTP_SITRONIX)},
1004
Benjamin Tissoires847672c2012-02-04 17:08:50 +01001005 /* TopSeed panels */
1006 { .driver_data = MT_CLS_TOPSEED,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001007 MT_USB_DEVICE(USB_VENDOR_ID_TOPSEED2,
Benjamin Tissoires847672c2012-02-04 17:08:50 +01001008 USB_DEVICE_ID_TOPSEED2_PERIPAD_701) },
1009
Benjamin Tissoires5e74e562011-05-19 14:18:16 +02001010 /* Touch International panels */
1011 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001012 MT_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL,
Benjamin Tissoires5e74e562011-05-19 14:18:16 +02001013 USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) },
1014
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001015 /* Unitec panels */
1016 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001017 MT_USB_DEVICE(USB_VENDOR_ID_UNITEC,
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001018 USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) },
1019 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001020 MT_USB_DEVICE(USB_VENDOR_ID_UNITEC,
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001021 USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) },
ice chienbc8a2a92011-07-15 16:58:06 +08001022 /* XAT */
1023 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001024 MT_USB_DEVICE(USB_VENDOR_ID_XAT,
ice chienbc8a2a92011-07-15 16:58:06 +08001025 USB_DEVICE_ID_XAT_CSR) },
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001026
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001027 /* Xiroku */
1028 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001029 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001030 USB_DEVICE_ID_XIROKU_SPX) },
1031 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001032 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001033 USB_DEVICE_ID_XIROKU_MPX) },
1034 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001035 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001036 USB_DEVICE_ID_XIROKU_CSR) },
1037 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001038 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001039 USB_DEVICE_ID_XIROKU_SPX1) },
1040 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001041 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001042 USB_DEVICE_ID_XIROKU_MPX1) },
1043 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001044 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001045 USB_DEVICE_ID_XIROKU_CSR1) },
1046 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001047 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001048 USB_DEVICE_ID_XIROKU_SPX2) },
1049 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001050 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001051 USB_DEVICE_ID_XIROKU_MPX2) },
1052 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001053 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001054 USB_DEVICE_ID_XIROKU_CSR2) },
1055
Henrik Rydberg4fa3a582012-05-01 08:40:01 +02001056 /* Generic MT device */
1057 { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) },
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001058 { }
1059};
1060MODULE_DEVICE_TABLE(hid, mt_devices);
1061
1062static const struct hid_usage_id mt_grabbed_usages[] = {
1063 { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
1064 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
1065};
1066
1067static struct hid_driver mt_driver = {
1068 .name = "hid-multitouch",
1069 .id_table = mt_devices,
1070 .probe = mt_probe,
1071 .remove = mt_remove,
1072 .input_mapping = mt_input_mapping,
1073 .input_mapped = mt_input_mapped,
1074 .feature_mapping = mt_feature_mapping,
1075 .usage_table = mt_grabbed_usages,
1076 .event = mt_event,
1077#ifdef CONFIG_PM
1078 .reset_resume = mt_reset_resume,
1079#endif
1080};
1081
1082static int __init mt_init(void)
1083{
1084 return hid_register_driver(&mt_driver);
1085}
1086
1087static void __exit mt_exit(void)
1088{
1089 hid_unregister_driver(&mt_driver);
1090}
1091
1092module_init(mt_init);
1093module_exit(mt_exit);