aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-multitouch.c
diff options
context:
space:
mode:
authorRichard Nauber <richard.nauber@googlemail.com>2011-03-09 00:20:57 -0500
committerJiri Kosina <jkosina@suse.cz>2011-03-14 08:05:08 -0400
commit4875ac114d8bce99838a9b0ee7c3f5469cc6352e (patch)
tree5829b1fd88aa5402366cb1ea1374189d14f7dd24 /drivers/hid/hid-multitouch.c
parentf153fc3990d4ad2709a52d7150e2c04363afb1fb (diff)
HID: merge hid-egalax into hid-multitouch
This patch merges the hid-egalax driver into hid-multitouch. There are two types of devices support by the hid-egalax driver: resistive and capacitive. Here, they are implicitly distinguished by the absence of a HID_DG_CONTACTCOUNT field in the latter, so no special code path needs to be introduced. As a side effect, this patch fixes the broken suspend/resume behavior in the old driver. [rydberg@euromail.se: minor fixups] Signed-off-by: Richard Nauber <Richard.Nauber@gmail.com> Signed-off-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-multitouch.c')
-rw-r--r--drivers/hid/hid-multitouch.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 4518006f4871..af5a7093b204 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -5,6 +5,12 @@
5 * Copyright (c) 2010-2011 Benjamin Tissoires <benjamin.tissoires@gmail.com> 5 * Copyright (c) 2010-2011 Benjamin Tissoires <benjamin.tissoires@gmail.com>
6 * Copyright (c) 2010-2011 Ecole Nationale de l'Aviation Civile, France 6 * Copyright (c) 2010-2011 Ecole Nationale de l'Aviation Civile, France
7 * 7 *
8 * 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 *
8 */ 14 */
9 15
10/* 16/*
@@ -37,6 +43,7 @@ MODULE_LICENSE("GPL");
37#define MT_QUIRK_SLOT_IS_CONTACTNUMBER (1 << 3) 43#define MT_QUIRK_SLOT_IS_CONTACTNUMBER (1 << 3)
38#define MT_QUIRK_VALID_IS_INRANGE (1 << 4) 44#define MT_QUIRK_VALID_IS_INRANGE (1 << 4)
39#define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 5) 45#define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 5)
46#define MT_QUIRK_EGALAX_XYZ_FIXUP (1 << 6)
40 47
41struct mt_slot { 48struct mt_slot {
42 __s32 x, y, p, w, h; 49 __s32 x, y, p, w, h;
@@ -70,6 +77,7 @@ struct mt_class {
70#define MT_CLS_DUAL_INRANGE_CONTACTID 2 77#define MT_CLS_DUAL_INRANGE_CONTACTID 2
71#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 3 78#define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 3
72#define MT_CLS_CYPRESS 4 79#define MT_CLS_CYPRESS 4
80#define MT_CLS_EGALAX 5
73 81
74/* 82/*
75 * these device-dependent functions determine what slot corresponds 83 * these device-dependent functions determine what slot corresponds
@@ -120,6 +128,14 @@ struct mt_class mt_classes[] = {
120 MT_QUIRK_CYPRESS, 128 MT_QUIRK_CYPRESS,
121 .maxcontacts = 10 }, 129 .maxcontacts = 10 },
122 130
131 { .name = MT_CLS_EGALAX,
132 .quirks = MT_QUIRK_SLOT_IS_CONTACTID |
133 MT_QUIRK_VALID_IS_INRANGE |
134 MT_QUIRK_EGALAX_XYZ_FIXUP,
135 .maxcontacts = 2,
136 .sn_move = 4096,
137 .sn_pressure = 32,
138 },
123 { } 139 { }
124}; 140};
125 141
@@ -147,11 +163,15 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
147{ 163{
148 struct mt_device *td = hid_get_drvdata(hdev); 164 struct mt_device *td = hid_get_drvdata(hdev);
149 struct mt_class *cls = td->mtclass; 165 struct mt_class *cls = td->mtclass;
166 __s32 quirks = cls->quirks;
167
150 switch (usage->hid & HID_USAGE_PAGE) { 168 switch (usage->hid & HID_USAGE_PAGE) {
151 169
152 case HID_UP_GENDESK: 170 case HID_UP_GENDESK:
153 switch (usage->hid) { 171 switch (usage->hid) {
154 case HID_GD_X: 172 case HID_GD_X:
173 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
174 field->logical_maximum = 32760;
155 hid_map_usage(hi, usage, bit, max, 175 hid_map_usage(hi, usage, bit, max,
156 EV_ABS, ABS_MT_POSITION_X); 176 EV_ABS, ABS_MT_POSITION_X);
157 set_abs(hi->input, ABS_MT_POSITION_X, field, 177 set_abs(hi->input, ABS_MT_POSITION_X, field,
@@ -161,6 +181,8 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
161 td->last_slot_field = usage->hid; 181 td->last_slot_field = usage->hid;
162 return 1; 182 return 1;
163 case HID_GD_Y: 183 case HID_GD_Y:
184 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
185 field->logical_maximum = 32760;
164 hid_map_usage(hi, usage, bit, max, 186 hid_map_usage(hi, usage, bit, max,
165 EV_ABS, ABS_MT_POSITION_Y); 187 EV_ABS, ABS_MT_POSITION_Y);
166 set_abs(hi->input, ABS_MT_POSITION_Y, field, 188 set_abs(hi->input, ABS_MT_POSITION_Y, field,
@@ -204,6 +226,8 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
204 td->last_slot_field = usage->hid; 226 td->last_slot_field = usage->hid;
205 return 1; 227 return 1;
206 case HID_DG_TIPPRESSURE: 228 case HID_DG_TIPPRESSURE:
229 if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
230 field->logical_minimum = 0;
207 hid_map_usage(hi, usage, bit, max, 231 hid_map_usage(hi, usage, bit, max,
208 EV_ABS, ABS_MT_PRESSURE); 232 EV_ABS, ABS_MT_PRESSURE);
209 set_abs(hi->input, ABS_MT_PRESSURE, field, 233 set_abs(hi->input, ABS_MT_PRESSURE, field,
@@ -487,6 +511,25 @@ static const struct hid_device_id mt_devices[] = {
487 HID_USB_DEVICE(USB_VENDOR_ID_CANDO, 511 HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
488 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) }, 512 USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) },
489 513
514 /* Resistive eGalax devices */
515 { .driver_data = MT_CLS_EGALAX,
516 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
517 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) },
518 { .driver_data = MT_CLS_EGALAX,
519 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
520 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3) },
521
522 /* Capacitive eGalax devices */
523 { .driver_data = MT_CLS_EGALAX,
524 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
525 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) },
526 { .driver_data = MT_CLS_EGALAX,
527 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
528 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2) },
529 { .driver_data = MT_CLS_EGALAX,
530 HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
531 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4) },
532
490 { } 533 { }
491}; 534};
492MODULE_DEVICE_TABLE(hid, mt_devices); 535MODULE_DEVICE_TABLE(hid, mt_devices);