diff options
author | Richard Nauber <richard.nauber@googlemail.com> | 2011-03-09 06:20:57 +0100 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-03-14 13:05:08 +0100 |
commit | 4875ac114d8bce99838a9b0ee7c3f5469cc6352e (patch) | |
tree | 5829b1fd88aa5402366cb1ea1374189d14f7dd24 /drivers/hid/hid-multitouch.c | |
parent | f153fc3990d4ad2709a52d7150e2c04363afb1fb (diff) | |
download | op-kernel-dev-4875ac114d8bce99838a9b0ee7c3f5469cc6352e.zip op-kernel-dev-4875ac114d8bce99838a9b0ee7c3f5469cc6352e.tar.gz |
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.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 4518006..af5a709 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -5,6 +5,12 @@ * Copyright (c) 2010-2011 Benjamin Tissoires <benjamin.tissoires@gmail.com> * Copyright (c) 2010-2011 Ecole Nationale de l'Aviation Civile, France * + * This code is partly based on hid-egalax.c: + * + * Copyright (c) 2010 Stephane Chatty <chatty@enac.fr> + * Copyright (c) 2010 Henrik Rydberg <rydberg@euromail.se> + * Copyright (c) 2010 Canonical, Ltd. + * */ /* @@ -37,6 +43,7 @@ MODULE_LICENSE("GPL"); #define MT_QUIRK_SLOT_IS_CONTACTNUMBER (1 << 3) #define MT_QUIRK_VALID_IS_INRANGE (1 << 4) #define MT_QUIRK_VALID_IS_CONFIDENCE (1 << 5) +#define MT_QUIRK_EGALAX_XYZ_FIXUP (1 << 6) struct mt_slot { __s32 x, y, p, w, h; @@ -70,6 +77,7 @@ struct mt_class { #define MT_CLS_DUAL_INRANGE_CONTACTID 2 #define MT_CLS_DUAL_INRANGE_CONTACTNUMBER 3 #define MT_CLS_CYPRESS 4 +#define MT_CLS_EGALAX 5 /* * these device-dependent functions determine what slot corresponds @@ -120,6 +128,14 @@ struct mt_class mt_classes[] = { MT_QUIRK_CYPRESS, .maxcontacts = 10 }, + { .name = MT_CLS_EGALAX, + .quirks = MT_QUIRK_SLOT_IS_CONTACTID | + MT_QUIRK_VALID_IS_INRANGE | + MT_QUIRK_EGALAX_XYZ_FIXUP, + .maxcontacts = 2, + .sn_move = 4096, + .sn_pressure = 32, + }, { } }; @@ -147,11 +163,15 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, { struct mt_device *td = hid_get_drvdata(hdev); struct mt_class *cls = td->mtclass; + __s32 quirks = cls->quirks; + switch (usage->hid & HID_USAGE_PAGE) { case HID_UP_GENDESK: switch (usage->hid) { case HID_GD_X: + if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP) + field->logical_maximum = 32760; hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_POSITION_X); 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, td->last_slot_field = usage->hid; return 1; case HID_GD_Y: + if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP) + field->logical_maximum = 32760; hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_POSITION_Y); 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, td->last_slot_field = usage->hid; return 1; case HID_DG_TIPPRESSURE: + if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP) + field->logical_minimum = 0; hid_map_usage(hi, usage, bit, max, EV_ABS, ABS_MT_PRESSURE); set_abs(hi->input, ABS_MT_PRESSURE, field, @@ -487,6 +511,25 @@ static const struct hid_device_id mt_devices[] = { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_PIXCIR_MULTI_TOUCH) }, + /* Resistive eGalax devices */ + { .driver_data = MT_CLS_EGALAX, + HID_USB_DEVICE(USB_VENDOR_ID_DWAV, + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) }, + { .driver_data = MT_CLS_EGALAX, + HID_USB_DEVICE(USB_VENDOR_ID_DWAV, + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3) }, + + /* Capacitive eGalax devices */ + { .driver_data = MT_CLS_EGALAX, + HID_USB_DEVICE(USB_VENDOR_ID_DWAV, + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) }, + { .driver_data = MT_CLS_EGALAX, + HID_USB_DEVICE(USB_VENDOR_ID_DWAV, + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2) }, + { .driver_data = MT_CLS_EGALAX, + HID_USB_DEVICE(USB_VENDOR_ID_DWAV, + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4) }, + { } }; MODULE_DEVICE_TABLE(hid, mt_devices); |