blob: 25b94253e68f6add47ec50203ee30653cb0ff35f [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 Tissoires5519cab2011-01-07 23:45:50 +010073struct mt_device {
74 struct mt_slot curdata; /* placeholder of incoming data */
Benjamin Tissoireseec29e32011-11-23 10:54:28 +010075 struct mt_class mtclass; /* our mt device class */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010076 unsigned last_field_index; /* last field index of the report */
77 unsigned last_slot_field; /* the last field of a slot */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010078 __s8 inputmode; /* InputMode HID feature, -1 if non-existent */
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +010079 __s8 maxcontact_report_id; /* Maximum Contact Number HID feature,
80 -1 if non-existent */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010081 __u8 num_received; /* how many contacts we received */
82 __u8 num_expected; /* expected last contact index */
83 __u8 maxcontacts;
Benjamin Tissoires9e87f222012-03-06 17:57:06 +010084 __u8 touches_by_report; /* how many touches are present in one report:
85 * 1 means we should use a serial protocol
86 * > 1 means hybrid (multitouch) protocol */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010087 bool curvalid; /* is the current contact valid? */
88 struct mt_slot *slots;
89};
90
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010091/* classes of device behavior */
Benjamin Tissoires22408282011-05-20 15:59:34 +020092#define MT_CLS_DEFAULT 0x0001
93
Stephane Chattya062cc52011-09-17 22:27:30 +020094#define MT_CLS_SERIAL 0x0002
95#define MT_CLS_CONFIDENCE 0x0003
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +010096#define MT_CLS_CONFIDENCE_CONTACT_ID 0x0004
97#define MT_CLS_CONFIDENCE_MINUS_ONE 0x0005
98#define MT_CLS_DUAL_INRANGE_CONTACTID 0x0006
99#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0007
100#define MT_CLS_DUAL_NSMU_CONTACTID 0x0008
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800101#define MT_CLS_INRANGE_CONTACTNUMBER 0x0009
Benjamin Tissoires22408282011-05-20 15:59:34 +0200102
103/* vendor specific classes */
104#define MT_CLS_3M 0x0101
105#define MT_CLS_CYPRESS 0x0102
106#define MT_CLS_EGALAX 0x0103
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100107#define MT_CLS_EGALAX_SERIAL 0x0104
Benjamin Tissoires847672c2012-02-04 17:08:50 +0100108#define MT_CLS_TOPSEED 0x0105
Denis Kovalev2258e862012-02-14 00:50:33 -0800109#define MT_CLS_PANASONIC 0x0106
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100110
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100111#define MT_DEFAULT_MAXCONTACT 10
112
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200113#define MT_USB_DEVICE(v, p) HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH, v, p)
114#define MT_BT_DEVICE(v, p) HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_MULTITOUCH, v, p)
115
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100116/*
117 * these device-dependent functions determine what slot corresponds
118 * to a valid contact that was just read.
119 */
120
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100121static int cypress_compute_slot(struct mt_device *td)
122{
123 if (td->curdata.contactid != 0 || td->num_received == 0)
124 return td->curdata.contactid;
125 else
126 return -1;
127}
128
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100129static int find_slot_from_contactid(struct mt_device *td)
130{
131 int i;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100132 for (i = 0; i < td->maxcontacts; ++i) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100133 if (td->slots[i].contactid == td->curdata.contactid &&
134 td->slots[i].touch_state)
135 return i;
136 }
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100137 for (i = 0; i < td->maxcontacts; ++i) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100138 if (!td->slots[i].seen_in_this_frame &&
139 !td->slots[i].touch_state)
140 return i;
141 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100142 /* should not occurs. If this happens that means
143 * that the device sent more touches that it says
144 * in the report descriptor. It is ignored then. */
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100145 return -1;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100146}
147
Jiri Kosinab3c21d22011-11-22 23:23:37 +0100148static struct mt_class mt_classes[] = {
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100149 { .name = MT_CLS_DEFAULT,
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100150 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP },
Stephane Chattya062cc52011-09-17 22:27:30 +0200151 { .name = MT_CLS_SERIAL,
152 .quirks = MT_QUIRK_ALWAYS_VALID},
Benjamin Tissoires22408282011-05-20 15:59:34 +0200153 { .name = MT_CLS_CONFIDENCE,
154 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE },
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100155 { .name = MT_CLS_CONFIDENCE_CONTACT_ID,
156 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
157 MT_QUIRK_SLOT_IS_CONTACTID },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200158 { .name = MT_CLS_CONFIDENCE_MINUS_ONE,
159 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
160 MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE },
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100161 { .name = MT_CLS_DUAL_INRANGE_CONTACTID,
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100162 .quirks = MT_QUIRK_VALID_IS_INRANGE |
163 MT_QUIRK_SLOT_IS_CONTACTID,
164 .maxcontacts = 2 },
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100165 { .name = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100166 .quirks = MT_QUIRK_VALID_IS_INRANGE |
167 MT_QUIRK_SLOT_IS_CONTACTNUMBER,
168 .maxcontacts = 2 },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200169 { .name = MT_CLS_DUAL_NSMU_CONTACTID,
170 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
171 MT_QUIRK_SLOT_IS_CONTACTID,
172 .maxcontacts = 2 },
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800173 { .name = MT_CLS_INRANGE_CONTACTNUMBER,
174 .quirks = MT_QUIRK_VALID_IS_INRANGE |
175 MT_QUIRK_SLOT_IS_CONTACTNUMBER },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200176
177 /*
178 * vendor specific classes
179 */
180 { .name = MT_CLS_3M,
181 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
182 MT_QUIRK_SLOT_IS_CONTACTID,
183 .sn_move = 2048,
184 .sn_width = 128,
185 .sn_height = 128 },
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100186 { .name = MT_CLS_CYPRESS,
187 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
188 MT_QUIRK_CYPRESS,
189 .maxcontacts = 10 },
Richard Nauber4875ac12011-03-09 06:20:57 +0100190 { .name = MT_CLS_EGALAX,
191 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
Benjamin Tissoires2261bb92011-11-23 10:54:29 +0100192 MT_QUIRK_VALID_IS_INRANGE,
Richard Nauber4875ac12011-03-09 06:20:57 +0100193 .sn_move = 4096,
194 .sn_pressure = 32,
195 },
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100196 { .name = MT_CLS_EGALAX_SERIAL,
197 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
198 MT_QUIRK_ALWAYS_VALID,
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100199 .sn_move = 4096,
200 .sn_pressure = 32,
201 },
Benjamin Tissoires847672c2012-02-04 17:08:50 +0100202 { .name = MT_CLS_TOPSEED,
203 .quirks = MT_QUIRK_ALWAYS_VALID,
204 .is_indirect = true,
205 .maxcontacts = 2,
206 },
Denis Kovalev2258e862012-02-14 00:50:33 -0800207 { .name = MT_CLS_PANASONIC,
208 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP,
209 .maxcontacts = 4 },
Benjamin Tissoires043b4032011-03-18 14:27:53 +0100210
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100211 { }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100212};
213
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100214static ssize_t mt_show_quirks(struct device *dev,
215 struct device_attribute *attr,
216 char *buf)
217{
218 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
219 struct mt_device *td = hid_get_drvdata(hdev);
220
221 return sprintf(buf, "%u\n", td->mtclass.quirks);
222}
223
224static ssize_t mt_set_quirks(struct device *dev,
225 struct device_attribute *attr,
226 const char *buf, size_t count)
227{
228 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
229 struct mt_device *td = hid_get_drvdata(hdev);
230
231 unsigned long val;
232
233 if (kstrtoul(buf, 0, &val))
234 return -EINVAL;
235
236 td->mtclass.quirks = val;
237
238 return count;
239}
240
241static DEVICE_ATTR(quirks, S_IWUSR | S_IRUGO, mt_show_quirks, mt_set_quirks);
242
243static struct attribute *sysfs_attrs[] = {
244 &dev_attr_quirks.attr,
245 NULL
246};
247
248static struct attribute_group mt_attribute_group = {
249 .attrs = sysfs_attrs
250};
251
Henrik Rydbergf635bd12011-02-24 19:30:59 +0100252static void mt_feature_mapping(struct hid_device *hdev,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100253 struct hid_field *field, struct hid_usage *usage)
254{
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100255 struct mt_device *td = hid_get_drvdata(hdev);
256
257 switch (usage->hid) {
258 case HID_DG_INPUTMODE:
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100259 td->inputmode = field->report->id;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100260 break;
261 case HID_DG_CONTACTMAX:
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100262 td->maxcontact_report_id = field->report->id;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100263 td->maxcontacts = field->value[0];
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100264 if (td->mtclass.maxcontacts)
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100265 /* check if the maxcontacts is given by the class */
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100266 td->maxcontacts = td->mtclass.maxcontacts;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100267
268 break;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100269 }
270}
271
272static void set_abs(struct input_dev *input, unsigned int code,
273 struct hid_field *field, int snratio)
274{
275 int fmin = field->logical_minimum;
276 int fmax = field->logical_maximum;
277 int fuzz = snratio ? (fmax - fmin) / snratio : 0;
278 input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
279}
280
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100281static void set_last_slot_field(struct hid_usage *usage, struct mt_device *td,
282 struct hid_input *hi)
283{
284 if (!test_bit(usage->hid, hi->input->absbit))
285 td->last_slot_field = usage->hid;
286}
287
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100288static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
289 struct hid_field *field, struct hid_usage *usage,
290 unsigned long **bit, int *max)
291{
292 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100293 struct mt_class *cls = &td->mtclass;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100294 int code;
Richard Nauber4875ac12011-03-09 06:20:57 +0100295
Jeff Brown658d4aed592011-08-15 16:44:28 -0700296 /* Only map fields from TouchScreen or TouchPad collections.
Denis Kovalev2258e862012-02-14 00:50:33 -0800297 * We need to ignore fields that belong to other collections
298 * such as Mouse that might have the same GenericDesktop usages. */
Jeff Brown658d4aed592011-08-15 16:44:28 -0700299 if (field->application == HID_DG_TOUCHSCREEN)
300 set_bit(INPUT_PROP_DIRECT, hi->input->propbit);
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100301 else if (field->application != HID_DG_TOUCHPAD)
Jeff Brown658d4aed592011-08-15 16:44:28 -0700302 return 0;
303
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100304 /* In case of an indirect device (touchpad), we need to add
305 * specific BTN_TOOL_* to be handled by the synaptics xorg
306 * driver.
307 * We also consider that touchscreens providing buttons are touchpads.
308 */
309 if (field->application == HID_DG_TOUCHPAD ||
310 (usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON ||
311 cls->is_indirect) {
312 set_bit(INPUT_PROP_POINTER, hi->input->propbit);
313 set_bit(BTN_TOOL_FINGER, hi->input->keybit);
314 set_bit(BTN_TOOL_DOUBLETAP, hi->input->keybit);
315 set_bit(BTN_TOOL_TRIPLETAP, hi->input->keybit);
316 set_bit(BTN_TOOL_QUADTAP, hi->input->keybit);
317 }
318
Benjamin Tissoires2261bb92011-11-23 10:54:29 +0100319 /* eGalax devices provide a Digitizer.Stylus input which overrides
320 * the correct Digitizers.Finger X/Y ranges.
321 * Let's just ignore this input. */
322 if (field->physical == HID_DG_STYLUS)
323 return -1;
324
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100325 switch (usage->hid & HID_USAGE_PAGE) {
326
327 case HID_UP_GENDESK:
328 switch (usage->hid) {
329 case HID_GD_X:
330 hid_map_usage(hi, usage, bit, max,
331 EV_ABS, ABS_MT_POSITION_X);
332 set_abs(hi->input, ABS_MT_POSITION_X, field,
333 cls->sn_move);
334 /* touchscreen emulation */
335 set_abs(hi->input, ABS_X, field, cls->sn_move);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100336 set_last_slot_field(usage, td, hi);
337 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100338 return 1;
339 case HID_GD_Y:
340 hid_map_usage(hi, usage, bit, max,
341 EV_ABS, ABS_MT_POSITION_Y);
342 set_abs(hi->input, ABS_MT_POSITION_Y, field,
343 cls->sn_move);
344 /* touchscreen emulation */
345 set_abs(hi->input, ABS_Y, field, cls->sn_move);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100346 set_last_slot_field(usage, td, hi);
347 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100348 return 1;
349 }
350 return 0;
351
352 case HID_UP_DIGITIZER:
353 switch (usage->hid) {
354 case HID_DG_INRANGE:
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100355 set_last_slot_field(usage, td, hi);
356 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100357 return 1;
358 case HID_DG_CONFIDENCE:
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100359 set_last_slot_field(usage, td, hi);
360 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100361 return 1;
362 case HID_DG_TIPSWITCH:
363 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
364 input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100365 set_last_slot_field(usage, td, hi);
366 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100367 return 1;
368 case HID_DG_CONTACTID:
Benjamin Tissoires50bc03a2011-06-21 15:01:53 +0200369 if (!td->maxcontacts)
370 td->maxcontacts = MT_DEFAULT_MAXCONTACT;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100371 input_mt_init_slots(hi->input, td->maxcontacts);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100372 td->last_slot_field = usage->hid;
Benjamin Tissoires2955cae2011-04-21 14:15:59 +0200373 td->last_field_index = field->index;
Benjamin Tissoires9e87f222012-03-06 17:57:06 +0100374 td->touches_by_report++;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100375 return 1;
376 case HID_DG_WIDTH:
377 hid_map_usage(hi, usage, bit, max,
378 EV_ABS, ABS_MT_TOUCH_MAJOR);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100379 set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
380 cls->sn_width);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100381 set_last_slot_field(usage, td, hi);
382 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100383 return 1;
384 case HID_DG_HEIGHT:
385 hid_map_usage(hi, usage, bit, max,
386 EV_ABS, ABS_MT_TOUCH_MINOR);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100387 set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
388 cls->sn_height);
Benjamin Tissoires1e648a12011-03-18 14:27:55 +0100389 input_set_abs_params(hi->input,
390 ABS_MT_ORIENTATION, 0, 1, 0, 0);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100391 set_last_slot_field(usage, td, hi);
392 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100393 return 1;
394 case HID_DG_TIPPRESSURE:
395 hid_map_usage(hi, usage, bit, max,
396 EV_ABS, ABS_MT_PRESSURE);
397 set_abs(hi->input, ABS_MT_PRESSURE, field,
398 cls->sn_pressure);
399 /* touchscreen emulation */
400 set_abs(hi->input, ABS_PRESSURE, field,
401 cls->sn_pressure);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100402 set_last_slot_field(usage, td, hi);
403 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100404 return 1;
405 case HID_DG_CONTACTCOUNT:
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100406 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100407 return 1;
408 case HID_DG_CONTACTMAX:
409 /* we don't set td->last_slot_field as contactcount and
410 * contact max are global to the report */
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100411 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100412 return -1;
413 }
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100414 case HID_DG_TOUCH:
415 /* Legacy devices use TIPSWITCH and not TOUCH.
416 * Let's just ignore this field. */
417 return -1;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100418 /* let hid-input decide for the others */
419 return 0;
420
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100421 case HID_UP_BUTTON:
422 code = BTN_MOUSE + ((usage->hid - 1) & HID_USAGE);
423 hid_map_usage(hi, usage, bit, max, EV_KEY, code);
424 input_set_capability(hi->input, EV_KEY, code);
425 return 1;
426
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100427 case 0xff000000:
428 /* we do not want to map these: no input-oriented meaning */
429 return -1;
430 }
431
432 return 0;
433}
434
435static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
436 struct hid_field *field, struct hid_usage *usage,
437 unsigned long **bit, int *max)
438{
439 if (usage->type == EV_KEY || usage->type == EV_ABS)
440 set_bit(usage->type, hi->input->evbit);
441
442 return -1;
443}
444
445static int mt_compute_slot(struct mt_device *td)
446{
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100447 __s32 quirks = td->mtclass.quirks;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100448
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100449 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID)
450 return td->curdata.contactid;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100451
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100452 if (quirks & MT_QUIRK_CYPRESS)
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100453 return cypress_compute_slot(td);
454
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100455 if (quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER)
456 return td->num_received;
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100457
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200458 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE)
459 return td->curdata.contactid - 1;
460
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100461 return find_slot_from_contactid(td);
462}
463
464/*
465 * this function is called when a whole contact has been processed,
466 * so that it can assign it to a slot and store the data there
467 */
468static void mt_complete_slot(struct mt_device *td)
469{
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100470 td->curdata.seen_in_this_frame = true;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100471 if (td->curvalid) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100472 int slotnum = mt_compute_slot(td);
473
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100474 if (slotnum >= 0 && slotnum < td->maxcontacts)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100475 td->slots[slotnum] = td->curdata;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100476 }
477 td->num_received++;
478}
479
480
481/*
482 * this function is called when a whole packet has been received and processed,
483 * so that it can decide what to send to the input layer.
484 */
485static void mt_emit_event(struct mt_device *td, struct input_dev *input)
486{
487 int i;
488
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100489 for (i = 0; i < td->maxcontacts; ++i) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100490 struct mt_slot *s = &(td->slots[i]);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100491 if ((td->mtclass.quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) &&
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100492 !s->seen_in_this_frame) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100493 s->touch_state = false;
494 }
495
496 input_mt_slot(input, i);
497 input_mt_report_slot_state(input, MT_TOOL_FINGER,
498 s->touch_state);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100499 if (s->touch_state) {
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100500 /* this finger is on the screen */
501 int wide = (s->w > s->h);
502 /* divided by two to match visual scale of touch */
503 int major = max(s->w, s->h) >> 1;
504 int minor = min(s->w, s->h) >> 1;
505
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100506 input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
507 input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100508 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100509 input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100510 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
511 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100512 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100513 s->seen_in_this_frame = false;
514
515 }
516
517 input_mt_report_pointer_emulation(input, true);
518 input_sync(input);
519 td->num_received = 0;
520}
521
522
523
524static int mt_event(struct hid_device *hid, struct hid_field *field,
525 struct hid_usage *usage, __s32 value)
526{
527 struct mt_device *td = hid_get_drvdata(hid);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100528 __s32 quirks = td->mtclass.quirks;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100529
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100530 if (hid->claimed & HID_CLAIMED_INPUT && td->slots) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100531 switch (usage->hid) {
532 case HID_DG_INRANGE:
Stephane Chattya062cc52011-09-17 22:27:30 +0200533 if (quirks & MT_QUIRK_ALWAYS_VALID)
534 td->curvalid = true;
535 else if (quirks & MT_QUIRK_VALID_IS_INRANGE)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100536 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100537 break;
538 case HID_DG_TIPSWITCH:
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100539 if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
540 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100541 td->curdata.touch_state = value;
542 break;
543 case HID_DG_CONFIDENCE:
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100544 if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE)
545 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100546 break;
547 case HID_DG_CONTACTID:
548 td->curdata.contactid = value;
549 break;
550 case HID_DG_TIPPRESSURE:
551 td->curdata.p = value;
552 break;
553 case HID_GD_X:
554 td->curdata.x = value;
555 break;
556 case HID_GD_Y:
557 td->curdata.y = value;
558 break;
559 case HID_DG_WIDTH:
560 td->curdata.w = value;
561 break;
562 case HID_DG_HEIGHT:
563 td->curdata.h = value;
564 break;
565 case HID_DG_CONTACTCOUNT:
566 /*
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100567 * Includes multi-packet support where subsequent
568 * packets are sent with zero contactcount.
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100569 */
570 if (value)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100571 td->num_expected = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100572 break;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100573 case HID_DG_TOUCH:
574 /* do nothing */
575 break;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100576
577 default:
578 /* fallback to the generic hidinput handling */
579 return 0;
580 }
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100581
Denis Kovalev2258e862012-02-14 00:50:33 -0800582 if (usage->hid == td->last_slot_field)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100583 mt_complete_slot(td);
584
585 if (field->index == td->last_field_index
586 && td->num_received >= td->num_expected)
587 mt_emit_event(td, field->hidinput->input);
588
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100589 }
590
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100591 /* we have handled the hidinput part, now remains hiddev */
592 if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
593 hid->hiddev_hid_event(hid, field, usage, value);
594
595 return 1;
596}
597
598static void mt_set_input_mode(struct hid_device *hdev)
599{
600 struct mt_device *td = hid_get_drvdata(hdev);
601 struct hid_report *r;
602 struct hid_report_enum *re;
603
604 if (td->inputmode < 0)
605 return;
606
607 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
608 r = re->report_id_hash[td->inputmode];
609 if (r) {
610 r->field[0]->value[0] = 0x02;
611 usbhid_submit_report(hdev, r, USB_DIR_OUT);
612 }
613}
614
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100615static void mt_set_maxcontacts(struct hid_device *hdev)
616{
617 struct mt_device *td = hid_get_drvdata(hdev);
618 struct hid_report *r;
619 struct hid_report_enum *re;
620 int fieldmax, max;
621
622 if (td->maxcontact_report_id < 0)
623 return;
624
625 if (!td->mtclass.maxcontacts)
626 return;
627
628 re = &hdev->report_enum[HID_FEATURE_REPORT];
629 r = re->report_id_hash[td->maxcontact_report_id];
630 if (r) {
631 max = td->mtclass.maxcontacts;
632 fieldmax = r->field[0]->logical_maximum;
633 max = min(fieldmax, max);
634 if (r->field[0]->value[0] != max) {
635 r->field[0]->value[0] = max;
636 usbhid_submit_report(hdev, r, USB_DIR_OUT);
637 }
638 }
639}
640
Henrik Rydberg4fa3a582012-05-01 08:40:01 +0200641static void mt_post_parse_default_settings(struct mt_device *td)
642{
643 __s32 quirks = td->mtclass.quirks;
644
645 /* unknown serial device needs special quirks */
646 if (td->touches_by_report == 1) {
647 quirks |= MT_QUIRK_ALWAYS_VALID;
648 quirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP;
649 quirks &= ~MT_QUIRK_VALID_IS_INRANGE;
650 quirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE;
651 }
652
653 td->mtclass.quirks = quirks;
654}
655
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100656static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
657{
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100658 int ret, i;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100659 struct mt_device *td;
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100660 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
661
Benjamin Tissoires8d179a92012-03-06 17:57:04 +0100662 if (id) {
663 for (i = 0; mt_classes[i].name ; i++) {
664 if (id->driver_data == mt_classes[i].name) {
665 mtclass = &(mt_classes[i]);
666 break;
667 }
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100668 }
669 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100670
Henrik Rydbergd682bd72011-11-01 15:26:31 +0100671 /* This allows the driver to correctly support devices
672 * that emit events over several HID messages.
673 */
674 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100675
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100676 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100677 if (!td) {
678 dev_err(&hdev->dev, "cannot allocate multitouch data\n");
679 return -ENOMEM;
680 }
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100681 td->mtclass = *mtclass;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100682 td->inputmode = -1;
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100683 td->maxcontact_report_id = -1;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100684 hid_set_drvdata(hdev, td);
685
686 ret = hid_parse(hdev);
687 if (ret != 0)
688 goto fail;
689
690 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100691 if (ret)
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100692 goto fail;
693
Henrik Rydberg4fa3a582012-05-01 08:40:01 +0200694 if (id->vendor == HID_ANY_ID && id->product == HID_ANY_ID)
695 mt_post_parse_default_settings(td);
Benjamin Tissoires9e87f222012-03-06 17:57:06 +0100696
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100697 td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
698 GFP_KERNEL);
699 if (!td->slots) {
700 dev_err(&hdev->dev, "cannot allocate multitouch slots\n");
701 hid_hw_stop(hdev);
702 ret = -ENOMEM;
703 goto fail;
704 }
705
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100706 ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group);
707
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100708 mt_set_maxcontacts(hdev);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100709 mt_set_input_mode(hdev);
710
711 return 0;
712
713fail:
714 kfree(td);
715 return ret;
716}
717
718#ifdef CONFIG_PM
719static int mt_reset_resume(struct hid_device *hdev)
720{
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100721 mt_set_maxcontacts(hdev);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100722 mt_set_input_mode(hdev);
723 return 0;
724}
725#endif
726
727static void mt_remove(struct hid_device *hdev)
728{
729 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100730 sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100731 hid_hw_stop(hdev);
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100732 kfree(td->slots);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100733 kfree(td);
734 hid_set_drvdata(hdev, NULL);
735}
736
737static const struct hid_device_id mt_devices[] = {
738
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100739 /* 3M panels */
740 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200741 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100742 USB_DEVICE_ID_3M1968) },
743 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200744 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100745 USB_DEVICE_ID_3M2256) },
Benjamin Tissoiresc4fad872011-12-23 15:41:00 +0100746 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200747 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresc4fad872011-12-23 15:41:00 +0100748 USB_DEVICE_ID_3M3266) },
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100749
Benjamin Tissoirese6aac342011-05-19 14:18:13 +0200750 /* ActionStar panels */
751 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200752 MT_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR,
Benjamin Tissoirese6aac342011-05-19 14:18:13 +0200753 USB_DEVICE_ID_ACTIONSTAR_1011) },
754
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100755 /* Atmel panels */
756 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200757 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL,
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100758 USB_DEVICE_ID_ATMEL_MULTITOUCH) },
Benjamin Tissoires841cb152012-03-06 10:53:45 +0100759 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200760 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL,
Benjamin Tissoires841cb152012-03-06 10:53:45 +0100761 USB_DEVICE_ID_ATMEL_MXT_DIGITIZER) },
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100762
Jiri Kosina9ed32692012-04-20 12:15:44 +0200763 /* Baanto multitouch devices */
764 { .driver_data = MT_CLS_DEFAULT,
Jiri Kosina16b79bb2012-05-05 23:32:54 +0200765 MT_USB_DEVICE(USB_VENDOR_ID_BAANTO,
Jiri Kosina9ed32692012-04-20 12:15:44 +0200766 USB_DEVICE_ID_BAANTO_MT_190W2) },
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100767 /* Cando panels */
768 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200769 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100770 USB_DEVICE_ID_CANDO_MULTI_TOUCH) },
771 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200772 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100773 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) },
774 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200775 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100776 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) },
777 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200778 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100779 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },
780
Austin Zhang942fd422011-05-28 02:03:47 +0800781 /* Chunghwa Telecom touch panels */
782 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200783 MT_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT,
Austin Zhang942fd422011-05-28 02:03:47 +0800784 USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) },
785
Benjamin Tissoires79603dc2011-05-19 14:18:14 +0200786 /* CVTouch panels */
787 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200788 MT_USB_DEVICE(USB_VENDOR_ID_CVTOUCH,
Benjamin Tissoires79603dc2011-05-19 14:18:14 +0200789 USB_DEVICE_ID_CVTOUCH_SCREEN) },
790
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100791 /* Cypress panel */
792 { .driver_data = MT_CLS_CYPRESS,
793 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS,
794 USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
795
Benjamin Tissoires22408282011-05-20 15:59:34 +0200796 /* eGalax devices (resistive) */
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100797 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200798 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100799 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) },
800 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200801 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100802 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200803
804 /* eGalax devices (capacitive) */
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100805 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200806 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100807 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100808 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200809 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100810 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7207) },
811 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200812 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100813 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E) },
814 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200815 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100816 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7224) },
Benjamin Tissoires2ce09df2012-03-06 17:57:02 +0100817 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200818 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoires2ce09df2012-03-06 17:57:02 +0100819 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_722A) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100820 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200821 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100822 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100823 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200824 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100825 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7262) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100826 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200827 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100828 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100829 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200830 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100831 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72AA) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100832 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200833 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoires66f06122011-11-23 10:54:33 +0100834 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA) },
835 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200836 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Marek Vasutbb9ff212011-11-23 10:54:32 +0100837 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) },
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100838 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200839 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100840 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349) },
841 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200842 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100843 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200844
Benjamin Tissoiresc04abee2011-05-19 11:37:29 +0200845 /* Elo TouchSystems IntelliTouch Plus panel */
846 { .driver_data = MT_CLS_DUAL_NSMU_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200847 MT_USB_DEVICE(USB_VENDOR_ID_ELO,
Benjamin Tissoiresc04abee2011-05-19 11:37:29 +0200848 USB_DEVICE_ID_ELO_TS2515) },
849
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100850 /* GeneralTouch panel */
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100851 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200852 MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100853 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) },
854
Andreas Nielsen4d5df5d2012-03-19 15:41:03 +0100855 /* Gametel game controller */
856 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200857 MT_BT_DEVICE(USB_VENDOR_ID_FRUCTEL,
Andreas Nielsen4d5df5d2012-03-19 15:41:03 +0100858 USB_DEVICE_ID_GAMETEL_MT_MODE) },
859
Benjamin Tissoiresee0fbd12011-05-19 14:18:15 +0200860 /* GoodTouch panels */
861 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200862 MT_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH,
Benjamin Tissoiresee0fbd12011-05-19 14:18:15 +0200863 USB_DEVICE_ID_GOODTOUCH_000f) },
864
Benjamin Tissoires54580362011-11-29 13:13:12 +0100865 /* Hanvon panels */
866 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200867 MT_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT,
Benjamin Tissoires54580362011-11-29 13:13:12 +0100868 USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) },
869
Stephane Chattya062cc52011-09-17 22:27:30 +0200870 /* Ideacom panel */
871 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200872 MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
Stephane Chattya062cc52011-09-17 22:27:30 +0200873 USB_DEVICE_ID_IDEACOM_IDC6650) },
Benjamin Tissoires71078b02012-03-06 10:53:46 +0100874 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200875 MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
Benjamin Tissoires71078b02012-03-06 10:53:46 +0100876 USB_DEVICE_ID_IDEACOM_IDC6651) },
Stephane Chattya062cc52011-09-17 22:27:30 +0200877
Austin Zhang4e61f0d2011-05-09 23:54:14 +0800878 /* Ilitek dual touch panel */
879 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200880 MT_USB_DEVICE(USB_VENDOR_ID_ILITEK,
Austin Zhang4e61f0d2011-05-09 23:54:14 +0800881 USB_DEVICE_ID_ILITEK_MULTITOUCH) },
882
Benjamin Tissoires4dfcced2011-01-31 11:28:22 +0100883 /* IRTOUCH panels */
884 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200885 MT_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS,
Benjamin Tissoires4dfcced2011-01-31 11:28:22 +0100886 USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
887
Jeff Brownc50bb1a2011-08-15 21:12:09 -0700888 /* LG Display panels */
889 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200890 MT_USB_DEVICE(USB_VENDOR_ID_LG,
Jeff Brownc50bb1a2011-08-15 21:12:09 -0700891 USB_DEVICE_ID_LG_MULTITOUCH) },
892
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200893 /* Lumio panels */
894 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200895 MT_USB_DEVICE(USB_VENDOR_ID_LUMIO,
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200896 USB_DEVICE_ID_CRYSTALTOUCH) },
Benjamin Tissoiresc3ead6d2011-06-21 15:01:55 +0200897 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200898 MT_USB_DEVICE(USB_VENDOR_ID_LUMIO,
Benjamin Tissoiresc3ead6d2011-06-21 15:01:55 +0200899 USB_DEVICE_ID_CRYSTALTOUCH_DUAL) },
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200900
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200901 /* MosArt panels */
902 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200903 MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200904 USB_DEVICE_ID_ASUS_T91MT)},
905 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200906 MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200907 USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) },
908 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200909 MT_USB_DEVICE(USB_VENDOR_ID_TURBOX,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200910 USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) },
911
Denis Kovalev2258e862012-02-14 00:50:33 -0800912 /* Panasonic panels */
913 { .driver_data = MT_CLS_PANASONIC,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200914 MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
Denis Kovalev2258e862012-02-14 00:50:33 -0800915 USB_DEVICE_ID_PANABOARD_UBT780) },
916 { .driver_data = MT_CLS_PANASONIC,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200917 MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
Denis Kovalev2258e862012-02-14 00:50:33 -0800918 USB_DEVICE_ID_PANABOARD_UBT880) },
919
John Sung6ab3a9a2011-04-21 16:21:52 +0200920 /* PenMount panels */
921 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200922 MT_USB_DEVICE(USB_VENDOR_ID_PENMOUNT,
John Sung6ab3a9a2011-04-21 16:21:52 +0200923 USB_DEVICE_ID_PENMOUNT_PCI) },
924
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800925 /* PixArt optical touch screen */
926 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200927 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800928 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN) },
929 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200930 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800931 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1) },
932 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200933 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800934 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2) },
935
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100936 /* PixCir-based panels */
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100937 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200938 MT_USB_DEVICE(USB_VENDOR_ID_HANVON,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100939 USB_DEVICE_ID_HANVON_MULTITOUCH) },
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100940 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200941 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100942 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
943
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100944 /* Quanta-based panels */
945 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200946 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100947 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) },
948 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200949 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100950 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001) },
951 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200952 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100953 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008) },
954
Benjamin Tissoires043b4032011-03-18 14:27:53 +0100955 /* Stantum panels */
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +0200956 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200957 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM,
Benjamin Tissoires043b4032011-03-18 14:27:53 +0100958 USB_DEVICE_ID_MTP)},
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +0200959 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200960 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM,
Benjamin Tissoires043b4032011-03-18 14:27:53 +0100961 USB_DEVICE_ID_MTP_STM)},
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +0200962 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200963 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX,
Benjamin Tissoires043b4032011-03-18 14:27:53 +0100964 USB_DEVICE_ID_MTP_SITRONIX)},
965
Benjamin Tissoires847672c2012-02-04 17:08:50 +0100966 /* TopSeed panels */
967 { .driver_data = MT_CLS_TOPSEED,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200968 MT_USB_DEVICE(USB_VENDOR_ID_TOPSEED2,
Benjamin Tissoires847672c2012-02-04 17:08:50 +0100969 USB_DEVICE_ID_TOPSEED2_PERIPAD_701) },
970
Benjamin Tissoires5e74e562011-05-19 14:18:16 +0200971 /* Touch International panels */
972 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200973 MT_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL,
Benjamin Tissoires5e74e562011-05-19 14:18:16 +0200974 USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) },
975
Benjamin Tissoires617b64f2011-05-19 14:18:17 +0200976 /* Unitec panels */
977 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200978 MT_USB_DEVICE(USB_VENDOR_ID_UNITEC,
Benjamin Tissoires617b64f2011-05-19 14:18:17 +0200979 USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) },
980 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200981 MT_USB_DEVICE(USB_VENDOR_ID_UNITEC,
Benjamin Tissoires617b64f2011-05-19 14:18:17 +0200982 USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) },
ice chienbc8a2a92011-07-15 16:58:06 +0800983 /* XAT */
984 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200985 MT_USB_DEVICE(USB_VENDOR_ID_XAT,
ice chienbc8a2a92011-07-15 16:58:06 +0800986 USB_DEVICE_ID_XAT_CSR) },
Benjamin Tissoires617b64f2011-05-19 14:18:17 +0200987
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +0900988 /* Xiroku */
989 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200990 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +0900991 USB_DEVICE_ID_XIROKU_SPX) },
992 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200993 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +0900994 USB_DEVICE_ID_XIROKU_MPX) },
995 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200996 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +0900997 USB_DEVICE_ID_XIROKU_CSR) },
998 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200999 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001000 USB_DEVICE_ID_XIROKU_SPX1) },
1001 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001002 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001003 USB_DEVICE_ID_XIROKU_MPX1) },
1004 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001005 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001006 USB_DEVICE_ID_XIROKU_CSR1) },
1007 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001008 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001009 USB_DEVICE_ID_XIROKU_SPX2) },
1010 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001011 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001012 USB_DEVICE_ID_XIROKU_MPX2) },
1013 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001014 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001015 USB_DEVICE_ID_XIROKU_CSR2) },
1016
Henrik Rydberg4fa3a582012-05-01 08:40:01 +02001017 /* Generic MT device */
1018 { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) },
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001019 { }
1020};
1021MODULE_DEVICE_TABLE(hid, mt_devices);
1022
1023static const struct hid_usage_id mt_grabbed_usages[] = {
1024 { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
1025 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
1026};
1027
1028static struct hid_driver mt_driver = {
1029 .name = "hid-multitouch",
1030 .id_table = mt_devices,
1031 .probe = mt_probe,
1032 .remove = mt_remove,
1033 .input_mapping = mt_input_mapping,
1034 .input_mapped = mt_input_mapped,
1035 .feature_mapping = mt_feature_mapping,
1036 .usage_table = mt_grabbed_usages,
1037 .event = mt_event,
1038#ifdef CONFIG_PM
1039 .reset_resume = mt_reset_resume,
1040#endif
1041};
1042
1043static int __init mt_init(void)
1044{
1045 return hid_register_driver(&mt_driver);
1046}
1047
1048static void __exit mt_exit(void)
1049{
1050 hid_unregister_driver(&mt_driver);
1051}
1052
1053module_init(mt_init);
1054module_exit(mt_exit);