blob: 1df86a7536b8d36556a679cda49e3d1e9aeb3bf3 [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 */
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? */
97 struct mt_slot *slots;
Henrik Rydberg76f59022012-09-01 20:11:34 +020098 unsigned mt_flags; /* flags to pass to input-mt */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010099};
100
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100101/* classes of device behavior */
Benjamin Tissoires22408282011-05-20 15:59:34 +0200102#define MT_CLS_DEFAULT 0x0001
103
Stephane Chattya062cc52011-09-17 22:27:30 +0200104#define MT_CLS_SERIAL 0x0002
105#define MT_CLS_CONFIDENCE 0x0003
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100106#define MT_CLS_CONFIDENCE_CONTACT_ID 0x0004
107#define MT_CLS_CONFIDENCE_MINUS_ONE 0x0005
108#define MT_CLS_DUAL_INRANGE_CONTACTID 0x0006
109#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0007
110#define MT_CLS_DUAL_NSMU_CONTACTID 0x0008
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800111#define MT_CLS_INRANGE_CONTACTNUMBER 0x0009
Benjamin Tissoires22408282011-05-20 15:59:34 +0200112
113/* vendor specific classes */
114#define MT_CLS_3M 0x0101
115#define MT_CLS_CYPRESS 0x0102
116#define MT_CLS_EGALAX 0x0103
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100117#define MT_CLS_EGALAX_SERIAL 0x0104
Benjamin Tissoires847672c2012-02-04 17:08:50 +0100118#define MT_CLS_TOPSEED 0x0105
Denis Kovalev2258e862012-02-14 00:50:33 -0800119#define MT_CLS_PANASONIC 0x0106
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 },
Benjamin Tissoires043b4032011-03-18 14:27:53 +0100220
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100221 { }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100222};
223
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100224static ssize_t mt_show_quirks(struct device *dev,
225 struct device_attribute *attr,
226 char *buf)
227{
228 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
229 struct mt_device *td = hid_get_drvdata(hdev);
230
231 return sprintf(buf, "%u\n", td->mtclass.quirks);
232}
233
234static ssize_t mt_set_quirks(struct device *dev,
235 struct device_attribute *attr,
236 const char *buf, size_t count)
237{
238 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
239 struct mt_device *td = hid_get_drvdata(hdev);
240
241 unsigned long val;
242
243 if (kstrtoul(buf, 0, &val))
244 return -EINVAL;
245
246 td->mtclass.quirks = val;
247
248 return count;
249}
250
251static DEVICE_ATTR(quirks, S_IWUSR | S_IRUGO, mt_show_quirks, mt_set_quirks);
252
253static struct attribute *sysfs_attrs[] = {
254 &dev_attr_quirks.attr,
255 NULL
256};
257
258static struct attribute_group mt_attribute_group = {
259 .attrs = sysfs_attrs
260};
261
Henrik Rydbergf635bd12011-02-24 19:30:59 +0100262static void mt_feature_mapping(struct hid_device *hdev,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100263 struct hid_field *field, struct hid_usage *usage)
264{
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100265 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoires4aceed32012-06-19 14:39:52 +0200266 int i;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100267
268 switch (usage->hid) {
269 case HID_DG_INPUTMODE:
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100270 td->inputmode = field->report->id;
Benjamin Tissoires4aceed32012-06-19 14:39:52 +0200271 td->inputmode_index = 0; /* has to be updated below */
272
273 for (i=0; i < field->maxusage; i++) {
274 if (field->usage[i].hid == usage->hid) {
275 td->inputmode_index = i;
276 break;
277 }
278 }
279
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100280 break;
281 case HID_DG_CONTACTMAX:
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100282 td->maxcontact_report_id = field->report->id;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100283 td->maxcontacts = field->value[0];
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100284 if (td->mtclass.maxcontacts)
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100285 /* check if the maxcontacts is given by the class */
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100286 td->maxcontacts = td->mtclass.maxcontacts;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100287
288 break;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100289 }
290}
291
292static void set_abs(struct input_dev *input, unsigned int code,
293 struct hid_field *field, int snratio)
294{
295 int fmin = field->logical_minimum;
296 int fmax = field->logical_maximum;
297 int fuzz = snratio ? (fmax - fmin) / snratio : 0;
298 input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
299}
300
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200301static void mt_store_field(struct hid_usage *usage, struct mt_device *td,
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100302 struct hid_input *hi)
303{
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200304 struct mt_fields *f = td->fields;
305
306 if (f->length >= HID_MAX_FIELDS)
307 return;
308
309 f->usages[f->length++] = usage->hid;
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100310}
311
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100312static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
313 struct hid_field *field, struct hid_usage *usage,
314 unsigned long **bit, int *max)
315{
316 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100317 struct mt_class *cls = &td->mtclass;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100318 int code;
Richard Nauber4875ac12011-03-09 06:20:57 +0100319
Jeff Brown658d4aed592011-08-15 16:44:28 -0700320 /* Only map fields from TouchScreen or TouchPad collections.
Denis Kovalev2258e862012-02-14 00:50:33 -0800321 * We need to ignore fields that belong to other collections
322 * such as Mouse that might have the same GenericDesktop usages. */
Jeff Brown658d4aed592011-08-15 16:44:28 -0700323 if (field->application == HID_DG_TOUCHSCREEN)
Henrik Rydberg76f59022012-09-01 20:11:34 +0200324 td->mt_flags |= INPUT_MT_DIRECT;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100325 else if (field->application != HID_DG_TOUCHPAD)
Jeff Brown658d4aed592011-08-15 16:44:28 -0700326 return 0;
327
Henrik Rydberg76f59022012-09-01 20:11:34 +0200328 /*
329 * Model touchscreens providing buttons as touchpads.
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100330 */
331 if (field->application == HID_DG_TOUCHPAD ||
Henrik Rydberg76f59022012-09-01 20:11:34 +0200332 (usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON)
333 td->mt_flags |= INPUT_MT_POINTER;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100334
Benjamin Tissoires2261bb92011-11-23 10:54:29 +0100335 /* eGalax devices provide a Digitizer.Stylus input which overrides
336 * the correct Digitizers.Finger X/Y ranges.
337 * Let's just ignore this input. */
338 if (field->physical == HID_DG_STYLUS)
339 return -1;
340
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100341 switch (usage->hid & HID_USAGE_PAGE) {
342
343 case HID_UP_GENDESK:
344 switch (usage->hid) {
345 case HID_GD_X:
346 hid_map_usage(hi, usage, bit, max,
347 EV_ABS, ABS_MT_POSITION_X);
348 set_abs(hi->input, ABS_MT_POSITION_X, field,
349 cls->sn_move);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200350 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100351 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100352 return 1;
353 case HID_GD_Y:
354 hid_map_usage(hi, usage, bit, max,
355 EV_ABS, ABS_MT_POSITION_Y);
356 set_abs(hi->input, ABS_MT_POSITION_Y, field,
357 cls->sn_move);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200358 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100359 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100360 return 1;
361 }
362 return 0;
363
364 case HID_UP_DIGITIZER:
365 switch (usage->hid) {
366 case HID_DG_INRANGE:
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200367 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100368 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100369 return 1;
370 case HID_DG_CONFIDENCE:
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_DG_TIPSWITCH:
375 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
376 input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200377 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100378 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100379 return 1;
380 case HID_DG_CONTACTID:
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200381 mt_store_field(usage, td, hi);
Benjamin Tissoires2955cae2011-04-21 14:15:59 +0200382 td->last_field_index = field->index;
Benjamin Tissoires9e87f222012-03-06 17:57:06 +0100383 td->touches_by_report++;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100384 return 1;
385 case HID_DG_WIDTH:
386 hid_map_usage(hi, usage, bit, max,
387 EV_ABS, ABS_MT_TOUCH_MAJOR);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100388 set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
389 cls->sn_width);
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_HEIGHT:
394 hid_map_usage(hi, usage, bit, max,
395 EV_ABS, ABS_MT_TOUCH_MINOR);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100396 set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
397 cls->sn_height);
Benjamin Tissoires1e648a12011-03-18 14:27:55 +0100398 input_set_abs_params(hi->input,
399 ABS_MT_ORIENTATION, 0, 1, 0, 0);
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_TIPPRESSURE:
404 hid_map_usage(hi, usage, bit, max,
405 EV_ABS, ABS_MT_PRESSURE);
406 set_abs(hi->input, ABS_MT_PRESSURE, field,
407 cls->sn_pressure);
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200408 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100409 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100410 return 1;
411 case HID_DG_CONTACTCOUNT:
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100412 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100413 return 1;
414 case HID_DG_CONTACTMAX:
415 /* we don't set td->last_slot_field as contactcount and
416 * contact max are global to the report */
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 }
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100420 case HID_DG_TOUCH:
421 /* Legacy devices use TIPSWITCH and not TOUCH.
422 * Let's just ignore this field. */
423 return -1;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100424 /* let hid-input decide for the others */
425 return 0;
426
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100427 case HID_UP_BUTTON:
428 code = BTN_MOUSE + ((usage->hid - 1) & HID_USAGE);
429 hid_map_usage(hi, usage, bit, max, EV_KEY, code);
430 input_set_capability(hi->input, EV_KEY, code);
431 return 1;
432
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100433 case 0xff000000:
434 /* we do not want to map these: no input-oriented meaning */
435 return -1;
436 }
437
438 return 0;
439}
440
441static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
442 struct hid_field *field, struct hid_usage *usage,
443 unsigned long **bit, int *max)
444{
445 if (usage->type == EV_KEY || usage->type == EV_ABS)
446 set_bit(usage->type, hi->input->evbit);
447
448 return -1;
449}
450
451static int mt_compute_slot(struct mt_device *td)
452{
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100453 __s32 quirks = td->mtclass.quirks;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100454
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100455 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID)
456 return td->curdata.contactid;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100457
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100458 if (quirks & MT_QUIRK_CYPRESS)
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100459 return cypress_compute_slot(td);
460
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100461 if (quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER)
462 return td->num_received;
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100463
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200464 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE)
465 return td->curdata.contactid - 1;
466
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100467 return find_slot_from_contactid(td);
468}
469
470/*
471 * this function is called when a whole contact has been processed,
472 * so that it can assign it to a slot and store the data there
473 */
474static void mt_complete_slot(struct mt_device *td)
475{
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100476 td->curdata.seen_in_this_frame = true;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100477 if (td->curvalid) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100478 int slotnum = mt_compute_slot(td);
479
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100480 if (slotnum >= 0 && slotnum < td->maxcontacts)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100481 td->slots[slotnum] = td->curdata;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100482 }
483 td->num_received++;
484}
485
486
487/*
488 * this function is called when a whole packet has been received and processed,
489 * so that it can decide what to send to the input layer.
490 */
491static void mt_emit_event(struct mt_device *td, struct input_dev *input)
492{
493 int i;
494
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100495 for (i = 0; i < td->maxcontacts; ++i) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100496 struct mt_slot *s = &(td->slots[i]);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100497 if ((td->mtclass.quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) &&
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100498 !s->seen_in_this_frame) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100499 s->touch_state = false;
500 }
501
502 input_mt_slot(input, i);
503 input_mt_report_slot_state(input, MT_TOOL_FINGER,
504 s->touch_state);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100505 if (s->touch_state) {
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100506 /* this finger is on the screen */
507 int wide = (s->w > s->h);
508 /* divided by two to match visual scale of touch */
509 int major = max(s->w, s->h) >> 1;
510 int minor = min(s->w, s->h) >> 1;
511
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100512 input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
513 input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100514 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100515 input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100516 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
517 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100518 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100519 s->seen_in_this_frame = false;
520
521 }
522
Henrik Rydberg76f59022012-09-01 20:11:34 +0200523 input_mt_sync_frame(input);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100524 input_sync(input);
525 td->num_received = 0;
526}
527
528
529
530static int mt_event(struct hid_device *hid, struct hid_field *field,
531 struct hid_usage *usage, __s32 value)
532{
533 struct mt_device *td = hid_get_drvdata(hid);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100534 __s32 quirks = td->mtclass.quirks;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100535
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100536 if (hid->claimed & HID_CLAIMED_INPUT && td->slots) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100537 switch (usage->hid) {
538 case HID_DG_INRANGE:
Stephane Chattya062cc52011-09-17 22:27:30 +0200539 if (quirks & MT_QUIRK_ALWAYS_VALID)
540 td->curvalid = true;
541 else if (quirks & MT_QUIRK_VALID_IS_INRANGE)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100542 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100543 break;
544 case HID_DG_TIPSWITCH:
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100545 if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
546 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100547 td->curdata.touch_state = value;
548 break;
549 case HID_DG_CONFIDENCE:
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100550 if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE)
551 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100552 break;
553 case HID_DG_CONTACTID:
554 td->curdata.contactid = value;
555 break;
556 case HID_DG_TIPPRESSURE:
557 td->curdata.p = value;
558 break;
559 case HID_GD_X:
560 td->curdata.x = value;
561 break;
562 case HID_GD_Y:
563 td->curdata.y = value;
564 break;
565 case HID_DG_WIDTH:
566 td->curdata.w = value;
567 break;
568 case HID_DG_HEIGHT:
569 td->curdata.h = value;
570 break;
571 case HID_DG_CONTACTCOUNT:
572 /*
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100573 * Includes multi-packet support where subsequent
574 * packets are sent with zero contactcount.
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100575 */
576 if (value)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100577 td->num_expected = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100578 break;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100579 case HID_DG_TOUCH:
580 /* do nothing */
581 break;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100582
583 default:
584 /* fallback to the generic hidinput handling */
585 return 0;
586 }
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100587
Denis Kovalev2258e862012-02-14 00:50:33 -0800588 if (usage->hid == td->last_slot_field)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100589 mt_complete_slot(td);
590
591 if (field->index == td->last_field_index
592 && td->num_received >= td->num_expected)
593 mt_emit_event(td, field->hidinput->input);
594
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100595 }
596
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100597 /* we have handled the hidinput part, now remains hiddev */
598 if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
599 hid->hiddev_hid_event(hid, field, usage, value);
600
601 return 1;
602}
603
604static void mt_set_input_mode(struct hid_device *hdev)
605{
606 struct mt_device *td = hid_get_drvdata(hdev);
607 struct hid_report *r;
608 struct hid_report_enum *re;
609
610 if (td->inputmode < 0)
611 return;
612
613 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
614 r = re->report_id_hash[td->inputmode];
615 if (r) {
Benjamin Tissoires4aceed32012-06-19 14:39:52 +0200616 r->field[0]->value[td->inputmode_index] = 0x02;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100617 usbhid_submit_report(hdev, r, USB_DIR_OUT);
618 }
619}
620
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100621static void mt_set_maxcontacts(struct hid_device *hdev)
622{
623 struct mt_device *td = hid_get_drvdata(hdev);
624 struct hid_report *r;
625 struct hid_report_enum *re;
626 int fieldmax, max;
627
628 if (td->maxcontact_report_id < 0)
629 return;
630
631 if (!td->mtclass.maxcontacts)
632 return;
633
634 re = &hdev->report_enum[HID_FEATURE_REPORT];
635 r = re->report_id_hash[td->maxcontact_report_id];
636 if (r) {
637 max = td->mtclass.maxcontacts;
638 fieldmax = r->field[0]->logical_maximum;
639 max = min(fieldmax, max);
640 if (r->field[0]->value[0] != max) {
641 r->field[0]->value[0] = max;
642 usbhid_submit_report(hdev, r, USB_DIR_OUT);
643 }
644 }
645}
646
Henrik Rydberg4fa3a582012-05-01 08:40:01 +0200647static void mt_post_parse_default_settings(struct mt_device *td)
648{
649 __s32 quirks = td->mtclass.quirks;
650
651 /* unknown serial device needs special quirks */
652 if (td->touches_by_report == 1) {
653 quirks |= MT_QUIRK_ALWAYS_VALID;
654 quirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP;
655 quirks &= ~MT_QUIRK_VALID_IS_INRANGE;
656 quirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE;
657 }
658
659 td->mtclass.quirks = quirks;
660}
661
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200662static void mt_post_parse(struct mt_device *td)
663{
664 struct mt_fields *f = td->fields;
665
666 if (td->touches_by_report > 0) {
667 int field_count_per_touch = f->length / td->touches_by_report;
668 td->last_slot_field = f->usages[field_count_per_touch - 1];
669 }
670}
671
Henrik Rydberg76f59022012-09-01 20:11:34 +0200672static void mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
673
674{
675 struct mt_device *td = hid_get_drvdata(hdev);
676 struct mt_class *cls = &td->mtclass;
677 struct input_dev *input = hi->input;
678
679 /* Only initialize slots for MT input devices */
680 if (!test_bit(ABS_MT_POSITION_X, input->absbit))
681 return;
682
683 if (!td->maxcontacts)
684 td->maxcontacts = MT_DEFAULT_MAXCONTACT;
685
686 mt_post_parse(td);
687 if (td->serial_maybe)
688 mt_post_parse_default_settings(td);
689
690 if (cls->is_indirect)
691 td->mt_flags |= INPUT_MT_POINTER;
692
693 input_mt_init_slots(input, td->maxcontacts, td->mt_flags);
694
695 td->mt_flags = 0;
696}
697
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100698static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
699{
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100700 int ret, i;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100701 struct mt_device *td;
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100702 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
703
Benjamin Tissoires8d179a92012-03-06 17:57:04 +0100704 if (id) {
705 for (i = 0; mt_classes[i].name ; i++) {
706 if (id->driver_data == mt_classes[i].name) {
707 mtclass = &(mt_classes[i]);
708 break;
709 }
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100710 }
711 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100712
Henrik Rydbergd682bd72011-11-01 15:26:31 +0100713 /* This allows the driver to correctly support devices
714 * that emit events over several HID messages.
715 */
716 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100717
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100718 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100719 if (!td) {
720 dev_err(&hdev->dev, "cannot allocate multitouch data\n");
721 return -ENOMEM;
722 }
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100723 td->mtclass = *mtclass;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100724 td->inputmode = -1;
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100725 td->maxcontact_report_id = -1;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100726 hid_set_drvdata(hdev, td);
727
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200728 td->fields = kzalloc(sizeof(struct mt_fields), GFP_KERNEL);
729 if (!td->fields) {
730 dev_err(&hdev->dev, "cannot allocate multitouch fields data\n");
731 ret = -ENOMEM;
732 goto fail;
733 }
734
Henrik Rydberg76f59022012-09-01 20:11:34 +0200735 if (id->vendor == HID_ANY_ID && id->product == HID_ANY_ID)
736 td->serial_maybe = true;
737
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100738 ret = hid_parse(hdev);
739 if (ret != 0)
740 goto fail;
741
742 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100743 if (ret)
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100744 goto fail;
745
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100746 td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
747 GFP_KERNEL);
748 if (!td->slots) {
749 dev_err(&hdev->dev, "cannot allocate multitouch slots\n");
750 hid_hw_stop(hdev);
751 ret = -ENOMEM;
752 goto fail;
753 }
754
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100755 ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group);
756
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100757 mt_set_maxcontacts(hdev);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100758 mt_set_input_mode(hdev);
759
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200760 kfree(td->fields);
761 td->fields = NULL;
762
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100763 return 0;
764
765fail:
Benjamin Tissoires3ac36d12012-05-04 14:53:46 +0200766 kfree(td->fields);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100767 kfree(td);
768 return ret;
769}
770
771#ifdef CONFIG_PM
772static int mt_reset_resume(struct hid_device *hdev)
773{
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100774 mt_set_maxcontacts(hdev);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100775 mt_set_input_mode(hdev);
776 return 0;
777}
778#endif
779
780static void mt_remove(struct hid_device *hdev)
781{
782 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100783 sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100784 hid_hw_stop(hdev);
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100785 kfree(td->slots);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100786 kfree(td);
787 hid_set_drvdata(hdev, NULL);
788}
789
790static const struct hid_device_id mt_devices[] = {
791
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100792 /* 3M panels */
793 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200794 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100795 USB_DEVICE_ID_3M1968) },
796 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200797 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100798 USB_DEVICE_ID_3M2256) },
Benjamin Tissoiresc4fad872011-12-23 15:41:00 +0100799 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200800 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresc4fad872011-12-23 15:41:00 +0100801 USB_DEVICE_ID_3M3266) },
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100802
Benjamin Tissoirese6aac342011-05-19 14:18:13 +0200803 /* ActionStar panels */
804 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200805 MT_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR,
Benjamin Tissoirese6aac342011-05-19 14:18:13 +0200806 USB_DEVICE_ID_ACTIONSTAR_1011) },
807
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100808 /* Atmel panels */
809 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200810 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL,
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100811 USB_DEVICE_ID_ATMEL_MULTITOUCH) },
Benjamin Tissoires841cb152012-03-06 10:53:45 +0100812 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200813 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL,
Benjamin Tissoires841cb152012-03-06 10:53:45 +0100814 USB_DEVICE_ID_ATMEL_MXT_DIGITIZER) },
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100815
Jiri Kosina9ed32692012-04-20 12:15:44 +0200816 /* Baanto multitouch devices */
817 { .driver_data = MT_CLS_DEFAULT,
Jiri Kosina16b79bb2012-05-05 23:32:54 +0200818 MT_USB_DEVICE(USB_VENDOR_ID_BAANTO,
Jiri Kosina9ed32692012-04-20 12:15:44 +0200819 USB_DEVICE_ID_BAANTO_MT_190W2) },
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100820 /* Cando panels */
821 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200822 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100823 USB_DEVICE_ID_CANDO_MULTI_TOUCH) },
824 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200825 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100826 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) },
827 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200828 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100829 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) },
830 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200831 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100832 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },
833
Austin Zhang942fd422011-05-28 02:03:47 +0800834 /* Chunghwa Telecom touch panels */
835 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200836 MT_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT,
Austin Zhang942fd422011-05-28 02:03:47 +0800837 USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) },
838
Benjamin Tissoires79603dc2011-05-19 14:18:14 +0200839 /* CVTouch panels */
840 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200841 MT_USB_DEVICE(USB_VENDOR_ID_CVTOUCH,
Benjamin Tissoires79603dc2011-05-19 14:18:14 +0200842 USB_DEVICE_ID_CVTOUCH_SCREEN) },
843
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100844 /* Cypress panel */
845 { .driver_data = MT_CLS_CYPRESS,
846 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS,
847 USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
848
Benjamin Tissoires22408282011-05-20 15:59:34 +0200849 /* eGalax devices (resistive) */
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100850 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200851 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100852 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) },
853 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200854 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100855 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200856
857 /* eGalax devices (capacitive) */
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100858 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200859 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100860 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100861 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200862 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100863 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7207) },
864 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200865 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100866 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E) },
867 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200868 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100869 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224) },
Benjamin Tissoires2ce09df2012-03-06 17:57:02 +0100870 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200871 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoires2ce09df2012-03-06 17:57:02 +0100872 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_722A) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100873 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200874 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100875 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100876 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200877 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100878 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7262) },
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_72A1) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100882 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200883 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100884 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72AA) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100885 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200886 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoires66f06122011-11-23 10:54:33 +0100887 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA) },
888 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200889 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Marek Vasutbb9ff212011-11-23 10:54:32 +0100890 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) },
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100891 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200892 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100893 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349) },
894 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200895 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100896 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200897
Benjamin Tissoiresc04abee2011-05-19 11:37:29 +0200898 /* Elo TouchSystems IntelliTouch Plus panel */
899 { .driver_data = MT_CLS_DUAL_NSMU_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200900 MT_USB_DEVICE(USB_VENDOR_ID_ELO,
Benjamin Tissoiresc04abee2011-05-19 11:37:29 +0200901 USB_DEVICE_ID_ELO_TS2515) },
902
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100903 /* GeneralTouch panel */
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100904 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200905 MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100906 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) },
907
Andreas Nielsen4d5df5d2012-03-19 15:41:03 +0100908 /* Gametel game controller */
909 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200910 MT_BT_DEVICE(USB_VENDOR_ID_FRUCTEL,
Andreas Nielsen4d5df5d2012-03-19 15:41:03 +0100911 USB_DEVICE_ID_GAMETEL_MT_MODE) },
912
Benjamin Tissoiresee0fbd12011-05-19 14:18:15 +0200913 /* GoodTouch panels */
914 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200915 MT_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH,
Benjamin Tissoiresee0fbd12011-05-19 14:18:15 +0200916 USB_DEVICE_ID_GOODTOUCH_000f) },
917
Benjamin Tissoires54580362011-11-29 13:13:12 +0100918 /* Hanvon panels */
919 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200920 MT_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT,
Benjamin Tissoires54580362011-11-29 13:13:12 +0100921 USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) },
922
Stephane Chattya062cc52011-09-17 22:27:30 +0200923 /* Ideacom panel */
924 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200925 MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
Stephane Chattya062cc52011-09-17 22:27:30 +0200926 USB_DEVICE_ID_IDEACOM_IDC6650) },
Benjamin Tissoires71078b02012-03-06 10:53:46 +0100927 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200928 MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
Benjamin Tissoires71078b02012-03-06 10:53:46 +0100929 USB_DEVICE_ID_IDEACOM_IDC6651) },
Stephane Chattya062cc52011-09-17 22:27:30 +0200930
Austin Zhang4e61f0d2011-05-09 23:54:14 +0800931 /* Ilitek dual touch panel */
932 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200933 MT_USB_DEVICE(USB_VENDOR_ID_ILITEK,
Austin Zhang4e61f0d2011-05-09 23:54:14 +0800934 USB_DEVICE_ID_ILITEK_MULTITOUCH) },
935
Benjamin Tissoires4dfcced2011-01-31 11:28:22 +0100936 /* IRTOUCH panels */
937 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200938 MT_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS,
Benjamin Tissoires4dfcced2011-01-31 11:28:22 +0100939 USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
940
Jeff Brownc50bb1a2011-08-15 21:12:09 -0700941 /* LG Display panels */
942 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200943 MT_USB_DEVICE(USB_VENDOR_ID_LG,
Jeff Brownc50bb1a2011-08-15 21:12:09 -0700944 USB_DEVICE_ID_LG_MULTITOUCH) },
945
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200946 /* Lumio panels */
947 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200948 MT_USB_DEVICE(USB_VENDOR_ID_LUMIO,
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200949 USB_DEVICE_ID_CRYSTALTOUCH) },
Benjamin Tissoiresc3ead6d2011-06-21 15:01:55 +0200950 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200951 MT_USB_DEVICE(USB_VENDOR_ID_LUMIO,
Benjamin Tissoiresc3ead6d2011-06-21 15:01:55 +0200952 USB_DEVICE_ID_CRYSTALTOUCH_DUAL) },
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200953
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200954 /* MosArt panels */
955 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200956 MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200957 USB_DEVICE_ID_ASUS_T91MT)},
958 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200959 MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200960 USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) },
961 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200962 MT_USB_DEVICE(USB_VENDOR_ID_TURBOX,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200963 USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) },
964
Denis Kovalev2258e862012-02-14 00:50:33 -0800965 /* Panasonic panels */
966 { .driver_data = MT_CLS_PANASONIC,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200967 MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
Denis Kovalev2258e862012-02-14 00:50:33 -0800968 USB_DEVICE_ID_PANABOARD_UBT780) },
969 { .driver_data = MT_CLS_PANASONIC,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200970 MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
Denis Kovalev2258e862012-02-14 00:50:33 -0800971 USB_DEVICE_ID_PANABOARD_UBT880) },
972
Austin Hendrix4db703e2012-06-04 15:27:51 -0700973 /* Novatek Panel */
974 { .driver_data = MT_CLS_DEFAULT,
Jiri Kosina4380d812012-06-06 16:28:33 +0200975 MT_USB_DEVICE(USB_VENDOR_ID_NOVATEK,
Austin Hendrix4db703e2012-06-04 15:27:51 -0700976 USB_DEVICE_ID_NOVATEK_PCT) },
977
John Sung6ab3a9a2011-04-21 16:21:52 +0200978 /* PenMount panels */
979 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200980 MT_USB_DEVICE(USB_VENDOR_ID_PENMOUNT,
John Sung6ab3a9a2011-04-21 16:21:52 +0200981 USB_DEVICE_ID_PENMOUNT_PCI) },
982
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800983 /* PixArt optical touch screen */
984 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200985 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800986 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN) },
987 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200988 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800989 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1) },
990 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200991 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800992 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2) },
993
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100994 /* PixCir-based panels */
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100995 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200996 MT_USB_DEVICE(USB_VENDOR_ID_HANVON,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100997 USB_DEVICE_ID_HANVON_MULTITOUCH) },
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100998 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200999 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001000 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
1001
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +01001002 /* Quanta-based panels */
1003 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001004 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +01001005 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) },
1006 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001007 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +01001008 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001) },
1009 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001010 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +01001011 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008) },
1012
Benjamin Tissoires043b4032011-03-18 14:27:53 +01001013 /* Stantum panels */
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +02001014 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001015 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM,
Benjamin Tissoires043b4032011-03-18 14:27:53 +01001016 USB_DEVICE_ID_MTP)},
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +02001017 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001018 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM,
Benjamin Tissoires043b4032011-03-18 14:27:53 +01001019 USB_DEVICE_ID_MTP_STM)},
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +02001020 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001021 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX,
Benjamin Tissoires043b4032011-03-18 14:27:53 +01001022 USB_DEVICE_ID_MTP_SITRONIX)},
1023
Benjamin Tissoires847672c2012-02-04 17:08:50 +01001024 /* TopSeed panels */
1025 { .driver_data = MT_CLS_TOPSEED,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001026 MT_USB_DEVICE(USB_VENDOR_ID_TOPSEED2,
Benjamin Tissoires847672c2012-02-04 17:08:50 +01001027 USB_DEVICE_ID_TOPSEED2_PERIPAD_701) },
1028
Benjamin Tissoires5e74e562011-05-19 14:18:16 +02001029 /* Touch International panels */
1030 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001031 MT_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL,
Benjamin Tissoires5e74e562011-05-19 14:18:16 +02001032 USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) },
1033
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001034 /* Unitec panels */
1035 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001036 MT_USB_DEVICE(USB_VENDOR_ID_UNITEC,
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001037 USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) },
1038 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001039 MT_USB_DEVICE(USB_VENDOR_ID_UNITEC,
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001040 USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) },
ice chienbc8a2a92011-07-15 16:58:06 +08001041 /* XAT */
1042 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001043 MT_USB_DEVICE(USB_VENDOR_ID_XAT,
ice chienbc8a2a92011-07-15 16:58:06 +08001044 USB_DEVICE_ID_XAT_CSR) },
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001045
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001046 /* Xiroku */
1047 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001048 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001049 USB_DEVICE_ID_XIROKU_SPX) },
1050 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001051 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001052 USB_DEVICE_ID_XIROKU_MPX) },
1053 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001054 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001055 USB_DEVICE_ID_XIROKU_CSR) },
1056 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001057 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001058 USB_DEVICE_ID_XIROKU_SPX1) },
1059 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001060 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001061 USB_DEVICE_ID_XIROKU_MPX1) },
1062 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001063 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001064 USB_DEVICE_ID_XIROKU_CSR1) },
1065 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001066 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001067 USB_DEVICE_ID_XIROKU_SPX2) },
1068 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001069 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001070 USB_DEVICE_ID_XIROKU_MPX2) },
1071 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001072 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001073 USB_DEVICE_ID_XIROKU_CSR2) },
1074
Benjamin Tissoires82d06982012-06-19 14:39:54 +02001075 /* Zytronic panels */
1076 { .driver_data = MT_CLS_SERIAL,
1077 MT_USB_DEVICE(USB_VENDOR_ID_ZYTRONIC,
1078 USB_DEVICE_ID_ZYTRONIC_ZXY100) },
1079
Henrik Rydberg4fa3a582012-05-01 08:40:01 +02001080 /* Generic MT device */
1081 { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) },
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001082 { }
1083};
1084MODULE_DEVICE_TABLE(hid, mt_devices);
1085
1086static const struct hid_usage_id mt_grabbed_usages[] = {
1087 { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
1088 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
1089};
1090
1091static struct hid_driver mt_driver = {
1092 .name = "hid-multitouch",
1093 .id_table = mt_devices,
1094 .probe = mt_probe,
1095 .remove = mt_remove,
1096 .input_mapping = mt_input_mapping,
1097 .input_mapped = mt_input_mapped,
Henrik Rydberg76f59022012-09-01 20:11:34 +02001098 .input_configured = mt_input_configured,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001099 .feature_mapping = mt_feature_mapping,
1100 .usage_table = mt_grabbed_usages,
1101 .event = mt_event,
1102#ifdef CONFIG_PM
1103 .reset_resume = mt_reset_resume,
1104#endif
1105};
1106
1107static int __init mt_init(void)
1108{
1109 return hid_register_driver(&mt_driver);
1110}
1111
1112static void __exit mt_exit(void)
1113{
1114 hid_unregister_driver(&mt_driver);
1115}
1116
1117module_init(mt_init);
1118module_exit(mt_exit);