blob: 7867d69f0efe1cd734c57e7e4627eb9aaf7a367e [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)
Henrik Rydberg77723e32012-09-07 19:37:40 +020054#define MT_QUIRK_NO_AREA (1 << 9)
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010055
56struct mt_slot {
57 __s32 x, y, p, w, h;
58 __s32 contactid; /* the device ContactID assigned to this slot */
59 bool touch_state; /* is the touch valid? */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010060};
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 */
Henrik Rydberg76f59022012-09-01 20:11:34 +020095 bool serial_maybe; /* need to check for serial protocol */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010096 bool curvalid; /* is the current contact valid? */
Henrik Rydberg76f59022012-09-01 20:11:34 +020097 unsigned mt_flags; /* flags to pass to input-mt */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010098};
99
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100100/* classes of device behavior */
Benjamin Tissoires22408282011-05-20 15:59:34 +0200101#define MT_CLS_DEFAULT 0x0001
102
Stephane Chattya062cc52011-09-17 22:27:30 +0200103#define MT_CLS_SERIAL 0x0002
104#define MT_CLS_CONFIDENCE 0x0003
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100105#define MT_CLS_CONFIDENCE_CONTACT_ID 0x0004
106#define MT_CLS_CONFIDENCE_MINUS_ONE 0x0005
107#define MT_CLS_DUAL_INRANGE_CONTACTID 0x0006
108#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0007
109#define MT_CLS_DUAL_NSMU_CONTACTID 0x0008
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800110#define MT_CLS_INRANGE_CONTACTNUMBER 0x0009
Benjamin Tissoires22408282011-05-20 15:59:34 +0200111
112/* vendor specific classes */
113#define MT_CLS_3M 0x0101
114#define MT_CLS_CYPRESS 0x0102
115#define MT_CLS_EGALAX 0x0103
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100116#define MT_CLS_EGALAX_SERIAL 0x0104
Benjamin Tissoires847672c2012-02-04 17:08:50 +0100117#define MT_CLS_TOPSEED 0x0105
Denis Kovalev2258e862012-02-14 00:50:33 -0800118#define MT_CLS_PANASONIC 0x0106
Henrik Rydberg77723e32012-09-07 19:37:40 +0200119#define MT_CLS_FLATFROG 0x0107
Jiri Kosinacdcd3ac2012-10-01 14:38:54 +0200120#define MT_CLS_GENERALTOUCH_TWOFINGERS 0x0108
121#define MT_CLS_GENERALTOUCH_PWT_TENFINGERS 0x0109
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100122
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100123#define MT_DEFAULT_MAXCONTACT 10
124
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200125#define MT_USB_DEVICE(v, p) HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH, v, p)
126#define MT_BT_DEVICE(v, p) HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_MULTITOUCH, v, p)
127
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100128/*
129 * these device-dependent functions determine what slot corresponds
130 * to a valid contact that was just read.
131 */
132
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100133static int cypress_compute_slot(struct mt_device *td)
134{
135 if (td->curdata.contactid != 0 || td->num_received == 0)
136 return td->curdata.contactid;
137 else
138 return -1;
139}
140
Jiri Kosinab3c21d22011-11-22 23:23:37 +0100141static struct mt_class mt_classes[] = {
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100142 { .name = MT_CLS_DEFAULT,
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100143 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP },
Stephane Chattya062cc52011-09-17 22:27:30 +0200144 { .name = MT_CLS_SERIAL,
145 .quirks = MT_QUIRK_ALWAYS_VALID},
Benjamin Tissoires22408282011-05-20 15:59:34 +0200146 { .name = MT_CLS_CONFIDENCE,
147 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE },
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100148 { .name = MT_CLS_CONFIDENCE_CONTACT_ID,
149 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
150 MT_QUIRK_SLOT_IS_CONTACTID },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200151 { .name = MT_CLS_CONFIDENCE_MINUS_ONE,
152 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
153 MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE },
Benjamin Tissoires1e9cf35b2011-01-31 11:28:20 +0100154 { .name = MT_CLS_DUAL_INRANGE_CONTACTID,
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100155 .quirks = MT_QUIRK_VALID_IS_INRANGE |
156 MT_QUIRK_SLOT_IS_CONTACTID,
157 .maxcontacts = 2 },
Benjamin Tissoires1e9cf35b2011-01-31 11:28:20 +0100158 { .name = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100159 .quirks = MT_QUIRK_VALID_IS_INRANGE |
160 MT_QUIRK_SLOT_IS_CONTACTNUMBER,
161 .maxcontacts = 2 },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200162 { .name = MT_CLS_DUAL_NSMU_CONTACTID,
163 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
164 MT_QUIRK_SLOT_IS_CONTACTID,
165 .maxcontacts = 2 },
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800166 { .name = MT_CLS_INRANGE_CONTACTNUMBER,
167 .quirks = MT_QUIRK_VALID_IS_INRANGE |
168 MT_QUIRK_SLOT_IS_CONTACTNUMBER },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200169
170 /*
171 * vendor specific classes
172 */
173 { .name = MT_CLS_3M,
174 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
175 MT_QUIRK_SLOT_IS_CONTACTID,
176 .sn_move = 2048,
177 .sn_width = 128,
Henrik Rydbergc5d40be2012-09-05 16:58:12 +0200178 .sn_height = 128,
179 .maxcontacts = 60,
180 },
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100181 { .name = MT_CLS_CYPRESS,
182 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
183 MT_QUIRK_CYPRESS,
184 .maxcontacts = 10 },
Richard Nauber4875ac12011-03-09 06:20:57 +0100185 { .name = MT_CLS_EGALAX,
186 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
Benjamin Tissoires2261bb92011-11-23 10:54:29 +0100187 MT_QUIRK_VALID_IS_INRANGE,
Richard Nauber4875ac12011-03-09 06:20:57 +0100188 .sn_move = 4096,
189 .sn_pressure = 32,
190 },
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100191 { .name = MT_CLS_EGALAX_SERIAL,
192 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
193 MT_QUIRK_ALWAYS_VALID,
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100194 .sn_move = 4096,
195 .sn_pressure = 32,
196 },
Benjamin Tissoires847672c2012-02-04 17:08:50 +0100197 { .name = MT_CLS_TOPSEED,
198 .quirks = MT_QUIRK_ALWAYS_VALID,
199 .is_indirect = true,
200 .maxcontacts = 2,
201 },
Denis Kovalev2258e862012-02-14 00:50:33 -0800202 { .name = MT_CLS_PANASONIC,
203 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP,
204 .maxcontacts = 4 },
Xianhan Yuf5ff4e12012-09-28 10:18:59 +0800205 { .name = MT_CLS_GENERALTOUCH_TWOFINGERS,
206 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
207 MT_QUIRK_VALID_IS_INRANGE |
208 MT_QUIRK_SLOT_IS_CONTACTNUMBER,
209 .maxcontacts = 2
210 },
211 { .name = MT_CLS_GENERALTOUCH_PWT_TENFINGERS,
212 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
Xianhan Yu58ad34b2012-10-29 23:04:37 +0800213 MT_QUIRK_SLOT_IS_CONTACTNUMBER
Xianhan Yuf5ff4e12012-09-28 10:18:59 +0800214 },
Benjamin Tissoires043b4032011-03-18 14:27:53 +0100215
Henrik Rydberg77723e32012-09-07 19:37:40 +0200216 { .name = MT_CLS_FLATFROG,
217 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
218 MT_QUIRK_NO_AREA,
219 .sn_move = 2048,
220 .maxcontacts = 40,
221 },
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100222 { }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100223};
224
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100225static ssize_t mt_show_quirks(struct device *dev,
226 struct device_attribute *attr,
227 char *buf)
228{
229 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
230 struct mt_device *td = hid_get_drvdata(hdev);
231
232 return sprintf(buf, "%u\n", td->mtclass.quirks);
233}
234
235static ssize_t mt_set_quirks(struct device *dev,
236 struct device_attribute *attr,
237 const char *buf, size_t count)
238{
239 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
240 struct mt_device *td = hid_get_drvdata(hdev);
241
242 unsigned long val;
243
244 if (kstrtoul(buf, 0, &val))
245 return -EINVAL;
246
247 td->mtclass.quirks = val;
248
249 return count;
250}
251
252static DEVICE_ATTR(quirks, S_IWUSR | S_IRUGO, mt_show_quirks, mt_set_quirks);
253
254static struct attribute *sysfs_attrs[] = {
255 &dev_attr_quirks.attr,
256 NULL
257};
258
259static struct attribute_group mt_attribute_group = {
260 .attrs = sysfs_attrs
261};
262
Henrik Rydbergf635bd12011-02-24 19:30:59 +0100263static void mt_feature_mapping(struct hid_device *hdev,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100264 struct hid_field *field, struct hid_usage *usage)
265{
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100266 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoires4aceed32012-06-19 14:39:52 +0200267 int i;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100268
269 switch (usage->hid) {
270 case HID_DG_INPUTMODE:
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100271 td->inputmode = field->report->id;
Benjamin Tissoires4aceed32012-06-19 14:39:52 +0200272 td->inputmode_index = 0; /* has to be updated below */
273
274 for (i=0; i < field->maxusage; i++) {
275 if (field->usage[i].hid == usage->hid) {
276 td->inputmode_index = i;
277 break;
278 }
279 }
280
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100281 break;
282 case HID_DG_CONTACTMAX:
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100283 td->maxcontact_report_id = field->report->id;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100284 td->maxcontacts = field->value[0];
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100285 if (td->mtclass.maxcontacts)
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100286 /* check if the maxcontacts is given by the class */
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100287 td->maxcontacts = td->mtclass.maxcontacts;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100288
289 break;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100290 }
291}
292
293static void set_abs(struct input_dev *input, unsigned int code,
294 struct hid_field *field, int snratio)
295{
296 int fmin = field->logical_minimum;
297 int fmax = field->logical_maximum;
298 int fuzz = snratio ? (fmax - fmin) / snratio : 0;
299 input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
300}
301
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200302static void mt_store_field(struct hid_usage *usage, struct mt_device *td,
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100303 struct hid_input *hi)
304{
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200305 struct mt_fields *f = td->fields;
306
307 if (f->length >= HID_MAX_FIELDS)
308 return;
309
310 f->usages[f->length++] = usage->hid;
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100311}
312
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100313static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
314 struct hid_field *field, struct hid_usage *usage,
315 unsigned long **bit, int *max)
316{
317 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100318 struct mt_class *cls = &td->mtclass;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100319 int code;
Richard Nauber4875ac12011-03-09 06:20:57 +0100320
Jeff Brown658d4aed592011-08-15 16:44:28 -0700321 /* Only map fields from TouchScreen or TouchPad collections.
Denis Kovalev2258e862012-02-14 00:50:33 -0800322 * We need to ignore fields that belong to other collections
323 * such as Mouse that might have the same GenericDesktop usages. */
Jeff Brown658d4aed592011-08-15 16:44:28 -0700324 if (field->application == HID_DG_TOUCHSCREEN)
Henrik Rydberg76f59022012-09-01 20:11:34 +0200325 td->mt_flags |= INPUT_MT_DIRECT;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100326 else if (field->application != HID_DG_TOUCHPAD)
Jeff Brown658d4aed592011-08-15 16:44:28 -0700327 return 0;
328
Henrik Rydberg76f59022012-09-01 20:11:34 +0200329 /*
330 * Model touchscreens providing buttons as touchpads.
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100331 */
332 if (field->application == HID_DG_TOUCHPAD ||
Henrik Rydberg76f59022012-09-01 20:11:34 +0200333 (usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON)
334 td->mt_flags |= INPUT_MT_POINTER;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100335
Benjamin Tissoires2261bb92011-11-23 10:54:29 +0100336 /* eGalax devices provide a Digitizer.Stylus input which overrides
337 * the correct Digitizers.Finger X/Y ranges.
338 * Let's just ignore this input. */
339 if (field->physical == HID_DG_STYLUS)
340 return -1;
341
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100342 switch (usage->hid & HID_USAGE_PAGE) {
343
344 case HID_UP_GENDESK:
345 switch (usage->hid) {
346 case HID_GD_X:
347 hid_map_usage(hi, usage, bit, max,
348 EV_ABS, ABS_MT_POSITION_X);
349 set_abs(hi->input, ABS_MT_POSITION_X, field,
350 cls->sn_move);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200351 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100352 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100353 return 1;
354 case HID_GD_Y:
355 hid_map_usage(hi, usage, bit, max,
356 EV_ABS, ABS_MT_POSITION_Y);
357 set_abs(hi->input, ABS_MT_POSITION_Y, field,
358 cls->sn_move);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200359 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100360 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100361 return 1;
362 }
363 return 0;
364
365 case HID_UP_DIGITIZER:
366 switch (usage->hid) {
367 case HID_DG_INRANGE:
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200368 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100369 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100370 return 1;
371 case HID_DG_CONFIDENCE:
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200372 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100373 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100374 return 1;
375 case HID_DG_TIPSWITCH:
376 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
377 input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200378 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100379 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100380 return 1;
381 case HID_DG_CONTACTID:
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200382 mt_store_field(usage, td, hi);
Benjamin Tissoires2955cae2011-04-21 14:15:59 +0200383 td->last_field_index = field->index;
Benjamin Tissoires9e87f222012-03-06 17:57:06 +0100384 td->touches_by_report++;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100385 return 1;
386 case HID_DG_WIDTH:
387 hid_map_usage(hi, usage, bit, max,
388 EV_ABS, ABS_MT_TOUCH_MAJOR);
Henrik Rydberg77723e32012-09-07 19:37:40 +0200389 if (!(cls->quirks & MT_QUIRK_NO_AREA))
390 set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
391 cls->sn_width);
Benjamin Tissoires3ac36d12012-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);
Henrik Rydberg77723e32012-09-07 19:37:40 +0200398 if (!(cls->quirks & MT_QUIRK_NO_AREA)) {
399 set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
400 cls->sn_height);
401 input_set_abs_params(hi->input,
Benjamin Tissoires1e648a12011-03-18 14:27:55 +0100402 ABS_MT_ORIENTATION, 0, 1, 0, 0);
Henrik Rydberg77723e32012-09-07 19:37:40 +0200403 }
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200404 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100405 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100406 return 1;
407 case HID_DG_TIPPRESSURE:
408 hid_map_usage(hi, usage, bit, max,
409 EV_ABS, ABS_MT_PRESSURE);
410 set_abs(hi->input, ABS_MT_PRESSURE, field,
411 cls->sn_pressure);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200412 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100413 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100414 return 1;
415 case HID_DG_CONTACTCOUNT:
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100416 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100417 return 1;
418 case HID_DG_CONTACTMAX:
419 /* we don't set td->last_slot_field as contactcount and
420 * contact max are global to the report */
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100421 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100422 return -1;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100423 case HID_DG_TOUCH:
424 /* Legacy devices use TIPSWITCH and not TOUCH.
425 * Let's just ignore this field. */
426 return -1;
Alan Cox65b258e2012-10-25 15:35:25 +0100427 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100428 /* let hid-input decide for the others */
429 return 0;
430
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100431 case HID_UP_BUTTON:
432 code = BTN_MOUSE + ((usage->hid - 1) & HID_USAGE);
433 hid_map_usage(hi, usage, bit, max, EV_KEY, code);
434 input_set_capability(hi->input, EV_KEY, code);
435 return 1;
436
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100437 case 0xff000000:
438 /* we do not want to map these: no input-oriented meaning */
439 return -1;
440 }
441
442 return 0;
443}
444
445static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
446 struct hid_field *field, struct hid_usage *usage,
447 unsigned long **bit, int *max)
448{
449 if (usage->type == EV_KEY || usage->type == EV_ABS)
450 set_bit(usage->type, hi->input->evbit);
451
452 return -1;
453}
454
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200455static int mt_compute_slot(struct mt_device *td, struct input_dev *input)
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100456{
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100457 __s32 quirks = td->mtclass.quirks;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100458
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100459 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID)
460 return td->curdata.contactid;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100461
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100462 if (quirks & MT_QUIRK_CYPRESS)
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100463 return cypress_compute_slot(td);
464
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100465 if (quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER)
466 return td->num_received;
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100467
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200468 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE)
469 return td->curdata.contactid - 1;
470
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200471 return input_mt_get_slot_by_key(input, td->curdata.contactid);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100472}
473
474/*
475 * this function is called when a whole contact has been processed,
476 * so that it can assign it to a slot and store the data there
477 */
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200478static void mt_complete_slot(struct mt_device *td, struct input_dev *input)
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100479{
480 if (td->curvalid) {
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200481 int slotnum = mt_compute_slot(td, input);
482 struct mt_slot *s = &td->curdata;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100483
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200484 if (slotnum < 0 || slotnum >= td->maxcontacts)
485 return;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100486
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200487 input_mt_slot(input, slotnum);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100488 input_mt_report_slot_state(input, MT_TOOL_FINGER,
489 s->touch_state);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100490 if (s->touch_state) {
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100491 /* this finger is on the screen */
492 int wide = (s->w > s->h);
493 /* divided by two to match visual scale of touch */
494 int major = max(s->w, s->h) >> 1;
495 int minor = min(s->w, s->h) >> 1;
496
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100497 input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
498 input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100499 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100500 input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100501 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
502 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100503 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100504 }
505
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200506 td->num_received++;
507}
508
509/*
510 * this function is called when a whole packet has been received and processed,
511 * so that it can decide what to send to the input layer.
512 */
513static void mt_sync_frame(struct mt_device *td, struct input_dev *input)
514{
Henrik Rydberg76f59022012-09-01 20:11:34 +0200515 input_mt_sync_frame(input);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100516 input_sync(input);
517 td->num_received = 0;
518}
519
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100520static int mt_event(struct hid_device *hid, struct hid_field *field,
521 struct hid_usage *usage, __s32 value)
522{
523 struct mt_device *td = hid_get_drvdata(hid);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100524 __s32 quirks = td->mtclass.quirks;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100525
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200526 if (hid->claimed & HID_CLAIMED_INPUT) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100527 switch (usage->hid) {
528 case HID_DG_INRANGE:
Stephane Chattya062cc52011-09-17 22:27:30 +0200529 if (quirks & MT_QUIRK_ALWAYS_VALID)
530 td->curvalid = true;
531 else if (quirks & MT_QUIRK_VALID_IS_INRANGE)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100532 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100533 break;
534 case HID_DG_TIPSWITCH:
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100535 if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
536 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100537 td->curdata.touch_state = value;
538 break;
539 case HID_DG_CONFIDENCE:
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100540 if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE)
541 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100542 break;
543 case HID_DG_CONTACTID:
544 td->curdata.contactid = value;
545 break;
546 case HID_DG_TIPPRESSURE:
547 td->curdata.p = value;
548 break;
549 case HID_GD_X:
550 td->curdata.x = value;
551 break;
552 case HID_GD_Y:
553 td->curdata.y = value;
554 break;
555 case HID_DG_WIDTH:
556 td->curdata.w = value;
557 break;
558 case HID_DG_HEIGHT:
559 td->curdata.h = value;
560 break;
561 case HID_DG_CONTACTCOUNT:
562 /*
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100563 * Includes multi-packet support where subsequent
564 * packets are sent with zero contactcount.
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100565 */
566 if (value)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100567 td->num_expected = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100568 break;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100569 case HID_DG_TOUCH:
570 /* do nothing */
571 break;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100572
573 default:
574 /* fallback to the generic hidinput handling */
575 return 0;
576 }
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100577
Denis Kovalev2258e862012-02-14 00:50:33 -0800578 if (usage->hid == td->last_slot_field)
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200579 mt_complete_slot(td, field->hidinput->input);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100580
581 if (field->index == td->last_field_index
582 && td->num_received >= td->num_expected)
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200583 mt_sync_frame(td, field->hidinput->input);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100584
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100585 }
586
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100587 /* we have handled the hidinput part, now remains hiddev */
588 if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
589 hid->hiddev_hid_event(hid, field, usage, value);
590
591 return 1;
592}
593
594static void mt_set_input_mode(struct hid_device *hdev)
595{
596 struct mt_device *td = hid_get_drvdata(hdev);
597 struct hid_report *r;
598 struct hid_report_enum *re;
599
600 if (td->inputmode < 0)
601 return;
602
603 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
604 r = re->report_id_hash[td->inputmode];
605 if (r) {
Benjamin Tissoires4aceed32012-06-19 14:39:52 +0200606 r->field[0]->value[td->inputmode_index] = 0x02;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100607 usbhid_submit_report(hdev, r, USB_DIR_OUT);
608 }
609}
610
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100611static void mt_set_maxcontacts(struct hid_device *hdev)
612{
613 struct mt_device *td = hid_get_drvdata(hdev);
614 struct hid_report *r;
615 struct hid_report_enum *re;
616 int fieldmax, max;
617
618 if (td->maxcontact_report_id < 0)
619 return;
620
621 if (!td->mtclass.maxcontacts)
622 return;
623
624 re = &hdev->report_enum[HID_FEATURE_REPORT];
625 r = re->report_id_hash[td->maxcontact_report_id];
626 if (r) {
627 max = td->mtclass.maxcontacts;
628 fieldmax = r->field[0]->logical_maximum;
629 max = min(fieldmax, max);
630 if (r->field[0]->value[0] != max) {
631 r->field[0]->value[0] = max;
632 usbhid_submit_report(hdev, r, USB_DIR_OUT);
633 }
634 }
635}
636
Henrik Rydberg4fa3a582012-05-01 08:40:01 +0200637static void mt_post_parse_default_settings(struct mt_device *td)
638{
639 __s32 quirks = td->mtclass.quirks;
640
641 /* unknown serial device needs special quirks */
642 if (td->touches_by_report == 1) {
643 quirks |= MT_QUIRK_ALWAYS_VALID;
644 quirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP;
645 quirks &= ~MT_QUIRK_VALID_IS_INRANGE;
646 quirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE;
647 }
648
649 td->mtclass.quirks = quirks;
650}
651
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200652static void mt_post_parse(struct mt_device *td)
653{
654 struct mt_fields *f = td->fields;
655
656 if (td->touches_by_report > 0) {
657 int field_count_per_touch = f->length / td->touches_by_report;
658 td->last_slot_field = f->usages[field_count_per_touch - 1];
659 }
660}
661
Henrik Rydberg76f59022012-09-01 20:11:34 +0200662static void mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
663
664{
665 struct mt_device *td = hid_get_drvdata(hdev);
666 struct mt_class *cls = &td->mtclass;
667 struct input_dev *input = hi->input;
668
669 /* Only initialize slots for MT input devices */
670 if (!test_bit(ABS_MT_POSITION_X, input->absbit))
671 return;
672
673 if (!td->maxcontacts)
674 td->maxcontacts = MT_DEFAULT_MAXCONTACT;
675
676 mt_post_parse(td);
677 if (td->serial_maybe)
678 mt_post_parse_default_settings(td);
679
680 if (cls->is_indirect)
681 td->mt_flags |= INPUT_MT_POINTER;
682
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200683 if (cls->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
684 td->mt_flags |= INPUT_MT_DROP_UNUSED;
685
Henrik Rydberg76f59022012-09-01 20:11:34 +0200686 input_mt_init_slots(input, td->maxcontacts, td->mt_flags);
687
688 td->mt_flags = 0;
689}
690
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100691static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
692{
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100693 int ret, i;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100694 struct mt_device *td;
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100695 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
696
Henrik Rydberg94b5485c2012-08-08 21:45:50 +0200697 for (i = 0; mt_classes[i].name ; i++) {
698 if (id->driver_data == mt_classes[i].name) {
699 mtclass = &(mt_classes[i]);
700 break;
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100701 }
702 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100703
Henrik Rydbergd682bd72011-11-01 15:26:31 +0100704 /* This allows the driver to correctly support devices
705 * that emit events over several HID messages.
706 */
707 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100708
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100709 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100710 if (!td) {
711 dev_err(&hdev->dev, "cannot allocate multitouch data\n");
712 return -ENOMEM;
713 }
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100714 td->mtclass = *mtclass;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100715 td->inputmode = -1;
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100716 td->maxcontact_report_id = -1;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100717 hid_set_drvdata(hdev, td);
718
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200719 td->fields = kzalloc(sizeof(struct mt_fields), GFP_KERNEL);
720 if (!td->fields) {
721 dev_err(&hdev->dev, "cannot allocate multitouch fields data\n");
722 ret = -ENOMEM;
723 goto fail;
724 }
725
Henrik Rydberg76f59022012-09-01 20:11:34 +0200726 if (id->vendor == HID_ANY_ID && id->product == HID_ANY_ID)
727 td->serial_maybe = true;
728
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100729 ret = hid_parse(hdev);
730 if (ret != 0)
731 goto fail;
732
733 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100734 if (ret)
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100735 goto fail;
736
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100737 ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group);
738
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100739 mt_set_maxcontacts(hdev);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100740 mt_set_input_mode(hdev);
741
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200742 kfree(td->fields);
743 td->fields = NULL;
744
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100745 return 0;
746
747fail:
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200748 kfree(td->fields);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100749 kfree(td);
750 return ret;
751}
752
753#ifdef CONFIG_PM
754static int mt_reset_resume(struct hid_device *hdev)
755{
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100756 mt_set_maxcontacts(hdev);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100757 mt_set_input_mode(hdev);
758 return 0;
759}
Scott Liudfeefd12012-08-15 17:21:55 +0800760
761static int mt_resume(struct hid_device *hdev)
762{
763 struct usb_interface *intf;
764 struct usb_host_interface *interface;
765 struct usb_device *dev;
766
767 if (hdev->bus != BUS_USB)
768 return 0;
769
770 intf = to_usb_interface(hdev->dev.parent);
771 interface = intf->cur_altsetting;
772 dev = hid_to_usb_dev(hdev);
773
774 /* Some Elan legacy devices require SET_IDLE to be set on resume.
775 * It should be safe to send it to other devices too.
776 * Tested on 3M, Stantum, Cypress, Zytronic, eGalax, and Elan panels. */
777
778 usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
779 HID_REQ_SET_IDLE,
780 USB_TYPE_CLASS | USB_RECIP_INTERFACE,
781 0, interface->desc.bInterfaceNumber,
782 NULL, 0, USB_CTRL_SET_TIMEOUT);
783
784 return 0;
785}
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100786#endif
787
788static void mt_remove(struct hid_device *hdev)
789{
790 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100791 sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100792 hid_hw_stop(hdev);
793 kfree(td);
794 hid_set_drvdata(hdev, NULL);
795}
796
797static const struct hid_device_id mt_devices[] = {
798
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100799 /* 3M panels */
800 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200801 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100802 USB_DEVICE_ID_3M1968) },
803 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200804 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100805 USB_DEVICE_ID_3M2256) },
Benjamin Tissoiresc4fad872011-12-23 15:41:00 +0100806 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200807 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresc4fad872011-12-23 15:41:00 +0100808 USB_DEVICE_ID_3M3266) },
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100809
Benjamin Tissoirese6aac342011-05-19 14:18:13 +0200810 /* ActionStar panels */
811 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200812 MT_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR,
Benjamin Tissoirese6aac342011-05-19 14:18:13 +0200813 USB_DEVICE_ID_ACTIONSTAR_1011) },
814
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100815 /* Atmel panels */
816 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200817 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL,
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100818 USB_DEVICE_ID_ATMEL_MULTITOUCH) },
Benjamin Tissoires841cb152012-03-06 10:53:45 +0100819 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200820 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL,
Benjamin Tissoires841cb152012-03-06 10:53:45 +0100821 USB_DEVICE_ID_ATMEL_MXT_DIGITIZER) },
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100822
Jiri Kosina9ed32692012-04-20 12:15:44 +0200823 /* Baanto multitouch devices */
824 { .driver_data = MT_CLS_DEFAULT,
Jiri Kosina16b79bb2012-05-05 23:32:54 +0200825 MT_USB_DEVICE(USB_VENDOR_ID_BAANTO,
Jiri Kosina9ed32692012-04-20 12:15:44 +0200826 USB_DEVICE_ID_BAANTO_MT_190W2) },
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100827 /* Cando panels */
828 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200829 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100830 USB_DEVICE_ID_CANDO_MULTI_TOUCH) },
831 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200832 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100833 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) },
834 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200835 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100836 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) },
837 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200838 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100839 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },
840
Austin Zhang942fd422011-05-28 02:03:47 +0800841 /* Chunghwa Telecom touch panels */
842 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200843 MT_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT,
Austin Zhang942fd422011-05-28 02:03:47 +0800844 USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) },
845
Benjamin Tissoires79603dc2011-05-19 14:18:14 +0200846 /* CVTouch panels */
847 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200848 MT_USB_DEVICE(USB_VENDOR_ID_CVTOUCH,
Benjamin Tissoires79603dc2011-05-19 14:18:14 +0200849 USB_DEVICE_ID_CVTOUCH_SCREEN) },
850
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100851 /* Cypress panel */
852 { .driver_data = MT_CLS_CYPRESS,
853 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS,
854 USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
855
Benjamin Tissoires22408282011-05-20 15:59:34 +0200856 /* eGalax devices (resistive) */
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100857 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200858 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100859 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) },
860 { .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_480E) },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200863
864 /* eGalax devices (capacitive) */
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100865 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200866 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100867 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100868 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200869 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100870 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7207) },
871 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200872 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100873 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E) },
874 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200875 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100876 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224) },
Benjamin Tissoires2ce09df2012-03-06 17:57:02 +0100877 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200878 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoires2ce09df2012-03-06 17:57:02 +0100879 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_722A) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100880 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200881 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100882 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100883 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200884 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100885 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7262) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100886 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200887 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100888 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100889 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200890 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100891 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72AA) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100892 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200893 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoires66f06122011-11-23 10:54:33 +0100894 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA) },
895 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200896 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Marek Vasutbb9ff212011-11-23 10:54:32 +0100897 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) },
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100898 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200899 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100900 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349) },
901 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200902 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Thierry Redingae01c9e2012-08-09 08:34:48 +0200903 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_73F7) },
904 { .driver_data = MT_CLS_EGALAX_SERIAL,
905 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100906 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) },
Jiri Kosina3d771042012-08-15 10:01:01 +0200907 { .driver_data = MT_CLS_EGALAX,
908 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
909 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224) },
910 { .driver_data = MT_CLS_EGALAX,
911 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
912 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72D0) },
913 { .driver_data = MT_CLS_EGALAX,
914 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
915 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72C4) },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200916
Benjamin Tissoiresc04abee2011-05-19 11:37:29 +0200917 /* Elo TouchSystems IntelliTouch Plus panel */
918 { .driver_data = MT_CLS_DUAL_NSMU_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200919 MT_USB_DEVICE(USB_VENDOR_ID_ELO,
Benjamin Tissoiresc04abee2011-05-19 11:37:29 +0200920 USB_DEVICE_ID_ELO_TS2515) },
921
Henrik Rydberg77723e32012-09-07 19:37:40 +0200922 /* Flatfrog Panels */
923 { .driver_data = MT_CLS_FLATFROG,
924 MT_USB_DEVICE(USB_VENDOR_ID_FLATFROG,
925 USB_DEVICE_ID_MULTITOUCH_3200) },
926
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100927 /* GeneralTouch panel */
Xianhan Yuf5ff4e12012-09-28 10:18:59 +0800928 { .driver_data = MT_CLS_GENERALTOUCH_TWOFINGERS,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200929 MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100930 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) },
Xianhan Yuf5ff4e12012-09-28 10:18:59 +0800931 { .driver_data = MT_CLS_GENERALTOUCH_PWT_TENFINGERS,
932 MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
933 USB_DEVICE_ID_GENERAL_TOUCH_WIN8_PWT_TENFINGERS) },
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100934
Andreas Nielsen4d5df5d2012-03-19 15:41:03 +0100935 /* Gametel game controller */
936 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200937 MT_BT_DEVICE(USB_VENDOR_ID_FRUCTEL,
Andreas Nielsen4d5df5d2012-03-19 15:41:03 +0100938 USB_DEVICE_ID_GAMETEL_MT_MODE) },
939
Benjamin Tissoiresee0fbd12011-05-19 14:18:15 +0200940 /* GoodTouch panels */
941 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200942 MT_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH,
Benjamin Tissoiresee0fbd12011-05-19 14:18:15 +0200943 USB_DEVICE_ID_GOODTOUCH_000f) },
944
Benjamin Tissoires54580362011-11-29 13:13:12 +0100945 /* Hanvon panels */
946 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200947 MT_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT,
Benjamin Tissoires54580362011-11-29 13:13:12 +0100948 USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) },
949
Stephane Chattya062cc52011-09-17 22:27:30 +0200950 /* Ideacom panel */
951 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200952 MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
Stephane Chattya062cc52011-09-17 22:27:30 +0200953 USB_DEVICE_ID_IDEACOM_IDC6650) },
Benjamin Tissoires71078b02012-03-06 10:53:46 +0100954 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200955 MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
Benjamin Tissoires71078b02012-03-06 10:53:46 +0100956 USB_DEVICE_ID_IDEACOM_IDC6651) },
Stephane Chattya062cc52011-09-17 22:27:30 +0200957
Austin Zhang4e61f0d2011-05-09 23:54:14 +0800958 /* Ilitek dual touch panel */
959 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200960 MT_USB_DEVICE(USB_VENDOR_ID_ILITEK,
Austin Zhang4e61f0d2011-05-09 23:54:14 +0800961 USB_DEVICE_ID_ILITEK_MULTITOUCH) },
962
Benjamin Tissoires4dfcced2011-01-31 11:28:22 +0100963 /* IRTOUCH panels */
964 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200965 MT_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS,
Benjamin Tissoires4dfcced2011-01-31 11:28:22 +0100966 USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
967
Jeff Brownc50bb1a2011-08-15 21:12:09 -0700968 /* LG Display panels */
969 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200970 MT_USB_DEVICE(USB_VENDOR_ID_LG,
Jeff Brownc50bb1a2011-08-15 21:12:09 -0700971 USB_DEVICE_ID_LG_MULTITOUCH) },
972
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200973 /* Lumio panels */
974 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200975 MT_USB_DEVICE(USB_VENDOR_ID_LUMIO,
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200976 USB_DEVICE_ID_CRYSTALTOUCH) },
Benjamin Tissoiresc3ead6d2011-06-21 15:01:55 +0200977 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200978 MT_USB_DEVICE(USB_VENDOR_ID_LUMIO,
Benjamin Tissoiresc3ead6d2011-06-21 15:01:55 +0200979 USB_DEVICE_ID_CRYSTALTOUCH_DUAL) },
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200980
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200981 /* MosArt panels */
982 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200983 MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200984 USB_DEVICE_ID_ASUS_T91MT)},
985 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200986 MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200987 USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) },
988 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200989 MT_USB_DEVICE(USB_VENDOR_ID_TURBOX,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200990 USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) },
991
Denis Kovalev2258e862012-02-14 00:50:33 -0800992 /* Panasonic panels */
993 { .driver_data = MT_CLS_PANASONIC,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200994 MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
Denis Kovalev2258e862012-02-14 00:50:33 -0800995 USB_DEVICE_ID_PANABOARD_UBT780) },
996 { .driver_data = MT_CLS_PANASONIC,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200997 MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
Denis Kovalev2258e862012-02-14 00:50:33 -0800998 USB_DEVICE_ID_PANABOARD_UBT880) },
999
Austin Hendrix4db703e2012-06-04 15:27:51 -07001000 /* Novatek Panel */
1001 { .driver_data = MT_CLS_DEFAULT,
Jiri Kosina4380d812012-06-06 16:28:33 +02001002 MT_USB_DEVICE(USB_VENDOR_ID_NOVATEK,
Austin Hendrix4db703e2012-06-04 15:27:51 -07001003 USB_DEVICE_ID_NOVATEK_PCT) },
1004
John Sung6ab3a9a2011-04-21 16:21:52 +02001005 /* PenMount panels */
1006 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001007 MT_USB_DEVICE(USB_VENDOR_ID_PENMOUNT,
John Sung6ab3a9a2011-04-21 16:21:52 +02001008 USB_DEVICE_ID_PENMOUNT_PCI) },
1009
Aaron Tianb7ea95f2011-12-15 11:09:06 +08001010 /* PixArt optical touch screen */
1011 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001012 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +08001013 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN) },
1014 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001015 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +08001016 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1) },
1017 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001018 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +08001019 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2) },
1020
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001021 /* PixCir-based panels */
Benjamin Tissoires1e9cf35b2011-01-31 11:28:20 +01001022 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001023 MT_USB_DEVICE(USB_VENDOR_ID_HANVON,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001024 USB_DEVICE_ID_HANVON_MULTITOUCH) },
Benjamin Tissoires1e9cf35b2011-01-31 11:28:20 +01001025 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001026 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001027 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
1028
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +01001029 /* Quanta-based panels */
1030 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001031 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +01001032 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) },
1033 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001034 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +01001035 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001) },
1036 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001037 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +01001038 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008) },
1039
Benjamin Tissoires043b4032011-03-18 14:27:53 +01001040 /* Stantum panels */
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +02001041 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001042 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM,
Benjamin Tissoires043b4032011-03-18 14:27:53 +01001043 USB_DEVICE_ID_MTP)},
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +02001044 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001045 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM,
Benjamin Tissoires043b4032011-03-18 14:27:53 +01001046 USB_DEVICE_ID_MTP_STM)},
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +02001047 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001048 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX,
Benjamin Tissoires043b4032011-03-18 14:27:53 +01001049 USB_DEVICE_ID_MTP_SITRONIX)},
1050
Benjamin Tissoires847672c2012-02-04 17:08:50 +01001051 /* TopSeed panels */
1052 { .driver_data = MT_CLS_TOPSEED,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001053 MT_USB_DEVICE(USB_VENDOR_ID_TOPSEED2,
Benjamin Tissoires847672c2012-02-04 17:08:50 +01001054 USB_DEVICE_ID_TOPSEED2_PERIPAD_701) },
1055
Benjamin Tissoires5e74e562011-05-19 14:18:16 +02001056 /* Touch International panels */
1057 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001058 MT_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL,
Benjamin Tissoires5e74e562011-05-19 14:18:16 +02001059 USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) },
1060
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001061 /* Unitec panels */
1062 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001063 MT_USB_DEVICE(USB_VENDOR_ID_UNITEC,
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001064 USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) },
1065 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001066 MT_USB_DEVICE(USB_VENDOR_ID_UNITEC,
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001067 USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) },
ice chienbc8a2a92011-07-15 16:58:06 +08001068 /* XAT */
1069 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001070 MT_USB_DEVICE(USB_VENDOR_ID_XAT,
ice chienbc8a2a92011-07-15 16:58:06 +08001071 USB_DEVICE_ID_XAT_CSR) },
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001072
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001073 /* Xiroku */
1074 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001075 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001076 USB_DEVICE_ID_XIROKU_SPX) },
1077 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001078 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001079 USB_DEVICE_ID_XIROKU_MPX) },
1080 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001081 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001082 USB_DEVICE_ID_XIROKU_CSR) },
1083 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001084 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001085 USB_DEVICE_ID_XIROKU_SPX1) },
1086 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001087 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001088 USB_DEVICE_ID_XIROKU_MPX1) },
1089 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001090 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001091 USB_DEVICE_ID_XIROKU_CSR1) },
1092 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001093 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001094 USB_DEVICE_ID_XIROKU_SPX2) },
1095 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001096 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001097 USB_DEVICE_ID_XIROKU_MPX2) },
1098 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001099 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001100 USB_DEVICE_ID_XIROKU_CSR2) },
1101
Benjamin Tissoires82d06982012-06-19 14:39:54 +02001102 /* Zytronic panels */
1103 { .driver_data = MT_CLS_SERIAL,
1104 MT_USB_DEVICE(USB_VENDOR_ID_ZYTRONIC,
1105 USB_DEVICE_ID_ZYTRONIC_ZXY100) },
1106
Henrik Rydberg4fa3a582012-05-01 08:40:01 +02001107 /* Generic MT device */
1108 { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) },
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001109 { }
1110};
1111MODULE_DEVICE_TABLE(hid, mt_devices);
1112
1113static const struct hid_usage_id mt_grabbed_usages[] = {
1114 { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
1115 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
1116};
1117
1118static struct hid_driver mt_driver = {
1119 .name = "hid-multitouch",
1120 .id_table = mt_devices,
1121 .probe = mt_probe,
1122 .remove = mt_remove,
1123 .input_mapping = mt_input_mapping,
1124 .input_mapped = mt_input_mapped,
Henrik Rydberg76f59022012-09-01 20:11:34 +02001125 .input_configured = mt_input_configured,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001126 .feature_mapping = mt_feature_mapping,
1127 .usage_table = mt_grabbed_usages,
1128 .event = mt_event,
1129#ifdef CONFIG_PM
1130 .reset_resume = mt_reset_resume,
Scott Liudfeefd12012-08-15 17:21:55 +08001131 .resume = mt_resume,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001132#endif
1133};
1134
1135static int __init mt_init(void)
1136{
1137 return hid_register_driver(&mt_driver);
1138}
1139
1140static void __exit mt_exit(void)
1141{
1142 hid_unregister_driver(&mt_driver);
1143}
1144
1145module_init(mt_init);
1146module_exit(mt_exit);