diff options
Diffstat (limited to 'drivers/hid/hid-multitouch.c')
-rw-r--r-- | drivers/hid/hid-multitouch.c | 61 |
1 files changed, 24 insertions, 37 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 2e1736ba2444..ba32f0172030 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
@@ -74,6 +74,7 @@ MODULE_LICENSE("GPL"); | |||
74 | #define MT_QUIRK_TOUCH_SIZE_SCALING BIT(15) | 74 | #define MT_QUIRK_TOUCH_SIZE_SCALING BIT(15) |
75 | #define MT_QUIRK_STICKY_FINGERS BIT(16) | 75 | #define MT_QUIRK_STICKY_FINGERS BIT(16) |
76 | #define MT_QUIRK_ASUS_CUSTOM_UP BIT(17) | 76 | #define MT_QUIRK_ASUS_CUSTOM_UP BIT(17) |
77 | #define MT_QUIRK_WIN8_PTP_BUTTONS BIT(18) | ||
77 | 78 | ||
78 | #define MT_INPUTMODE_TOUCHSCREEN 0x02 | 79 | #define MT_INPUTMODE_TOUCHSCREEN 0x02 |
79 | #define MT_INPUTMODE_TOUCHPAD 0x03 | 80 | #define MT_INPUTMODE_TOUCHPAD 0x03 |
@@ -126,7 +127,6 @@ struct mt_device { | |||
126 | int left_button_state; /* left button state */ | 127 | int left_button_state; /* left button state */ |
127 | unsigned last_slot_field; /* the last field of a slot */ | 128 | unsigned last_slot_field; /* the last field of a slot */ |
128 | unsigned mt_report_id; /* the report ID of the multitouch device */ | 129 | unsigned mt_report_id; /* the report ID of the multitouch device */ |
129 | unsigned long initial_quirks; /* initial quirks state */ | ||
130 | __s16 inputmode; /* InputMode HID feature, -1 if non-existent */ | 130 | __s16 inputmode; /* InputMode HID feature, -1 if non-existent */ |
131 | __s16 inputmode_index; /* InputMode HID feature index in the report */ | 131 | __s16 inputmode_index; /* InputMode HID feature index in the report */ |
132 | __s16 maxcontact_report_id; /* Maximum Contact Number HID feature, | 132 | __s16 maxcontact_report_id; /* Maximum Contact Number HID feature, |
@@ -183,6 +183,7 @@ static void mt_post_parse(struct mt_device *td); | |||
183 | #define MT_CLS_ASUS 0x010b | 183 | #define MT_CLS_ASUS 0x010b |
184 | #define MT_CLS_VTL 0x0110 | 184 | #define MT_CLS_VTL 0x0110 |
185 | #define MT_CLS_GOOGLE 0x0111 | 185 | #define MT_CLS_GOOGLE 0x0111 |
186 | #define MT_CLS_RAZER_BLADE_STEALTH 0x0112 | ||
186 | 187 | ||
187 | #define MT_DEFAULT_MAXCONTACT 10 | 188 | #define MT_DEFAULT_MAXCONTACT 10 |
188 | #define MT_MAX_MAXCONTACT 250 | 189 | #define MT_MAX_MAXCONTACT 250 |
@@ -241,7 +242,8 @@ static struct mt_class mt_classes[] = { | |||
241 | MT_QUIRK_IGNORE_DUPLICATES | | 242 | MT_QUIRK_IGNORE_DUPLICATES | |
242 | MT_QUIRK_HOVERING | | 243 | MT_QUIRK_HOVERING | |
243 | MT_QUIRK_CONTACT_CNT_ACCURATE | | 244 | MT_QUIRK_CONTACT_CNT_ACCURATE | |
244 | MT_QUIRK_STICKY_FINGERS }, | 245 | MT_QUIRK_STICKY_FINGERS | |
246 | MT_QUIRK_WIN8_PTP_BUTTONS }, | ||
245 | { .name = MT_CLS_EXPORT_ALL_INPUTS, | 247 | { .name = MT_CLS_EXPORT_ALL_INPUTS, |
246 | .quirks = MT_QUIRK_ALWAYS_VALID | | 248 | .quirks = MT_QUIRK_ALWAYS_VALID | |
247 | MT_QUIRK_CONTACT_CNT_ACCURATE, | 249 | MT_QUIRK_CONTACT_CNT_ACCURATE, |
@@ -250,7 +252,8 @@ static struct mt_class mt_classes[] = { | |||
250 | .quirks = MT_QUIRK_ALWAYS_VALID | | 252 | .quirks = MT_QUIRK_ALWAYS_VALID | |
251 | MT_QUIRK_IGNORE_DUPLICATES | | 253 | MT_QUIRK_IGNORE_DUPLICATES | |
252 | MT_QUIRK_HOVERING | | 254 | MT_QUIRK_HOVERING | |
253 | MT_QUIRK_CONTACT_CNT_ACCURATE, | 255 | MT_QUIRK_CONTACT_CNT_ACCURATE | |
256 | MT_QUIRK_WIN8_PTP_BUTTONS, | ||
254 | .export_all_inputs = true }, | 257 | .export_all_inputs = true }, |
255 | 258 | ||
256 | /* | 259 | /* |
@@ -323,6 +326,13 @@ static struct mt_class mt_classes[] = { | |||
323 | MT_QUIRK_SLOT_IS_CONTACTID | | 326 | MT_QUIRK_SLOT_IS_CONTACTID | |
324 | MT_QUIRK_HOVERING | 327 | MT_QUIRK_HOVERING |
325 | }, | 328 | }, |
329 | { .name = MT_CLS_RAZER_BLADE_STEALTH, | ||
330 | .quirks = MT_QUIRK_ALWAYS_VALID | | ||
331 | MT_QUIRK_IGNORE_DUPLICATES | | ||
332 | MT_QUIRK_HOVERING | | ||
333 | MT_QUIRK_CONTACT_CNT_ACCURATE | | ||
334 | MT_QUIRK_WIN8_PTP_BUTTONS, | ||
335 | }, | ||
326 | { } | 336 | { } |
327 | }; | 337 | }; |
328 | 338 | ||
@@ -369,7 +379,6 @@ static const struct attribute_group mt_attribute_group = { | |||
369 | 379 | ||
370 | static void mt_get_feature(struct hid_device *hdev, struct hid_report *report) | 380 | static void mt_get_feature(struct hid_device *hdev, struct hid_report *report) |
371 | { | 381 | { |
372 | struct mt_device *td = hid_get_drvdata(hdev); | ||
373 | int ret; | 382 | int ret; |
374 | u32 size = hid_report_len(report); | 383 | u32 size = hid_report_len(report); |
375 | u8 *buf; | 384 | u8 *buf; |
@@ -378,7 +387,7 @@ static void mt_get_feature(struct hid_device *hdev, struct hid_report *report) | |||
378 | * Do not fetch the feature report if the device has been explicitly | 387 | * Do not fetch the feature report if the device has been explicitly |
379 | * marked as non-capable. | 388 | * marked as non-capable. |
380 | */ | 389 | */ |
381 | if (td->initial_quirks & HID_QUIRK_NO_INIT_REPORTS) | 390 | if (hdev->quirks & HID_QUIRK_NO_INIT_REPORTS) |
382 | return; | 391 | return; |
383 | 392 | ||
384 | buf = hid_alloc_report_buf(report, GFP_KERNEL); | 393 | buf = hid_alloc_report_buf(report, GFP_KERNEL); |
@@ -660,8 +669,7 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
660 | * MS PTP spec says that external buttons left and right have | 669 | * MS PTP spec says that external buttons left and right have |
661 | * usages 2 and 3. | 670 | * usages 2 and 3. |
662 | */ | 671 | */ |
663 | if ((cls->name == MT_CLS_WIN_8 || | 672 | if ((cls->quirks & MT_QUIRK_WIN8_PTP_BUTTONS) && |
664 | cls->name == MT_CLS_WIN_8_DUAL) && | ||
665 | field->application == HID_DG_TOUCHPAD && | 673 | field->application == HID_DG_TOUCHPAD && |
666 | (usage->hid & HID_USAGE) > 1) | 674 | (usage->hid & HID_USAGE) > 1) |
667 | code--; | 675 | code--; |
@@ -773,9 +781,7 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input) | |||
773 | */ | 781 | */ |
774 | static void mt_sync_frame(struct mt_device *td, struct input_dev *input) | 782 | static void mt_sync_frame(struct mt_device *td, struct input_dev *input) |
775 | { | 783 | { |
776 | __s32 cls = td->mtclass.name; | 784 | if (td->mtclass.quirks & MT_QUIRK_WIN8_PTP_BUTTONS) |
777 | |||
778 | if (cls == MT_CLS_WIN_8 || cls == MT_CLS_WIN_8_DUAL) | ||
779 | input_event(input, EV_KEY, BTN_LEFT, td->left_button_state); | 785 | input_event(input, EV_KEY, BTN_LEFT, td->left_button_state); |
780 | 786 | ||
781 | input_mt_sync_frame(input); | 787 | input_mt_sync_frame(input); |
@@ -827,7 +833,6 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field, | |||
827 | bool first_packet) | 833 | bool first_packet) |
828 | { | 834 | { |
829 | struct mt_device *td = hid_get_drvdata(hid); | 835 | struct mt_device *td = hid_get_drvdata(hid); |
830 | __s32 cls = td->mtclass.name; | ||
831 | __s32 quirks = td->mtclass.quirks; | 836 | __s32 quirks = td->mtclass.quirks; |
832 | struct input_dev *input = field->hidinput->input; | 837 | struct input_dev *input = field->hidinput->input; |
833 | 838 | ||
@@ -905,7 +910,7 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field, | |||
905 | * non finger/touch events in the first_packet of | 910 | * non finger/touch events in the first_packet of |
906 | * a (possible) multi-packet frame. | 911 | * a (possible) multi-packet frame. |
907 | */ | 912 | */ |
908 | if ((cls == MT_CLS_WIN_8 || cls == MT_CLS_WIN_8_DUAL) && | 913 | if ((quirks & MT_QUIRK_WIN8_PTP_BUTTONS) && |
909 | !first_packet) | 914 | !first_packet) |
910 | return; | 915 | return; |
911 | 916 | ||
@@ -916,7 +921,7 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field, | |||
916 | * BTN_LEFT if either is pressed, so we or all values | 921 | * BTN_LEFT if either is pressed, so we or all values |
917 | * together and report the result in mt_sync_frame(). | 922 | * together and report the result in mt_sync_frame(). |
918 | */ | 923 | */ |
919 | if ((cls == MT_CLS_WIN_8 || cls == MT_CLS_WIN_8_DUAL) && | 924 | if ((quirks & MT_QUIRK_WIN8_PTP_BUTTONS) && |
920 | usage->type == EV_KEY && usage->code == BTN_LEFT) { | 925 | usage->type == EV_KEY && usage->code == BTN_LEFT) { |
921 | td->left_button_state |= value; | 926 | td->left_button_state |= value; |
922 | return; | 927 | return; |
@@ -940,7 +945,6 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field, | |||
940 | static void mt_touch_report(struct hid_device *hid, struct hid_report *report) | 945 | static void mt_touch_report(struct hid_device *hid, struct hid_report *report) |
941 | { | 946 | { |
942 | struct mt_device *td = hid_get_drvdata(hid); | 947 | struct mt_device *td = hid_get_drvdata(hid); |
943 | __s32 cls = td->mtclass.name; | ||
944 | struct hid_field *field; | 948 | struct hid_field *field; |
945 | bool first_packet; | 949 | bool first_packet; |
946 | unsigned count; | 950 | unsigned count; |
@@ -969,7 +973,7 @@ static void mt_touch_report(struct hid_device *hid, struct hid_report *report) | |||
969 | * of a possible multi-packet frame be checking that the | 973 | * of a possible multi-packet frame be checking that the |
970 | * timestamp has changed. | 974 | * timestamp has changed. |
971 | */ | 975 | */ |
972 | if ((cls == MT_CLS_WIN_8 || cls == MT_CLS_WIN_8_DUAL) && | 976 | if ((td->mtclass.quirks & MT_QUIRK_WIN8_PTP_BUTTONS) && |
973 | td->num_received == 0 && td->prev_scantime != scantime) | 977 | td->num_received == 0 && td->prev_scantime != scantime) |
974 | td->num_expected = value; | 978 | td->num_expected = value; |
975 | /* A non 0 contact count always indicates a first packet */ | 979 | /* A non 0 contact count always indicates a first packet */ |
@@ -1448,11 +1452,6 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
1448 | if (id->vendor == HID_ANY_ID && id->product == HID_ANY_ID) | 1452 | if (id->vendor == HID_ANY_ID && id->product == HID_ANY_ID) |
1449 | td->serial_maybe = true; | 1453 | td->serial_maybe = true; |
1450 | 1454 | ||
1451 | /* | ||
1452 | * Store the initial quirk state | ||
1453 | */ | ||
1454 | td->initial_quirks = hdev->quirks; | ||
1455 | |||
1456 | /* This allows the driver to correctly support devices | 1455 | /* This allows the driver to correctly support devices |
1457 | * that emit events over several HID messages. | 1456 | * that emit events over several HID messages. |
1458 | */ | 1457 | */ |
@@ -1464,22 +1463,6 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
1464 | * device. | 1463 | * device. |
1465 | */ | 1464 | */ |
1466 | hdev->quirks |= HID_QUIRK_MULTI_INPUT; | 1465 | hdev->quirks |= HID_QUIRK_MULTI_INPUT; |
1467 | hdev->quirks |= HID_QUIRK_NO_EMPTY_INPUT; | ||
1468 | |||
1469 | /* | ||
1470 | * Some multitouch screens do not like to be polled for input | ||
1471 | * reports. Fortunately, the Win8 spec says that all touches | ||
1472 | * should be sent during each report, making the initialization | ||
1473 | * of input reports unnecessary. For Win7 devices, well, let's hope | ||
1474 | * they will still be happy (this is only be a problem if a touch | ||
1475 | * was already there while probing the device). | ||
1476 | * | ||
1477 | * In addition some touchpads do not behave well if we read | ||
1478 | * all feature reports from them. Instead we prevent | ||
1479 | * initial report fetching and then selectively fetch each | ||
1480 | * report we are interested in. | ||
1481 | */ | ||
1482 | hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS; | ||
1483 | 1466 | ||
1484 | timer_setup(&td->release_timer, mt_expired_timeout, 0); | 1467 | timer_setup(&td->release_timer, mt_expired_timeout, 0); |
1485 | 1468 | ||
@@ -1538,7 +1521,6 @@ static void mt_remove(struct hid_device *hdev) | |||
1538 | 1521 | ||
1539 | sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group); | 1522 | sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group); |
1540 | hid_hw_stop(hdev); | 1523 | hid_hw_stop(hdev); |
1541 | hdev->quirks = td->initial_quirks; | ||
1542 | } | 1524 | } |
1543 | 1525 | ||
1544 | /* | 1526 | /* |
@@ -1794,6 +1776,11 @@ static const struct hid_device_id mt_devices[] = { | |||
1794 | MT_USB_DEVICE(USB_VENDOR_ID_QUANTA, | 1776 | MT_USB_DEVICE(USB_VENDOR_ID_QUANTA, |
1795 | USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001) }, | 1777 | USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001) }, |
1796 | 1778 | ||
1779 | /* Razer touchpads */ | ||
1780 | { .driver_data = MT_CLS_RAZER_BLADE_STEALTH, | ||
1781 | HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, | ||
1782 | USB_VENDOR_ID_SYNAPTICS, 0x8323) }, | ||
1783 | |||
1797 | /* Stantum panels */ | 1784 | /* Stantum panels */ |
1798 | { .driver_data = MT_CLS_CONFIDENCE, | 1785 | { .driver_data = MT_CLS_CONFIDENCE, |
1799 | MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM, | 1786 | MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM, |