blob: 9f3c5bf4dde3a4c03eff895a1ea086381a339fdd [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
Xianhan Yuf5ff4e12012-09-28 10:18:59 +0800118#define MT_CLS_GENERALTOUCH_TWOFINGERS 0x0107
119#define MT_CLS_GENERALTOUCH_PWT_TENFINGERS 0x0108
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100120
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100121#define MT_DEFAULT_MAXCONTACT 10
122
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200123#define MT_USB_DEVICE(v, p) HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH, v, p)
124#define MT_BT_DEVICE(v, p) HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_MULTITOUCH, v, p)
125
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100126/*
127 * these device-dependent functions determine what slot corresponds
128 * to a valid contact that was just read.
129 */
130
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100131static int cypress_compute_slot(struct mt_device *td)
132{
133 if (td->curdata.contactid != 0 || td->num_received == 0)
134 return td->curdata.contactid;
135 else
136 return -1;
137}
138
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100139static int find_slot_from_contactid(struct mt_device *td)
140{
141 int i;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100142 for (i = 0; i < td->maxcontacts; ++i) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100143 if (td->slots[i].contactid == td->curdata.contactid &&
144 td->slots[i].touch_state)
145 return i;
146 }
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100147 for (i = 0; i < td->maxcontacts; ++i) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100148 if (!td->slots[i].seen_in_this_frame &&
149 !td->slots[i].touch_state)
150 return i;
151 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100152 /* should not occurs. If this happens that means
153 * that the device sent more touches that it says
154 * in the report descriptor. It is ignored then. */
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100155 return -1;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100156}
157
Jiri Kosinab3c21d22011-11-22 23:23:37 +0100158static struct mt_class mt_classes[] = {
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100159 { .name = MT_CLS_DEFAULT,
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100160 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP },
Stephane Chattya062cc52011-09-17 22:27:30 +0200161 { .name = MT_CLS_SERIAL,
162 .quirks = MT_QUIRK_ALWAYS_VALID},
Benjamin Tissoires22408282011-05-20 15:59:34 +0200163 { .name = MT_CLS_CONFIDENCE,
164 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE },
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100165 { .name = MT_CLS_CONFIDENCE_CONTACT_ID,
166 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
167 MT_QUIRK_SLOT_IS_CONTACTID },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200168 { .name = MT_CLS_CONFIDENCE_MINUS_ONE,
169 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
170 MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE },
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100171 { .name = MT_CLS_DUAL_INRANGE_CONTACTID,
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100172 .quirks = MT_QUIRK_VALID_IS_INRANGE |
173 MT_QUIRK_SLOT_IS_CONTACTID,
174 .maxcontacts = 2 },
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100175 { .name = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100176 .quirks = MT_QUIRK_VALID_IS_INRANGE |
177 MT_QUIRK_SLOT_IS_CONTACTNUMBER,
178 .maxcontacts = 2 },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200179 { .name = MT_CLS_DUAL_NSMU_CONTACTID,
180 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
181 MT_QUIRK_SLOT_IS_CONTACTID,
182 .maxcontacts = 2 },
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800183 { .name = MT_CLS_INRANGE_CONTACTNUMBER,
184 .quirks = MT_QUIRK_VALID_IS_INRANGE |
185 MT_QUIRK_SLOT_IS_CONTACTNUMBER },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200186
187 /*
188 * vendor specific classes
189 */
190 { .name = MT_CLS_3M,
191 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
192 MT_QUIRK_SLOT_IS_CONTACTID,
193 .sn_move = 2048,
194 .sn_width = 128,
195 .sn_height = 128 },
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100196 { .name = MT_CLS_CYPRESS,
197 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
198 MT_QUIRK_CYPRESS,
199 .maxcontacts = 10 },
Richard Nauber4875ac12011-03-09 06:20:57 +0100200 { .name = MT_CLS_EGALAX,
201 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
Benjamin Tissoires2261bb92011-11-23 10:54:29 +0100202 MT_QUIRK_VALID_IS_INRANGE,
Richard Nauber4875ac12011-03-09 06:20:57 +0100203 .sn_move = 4096,
204 .sn_pressure = 32,
205 },
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100206 { .name = MT_CLS_EGALAX_SERIAL,
207 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
208 MT_QUIRK_ALWAYS_VALID,
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100209 .sn_move = 4096,
210 .sn_pressure = 32,
211 },
Benjamin Tissoires847672c2012-02-04 17:08:50 +0100212 { .name = MT_CLS_TOPSEED,
213 .quirks = MT_QUIRK_ALWAYS_VALID,
214 .is_indirect = true,
215 .maxcontacts = 2,
216 },
Denis Kovalev2258e862012-02-14 00:50:33 -0800217 { .name = MT_CLS_PANASONIC,
218 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP,
219 .maxcontacts = 4 },
Xianhan Yuf5ff4e12012-09-28 10:18:59 +0800220 { .name = MT_CLS_GENERALTOUCH_TWOFINGERS,
221 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
222 MT_QUIRK_VALID_IS_INRANGE |
223 MT_QUIRK_SLOT_IS_CONTACTNUMBER,
224 .maxcontacts = 2
225 },
226 { .name = MT_CLS_GENERALTOUCH_PWT_TENFINGERS,
227 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
228 MT_QUIRK_SLOT_IS_CONTACTNUMBER,
229 .maxcontacts = 10
230 },
Benjamin Tissoires043b4032011-03-18 14:27:53 +0100231
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100232 { }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100233};
234
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100235static ssize_t mt_show_quirks(struct device *dev,
236 struct device_attribute *attr,
237 char *buf)
238{
239 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
240 struct mt_device *td = hid_get_drvdata(hdev);
241
242 return sprintf(buf, "%u\n", td->mtclass.quirks);
243}
244
245static ssize_t mt_set_quirks(struct device *dev,
246 struct device_attribute *attr,
247 const char *buf, size_t count)
248{
249 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
250 struct mt_device *td = hid_get_drvdata(hdev);
251
252 unsigned long val;
253
254 if (kstrtoul(buf, 0, &val))
255 return -EINVAL;
256
257 td->mtclass.quirks = val;
258
259 return count;
260}
261
262static DEVICE_ATTR(quirks, S_IWUSR | S_IRUGO, mt_show_quirks, mt_set_quirks);
263
264static struct attribute *sysfs_attrs[] = {
265 &dev_attr_quirks.attr,
266 NULL
267};
268
269static struct attribute_group mt_attribute_group = {
270 .attrs = sysfs_attrs
271};
272
Henrik Rydbergf635bd12011-02-24 19:30:59 +0100273static void mt_feature_mapping(struct hid_device *hdev,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100274 struct hid_field *field, struct hid_usage *usage)
275{
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100276 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoires4aceed32012-06-19 14:39:52 +0200277 int i;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100278
279 switch (usage->hid) {
280 case HID_DG_INPUTMODE:
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100281 td->inputmode = field->report->id;
Benjamin Tissoires4aceed32012-06-19 14:39:52 +0200282 td->inputmode_index = 0; /* has to be updated below */
283
284 for (i=0; i < field->maxusage; i++) {
285 if (field->usage[i].hid == usage->hid) {
286 td->inputmode_index = i;
287 break;
288 }
289 }
290
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100291 break;
292 case HID_DG_CONTACTMAX:
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100293 td->maxcontact_report_id = field->report->id;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100294 td->maxcontacts = field->value[0];
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100295 if (td->mtclass.maxcontacts)
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100296 /* check if the maxcontacts is given by the class */
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100297 td->maxcontacts = td->mtclass.maxcontacts;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100298
299 break;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100300 }
301}
302
303static void set_abs(struct input_dev *input, unsigned int code,
304 struct hid_field *field, int snratio)
305{
306 int fmin = field->logical_minimum;
307 int fmax = field->logical_maximum;
308 int fuzz = snratio ? (fmax - fmin) / snratio : 0;
309 input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
310}
311
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200312static void mt_store_field(struct hid_usage *usage, struct mt_device *td,
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100313 struct hid_input *hi)
314{
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200315 struct mt_fields *f = td->fields;
316
317 if (f->length >= HID_MAX_FIELDS)
318 return;
319
320 f->usages[f->length++] = usage->hid;
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100321}
322
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100323static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
324 struct hid_field *field, struct hid_usage *usage,
325 unsigned long **bit, int *max)
326{
327 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100328 struct mt_class *cls = &td->mtclass;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100329 int code;
Richard Nauber4875ac12011-03-09 06:20:57 +0100330
Jeff Brown658d4aed592011-08-15 16:44:28 -0700331 /* Only map fields from TouchScreen or TouchPad collections.
Denis Kovalev2258e862012-02-14 00:50:33 -0800332 * We need to ignore fields that belong to other collections
333 * such as Mouse that might have the same GenericDesktop usages. */
Jeff Brown658d4aed592011-08-15 16:44:28 -0700334 if (field->application == HID_DG_TOUCHSCREEN)
335 set_bit(INPUT_PROP_DIRECT, hi->input->propbit);
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100336 else if (field->application != HID_DG_TOUCHPAD)
Jeff Brown658d4aed592011-08-15 16:44:28 -0700337 return 0;
338
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100339 /* In case of an indirect device (touchpad), we need to add
340 * specific BTN_TOOL_* to be handled by the synaptics xorg
341 * driver.
342 * We also consider that touchscreens providing buttons are touchpads.
343 */
344 if (field->application == HID_DG_TOUCHPAD ||
345 (usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON ||
346 cls->is_indirect) {
347 set_bit(INPUT_PROP_POINTER, hi->input->propbit);
348 set_bit(BTN_TOOL_FINGER, hi->input->keybit);
349 set_bit(BTN_TOOL_DOUBLETAP, hi->input->keybit);
350 set_bit(BTN_TOOL_TRIPLETAP, hi->input->keybit);
351 set_bit(BTN_TOOL_QUADTAP, hi->input->keybit);
352 }
353
Benjamin Tissoires2261bb92011-11-23 10:54:29 +0100354 /* eGalax devices provide a Digitizer.Stylus input which overrides
355 * the correct Digitizers.Finger X/Y ranges.
356 * Let's just ignore this input. */
357 if (field->physical == HID_DG_STYLUS)
358 return -1;
359
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100360 switch (usage->hid & HID_USAGE_PAGE) {
361
362 case HID_UP_GENDESK:
363 switch (usage->hid) {
364 case HID_GD_X:
365 hid_map_usage(hi, usage, bit, max,
366 EV_ABS, ABS_MT_POSITION_X);
367 set_abs(hi->input, ABS_MT_POSITION_X, field,
368 cls->sn_move);
369 /* touchscreen emulation */
370 set_abs(hi->input, ABS_X, field, cls->sn_move);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200371 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100372 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100373 return 1;
374 case HID_GD_Y:
375 hid_map_usage(hi, usage, bit, max,
376 EV_ABS, ABS_MT_POSITION_Y);
377 set_abs(hi->input, ABS_MT_POSITION_Y, field,
378 cls->sn_move);
379 /* touchscreen emulation */
380 set_abs(hi->input, ABS_Y, field, cls->sn_move);
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 }
385 return 0;
386
387 case HID_UP_DIGITIZER:
388 switch (usage->hid) {
389 case HID_DG_INRANGE:
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200390 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100391 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100392 return 1;
393 case HID_DG_CONFIDENCE:
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200394 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100395 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100396 return 1;
397 case HID_DG_TIPSWITCH:
398 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
399 input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200400 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100401 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100402 return 1;
403 case HID_DG_CONTACTID:
Benjamin Tissoires50bc03a2011-06-21 15:01:53 +0200404 if (!td->maxcontacts)
405 td->maxcontacts = MT_DEFAULT_MAXCONTACT;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100406 input_mt_init_slots(hi->input, td->maxcontacts);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200407 mt_store_field(usage, td, hi);
Benjamin Tissoires2955cae2011-04-21 14:15:59 +0200408 td->last_field_index = field->index;
Benjamin Tissoires9e87f222012-03-06 17:57:06 +0100409 td->touches_by_report++;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100410 return 1;
411 case HID_DG_WIDTH:
412 hid_map_usage(hi, usage, bit, max,
413 EV_ABS, ABS_MT_TOUCH_MAJOR);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100414 set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
415 cls->sn_width);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200416 mt_store_field(usage, td, hi);
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_HEIGHT:
420 hid_map_usage(hi, usage, bit, max,
421 EV_ABS, ABS_MT_TOUCH_MINOR);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100422 set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
423 cls->sn_height);
Benjamin Tissoires1e648a12011-03-18 14:27:55 +0100424 input_set_abs_params(hi->input,
425 ABS_MT_ORIENTATION, 0, 1, 0, 0);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200426 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100427 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100428 return 1;
429 case HID_DG_TIPPRESSURE:
430 hid_map_usage(hi, usage, bit, max,
431 EV_ABS, ABS_MT_PRESSURE);
432 set_abs(hi->input, ABS_MT_PRESSURE, field,
433 cls->sn_pressure);
434 /* touchscreen emulation */
435 set_abs(hi->input, ABS_PRESSURE, field,
436 cls->sn_pressure);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200437 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100438 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100439 return 1;
440 case HID_DG_CONTACTCOUNT:
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100441 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100442 return 1;
443 case HID_DG_CONTACTMAX:
444 /* we don't set td->last_slot_field as contactcount and
445 * contact max are global to the report */
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100446 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100447 return -1;
448 }
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100449 case HID_DG_TOUCH:
450 /* Legacy devices use TIPSWITCH and not TOUCH.
451 * Let's just ignore this field. */
452 return -1;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100453 /* let hid-input decide for the others */
454 return 0;
455
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100456 case HID_UP_BUTTON:
457 code = BTN_MOUSE + ((usage->hid - 1) & HID_USAGE);
458 hid_map_usage(hi, usage, bit, max, EV_KEY, code);
459 input_set_capability(hi->input, EV_KEY, code);
460 return 1;
461
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100462 case 0xff000000:
463 /* we do not want to map these: no input-oriented meaning */
464 return -1;
465 }
466
467 return 0;
468}
469
470static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
471 struct hid_field *field, struct hid_usage *usage,
472 unsigned long **bit, int *max)
473{
474 if (usage->type == EV_KEY || usage->type == EV_ABS)
475 set_bit(usage->type, hi->input->evbit);
476
477 return -1;
478}
479
480static int mt_compute_slot(struct mt_device *td)
481{
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100482 __s32 quirks = td->mtclass.quirks;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100483
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100484 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID)
485 return td->curdata.contactid;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100486
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100487 if (quirks & MT_QUIRK_CYPRESS)
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100488 return cypress_compute_slot(td);
489
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100490 if (quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER)
491 return td->num_received;
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100492
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200493 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE)
494 return td->curdata.contactid - 1;
495
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100496 return find_slot_from_contactid(td);
497}
498
499/*
500 * this function is called when a whole contact has been processed,
501 * so that it can assign it to a slot and store the data there
502 */
503static void mt_complete_slot(struct mt_device *td)
504{
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100505 td->curdata.seen_in_this_frame = true;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100506 if (td->curvalid) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100507 int slotnum = mt_compute_slot(td);
508
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100509 if (slotnum >= 0 && slotnum < td->maxcontacts)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100510 td->slots[slotnum] = td->curdata;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100511 }
512 td->num_received++;
513}
514
515
516/*
517 * this function is called when a whole packet has been received and processed,
518 * so that it can decide what to send to the input layer.
519 */
520static void mt_emit_event(struct mt_device *td, struct input_dev *input)
521{
522 int i;
523
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100524 for (i = 0; i < td->maxcontacts; ++i) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100525 struct mt_slot *s = &(td->slots[i]);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100526 if ((td->mtclass.quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) &&
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100527 !s->seen_in_this_frame) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100528 s->touch_state = false;
529 }
530
531 input_mt_slot(input, i);
532 input_mt_report_slot_state(input, MT_TOOL_FINGER,
533 s->touch_state);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100534 if (s->touch_state) {
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100535 /* this finger is on the screen */
536 int wide = (s->w > s->h);
537 /* divided by two to match visual scale of touch */
538 int major = max(s->w, s->h) >> 1;
539 int minor = min(s->w, s->h) >> 1;
540
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100541 input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
542 input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100543 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100544 input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100545 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
546 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100547 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100548 s->seen_in_this_frame = false;
549
550 }
551
552 input_mt_report_pointer_emulation(input, true);
553 input_sync(input);
554 td->num_received = 0;
555}
556
557
558
559static int mt_event(struct hid_device *hid, struct hid_field *field,
560 struct hid_usage *usage, __s32 value)
561{
562 struct mt_device *td = hid_get_drvdata(hid);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100563 __s32 quirks = td->mtclass.quirks;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100564
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100565 if (hid->claimed & HID_CLAIMED_INPUT && td->slots) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100566 switch (usage->hid) {
567 case HID_DG_INRANGE:
Stephane Chattya062cc52011-09-17 22:27:30 +0200568 if (quirks & MT_QUIRK_ALWAYS_VALID)
569 td->curvalid = true;
570 else if (quirks & MT_QUIRK_VALID_IS_INRANGE)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100571 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100572 break;
573 case HID_DG_TIPSWITCH:
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100574 if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
575 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100576 td->curdata.touch_state = value;
577 break;
578 case HID_DG_CONFIDENCE:
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100579 if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE)
580 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100581 break;
582 case HID_DG_CONTACTID:
583 td->curdata.contactid = value;
584 break;
585 case HID_DG_TIPPRESSURE:
586 td->curdata.p = value;
587 break;
588 case HID_GD_X:
589 td->curdata.x = value;
590 break;
591 case HID_GD_Y:
592 td->curdata.y = value;
593 break;
594 case HID_DG_WIDTH:
595 td->curdata.w = value;
596 break;
597 case HID_DG_HEIGHT:
598 td->curdata.h = value;
599 break;
600 case HID_DG_CONTACTCOUNT:
601 /*
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100602 * Includes multi-packet support where subsequent
603 * packets are sent with zero contactcount.
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100604 */
605 if (value)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100606 td->num_expected = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100607 break;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100608 case HID_DG_TOUCH:
609 /* do nothing */
610 break;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100611
612 default:
613 /* fallback to the generic hidinput handling */
614 return 0;
615 }
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100616
Denis Kovalev2258e862012-02-14 00:50:33 -0800617 if (usage->hid == td->last_slot_field)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100618 mt_complete_slot(td);
619
620 if (field->index == td->last_field_index
621 && td->num_received >= td->num_expected)
622 mt_emit_event(td, field->hidinput->input);
623
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100624 }
625
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100626 /* we have handled the hidinput part, now remains hiddev */
627 if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
628 hid->hiddev_hid_event(hid, field, usage, value);
629
630 return 1;
631}
632
633static void mt_set_input_mode(struct hid_device *hdev)
634{
635 struct mt_device *td = hid_get_drvdata(hdev);
636 struct hid_report *r;
637 struct hid_report_enum *re;
638
639 if (td->inputmode < 0)
640 return;
641
642 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
643 r = re->report_id_hash[td->inputmode];
644 if (r) {
Benjamin Tissoires4aceed32012-06-19 14:39:52 +0200645 r->field[0]->value[td->inputmode_index] = 0x02;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100646 usbhid_submit_report(hdev, r, USB_DIR_OUT);
647 }
648}
649
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100650static void mt_set_maxcontacts(struct hid_device *hdev)
651{
652 struct mt_device *td = hid_get_drvdata(hdev);
653 struct hid_report *r;
654 struct hid_report_enum *re;
655 int fieldmax, max;
656
657 if (td->maxcontact_report_id < 0)
658 return;
659
660 if (!td->mtclass.maxcontacts)
661 return;
662
663 re = &hdev->report_enum[HID_FEATURE_REPORT];
664 r = re->report_id_hash[td->maxcontact_report_id];
665 if (r) {
666 max = td->mtclass.maxcontacts;
667 fieldmax = r->field[0]->logical_maximum;
668 max = min(fieldmax, max);
669 if (r->field[0]->value[0] != max) {
670 r->field[0]->value[0] = max;
671 usbhid_submit_report(hdev, r, USB_DIR_OUT);
672 }
673 }
674}
675
Henrik Rydberg4fa3a582012-05-01 08:40:01 +0200676static void mt_post_parse_default_settings(struct mt_device *td)
677{
678 __s32 quirks = td->mtclass.quirks;
679
680 /* unknown serial device needs special quirks */
681 if (td->touches_by_report == 1) {
682 quirks |= MT_QUIRK_ALWAYS_VALID;
683 quirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP;
684 quirks &= ~MT_QUIRK_VALID_IS_INRANGE;
685 quirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE;
686 }
687
688 td->mtclass.quirks = quirks;
689}
690
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200691static void mt_post_parse(struct mt_device *td)
692{
693 struct mt_fields *f = td->fields;
694
695 if (td->touches_by_report > 0) {
696 int field_count_per_touch = f->length / td->touches_by_report;
697 td->last_slot_field = f->usages[field_count_per_touch - 1];
698 }
699}
700
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100701static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
702{
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100703 int ret, i;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100704 struct mt_device *td;
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100705 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
706
Henrik Rydberg94b54852012-08-08 21:45:50 +0200707 for (i = 0; mt_classes[i].name ; i++) {
708 if (id->driver_data == mt_classes[i].name) {
709 mtclass = &(mt_classes[i]);
710 break;
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100711 }
712 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100713
Henrik Rydbergd682bd72011-11-01 15:26:31 +0100714 /* This allows the driver to correctly support devices
715 * that emit events over several HID messages.
716 */
717 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100718
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100719 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100720 if (!td) {
721 dev_err(&hdev->dev, "cannot allocate multitouch data\n");
722 return -ENOMEM;
723 }
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100724 td->mtclass = *mtclass;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100725 td->inputmode = -1;
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100726 td->maxcontact_report_id = -1;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100727 hid_set_drvdata(hdev, td);
728
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200729 td->fields = kzalloc(sizeof(struct mt_fields), GFP_KERNEL);
730 if (!td->fields) {
731 dev_err(&hdev->dev, "cannot allocate multitouch fields data\n");
732 ret = -ENOMEM;
733 goto fail;
734 }
735
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100736 ret = hid_parse(hdev);
737 if (ret != 0)
738 goto fail;
739
740 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100741 if (ret)
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100742 goto fail;
743
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200744 mt_post_parse(td);
745
Henrik Rydberg4fa3a582012-05-01 08:40:01 +0200746 if (id->vendor == HID_ANY_ID && id->product == HID_ANY_ID)
747 mt_post_parse_default_settings(td);
Benjamin Tissoires9e87f222012-03-06 17:57:06 +0100748
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100749 td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
750 GFP_KERNEL);
751 if (!td->slots) {
752 dev_err(&hdev->dev, "cannot allocate multitouch slots\n");
753 hid_hw_stop(hdev);
754 ret = -ENOMEM;
755 goto fail;
756 }
757
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100758 ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group);
759
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100760 mt_set_maxcontacts(hdev);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100761 mt_set_input_mode(hdev);
762
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200763 kfree(td->fields);
764 td->fields = NULL;
765
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100766 return 0;
767
768fail:
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200769 kfree(td->fields);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100770 kfree(td);
771 return ret;
772}
773
774#ifdef CONFIG_PM
775static int mt_reset_resume(struct hid_device *hdev)
776{
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100777 mt_set_maxcontacts(hdev);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100778 mt_set_input_mode(hdev);
779 return 0;
780}
Scott Liudfeefd12012-08-15 17:21:55 +0800781
782static int mt_resume(struct hid_device *hdev)
783{
784 struct usb_interface *intf;
785 struct usb_host_interface *interface;
786 struct usb_device *dev;
787
788 if (hdev->bus != BUS_USB)
789 return 0;
790
791 intf = to_usb_interface(hdev->dev.parent);
792 interface = intf->cur_altsetting;
793 dev = hid_to_usb_dev(hdev);
794
795 /* Some Elan legacy devices require SET_IDLE to be set on resume.
796 * It should be safe to send it to other devices too.
797 * Tested on 3M, Stantum, Cypress, Zytronic, eGalax, and Elan panels. */
798
799 usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
800 HID_REQ_SET_IDLE,
801 USB_TYPE_CLASS | USB_RECIP_INTERFACE,
802 0, interface->desc.bInterfaceNumber,
803 NULL, 0, USB_CTRL_SET_TIMEOUT);
804
805 return 0;
806}
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100807#endif
808
809static void mt_remove(struct hid_device *hdev)
810{
811 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100812 sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100813 hid_hw_stop(hdev);
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100814 kfree(td->slots);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100815 kfree(td);
816 hid_set_drvdata(hdev, NULL);
817}
818
819static const struct hid_device_id mt_devices[] = {
820
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100821 /* 3M panels */
822 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200823 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100824 USB_DEVICE_ID_3M1968) },
825 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200826 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100827 USB_DEVICE_ID_3M2256) },
Benjamin Tissoiresc4fad872011-12-23 15:41:00 +0100828 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200829 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresc4fad872011-12-23 15:41:00 +0100830 USB_DEVICE_ID_3M3266) },
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100831
Benjamin Tissoirese6aac342011-05-19 14:18:13 +0200832 /* ActionStar panels */
833 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200834 MT_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR,
Benjamin Tissoirese6aac342011-05-19 14:18:13 +0200835 USB_DEVICE_ID_ACTIONSTAR_1011) },
836
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100837 /* Atmel panels */
838 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200839 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL,
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100840 USB_DEVICE_ID_ATMEL_MULTITOUCH) },
Benjamin Tissoires841cb152012-03-06 10:53:45 +0100841 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200842 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL,
Benjamin Tissoires841cb152012-03-06 10:53:45 +0100843 USB_DEVICE_ID_ATMEL_MXT_DIGITIZER) },
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100844
Jiri Kosina9ed32692012-04-20 12:15:44 +0200845 /* Baanto multitouch devices */
846 { .driver_data = MT_CLS_DEFAULT,
Jiri Kosina16b79bb2012-05-05 23:32:54 +0200847 MT_USB_DEVICE(USB_VENDOR_ID_BAANTO,
Jiri Kosina9ed32692012-04-20 12:15:44 +0200848 USB_DEVICE_ID_BAANTO_MT_190W2) },
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100849 /* Cando panels */
850 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200851 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100852 USB_DEVICE_ID_CANDO_MULTI_TOUCH) },
853 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200854 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100855 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) },
856 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200857 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100858 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) },
859 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200860 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100861 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },
862
Austin Zhang942fd422011-05-28 02:03:47 +0800863 /* Chunghwa Telecom touch panels */
864 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200865 MT_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT,
Austin Zhang942fd422011-05-28 02:03:47 +0800866 USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) },
867
Benjamin Tissoires79603dc2011-05-19 14:18:14 +0200868 /* CVTouch panels */
869 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200870 MT_USB_DEVICE(USB_VENDOR_ID_CVTOUCH,
Benjamin Tissoires79603dc2011-05-19 14:18:14 +0200871 USB_DEVICE_ID_CVTOUCH_SCREEN) },
872
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100873 /* Cypress panel */
874 { .driver_data = MT_CLS_CYPRESS,
875 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS,
876 USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
877
Benjamin Tissoires22408282011-05-20 15:59:34 +0200878 /* eGalax devices (resistive) */
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100879 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200880 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100881 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) },
882 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200883 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100884 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200885
886 /* eGalax devices (capacitive) */
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100887 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200888 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100889 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100890 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200891 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100892 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7207) },
893 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200894 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100895 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E) },
896 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200897 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100898 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224) },
Benjamin Tissoires2ce09df2012-03-06 17:57:02 +0100899 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200900 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoires2ce09df2012-03-06 17:57:02 +0100901 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_722A) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100902 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200903 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100904 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100905 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200906 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100907 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7262) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100908 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200909 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100910 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100911 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200912 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100913 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72AA) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100914 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200915 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoires66f06122011-11-23 10:54:33 +0100916 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA) },
917 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200918 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Marek Vasutbb9ff212011-11-23 10:54:32 +0100919 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) },
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100920 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200921 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100922 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349) },
923 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200924 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Thierry Redingae01c9e2012-08-09 08:34:48 +0200925 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_73F7) },
926 { .driver_data = MT_CLS_EGALAX_SERIAL,
927 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100928 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) },
Jiri Kosina3d771042012-08-15 10:01:01 +0200929 { .driver_data = MT_CLS_EGALAX,
930 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
931 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224) },
932 { .driver_data = MT_CLS_EGALAX,
933 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
934 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72D0) },
935 { .driver_data = MT_CLS_EGALAX,
936 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
937 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72C4) },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200938
Benjamin Tissoiresc04abee2011-05-19 11:37:29 +0200939 /* Elo TouchSystems IntelliTouch Plus panel */
940 { .driver_data = MT_CLS_DUAL_NSMU_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200941 MT_USB_DEVICE(USB_VENDOR_ID_ELO,
Benjamin Tissoiresc04abee2011-05-19 11:37:29 +0200942 USB_DEVICE_ID_ELO_TS2515) },
943
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100944 /* GeneralTouch panel */
Xianhan Yuf5ff4e12012-09-28 10:18:59 +0800945 { .driver_data = MT_CLS_GENERALTOUCH_TWOFINGERS,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200946 MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100947 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) },
Xianhan Yuf5ff4e12012-09-28 10:18:59 +0800948 { .driver_data = MT_CLS_GENERALTOUCH_PWT_TENFINGERS,
949 MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
950 USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PWT_TENFINGERS) },
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100951
Andreas Nielsen4d5df5d2012-03-19 15:41:03 +0100952 /* Gametel game controller */
953 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200954 MT_BT_DEVICE(USB_VENDOR_ID_FRUCTEL,
Andreas Nielsen4d5df5d2012-03-19 15:41:03 +0100955 USB_DEVICE_ID_GAMETEL_MT_MODE) },
956
Benjamin Tissoiresee0fbd12011-05-19 14:18:15 +0200957 /* GoodTouch panels */
958 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200959 MT_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH,
Benjamin Tissoiresee0fbd12011-05-19 14:18:15 +0200960 USB_DEVICE_ID_GOODTOUCH_000f) },
961
Benjamin Tissoires54580362011-11-29 13:13:12 +0100962 /* Hanvon panels */
963 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200964 MT_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT,
Benjamin Tissoires54580362011-11-29 13:13:12 +0100965 USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) },
966
Stephane Chattya062cc52011-09-17 22:27:30 +0200967 /* Ideacom panel */
968 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200969 MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
Stephane Chattya062cc52011-09-17 22:27:30 +0200970 USB_DEVICE_ID_IDEACOM_IDC6650) },
Benjamin Tissoires71078b02012-03-06 10:53:46 +0100971 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200972 MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
Benjamin Tissoires71078b02012-03-06 10:53:46 +0100973 USB_DEVICE_ID_IDEACOM_IDC6651) },
Stephane Chattya062cc52011-09-17 22:27:30 +0200974
Austin Zhang4e61f0d2011-05-09 23:54:14 +0800975 /* Ilitek dual touch panel */
976 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200977 MT_USB_DEVICE(USB_VENDOR_ID_ILITEK,
Austin Zhang4e61f0d2011-05-09 23:54:14 +0800978 USB_DEVICE_ID_ILITEK_MULTITOUCH) },
979
Benjamin Tissoires4dfcced2011-01-31 11:28:22 +0100980 /* IRTOUCH panels */
981 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200982 MT_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS,
Benjamin Tissoires4dfcced2011-01-31 11:28:22 +0100983 USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
984
Jeff Brownc50bb1a2011-08-15 21:12:09 -0700985 /* LG Display panels */
986 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200987 MT_USB_DEVICE(USB_VENDOR_ID_LG,
Jeff Brownc50bb1a2011-08-15 21:12:09 -0700988 USB_DEVICE_ID_LG_MULTITOUCH) },
989
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200990 /* Lumio panels */
991 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200992 MT_USB_DEVICE(USB_VENDOR_ID_LUMIO,
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200993 USB_DEVICE_ID_CRYSTALTOUCH) },
Benjamin Tissoiresc3ead6d2011-06-21 15:01:55 +0200994 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200995 MT_USB_DEVICE(USB_VENDOR_ID_LUMIO,
Benjamin Tissoiresc3ead6d2011-06-21 15:01:55 +0200996 USB_DEVICE_ID_CRYSTALTOUCH_DUAL) },
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200997
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200998 /* MosArt panels */
999 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001000 MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +02001001 USB_DEVICE_ID_ASUS_T91MT)},
1002 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001003 MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +02001004 USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) },
1005 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001006 MT_USB_DEVICE(USB_VENDOR_ID_TURBOX,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +02001007 USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) },
1008
Denis Kovalev2258e862012-02-14 00:50:33 -08001009 /* Panasonic panels */
1010 { .driver_data = MT_CLS_PANASONIC,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001011 MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
Denis Kovalev2258e862012-02-14 00:50:33 -08001012 USB_DEVICE_ID_PANABOARD_UBT780) },
1013 { .driver_data = MT_CLS_PANASONIC,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001014 MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
Denis Kovalev2258e862012-02-14 00:50:33 -08001015 USB_DEVICE_ID_PANABOARD_UBT880) },
1016
Austin Hendrix4db703e2012-06-04 15:27:51 -07001017 /* Novatek Panel */
1018 { .driver_data = MT_CLS_DEFAULT,
Jiri Kosina4380d812012-06-06 16:28:33 +02001019 MT_USB_DEVICE(USB_VENDOR_ID_NOVATEK,
Austin Hendrix4db703e2012-06-04 15:27:51 -07001020 USB_DEVICE_ID_NOVATEK_PCT) },
1021
John Sung6ab3a9a2011-04-21 16:21:52 +02001022 /* PenMount panels */
1023 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001024 MT_USB_DEVICE(USB_VENDOR_ID_PENMOUNT,
John Sung6ab3a9a2011-04-21 16:21:52 +02001025 USB_DEVICE_ID_PENMOUNT_PCI) },
1026
Aaron Tianb7ea95f2011-12-15 11:09:06 +08001027 /* PixArt optical touch screen */
1028 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001029 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +08001030 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN) },
1031 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001032 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +08001033 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1) },
1034 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001035 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +08001036 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2) },
1037
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001038 /* PixCir-based panels */
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +01001039 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001040 MT_USB_DEVICE(USB_VENDOR_ID_HANVON,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001041 USB_DEVICE_ID_HANVON_MULTITOUCH) },
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +01001042 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001043 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001044 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
1045
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +01001046 /* Quanta-based panels */
1047 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001048 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +01001049 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) },
1050 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001051 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +01001052 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001) },
1053 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001054 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +01001055 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008) },
1056
Benjamin Tissoires043b4032011-03-18 14:27:53 +01001057 /* Stantum panels */
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +02001058 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001059 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM,
Benjamin Tissoires043b4032011-03-18 14:27:53 +01001060 USB_DEVICE_ID_MTP)},
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +02001061 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001062 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM,
Benjamin Tissoires043b4032011-03-18 14:27:53 +01001063 USB_DEVICE_ID_MTP_STM)},
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +02001064 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001065 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX,
Benjamin Tissoires043b4032011-03-18 14:27:53 +01001066 USB_DEVICE_ID_MTP_SITRONIX)},
1067
Benjamin Tissoires847672c2012-02-04 17:08:50 +01001068 /* TopSeed panels */
1069 { .driver_data = MT_CLS_TOPSEED,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001070 MT_USB_DEVICE(USB_VENDOR_ID_TOPSEED2,
Benjamin Tissoires847672c2012-02-04 17:08:50 +01001071 USB_DEVICE_ID_TOPSEED2_PERIPAD_701) },
1072
Benjamin Tissoires5e74e562011-05-19 14:18:16 +02001073 /* Touch International panels */
1074 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001075 MT_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL,
Benjamin Tissoires5e74e562011-05-19 14:18:16 +02001076 USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) },
1077
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001078 /* Unitec panels */
1079 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001080 MT_USB_DEVICE(USB_VENDOR_ID_UNITEC,
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001081 USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) },
1082 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001083 MT_USB_DEVICE(USB_VENDOR_ID_UNITEC,
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001084 USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) },
ice chienbc8a2a92011-07-15 16:58:06 +08001085 /* XAT */
1086 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001087 MT_USB_DEVICE(USB_VENDOR_ID_XAT,
ice chienbc8a2a92011-07-15 16:58:06 +08001088 USB_DEVICE_ID_XAT_CSR) },
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001089
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001090 /* Xiroku */
1091 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001092 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001093 USB_DEVICE_ID_XIROKU_SPX) },
1094 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001095 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001096 USB_DEVICE_ID_XIROKU_MPX) },
1097 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001098 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001099 USB_DEVICE_ID_XIROKU_CSR) },
1100 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001101 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001102 USB_DEVICE_ID_XIROKU_SPX1) },
1103 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001104 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001105 USB_DEVICE_ID_XIROKU_MPX1) },
1106 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001107 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001108 USB_DEVICE_ID_XIROKU_CSR1) },
1109 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001110 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001111 USB_DEVICE_ID_XIROKU_SPX2) },
1112 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001113 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001114 USB_DEVICE_ID_XIROKU_MPX2) },
1115 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001116 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001117 USB_DEVICE_ID_XIROKU_CSR2) },
1118
Benjamin Tissoires82d06982012-06-19 14:39:54 +02001119 /* Zytronic panels */
1120 { .driver_data = MT_CLS_SERIAL,
1121 MT_USB_DEVICE(USB_VENDOR_ID_ZYTRONIC,
1122 USB_DEVICE_ID_ZYTRONIC_ZXY100) },
1123
Henrik Rydberg4fa3a582012-05-01 08:40:01 +02001124 /* Generic MT device */
1125 { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) },
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001126 { }
1127};
1128MODULE_DEVICE_TABLE(hid, mt_devices);
1129
1130static const struct hid_usage_id mt_grabbed_usages[] = {
1131 { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
1132 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
1133};
1134
1135static struct hid_driver mt_driver = {
1136 .name = "hid-multitouch",
1137 .id_table = mt_devices,
1138 .probe = mt_probe,
1139 .remove = mt_remove,
1140 .input_mapping = mt_input_mapping,
1141 .input_mapped = mt_input_mapped,
1142 .feature_mapping = mt_feature_mapping,
1143 .usage_table = mt_grabbed_usages,
1144 .event = mt_event,
1145#ifdef CONFIG_PM
1146 .reset_resume = mt_reset_resume,
Scott Liudfeefd12012-08-15 17:21:55 +08001147 .resume = mt_resume,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001148#endif
1149};
1150
1151static int __init mt_init(void)
1152{
1153 return hid_register_driver(&mt_driver);
1154}
1155
1156static void __exit mt_exit(void)
1157{
1158 hid_unregister_driver(&mt_driver);
1159}
1160
1161module_init(mt_init);
1162module_exit(mt_exit);