blob: ee0b76b398cb5a6a6fcda16dedbadff404d8f643 [file] [log] [blame]
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001/*
2 * HID driver for multitouch panels
3 *
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +01004 * Copyright (c) 2010-2012 Stephane Chatty <chatty@enac.fr>
5 * Copyright (c) 2010-2012 Benjamin Tissoires <benjamin.tissoires@gmail.com>
6 * Copyright (c) 2010-2012 Ecole Nationale de l'Aviation Civile, France
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01007 *
Richard Nauber4875ac12011-03-09 06:20:57 +01008 * This code is partly based on hid-egalax.c:
9 *
10 * Copyright (c) 2010 Stephane Chatty <chatty@enac.fr>
11 * Copyright (c) 2010 Henrik Rydberg <rydberg@euromail.se>
12 * Copyright (c) 2010 Canonical, Ltd.
13 *
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +010014 * This code is partly based on hid-3m-pct.c:
15 *
16 * Copyright (c) 2009-2010 Stephane Chatty <chatty@enac.fr>
17 * Copyright (c) 2010 Henrik Rydberg <rydberg@euromail.se>
18 * Copyright (c) 2010 Canonical, Ltd.
19 *
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010020 */
21
22/*
23 * This program is free software; you can redistribute it and/or modify it
24 * under the terms of the GNU General Public License as published by the Free
25 * Software Foundation; either version 2 of the License, or (at your option)
26 * any later version.
27 */
28
29#include <linux/device.h>
30#include <linux/hid.h>
31#include <linux/module.h>
32#include <linux/slab.h>
33#include <linux/usb.h>
34#include <linux/input/mt.h>
35#include "usbhid/usbhid.h"
36
37
38MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>");
Benjamin Tissoiresef2fafb2011-01-31 11:28:21 +010039MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>");
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010040MODULE_DESCRIPTION("HID multitouch panels");
41MODULE_LICENSE("GPL");
42
43#include "hid-ids.h"
44
45/* quirks to control the device */
46#define MT_QUIRK_NOT_SEEN_MEANS_UP (1 << 0)
47#define MT_QUIRK_SLOT_IS_CONTACTID (1 << 1)
Benjamin Tissoires2d936662011-01-11 16:45:54 +010048#define MT_QUIRK_CYPRESS (1 << 2)
Benjamin Tissoires5572da02011-01-07 23:47:27 +010049#define MT_QUIRK_SLOT_IS_CONTACTNUMBER (1 << 3)
Stephane Chattya062cc52011-09-17 22:27:30 +020050#define MT_QUIRK_ALWAYS_VALID (1 << 4)
51#define MT_QUIRK_VALID_IS_INRANGE (1 << 5)
52#define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 6)
Stephane Chattya062cc52011-09-17 22:27:30 +020053#define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE (1 << 8)
Henrik Rydberg77723e32012-09-07 19:37:40 +020054#define MT_QUIRK_NO_AREA (1 << 9)
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010055
56struct mt_slot {
57 __s32 x, y, p, w, h;
58 __s32 contactid; /* the device ContactID assigned to this slot */
59 bool touch_state; /* is the touch valid? */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010060};
61
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010062struct mt_class {
Benjamin Tissoires2d936662011-01-11 16:45:54 +010063 __s32 name; /* MT_CLS */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010064 __s32 quirks;
65 __s32 sn_move; /* Signal/noise ratio for move events */
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +010066 __s32 sn_width; /* Signal/noise ratio for width events */
67 __s32 sn_height; /* Signal/noise ratio for height events */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010068 __s32 sn_pressure; /* Signal/noise ratio for pressure events */
69 __u8 maxcontacts;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +010070 bool is_indirect; /* true for touchpads */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010071};
72
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +020073struct mt_fields {
74 unsigned usages[HID_MAX_FIELDS];
75 unsigned int length;
76};
77
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010078struct mt_device {
79 struct mt_slot curdata; /* placeholder of incoming data */
Benjamin Tissoireseec29e32011-11-23 10:54:28 +010080 struct mt_class mtclass; /* our mt device class */
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +020081 struct mt_fields *fields; /* temporary placeholder for storing the
82 multitouch fields */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010083 unsigned last_field_index; /* last field index of the report */
84 unsigned last_slot_field; /* the last field of a slot */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010085 __s8 inputmode; /* InputMode HID feature, -1 if non-existent */
Benjamin Tissoires4aceed32012-06-19 14:39:52 +020086 __s8 inputmode_index; /* InputMode HID feature index in the report */
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +010087 __s8 maxcontact_report_id; /* Maximum Contact Number HID feature,
88 -1 if non-existent */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010089 __u8 num_received; /* how many contacts we received */
90 __u8 num_expected; /* expected last contact index */
91 __u8 maxcontacts;
Benjamin Tissoires9e87f222012-03-06 17:57:06 +010092 __u8 touches_by_report; /* how many touches are present in one report:
93 * 1 means we should use a serial protocol
94 * > 1 means hybrid (multitouch) protocol */
Henrik Rydberg76f59022012-09-01 20:11:34 +020095 bool serial_maybe; /* need to check for serial protocol */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010096 bool curvalid; /* is the current contact valid? */
Henrik Rydberg76f59022012-09-01 20:11:34 +020097 unsigned mt_flags; /* flags to pass to input-mt */
Benjamin Tissoires5519cab2011-01-07 23:45:50 +010098};
99
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100100/* classes of device behavior */
Benjamin Tissoires22408282011-05-20 15:59:34 +0200101#define MT_CLS_DEFAULT 0x0001
102
Stephane Chattya062cc52011-09-17 22:27:30 +0200103#define MT_CLS_SERIAL 0x0002
104#define MT_CLS_CONFIDENCE 0x0003
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100105#define MT_CLS_CONFIDENCE_CONTACT_ID 0x0004
106#define MT_CLS_CONFIDENCE_MINUS_ONE 0x0005
107#define MT_CLS_DUAL_INRANGE_CONTACTID 0x0006
108#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 0x0007
109#define MT_CLS_DUAL_NSMU_CONTACTID 0x0008
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800110#define MT_CLS_INRANGE_CONTACTNUMBER 0x0009
Benjamin Tissoires22408282011-05-20 15:59:34 +0200111
112/* vendor specific classes */
113#define MT_CLS_3M 0x0101
114#define MT_CLS_CYPRESS 0x0102
115#define MT_CLS_EGALAX 0x0103
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100116#define MT_CLS_EGALAX_SERIAL 0x0104
Benjamin Tissoires847672c2012-02-04 17:08:50 +0100117#define MT_CLS_TOPSEED 0x0105
Denis Kovalev2258e862012-02-14 00:50:33 -0800118#define MT_CLS_PANASONIC 0x0106
Henrik Rydberg77723e32012-09-07 19:37:40 +0200119#define MT_CLS_FLATFROG 0x0107
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
Jiri Kosinab3c21d22011-11-22 23:23:37 +0100139static struct mt_class mt_classes[] = {
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100140 { .name = MT_CLS_DEFAULT,
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100141 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP },
Stephane Chattya062cc52011-09-17 22:27:30 +0200142 { .name = MT_CLS_SERIAL,
143 .quirks = MT_QUIRK_ALWAYS_VALID},
Benjamin Tissoires22408282011-05-20 15:59:34 +0200144 { .name = MT_CLS_CONFIDENCE,
145 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE },
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100146 { .name = MT_CLS_CONFIDENCE_CONTACT_ID,
147 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
148 MT_QUIRK_SLOT_IS_CONTACTID },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200149 { .name = MT_CLS_CONFIDENCE_MINUS_ONE,
150 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
151 MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE },
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100152 { .name = MT_CLS_DUAL_INRANGE_CONTACTID,
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100153 .quirks = MT_QUIRK_VALID_IS_INRANGE |
154 MT_QUIRK_SLOT_IS_CONTACTID,
155 .maxcontacts = 2 },
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100156 { .name = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100157 .quirks = MT_QUIRK_VALID_IS_INRANGE |
158 MT_QUIRK_SLOT_IS_CONTACTNUMBER,
159 .maxcontacts = 2 },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200160 { .name = MT_CLS_DUAL_NSMU_CONTACTID,
161 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
162 MT_QUIRK_SLOT_IS_CONTACTID,
163 .maxcontacts = 2 },
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800164 { .name = MT_CLS_INRANGE_CONTACTNUMBER,
165 .quirks = MT_QUIRK_VALID_IS_INRANGE |
166 MT_QUIRK_SLOT_IS_CONTACTNUMBER },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200167
168 /*
169 * vendor specific classes
170 */
171 { .name = MT_CLS_3M,
172 .quirks = MT_QUIRK_VALID_IS_CONFIDENCE |
173 MT_QUIRK_SLOT_IS_CONTACTID,
174 .sn_move = 2048,
175 .sn_width = 128,
Henrik Rydbergc5d40be2012-09-05 16:58:12 +0200176 .sn_height = 128,
177 .maxcontacts = 60,
178 },
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100179 { .name = MT_CLS_CYPRESS,
180 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
181 MT_QUIRK_CYPRESS,
182 .maxcontacts = 10 },
Richard Nauber4875ac12011-03-09 06:20:57 +0100183 { .name = MT_CLS_EGALAX,
184 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
Benjamin Tissoires2261bb92011-11-23 10:54:29 +0100185 MT_QUIRK_VALID_IS_INRANGE,
Richard Nauber4875ac12011-03-09 06:20:57 +0100186 .sn_move = 4096,
187 .sn_pressure = 32,
188 },
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100189 { .name = MT_CLS_EGALAX_SERIAL,
190 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
191 MT_QUIRK_ALWAYS_VALID,
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100192 .sn_move = 4096,
193 .sn_pressure = 32,
194 },
Benjamin Tissoires847672c2012-02-04 17:08:50 +0100195 { .name = MT_CLS_TOPSEED,
196 .quirks = MT_QUIRK_ALWAYS_VALID,
197 .is_indirect = true,
198 .maxcontacts = 2,
199 },
Denis Kovalev2258e862012-02-14 00:50:33 -0800200 { .name = MT_CLS_PANASONIC,
201 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP,
202 .maxcontacts = 4 },
Benjamin Tissoires043b4032011-03-18 14:27:53 +0100203
Henrik Rydberg77723e32012-09-07 19:37:40 +0200204 { .name = MT_CLS_FLATFROG,
205 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
206 MT_QUIRK_NO_AREA,
207 .sn_move = 2048,
208 .maxcontacts = 40,
209 },
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100210 { }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100211};
212
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100213static ssize_t mt_show_quirks(struct device *dev,
214 struct device_attribute *attr,
215 char *buf)
216{
217 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
218 struct mt_device *td = hid_get_drvdata(hdev);
219
220 return sprintf(buf, "%u\n", td->mtclass.quirks);
221}
222
223static ssize_t mt_set_quirks(struct device *dev,
224 struct device_attribute *attr,
225 const char *buf, size_t count)
226{
227 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
228 struct mt_device *td = hid_get_drvdata(hdev);
229
230 unsigned long val;
231
232 if (kstrtoul(buf, 0, &val))
233 return -EINVAL;
234
235 td->mtclass.quirks = val;
236
237 return count;
238}
239
240static DEVICE_ATTR(quirks, S_IWUSR | S_IRUGO, mt_show_quirks, mt_set_quirks);
241
242static struct attribute *sysfs_attrs[] = {
243 &dev_attr_quirks.attr,
244 NULL
245};
246
247static struct attribute_group mt_attribute_group = {
248 .attrs = sysfs_attrs
249};
250
Henrik Rydbergf635bd12011-02-24 19:30:59 +0100251static void mt_feature_mapping(struct hid_device *hdev,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100252 struct hid_field *field, struct hid_usage *usage)
253{
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100254 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoires4aceed32012-06-19 14:39:52 +0200255 int i;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100256
257 switch (usage->hid) {
258 case HID_DG_INPUTMODE:
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100259 td->inputmode = field->report->id;
Benjamin Tissoires4aceed32012-06-19 14:39:52 +0200260 td->inputmode_index = 0; /* has to be updated below */
261
262 for (i=0; i < field->maxusage; i++) {
263 if (field->usage[i].hid == usage->hid) {
264 td->inputmode_index = i;
265 break;
266 }
267 }
268
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100269 break;
270 case HID_DG_CONTACTMAX:
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100271 td->maxcontact_report_id = field->report->id;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100272 td->maxcontacts = field->value[0];
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100273 if (td->mtclass.maxcontacts)
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100274 /* check if the maxcontacts is given by the class */
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100275 td->maxcontacts = td->mtclass.maxcontacts;
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100276
277 break;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100278 }
279}
280
281static void set_abs(struct input_dev *input, unsigned int code,
282 struct hid_field *field, int snratio)
283{
284 int fmin = field->logical_minimum;
285 int fmax = field->logical_maximum;
286 int fuzz = snratio ? (fmax - fmin) / snratio : 0;
287 input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
288}
289
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200290static void mt_store_field(struct hid_usage *usage, struct mt_device *td,
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100291 struct hid_input *hi)
292{
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200293 struct mt_fields *f = td->fields;
294
295 if (f->length >= HID_MAX_FIELDS)
296 return;
297
298 f->usages[f->length++] = usage->hid;
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100299}
300
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100301static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
302 struct hid_field *field, struct hid_usage *usage,
303 unsigned long **bit, int *max)
304{
305 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100306 struct mt_class *cls = &td->mtclass;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100307 int code;
Richard Nauber4875ac12011-03-09 06:20:57 +0100308
Jeff Brown658d4aed592011-08-15 16:44:28 -0700309 /* Only map fields from TouchScreen or TouchPad collections.
Denis Kovalev2258e862012-02-14 00:50:33 -0800310 * We need to ignore fields that belong to other collections
311 * such as Mouse that might have the same GenericDesktop usages. */
Jeff Brown658d4aed592011-08-15 16:44:28 -0700312 if (field->application == HID_DG_TOUCHSCREEN)
Henrik Rydberg76f59022012-09-01 20:11:34 +0200313 td->mt_flags |= INPUT_MT_DIRECT;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100314 else if (field->application != HID_DG_TOUCHPAD)
Jeff Brown658d4aed592011-08-15 16:44:28 -0700315 return 0;
316
Henrik Rydberg76f59022012-09-01 20:11:34 +0200317 /*
318 * Model touchscreens providing buttons as touchpads.
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100319 */
320 if (field->application == HID_DG_TOUCHPAD ||
Henrik Rydberg76f59022012-09-01 20:11:34 +0200321 (usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON)
322 td->mt_flags |= INPUT_MT_POINTER;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100323
Benjamin Tissoires2261bb92011-11-23 10:54:29 +0100324 /* eGalax devices provide a Digitizer.Stylus input which overrides
325 * the correct Digitizers.Finger X/Y ranges.
326 * Let's just ignore this input. */
327 if (field->physical == HID_DG_STYLUS)
328 return -1;
329
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100330 switch (usage->hid & HID_USAGE_PAGE) {
331
332 case HID_UP_GENDESK:
333 switch (usage->hid) {
334 case HID_GD_X:
335 hid_map_usage(hi, usage, bit, max,
336 EV_ABS, ABS_MT_POSITION_X);
337 set_abs(hi->input, ABS_MT_POSITION_X, field,
338 cls->sn_move);
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200339 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100340 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100341 return 1;
342 case HID_GD_Y:
343 hid_map_usage(hi, usage, bit, max,
344 EV_ABS, ABS_MT_POSITION_Y);
345 set_abs(hi->input, ABS_MT_POSITION_Y, field,
346 cls->sn_move);
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200347 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100348 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100349 return 1;
350 }
351 return 0;
352
353 case HID_UP_DIGITIZER:
354 switch (usage->hid) {
355 case HID_DG_INRANGE:
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200356 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100357 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100358 return 1;
359 case HID_DG_CONFIDENCE:
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200360 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100361 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100362 return 1;
363 case HID_DG_TIPSWITCH:
364 hid_map_usage(hi, usage, bit, max, EV_KEY, BTN_TOUCH);
365 input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200366 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100367 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100368 return 1;
369 case HID_DG_CONTACTID:
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200370 mt_store_field(usage, td, hi);
Benjamin Tissoires2955cae2011-04-21 14:15:59 +0200371 td->last_field_index = field->index;
Benjamin Tissoires9e87f222012-03-06 17:57:06 +0100372 td->touches_by_report++;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100373 return 1;
374 case HID_DG_WIDTH:
375 hid_map_usage(hi, usage, bit, max,
376 EV_ABS, ABS_MT_TOUCH_MAJOR);
Henrik Rydberg77723e32012-09-07 19:37:40 +0200377 if (!(cls->quirks & MT_QUIRK_NO_AREA))
378 set_abs(hi->input, ABS_MT_TOUCH_MAJOR, field,
379 cls->sn_width);
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200380 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100381 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100382 return 1;
383 case HID_DG_HEIGHT:
384 hid_map_usage(hi, usage, bit, max,
385 EV_ABS, ABS_MT_TOUCH_MINOR);
Henrik Rydberg77723e32012-09-07 19:37:40 +0200386 if (!(cls->quirks & MT_QUIRK_NO_AREA)) {
387 set_abs(hi->input, ABS_MT_TOUCH_MINOR, field,
388 cls->sn_height);
389 input_set_abs_params(hi->input,
Benjamin Tissoires1e648a12011-03-18 14:27:55 +0100390 ABS_MT_ORIENTATION, 0, 1, 0, 0);
Henrik Rydberg77723e32012-09-07 19:37:40 +0200391 }
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200392 mt_store_field(usage, td, hi);
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100393 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100394 return 1;
395 case HID_DG_TIPPRESSURE:
396 hid_map_usage(hi, usage, bit, max,
397 EV_ABS, ABS_MT_PRESSURE);
398 set_abs(hi->input, ABS_MT_PRESSURE, field,
399 cls->sn_pressure);
Benjamin Tissoires3ac36d152012-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_CONTACTCOUNT:
Benjamin Tissoiresed9d5c92012-03-06 17:57:03 +0100404 td->last_field_index = field->index;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100405 return 1;
406 case HID_DG_CONTACTMAX:
407 /* we don't set td->last_slot_field as contactcount and
408 * contact max are global to the report */
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 }
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100412 case HID_DG_TOUCH:
413 /* Legacy devices use TIPSWITCH and not TOUCH.
414 * Let's just ignore this field. */
415 return -1;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100416 /* let hid-input decide for the others */
417 return 0;
418
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100419 case HID_UP_BUTTON:
420 code = BTN_MOUSE + ((usage->hid - 1) & HID_USAGE);
421 hid_map_usage(hi, usage, bit, max, EV_KEY, code);
422 input_set_capability(hi->input, EV_KEY, code);
423 return 1;
424
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100425 case 0xff000000:
426 /* we do not want to map these: no input-oriented meaning */
427 return -1;
428 }
429
430 return 0;
431}
432
433static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
434 struct hid_field *field, struct hid_usage *usage,
435 unsigned long **bit, int *max)
436{
437 if (usage->type == EV_KEY || usage->type == EV_ABS)
438 set_bit(usage->type, hi->input->evbit);
439
440 return -1;
441}
442
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200443static int mt_compute_slot(struct mt_device *td, struct input_dev *input)
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100444{
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100445 __s32 quirks = td->mtclass.quirks;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100446
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100447 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID)
448 return td->curdata.contactid;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100449
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100450 if (quirks & MT_QUIRK_CYPRESS)
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100451 return cypress_compute_slot(td);
452
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100453 if (quirks & MT_QUIRK_SLOT_IS_CONTACTNUMBER)
454 return td->num_received;
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100455
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200456 if (quirks & MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE)
457 return td->curdata.contactid - 1;
458
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200459 return input_mt_get_slot_by_key(input, td->curdata.contactid);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100460}
461
462/*
463 * this function is called when a whole contact has been processed,
464 * so that it can assign it to a slot and store the data there
465 */
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200466static void mt_complete_slot(struct mt_device *td, struct input_dev *input)
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100467{
468 if (td->curvalid) {
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200469 int slotnum = mt_compute_slot(td, input);
470 struct mt_slot *s = &td->curdata;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100471
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200472 if (slotnum < 0 || slotnum >= td->maxcontacts)
473 return;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100474
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200475 input_mt_slot(input, slotnum);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100476 input_mt_report_slot_state(input, MT_TOOL_FINGER,
477 s->touch_state);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100478 if (s->touch_state) {
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100479 /* this finger is on the screen */
480 int wide = (s->w > s->h);
481 /* divided by two to match visual scale of touch */
482 int major = max(s->w, s->h) >> 1;
483 int minor = min(s->w, s->h) >> 1;
484
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100485 input_event(input, EV_ABS, ABS_MT_POSITION_X, s->x);
486 input_event(input, EV_ABS, ABS_MT_POSITION_Y, s->y);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100487 input_event(input, EV_ABS, ABS_MT_ORIENTATION, wide);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100488 input_event(input, EV_ABS, ABS_MT_PRESSURE, s->p);
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100489 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
490 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100491 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100492 }
493
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200494 td->num_received++;
495}
496
497/*
498 * this function is called when a whole packet has been received and processed,
499 * so that it can decide what to send to the input layer.
500 */
501static void mt_sync_frame(struct mt_device *td, struct input_dev *input)
502{
Henrik Rydberg76f59022012-09-01 20:11:34 +0200503 input_mt_sync_frame(input);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100504 input_sync(input);
505 td->num_received = 0;
506}
507
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100508static int mt_event(struct hid_device *hid, struct hid_field *field,
509 struct hid_usage *usage, __s32 value)
510{
511 struct mt_device *td = hid_get_drvdata(hid);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100512 __s32 quirks = td->mtclass.quirks;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100513
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200514 if (hid->claimed & HID_CLAIMED_INPUT) {
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100515 switch (usage->hid) {
516 case HID_DG_INRANGE:
Stephane Chattya062cc52011-09-17 22:27:30 +0200517 if (quirks & MT_QUIRK_ALWAYS_VALID)
518 td->curvalid = true;
519 else if (quirks & MT_QUIRK_VALID_IS_INRANGE)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100520 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100521 break;
522 case HID_DG_TIPSWITCH:
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100523 if (quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
524 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100525 td->curdata.touch_state = value;
526 break;
527 case HID_DG_CONFIDENCE:
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100528 if (quirks & MT_QUIRK_VALID_IS_CONFIDENCE)
529 td->curvalid = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100530 break;
531 case HID_DG_CONTACTID:
532 td->curdata.contactid = value;
533 break;
534 case HID_DG_TIPPRESSURE:
535 td->curdata.p = value;
536 break;
537 case HID_GD_X:
538 td->curdata.x = value;
539 break;
540 case HID_GD_Y:
541 td->curdata.y = value;
542 break;
543 case HID_DG_WIDTH:
544 td->curdata.w = value;
545 break;
546 case HID_DG_HEIGHT:
547 td->curdata.h = value;
548 break;
549 case HID_DG_CONTACTCOUNT:
550 /*
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100551 * Includes multi-packet support where subsequent
552 * packets are sent with zero contactcount.
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100553 */
554 if (value)
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100555 td->num_expected = value;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100556 break;
Benjamin Tissoiresc2ef8f22012-02-04 17:08:48 +0100557 case HID_DG_TOUCH:
558 /* do nothing */
559 break;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100560
561 default:
562 /* fallback to the generic hidinput handling */
563 return 0;
564 }
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100565
Denis Kovalev2258e862012-02-14 00:50:33 -0800566 if (usage->hid == td->last_slot_field)
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200567 mt_complete_slot(td, field->hidinput->input);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100568
569 if (field->index == td->last_field_index
570 && td->num_received >= td->num_expected)
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200571 mt_sync_frame(td, field->hidinput->input);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100572
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100573 }
574
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100575 /* we have handled the hidinput part, now remains hiddev */
576 if (hid->claimed & HID_CLAIMED_HIDDEV && hid->hiddev_hid_event)
577 hid->hiddev_hid_event(hid, field, usage, value);
578
579 return 1;
580}
581
582static void mt_set_input_mode(struct hid_device *hdev)
583{
584 struct mt_device *td = hid_get_drvdata(hdev);
585 struct hid_report *r;
586 struct hid_report_enum *re;
587
588 if (td->inputmode < 0)
589 return;
590
591 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
592 r = re->report_id_hash[td->inputmode];
593 if (r) {
Benjamin Tissoires4aceed32012-06-19 14:39:52 +0200594 r->field[0]->value[td->inputmode_index] = 0x02;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100595 usbhid_submit_report(hdev, r, USB_DIR_OUT);
596 }
597}
598
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100599static void mt_set_maxcontacts(struct hid_device *hdev)
600{
601 struct mt_device *td = hid_get_drvdata(hdev);
602 struct hid_report *r;
603 struct hid_report_enum *re;
604 int fieldmax, max;
605
606 if (td->maxcontact_report_id < 0)
607 return;
608
609 if (!td->mtclass.maxcontacts)
610 return;
611
612 re = &hdev->report_enum[HID_FEATURE_REPORT];
613 r = re->report_id_hash[td->maxcontact_report_id];
614 if (r) {
615 max = td->mtclass.maxcontacts;
616 fieldmax = r->field[0]->logical_maximum;
617 max = min(fieldmax, max);
618 if (r->field[0]->value[0] != max) {
619 r->field[0]->value[0] = max;
620 usbhid_submit_report(hdev, r, USB_DIR_OUT);
621 }
622 }
623}
624
Henrik Rydberg4fa3a582012-05-01 08:40:01 +0200625static void mt_post_parse_default_settings(struct mt_device *td)
626{
627 __s32 quirks = td->mtclass.quirks;
628
629 /* unknown serial device needs special quirks */
630 if (td->touches_by_report == 1) {
631 quirks |= MT_QUIRK_ALWAYS_VALID;
632 quirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP;
633 quirks &= ~MT_QUIRK_VALID_IS_INRANGE;
634 quirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE;
635 }
636
637 td->mtclass.quirks = quirks;
638}
639
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200640static void mt_post_parse(struct mt_device *td)
641{
642 struct mt_fields *f = td->fields;
643
644 if (td->touches_by_report > 0) {
645 int field_count_per_touch = f->length / td->touches_by_report;
646 td->last_slot_field = f->usages[field_count_per_touch - 1];
647 }
648}
649
Henrik Rydberg76f59022012-09-01 20:11:34 +0200650static void mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
651
652{
653 struct mt_device *td = hid_get_drvdata(hdev);
654 struct mt_class *cls = &td->mtclass;
655 struct input_dev *input = hi->input;
656
657 /* Only initialize slots for MT input devices */
658 if (!test_bit(ABS_MT_POSITION_X, input->absbit))
659 return;
660
661 if (!td->maxcontacts)
662 td->maxcontacts = MT_DEFAULT_MAXCONTACT;
663
664 mt_post_parse(td);
665 if (td->serial_maybe)
666 mt_post_parse_default_settings(td);
667
668 if (cls->is_indirect)
669 td->mt_flags |= INPUT_MT_POINTER;
670
Henrik Rydberg3e1b5012012-09-01 19:46:58 +0200671 if (cls->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)
672 td->mt_flags |= INPUT_MT_DROP_UNUSED;
673
Henrik Rydberg76f59022012-09-01 20:11:34 +0200674 input_mt_init_slots(input, td->maxcontacts, td->mt_flags);
675
676 td->mt_flags = 0;
677}
678
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100679static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
680{
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100681 int ret, i;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100682 struct mt_device *td;
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100683 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
684
Benjamin Tissoires8d179a92012-03-06 17:57:04 +0100685 if (id) {
686 for (i = 0; mt_classes[i].name ; i++) {
687 if (id->driver_data == mt_classes[i].name) {
688 mtclass = &(mt_classes[i]);
689 break;
690 }
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100691 }
692 }
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100693
Henrik Rydbergd682bd72011-11-01 15:26:31 +0100694 /* This allows the driver to correctly support devices
695 * that emit events over several HID messages.
696 */
697 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100698
Benjamin Tissoires9498f952011-03-18 14:27:52 +0100699 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100700 if (!td) {
701 dev_err(&hdev->dev, "cannot allocate multitouch data\n");
702 return -ENOMEM;
703 }
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100704 td->mtclass = *mtclass;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100705 td->inputmode = -1;
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100706 td->maxcontact_report_id = -1;
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100707 hid_set_drvdata(hdev, td);
708
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200709 td->fields = kzalloc(sizeof(struct mt_fields), GFP_KERNEL);
710 if (!td->fields) {
711 dev_err(&hdev->dev, "cannot allocate multitouch fields data\n");
712 ret = -ENOMEM;
713 goto fail;
714 }
715
Henrik Rydberg76f59022012-09-01 20:11:34 +0200716 if (id->vendor == HID_ANY_ID && id->product == HID_ANY_ID)
717 td->serial_maybe = true;
718
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100719 ret = hid_parse(hdev);
720 if (ret != 0)
721 goto fail;
722
723 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
Benjamin Tissoires2d936662011-01-11 16:45:54 +0100724 if (ret)
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100725 goto fail;
726
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100727 ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group);
728
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100729 mt_set_maxcontacts(hdev);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100730 mt_set_input_mode(hdev);
731
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200732 kfree(td->fields);
733 td->fields = NULL;
734
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100735 return 0;
736
737fail:
Benjamin Tissoires3ac36d152012-05-04 14:53:46 +0200738 kfree(td->fields);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100739 kfree(td);
740 return ret;
741}
742
743#ifdef CONFIG_PM
744static int mt_reset_resume(struct hid_device *hdev)
745{
Benjamin Tissoires31ae9bd2012-02-04 17:08:49 +0100746 mt_set_maxcontacts(hdev);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100747 mt_set_input_mode(hdev);
748 return 0;
749}
750#endif
751
752static void mt_remove(struct hid_device *hdev)
753{
754 struct mt_device *td = hid_get_drvdata(hdev);
Benjamin Tissoireseec29e32011-11-23 10:54:28 +0100755 sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group);
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100756 hid_hw_stop(hdev);
757 kfree(td);
758 hid_set_drvdata(hdev, NULL);
759}
760
761static const struct hid_device_id mt_devices[] = {
762
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100763 /* 3M panels */
764 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200765 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100766 USB_DEVICE_ID_3M1968) },
767 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200768 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100769 USB_DEVICE_ID_3M2256) },
Benjamin Tissoiresc4fad872011-12-23 15:41:00 +0100770 { .driver_data = MT_CLS_3M,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200771 MT_USB_DEVICE(USB_VENDOR_ID_3M,
Benjamin Tissoiresc4fad872011-12-23 15:41:00 +0100772 USB_DEVICE_ID_3M3266) },
Benjamin Tissoiresf786bba2011-03-22 17:34:01 +0100773
Benjamin Tissoirese6aac342011-05-19 14:18:13 +0200774 /* ActionStar panels */
775 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200776 MT_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR,
Benjamin Tissoirese6aac342011-05-19 14:18:13 +0200777 USB_DEVICE_ID_ACTIONSTAR_1011) },
778
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100779 /* Atmel panels */
780 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200781 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL,
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100782 USB_DEVICE_ID_ATMEL_MULTITOUCH) },
Benjamin Tissoires841cb152012-03-06 10:53:45 +0100783 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200784 MT_USB_DEVICE(USB_VENDOR_ID_ATMEL,
Benjamin Tissoires841cb152012-03-06 10:53:45 +0100785 USB_DEVICE_ID_ATMEL_MXT_DIGITIZER) },
Benjamin Tissoiresb1057122011-12-23 15:40:59 +0100786
Jiri Kosina9ed32692012-04-20 12:15:44 +0200787 /* Baanto multitouch devices */
788 { .driver_data = MT_CLS_DEFAULT,
Jiri Kosina16b79bb2012-05-05 23:32:54 +0200789 MT_USB_DEVICE(USB_VENDOR_ID_BAANTO,
Jiri Kosina9ed32692012-04-20 12:15:44 +0200790 USB_DEVICE_ID_BAANTO_MT_190W2) },
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100791 /* Cando panels */
792 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200793 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100794 USB_DEVICE_ID_CANDO_MULTI_TOUCH) },
795 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200796 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100797 USB_DEVICE_ID_CANDO_MULTI_TOUCH_10_1) },
798 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200799 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100800 USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) },
801 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200802 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoiresa841b622011-03-18 14:27:54 +0100803 USB_DEVICE_ID_CANDO_MULTI_TOUCH_15_6) },
804
Austin Zhang942fd422011-05-28 02:03:47 +0800805 /* Chunghwa Telecom touch panels */
806 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200807 MT_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT,
Austin Zhang942fd422011-05-28 02:03:47 +0800808 USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) },
809
Benjamin Tissoires79603dc2011-05-19 14:18:14 +0200810 /* CVTouch panels */
811 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200812 MT_USB_DEVICE(USB_VENDOR_ID_CVTOUCH,
Benjamin Tissoires79603dc2011-05-19 14:18:14 +0200813 USB_DEVICE_ID_CVTOUCH_SCREEN) },
814
Benjamin Tissoiresa3b5e572011-01-07 23:46:30 +0100815 /* Cypress panel */
816 { .driver_data = MT_CLS_CYPRESS,
817 HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS,
818 USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
819
Benjamin Tissoires22408282011-05-20 15:59:34 +0200820 /* eGalax devices (resistive) */
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100821 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200822 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100823 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) },
824 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200825 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100826 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200827
828 /* eGalax devices (capacitive) */
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100829 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200830 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100831 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100832 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200833 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100834 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7207) },
835 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200836 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100837 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_725E) },
838 { .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_7224) },
Benjamin Tissoires2ce09df2012-03-06 17:57:02 +0100841 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200842 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoires2ce09df2012-03-06 17:57:02 +0100843 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_722A) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100844 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200845 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100846 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100847 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200848 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100849 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7262) },
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_72A1) },
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100853 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200854 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100855 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72AA) },
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100856 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200857 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoires66f06122011-11-23 10:54:33 +0100858 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA) },
859 { .driver_data = MT_CLS_EGALAX,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200860 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Marek Vasutbb9ff212011-11-23 10:54:32 +0100861 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) },
Benjamin Tissoires1b723e82011-11-23 10:54:34 +0100862 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200863 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoiresfd1d1522012-03-06 10:53:47 +0100864 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349) },
865 { .driver_data = MT_CLS_EGALAX_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200866 MT_USB_DEVICE(USB_VENDOR_ID_DWAV,
Benjamin Tissoirese36f6902011-11-23 10:54:31 +0100867 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) },
Benjamin Tissoires22408282011-05-20 15:59:34 +0200868
Benjamin Tissoiresc04abee2011-05-19 11:37:29 +0200869 /* Elo TouchSystems IntelliTouch Plus panel */
870 { .driver_data = MT_CLS_DUAL_NSMU_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200871 MT_USB_DEVICE(USB_VENDOR_ID_ELO,
Benjamin Tissoiresc04abee2011-05-19 11:37:29 +0200872 USB_DEVICE_ID_ELO_TS2515) },
873
Henrik Rydberg77723e32012-09-07 19:37:40 +0200874 /* Flatfrog Panels */
875 { .driver_data = MT_CLS_FLATFROG,
876 MT_USB_DEVICE(USB_VENDOR_ID_FLATFROG,
877 USB_DEVICE_ID_MULTITOUCH_3200) },
878
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100879 /* GeneralTouch panel */
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100880 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200881 MT_USB_DEVICE(USB_VENDOR_ID_GENERAL_TOUCH,
Benjamin Tissoires5572da02011-01-07 23:47:27 +0100882 USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS) },
883
Andreas Nielsen4d5df5d2012-03-19 15:41:03 +0100884 /* Gametel game controller */
885 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200886 MT_BT_DEVICE(USB_VENDOR_ID_FRUCTEL,
Andreas Nielsen4d5df5d2012-03-19 15:41:03 +0100887 USB_DEVICE_ID_GAMETEL_MT_MODE) },
888
Benjamin Tissoiresee0fbd12011-05-19 14:18:15 +0200889 /* GoodTouch panels */
890 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200891 MT_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH,
Benjamin Tissoiresee0fbd12011-05-19 14:18:15 +0200892 USB_DEVICE_ID_GOODTOUCH_000f) },
893
Benjamin Tissoires54580362011-11-29 13:13:12 +0100894 /* Hanvon panels */
895 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200896 MT_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT,
Benjamin Tissoires54580362011-11-29 13:13:12 +0100897 USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) },
898
Stephane Chattya062cc52011-09-17 22:27:30 +0200899 /* Ideacom panel */
900 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200901 MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
Stephane Chattya062cc52011-09-17 22:27:30 +0200902 USB_DEVICE_ID_IDEACOM_IDC6650) },
Benjamin Tissoires71078b02012-03-06 10:53:46 +0100903 { .driver_data = MT_CLS_SERIAL,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200904 MT_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
Benjamin Tissoires71078b02012-03-06 10:53:46 +0100905 USB_DEVICE_ID_IDEACOM_IDC6651) },
Stephane Chattya062cc52011-09-17 22:27:30 +0200906
Austin Zhang4e61f0d2011-05-09 23:54:14 +0800907 /* Ilitek dual touch panel */
908 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200909 MT_USB_DEVICE(USB_VENDOR_ID_ILITEK,
Austin Zhang4e61f0d2011-05-09 23:54:14 +0800910 USB_DEVICE_ID_ILITEK_MULTITOUCH) },
911
Benjamin Tissoires4dfcced2011-01-31 11:28:22 +0100912 /* IRTOUCH panels */
913 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200914 MT_USB_DEVICE(USB_VENDOR_ID_IRTOUCHSYSTEMS,
Benjamin Tissoires4dfcced2011-01-31 11:28:22 +0100915 USB_DEVICE_ID_IRTOUCH_INFRARED_USB) },
916
Jeff Brownc50bb1a2011-08-15 21:12:09 -0700917 /* LG Display panels */
918 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200919 MT_USB_DEVICE(USB_VENDOR_ID_LG,
Jeff Brownc50bb1a2011-08-15 21:12:09 -0700920 USB_DEVICE_ID_LG_MULTITOUCH) },
921
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200922 /* Lumio panels */
923 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200924 MT_USB_DEVICE(USB_VENDOR_ID_LUMIO,
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200925 USB_DEVICE_ID_CRYSTALTOUCH) },
Benjamin Tissoiresc3ead6d2011-06-21 15:01:55 +0200926 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200927 MT_USB_DEVICE(USB_VENDOR_ID_LUMIO,
Benjamin Tissoiresc3ead6d2011-06-21 15:01:55 +0200928 USB_DEVICE_ID_CRYSTALTOUCH_DUAL) },
Benjamin Tissoiresdf167c42011-05-18 15:27:24 +0200929
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200930 /* MosArt panels */
931 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200932 MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200933 USB_DEVICE_ID_ASUS_T91MT)},
934 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200935 MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200936 USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) },
937 { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200938 MT_USB_DEVICE(USB_VENDOR_ID_TURBOX,
Benjamin Tissoires4a6ee682011-04-22 11:51:48 +0200939 USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART) },
940
Denis Kovalev2258e862012-02-14 00:50:33 -0800941 /* Panasonic panels */
942 { .driver_data = MT_CLS_PANASONIC,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200943 MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
Denis Kovalev2258e862012-02-14 00:50:33 -0800944 USB_DEVICE_ID_PANABOARD_UBT780) },
945 { .driver_data = MT_CLS_PANASONIC,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200946 MT_USB_DEVICE(USB_VENDOR_ID_PANASONIC,
Denis Kovalev2258e862012-02-14 00:50:33 -0800947 USB_DEVICE_ID_PANABOARD_UBT880) },
948
Austin Hendrix4db703e2012-06-04 15:27:51 -0700949 /* Novatek Panel */
950 { .driver_data = MT_CLS_DEFAULT,
Jiri Kosina4380d812012-06-06 16:28:33 +0200951 MT_USB_DEVICE(USB_VENDOR_ID_NOVATEK,
Austin Hendrix4db703e2012-06-04 15:27:51 -0700952 USB_DEVICE_ID_NOVATEK_PCT) },
953
John Sung6ab3a9a2011-04-21 16:21:52 +0200954 /* PenMount panels */
955 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200956 MT_USB_DEVICE(USB_VENDOR_ID_PENMOUNT,
John Sung6ab3a9a2011-04-21 16:21:52 +0200957 USB_DEVICE_ID_PENMOUNT_PCI) },
958
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800959 /* PixArt optical touch screen */
960 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200961 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800962 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN) },
963 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200964 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800965 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1) },
966 { .driver_data = MT_CLS_INRANGE_CONTACTNUMBER,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200967 MT_USB_DEVICE(USB_VENDOR_ID_PIXART,
Aaron Tianb7ea95f2011-12-15 11:09:06 +0800968 USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2) },
969
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100970 /* PixCir-based panels */
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100971 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200972 MT_USB_DEVICE(USB_VENDOR_ID_HANVON,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100973 USB_DEVICE_ID_HANVON_MULTITOUCH) },
Benjamin Tissoires1e9cf352011-01-31 11:28:20 +0100974 { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200975 MT_USB_DEVICE(USB_VENDOR_ID_CANDO,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +0100976 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
977
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100978 /* Quanta-based panels */
979 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200980 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100981 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) },
982 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200983 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100984 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001) },
985 { .driver_data = MT_CLS_CONFIDENCE_CONTACT_ID,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200986 MT_USB_DEVICE(USB_VENDOR_ID_QUANTA,
Benjamin Tissoires5e7ea112011-11-29 13:13:10 +0100987 USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008) },
988
Benjamin Tissoires043b4032011-03-18 14:27:53 +0100989 /* Stantum panels */
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +0200990 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200991 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM,
Benjamin Tissoires043b4032011-03-18 14:27:53 +0100992 USB_DEVICE_ID_MTP)},
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +0200993 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200994 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM,
Benjamin Tissoires043b4032011-03-18 14:27:53 +0100995 USB_DEVICE_ID_MTP_STM)},
Benjamin Tissoiresbf5af9b2011-05-19 14:18:18 +0200996 { .driver_data = MT_CLS_CONFIDENCE,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +0200997 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_SITRONIX,
Benjamin Tissoires043b4032011-03-18 14:27:53 +0100998 USB_DEVICE_ID_MTP_SITRONIX)},
999
Benjamin Tissoires847672c2012-02-04 17:08:50 +01001000 /* TopSeed panels */
1001 { .driver_data = MT_CLS_TOPSEED,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001002 MT_USB_DEVICE(USB_VENDOR_ID_TOPSEED2,
Benjamin Tissoires847672c2012-02-04 17:08:50 +01001003 USB_DEVICE_ID_TOPSEED2_PERIPAD_701) },
1004
Benjamin Tissoires5e74e562011-05-19 14:18:16 +02001005 /* Touch International panels */
1006 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001007 MT_USB_DEVICE(USB_VENDOR_ID_TOUCH_INTL,
Benjamin Tissoires5e74e562011-05-19 14:18:16 +02001008 USB_DEVICE_ID_TOUCH_INTL_MULTI_TOUCH) },
1009
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001010 /* Unitec panels */
1011 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001012 MT_USB_DEVICE(USB_VENDOR_ID_UNITEC,
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001013 USB_DEVICE_ID_UNITEC_USB_TOUCH_0709) },
1014 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001015 MT_USB_DEVICE(USB_VENDOR_ID_UNITEC,
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001016 USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) },
ice chienbc8a2a92011-07-15 16:58:06 +08001017 /* XAT */
1018 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001019 MT_USB_DEVICE(USB_VENDOR_ID_XAT,
ice chienbc8a2a92011-07-15 16:58:06 +08001020 USB_DEVICE_ID_XAT_CSR) },
Benjamin Tissoires617b64f2011-05-19 14:18:17 +02001021
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001022 /* Xiroku */
1023 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001024 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001025 USB_DEVICE_ID_XIROKU_SPX) },
1026 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001027 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001028 USB_DEVICE_ID_XIROKU_MPX) },
1029 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001030 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001031 USB_DEVICE_ID_XIROKU_CSR) },
1032 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001033 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001034 USB_DEVICE_ID_XIROKU_SPX1) },
1035 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001036 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001037 USB_DEVICE_ID_XIROKU_MPX1) },
1038 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001039 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001040 USB_DEVICE_ID_XIROKU_CSR1) },
1041 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001042 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001043 USB_DEVICE_ID_XIROKU_SPX2) },
1044 { .driver_data = MT_CLS_DEFAULT,
Henrik Rydberg2c2110e2012-05-04 15:32:04 +02001045 MT_USB_DEVICE(USB_VENDOR_ID_XIROKU,
Masatoshi Hoshikawa11576c62012-01-05 11:53:46 +09001046 USB_DEVICE_ID_XIROKU_MPX2) },
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_CSR2) },
1050
Benjamin Tissoires82d06982012-06-19 14:39:54 +02001051 /* Zytronic panels */
1052 { .driver_data = MT_CLS_SERIAL,
1053 MT_USB_DEVICE(USB_VENDOR_ID_ZYTRONIC,
1054 USB_DEVICE_ID_ZYTRONIC_ZXY100) },
1055
Henrik Rydberg4fa3a582012-05-01 08:40:01 +02001056 /* Generic MT device */
1057 { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) },
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001058 { }
1059};
1060MODULE_DEVICE_TABLE(hid, mt_devices);
1061
1062static const struct hid_usage_id mt_grabbed_usages[] = {
1063 { HID_ANY_ID, HID_ANY_ID, HID_ANY_ID },
1064 { HID_ANY_ID - 1, HID_ANY_ID - 1, HID_ANY_ID - 1}
1065};
1066
1067static struct hid_driver mt_driver = {
1068 .name = "hid-multitouch",
1069 .id_table = mt_devices,
1070 .probe = mt_probe,
1071 .remove = mt_remove,
1072 .input_mapping = mt_input_mapping,
1073 .input_mapped = mt_input_mapped,
Henrik Rydberg76f59022012-09-01 20:11:34 +02001074 .input_configured = mt_input_configured,
Benjamin Tissoires5519cab2011-01-07 23:45:50 +01001075 .feature_mapping = mt_feature_mapping,
1076 .usage_table = mt_grabbed_usages,
1077 .event = mt_event,
1078#ifdef CONFIG_PM
1079 .reset_resume = mt_reset_resume,
1080#endif
1081};
1082
1083static int __init mt_init(void)
1084{
1085 return hid_register_driver(&mt_driver);
1086}
1087
1088static void __exit mt_exit(void)
1089{
1090 hid_unregister_driver(&mt_driver);
1091}
1092
1093module_init(mt_init);
1094module_exit(mt_exit);