Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid

Pull HID updates from Jiri Kosina:

- hid-mcp2221 GPIO support, from Rishi Gupta

- MT_CLS_WIN_8_DUAL obsolete quirk removal from hid-multitouch, from
Kai-Heng Feng

- a bunch of new hardware support to hid-asus driver, from Hans de
Goede

- other assorted small fixes, cleanups and device-specific quirks

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
HID: multitouch: Remove MT_CLS_WIN_8_DUAL
HID: multitouch: enable multi-input as a quirk for some devices
HID: sony: Fix for broken buttons on DS3 USB dongles
HID: Add quirks for Trust Panora Graphic Tablet
HID: apple: Swap the Fn and Left Control keys on Apple keyboards
HID: asus: Add depends on USB_HID to HID_ASUS Kconfig option
HID: asus: Fix mute and touchpad-toggle keys on Medion Akoya E1239T
HID: asus: Add support for multi-touch touchpad on Medion Akoya E1239T
HID: asus: Add report_size to struct asus_touchpad_info
HID: asus: Add hid_is_using_ll_driver(usb_hid_driver) check
HID: asus: Simplify skipping of mappings for Asus T100CHI keyboard-dock
HID: asus: Only set EV_REP if we are adding a mapping
HID: i2c-hid: add Schneider SCL142ALM to descriptor override
HID: intel-ish-hid: avoid bogus uninitialized-variable warning
HID: mcp2221: add GPIO functionality support
HID: fix typo in Kconfig
HID: logitech: drop outdated references to unifying receivers

+364 -74
+6 -5
drivers/hid/Kconfig
··· 42 42 ---help--- 43 43 Say Y here if you want to support HID devices (from the USB 44 44 specification standpoint) that aren't strictly user interface 45 - devices, like monitor controls and Uninterruptable Power Supplies. 45 + devices, like monitor controls and Uninterruptible Power Supplies. 46 46 47 47 This module supports these devices separately using a separate 48 48 event interface on /dev/hidraw. ··· 149 149 150 150 config HID_ASUS 151 151 tristate "Asus" 152 + depends on USB_HID 152 153 depends on LEDS_CLASS 153 154 depends on ASUS_WMI || ASUS_WMI=n 154 155 select POWER_SUPPLY ··· 539 538 Support for Logitech devices that are not fully compliant with HID standard. 540 539 541 540 config HID_LOGITECH_DJ 542 - tristate "Logitech Unifying receivers full support" 541 + tristate "Logitech receivers full support" 543 542 depends on USB_HID 544 543 depends on HIDRAW 545 544 depends on HID_LOGITECH 546 545 select HID_LOGITECH_HIDPP 547 546 ---help--- 548 - Say Y if you want support for Logitech Unifying receivers and devices. 549 - Unifying receivers are capable of pairing up to 6 Logitech compliant 547 + Say Y if you want support for Logitech receivers and devices. 548 + Logitech receivers are capable of pairing multiple Logitech compliant 550 549 devices to the same receiver. Without this driver it will be handled by 551 550 generic USB_HID driver and all incoming events will be multiplexed 552 551 into a single mouse and a single keyboard device. ··· 1141 1140 to decide how to interpret these special sensor ids and process in 1142 1141 the user space. Currently some manufacturers are using these ids for 1143 1142 sensor calibration and debugging other sensors. Manufacturers 1144 - should't use these special custom sensor ids to export any of the 1143 + shouldn't use these special custom sensor ids to export any of the 1145 1144 standard sensors. 1146 1145 Select this config option for custom/generic sensor support. 1147 1146
+28 -2
drivers/hid/hid-apple.c
··· 51 51 "(For people who want to keep Windows PC keyboard muscle memory. " 52 52 "[0] = as-is, Mac layout. 1 = swapped, Windows layout.)"); 53 53 54 + static unsigned int swap_fn_leftctrl; 55 + module_param(swap_fn_leftctrl, uint, 0644); 56 + MODULE_PARM_DESC(swap_fn_leftctrl, "Swap the Fn and left Control keys. " 57 + "(For people who want to keep PC keyboard muscle memory. " 58 + "[0] = as-is, Mac layout, 1 = swapped, PC layout)"); 59 + 54 60 struct apple_sc { 55 61 unsigned long quirks; 56 62 unsigned int fn_on; ··· 168 162 { } 169 163 }; 170 164 165 + static const struct apple_key_translation swapped_fn_leftctrl_keys[] = { 166 + { KEY_FN, KEY_LEFTCTRL }, 167 + { } 168 + }; 169 + 171 170 static const struct apple_key_translation *apple_find_translation( 172 171 const struct apple_key_translation *table, u16 from) 173 172 { ··· 194 183 bool do_translate; 195 184 u16 code = 0; 196 185 197 - if (usage->code == KEY_FN) { 186 + u16 fn_keycode = (swap_fn_leftctrl) ? (KEY_LEFTCTRL) : (KEY_FN); 187 + 188 + if (usage->code == fn_keycode) { 198 189 asc->fn_on = !!value; 199 - input_event(input, usage->type, usage->code, value); 190 + input_event(input, usage->type, KEY_FN, value); 200 191 return 1; 201 192 } 202 193 ··· 283 270 } 284 271 } 285 272 273 + if (swap_fn_leftctrl) { 274 + trans = apple_find_translation(swapped_fn_leftctrl_keys, usage->code); 275 + if (trans) { 276 + input_event(input, usage->type, trans->to, value); 277 + return 1; 278 + } 279 + } 280 + 286 281 return 0; 287 282 } 288 283 ··· 354 333 355 334 for (trans = apple_iso_keyboard; trans->from; trans++) 356 335 set_bit(trans->to, input->keybit); 336 + 337 + if (swap_fn_leftctrl) { 338 + for (trans = swapped_fn_leftctrl_keys; trans->from; trans++) 339 + set_bit(trans->to, input->keybit); 340 + } 357 341 } 358 342 359 343 static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi,
+103 -19
drivers/hid/hid-asus.c
··· 40 40 MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); 41 41 42 42 #define T100_TPAD_INTF 2 43 + #define MEDION_E1239T_TPAD_INTF 1 43 44 45 + #define E1239T_TP_TOGGLE_REPORT_ID 0x05 44 46 #define T100CHI_MOUSE_REPORT_ID 0x06 45 47 #define FEATURE_REPORT_ID 0x0d 46 48 #define INPUT_REPORT_ID 0x5d ··· 79 77 #define QUIRK_G752_KEYBOARD BIT(8) 80 78 #define QUIRK_T101HA_DOCK BIT(9) 81 79 #define QUIRK_T90CHI BIT(10) 80 + #define QUIRK_MEDION_E1239T BIT(11) 82 81 83 82 #define I2C_KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \ 84 83 QUIRK_NO_INIT_REPORTS | \ ··· 105 102 int res_y; 106 103 int contact_size; 107 104 int max_contacts; 105 + int report_size; 108 106 }; 109 107 110 108 struct asus_drvdata { 111 109 unsigned long quirks; 112 110 struct hid_device *hdev; 113 111 struct input_dev *input; 112 + struct input_dev *tp_kbd_input; 114 113 struct asus_kbd_leds *kbd_backlight; 115 114 const struct asus_touchpad_info *tp; 116 115 bool enable_backlight; ··· 131 126 .max_y = 1758, 132 127 .contact_size = 5, 133 128 .max_contacts = 5, 129 + .report_size = 28 /* 2 byte header + 5 * 5 + 1 byte footer */, 134 130 }; 135 131 136 132 static const struct asus_touchpad_info asus_t100ta_tp = { ··· 141 135 .res_y = 27, /* units/mm */ 142 136 .contact_size = 5, 143 137 .max_contacts = 5, 138 + .report_size = 28 /* 2 byte header + 5 * 5 + 1 byte footer */, 144 139 }; 145 140 146 141 static const struct asus_touchpad_info asus_t100ha_tp = { ··· 151 144 .res_y = 29, /* units/mm */ 152 145 .contact_size = 5, 153 146 .max_contacts = 5, 147 + .report_size = 28 /* 2 byte header + 5 * 5 + 1 byte footer */, 154 148 }; 155 149 156 150 static const struct asus_touchpad_info asus_t200ta_tp = { ··· 161 153 .res_y = 28, /* units/mm */ 162 154 .contact_size = 5, 163 155 .max_contacts = 5, 156 + .report_size = 28 /* 2 byte header + 5 * 5 + 1 byte footer */, 164 157 }; 165 158 166 159 static const struct asus_touchpad_info asus_t100chi_tp = { ··· 171 162 .res_y = 29, /* units/mm */ 172 163 .contact_size = 3, 173 164 .max_contacts = 4, 165 + .report_size = 15 /* 2 byte header + 3 * 4 + 1 byte footer */, 166 + }; 167 + 168 + static const struct asus_touchpad_info medion_e1239t_tp = { 169 + .max_x = 2640, 170 + .max_y = 1380, 171 + .res_x = 29, /* units/mm */ 172 + .res_y = 28, /* units/mm */ 173 + .contact_size = 5, 174 + .max_contacts = 5, 175 + .report_size = 32 /* 2 byte header + 5 * 5 + 5 byte footer */, 174 176 }; 175 177 176 178 static void asus_report_contact_down(struct asus_drvdata *drvdat, ··· 249 229 int i, toolType = MT_TOOL_FINGER; 250 230 u8 *contactData = data + 2; 251 231 252 - if (size != 3 + drvdat->tp->contact_size * drvdat->tp->max_contacts) 232 + if (size != drvdat->tp->report_size) 253 233 return 0; 254 234 255 235 for (i = 0; i < drvdat->tp->max_contacts; i++) { ··· 277 257 return 1; 278 258 } 279 259 260 + static int asus_e1239t_event(struct asus_drvdata *drvdat, u8 *data, int size) 261 + { 262 + if (size != 3) 263 + return 0; 264 + 265 + /* Handle broken mute key which only sends press events */ 266 + if (!drvdat->tp && 267 + data[0] == 0x02 && data[1] == 0xe2 && data[2] == 0x00) { 268 + input_report_key(drvdat->input, KEY_MUTE, 1); 269 + input_sync(drvdat->input); 270 + input_report_key(drvdat->input, KEY_MUTE, 0); 271 + input_sync(drvdat->input); 272 + return 1; 273 + } 274 + 275 + /* Handle custom touchpad toggle key which only sends press events */ 276 + if (drvdat->tp_kbd_input && 277 + data[0] == 0x05 && data[1] == 0x02 && data[2] == 0x28) { 278 + input_report_key(drvdat->tp_kbd_input, KEY_F21, 1); 279 + input_sync(drvdat->tp_kbd_input); 280 + input_report_key(drvdat->tp_kbd_input, KEY_F21, 0); 281 + input_sync(drvdat->tp_kbd_input); 282 + return 1; 283 + } 284 + 285 + return 0; 286 + } 287 + 280 288 static int asus_event(struct hid_device *hdev, struct hid_field *field, 281 289 struct hid_usage *usage, __s32 value) 282 290 { ··· 328 280 329 281 if (drvdata->tp && data[0] == INPUT_REPORT_ID) 330 282 return asus_report_input(drvdata, data, size); 283 + 284 + if (drvdata->quirks & QUIRK_MEDION_E1239T) 285 + return asus_e1239t_event(drvdata, data, size); 331 286 332 287 return 0; 333 288 } ··· 666 615 hi->report->id != T100CHI_MOUSE_REPORT_ID) 667 616 return 0; 668 617 618 + /* Handle MULTI_INPUT on E1239T mouse/touchpad USB interface */ 619 + if (drvdata->tp && (drvdata->quirks & QUIRK_MEDION_E1239T)) { 620 + switch (hi->report->id) { 621 + case E1239T_TP_TOGGLE_REPORT_ID: 622 + input_set_capability(input, EV_KEY, KEY_F21); 623 + input->name = "Asus Touchpad Keys"; 624 + drvdata->tp_kbd_input = input; 625 + return 0; 626 + case INPUT_REPORT_ID: 627 + break; /* Touchpad report, handled below */ 628 + default: 629 + return 0; /* Ignore other reports */ 630 + } 631 + } 632 + 669 633 if (drvdata->tp) { 670 634 int ret; 671 635 ··· 743 677 * This avoids a bunch of non-functional hid_input devices getting 744 678 * created because of the T100CHI using HID_QUIRK_MULTI_INPUT. 745 679 */ 746 - if (drvdata->quirks & (QUIRK_T100CHI | QUIRK_T90CHI)) { 747 - if (field->application == (HID_UP_GENDESK | 0x0080) || 748 - usage->hid == (HID_UP_GENDEVCTRLS | 0x0024) || 749 - usage->hid == (HID_UP_GENDEVCTRLS | 0x0025) || 750 - usage->hid == (HID_UP_GENDEVCTRLS | 0x0026)) 751 - return -1; 752 - /* 753 - * We use the hid_input for the mouse report for the touchpad, 754 - * keep the left button, to avoid the core removing it. 755 - */ 756 - if (field->application == HID_GD_MOUSE && 757 - usage->hid != (HID_UP_BUTTON | 1)) 758 - return -1; 759 - } 680 + if ((drvdata->quirks & (QUIRK_T100CHI | QUIRK_T90CHI)) && 681 + (field->application == (HID_UP_GENDESK | 0x0080) || 682 + field->application == HID_GD_MOUSE || 683 + usage->hid == (HID_UP_GENDEVCTRLS | 0x0024) || 684 + usage->hid == (HID_UP_GENDEVCTRLS | 0x0025) || 685 + usage->hid == (HID_UP_GENDEVCTRLS | 0x0026))) 686 + return -1; 760 687 761 688 /* ASUS-specific keyboard hotkeys */ 762 689 if ((usage->hid & HID_USAGE_PAGE) == 0xff310000) { 763 - set_bit(EV_REP, hi->input->evbit); 764 690 switch (usage->hid & HID_USAGE) { 765 691 case 0x10: asus_map_key_clear(KEY_BRIGHTNESSDOWN); break; 766 692 case 0x20: asus_map_key_clear(KEY_BRIGHTNESSUP); break; ··· 795 737 if (drvdata->quirks & QUIRK_USE_KBD_BACKLIGHT) 796 738 drvdata->enable_backlight = true; 797 739 740 + set_bit(EV_REP, hi->input->evbit); 798 741 return 1; 799 742 } 800 743 801 744 if ((usage->hid & HID_USAGE_PAGE) == HID_UP_MSVENDOR) { 802 - set_bit(EV_REP, hi->input->evbit); 803 745 switch (usage->hid & HID_USAGE) { 804 746 case 0xff01: asus_map_key_clear(BTN_1); break; 805 747 case 0xff02: asus_map_key_clear(BTN_2); break; ··· 822 764 return 0; 823 765 } 824 766 767 + set_bit(EV_REP, hi->input->evbit); 825 768 return 1; 826 769 } 827 770 ··· 839 780 */ 840 781 return -1; 841 782 } 783 + } 784 + 785 + /* 786 + * The mute button is broken and only sends press events, we 787 + * deal with this in our raw_event handler, so do not map it. 788 + */ 789 + if ((drvdata->quirks & QUIRK_MEDION_E1239T) && 790 + usage->hid == (HID_UP_CONSUMER | 0xe2)) { 791 + input_set_capability(hi->input, EV_KEY, KEY_MUTE); 792 + return -1; 842 793 } 843 794 844 795 return 0; ··· 918 849 if (drvdata->quirks & QUIRK_IS_MULTITOUCH) 919 850 drvdata->tp = &asus_i2c_tp; 920 851 921 - if (drvdata->quirks & QUIRK_T100_KEYBOARD) { 852 + if ((drvdata->quirks & QUIRK_T100_KEYBOARD) && 853 + hid_is_using_ll_driver(hdev, &usb_hid_driver)) { 922 854 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); 923 855 924 856 if (intf->altsetting->desc.bInterfaceNumber == T100_TPAD_INTF) { ··· 945 875 */ 946 876 hdev->quirks |= HID_QUIRK_MULTI_INPUT; 947 877 drvdata->tp = &asus_t100chi_tp; 878 + } 879 + 880 + if ((drvdata->quirks & QUIRK_MEDION_E1239T) && 881 + hid_is_using_ll_driver(hdev, &usb_hid_driver)) { 882 + struct usb_host_interface *alt = 883 + to_usb_interface(hdev->dev.parent)->altsetting; 884 + 885 + if (alt->desc.bInterfaceNumber == MEDION_E1239T_TPAD_INTF) { 886 + /* For separate input-devs for tp and tp toggle key */ 887 + hdev->quirks |= HID_QUIRK_MULTI_INPUT; 888 + drvdata->quirks |= QUIRK_SKIP_INPUT_MAPPING; 889 + drvdata->tp = &medion_e1239t_tp; 890 + } 948 891 } 949 892 950 893 if (drvdata->quirks & QUIRK_NO_INIT_REPORTS) ··· 1139 1056 { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_ASUS_MD_5112) }, 1140 1057 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ASUSTEK, 1141 1058 USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD), QUIRK_T100CHI }, 1142 - 1059 + { HID_USB_DEVICE(USB_VENDOR_ID_ITE, USB_DEVICE_ID_ITE_MEDION_E1239T), 1060 + QUIRK_MEDION_E1239T }, 1143 1061 { } 1144 1062 }; 1145 1063 MODULE_DEVICE_TABLE(hid, asus_devices);
+4 -8
drivers/hid/hid-ids.h
··· 76 76 77 77 #define USB_VENDOR_ID_ALPS_JP 0x044E 78 78 #define HID_DEVICE_ID_ALPS_U1_DUAL 0x120B 79 - #define HID_DEVICE_ID_ALPS_U1_DUAL_PTP 0x121F 80 - #define HID_DEVICE_ID_ALPS_U1_DUAL_3BTN_PTP 0x1220 81 79 #define HID_DEVICE_ID_ALPS_U1 0x1215 82 80 #define HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY 0x121E 83 81 #define HID_DEVICE_ID_ALPS_T4_BTNLESS 0x120C 84 - #define HID_DEVICE_ID_ALPS_1222 0x1222 85 82 86 83 #define USB_VENDOR_ID_AMI 0x046b 87 84 #define USB_DEVICE_ID_AMI_VIRT_KEYBOARD_AND_MOUSE 0xff10 ··· 277 280 #define USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH 0x0001 278 281 279 282 #define USB_VENDOR_ID_CIDC 0x1677 280 - 281 - #define I2C_VENDOR_ID_CIRQUE 0x0488 282 - #define I2C_PRODUCT_ID_CIRQUE_121F 0x121F 283 283 284 284 #define USB_VENDOR_ID_CJTOUCH 0x24b8 285 285 #define USB_DEVICE_ID_CJTOUCH_MULTI_TOUCH_0020 0x0020 ··· 634 640 #define I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720 0x837a 635 641 #define USB_DEVICE_ID_ITE_LENOVO_YOGA900 0x8396 636 642 #define USB_DEVICE_ID_ITE8595 0x8595 643 + #define USB_DEVICE_ID_ITE_MEDION_E1239T 0xce50 637 644 638 645 #define USB_VENDOR_ID_JABRA 0x0b0e 639 646 #define USB_DEVICE_ID_JABRA_SPEAK_410 0x0412 ··· 725 730 #define USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL 0x6049 726 731 #define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067 727 732 #define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085 728 - #define USB_DEVICE_ID_LENOVO_X1_TAB 0x60a3 729 - #define USB_DEVICE_ID_LENOVO_X1_TAB3 0x60b5 730 733 #define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D 0x608d 731 734 732 735 #define USB_VENDOR_ID_LG 0x1fd2 ··· 1149 1156 #define USB_VENDOR_ID_TPV 0x25aa 1150 1157 #define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882 0x8882 1151 1158 #define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8883 0x8883 1159 + 1160 + #define USB_VENDOR_ID_TRUST 0x145f 1161 + #define USB_DEVICE_ID_TRUST_PANORA_TABLET 0x0212 1152 1162 1153 1163 #define USB_VENDOR_ID_TURBOX 0x062a 1154 1164 #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201
+2 -2
drivers/hid/hid-logitech-dj.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 - * HID driver for Logitech Unifying receivers 3 + * HID driver for Logitech receivers 4 4 * 5 5 * Copyright (c) 2011 Logitech 6 6 */ ··· 701 701 type_str, dj_hiddev->product); 702 702 } else { 703 703 snprintf(dj_hiddev->name, sizeof(dj_hiddev->name), 704 - "Logitech Unifying Device. Wireless PID:%04x", 704 + "Logitech Wireless Device PID:%04x", 705 705 dj_hiddev->product); 706 706 } 707 707
+1 -1
drivers/hid/hid-logitech-hidpp.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 - * HIDPP protocol for Logitech Unifying receivers 3 + * HIDPP protocol for Logitech receivers 4 4 * 5 5 * Copyright (c) 2011 Logitech (c) 6 6 * Copyright (c) 2012-2013 Google (c)
+169
drivers/hid/hid-mcp2221.c
··· 15 15 #include <linux/hid.h> 16 16 #include <linux/hidraw.h> 17 17 #include <linux/i2c.h> 18 + #include <linux/gpio/driver.h> 18 19 #include "hid-ids.h" 19 20 20 21 /* Commands codes in a raw output report */ ··· 28 27 MCP2221_I2C_PARAM_OR_STATUS = 0x10, 29 28 MCP2221_I2C_SET_SPEED = 0x20, 30 29 MCP2221_I2C_CANCEL = 0x10, 30 + MCP2221_GPIO_SET = 0x50, 31 + MCP2221_GPIO_GET = 0x51, 31 32 }; 32 33 33 34 /* Response codes in a raw input report */ ··· 45 42 MCP2221_I2C_WRADDRL_SEND = 0x21, 46 43 MCP2221_I2C_ADDR_NACK = 0x25, 47 44 MCP2221_I2C_READ_COMPL = 0x55, 45 + MCP2221_ALT_F_NOT_GPIOV = 0xEE, 46 + MCP2221_ALT_F_NOT_GPIOD = 0xEF, 48 47 }; 49 48 50 49 /* ··· 64 59 int rxbuf_idx; 65 60 int status; 66 61 u8 cur_i2c_clk_div; 62 + struct gpio_chip *gc; 63 + u8 gp_idx; 64 + u8 gpio_dir; 67 65 }; 68 66 69 67 /* ··· 534 526 .functionality = mcp_i2c_func, 535 527 }; 536 528 529 + static int mcp_gpio_get(struct gpio_chip *gc, 530 + unsigned int offset) 531 + { 532 + int ret; 533 + struct mcp2221 *mcp = gpiochip_get_data(gc); 534 + 535 + mcp->txbuf[0] = MCP2221_GPIO_GET; 536 + 537 + mcp->gp_idx = (offset + 1) * 2; 538 + 539 + mutex_lock(&mcp->lock); 540 + ret = mcp_send_data_req_status(mcp, mcp->txbuf, 1); 541 + mutex_unlock(&mcp->lock); 542 + 543 + return ret; 544 + } 545 + 546 + static void mcp_gpio_set(struct gpio_chip *gc, 547 + unsigned int offset, int value) 548 + { 549 + struct mcp2221 *mcp = gpiochip_get_data(gc); 550 + 551 + memset(mcp->txbuf, 0, 18); 552 + mcp->txbuf[0] = MCP2221_GPIO_SET; 553 + 554 + mcp->gp_idx = ((offset + 1) * 4) - 1; 555 + 556 + mcp->txbuf[mcp->gp_idx - 1] = 1; 557 + mcp->txbuf[mcp->gp_idx] = !!value; 558 + 559 + mutex_lock(&mcp->lock); 560 + mcp_send_data_req_status(mcp, mcp->txbuf, 18); 561 + mutex_unlock(&mcp->lock); 562 + } 563 + 564 + static int mcp_gpio_dir_set(struct mcp2221 *mcp, 565 + unsigned int offset, u8 val) 566 + { 567 + memset(mcp->txbuf, 0, 18); 568 + mcp->txbuf[0] = MCP2221_GPIO_SET; 569 + 570 + mcp->gp_idx = (offset + 1) * 5; 571 + 572 + mcp->txbuf[mcp->gp_idx - 1] = 1; 573 + mcp->txbuf[mcp->gp_idx] = val; 574 + 575 + return mcp_send_data_req_status(mcp, mcp->txbuf, 18); 576 + } 577 + 578 + static int mcp_gpio_direction_input(struct gpio_chip *gc, 579 + unsigned int offset) 580 + { 581 + int ret; 582 + struct mcp2221 *mcp = gpiochip_get_data(gc); 583 + 584 + mutex_lock(&mcp->lock); 585 + ret = mcp_gpio_dir_set(mcp, offset, 0); 586 + mutex_unlock(&mcp->lock); 587 + 588 + return ret; 589 + } 590 + 591 + static int mcp_gpio_direction_output(struct gpio_chip *gc, 592 + unsigned int offset, int value) 593 + { 594 + int ret; 595 + struct mcp2221 *mcp = gpiochip_get_data(gc); 596 + 597 + mutex_lock(&mcp->lock); 598 + ret = mcp_gpio_dir_set(mcp, offset, 1); 599 + mutex_unlock(&mcp->lock); 600 + 601 + /* Can't configure as output, bailout early */ 602 + if (ret) 603 + return ret; 604 + 605 + mcp_gpio_set(gc, offset, value); 606 + 607 + return 0; 608 + } 609 + 610 + static int mcp_gpio_get_direction(struct gpio_chip *gc, 611 + unsigned int offset) 612 + { 613 + int ret; 614 + struct mcp2221 *mcp = gpiochip_get_data(gc); 615 + 616 + mcp->txbuf[0] = MCP2221_GPIO_GET; 617 + 618 + mcp->gp_idx = (offset + 1) * 2; 619 + 620 + mutex_lock(&mcp->lock); 621 + ret = mcp_send_data_req_status(mcp, mcp->txbuf, 1); 622 + mutex_unlock(&mcp->lock); 623 + 624 + if (ret) 625 + return ret; 626 + 627 + if (mcp->gpio_dir) 628 + return GPIO_LINE_DIRECTION_IN; 629 + 630 + return GPIO_LINE_DIRECTION_OUT; 631 + } 632 + 537 633 /* Gives current state of i2c engine inside mcp2221 */ 538 634 static int mcp_get_i2c_eng_state(struct mcp2221 *mcp, 539 635 u8 *data, u8 idx) ··· 750 638 complete(&mcp->wait_in_report); 751 639 break; 752 640 641 + case MCP2221_GPIO_GET: 642 + switch (data[1]) { 643 + case MCP2221_SUCCESS: 644 + if ((data[mcp->gp_idx] == MCP2221_ALT_F_NOT_GPIOV) || 645 + (data[mcp->gp_idx + 1] == MCP2221_ALT_F_NOT_GPIOD)) { 646 + mcp->status = -ENOENT; 647 + } else { 648 + mcp->status = !!data[mcp->gp_idx]; 649 + mcp->gpio_dir = !!data[mcp->gp_idx + 1]; 650 + } 651 + break; 652 + default: 653 + mcp->status = -EAGAIN; 654 + } 655 + complete(&mcp->wait_in_report); 656 + break; 657 + 658 + case MCP2221_GPIO_SET: 659 + switch (data[1]) { 660 + case MCP2221_SUCCESS: 661 + if ((data[mcp->gp_idx] == MCP2221_ALT_F_NOT_GPIOV) || 662 + (data[mcp->gp_idx - 1] == MCP2221_ALT_F_NOT_GPIOV)) { 663 + mcp->status = -ENOENT; 664 + } else { 665 + mcp->status = 0; 666 + } 667 + break; 668 + default: 669 + mcp->status = -EAGAIN; 670 + } 671 + complete(&mcp->wait_in_report); 672 + break; 673 + 753 674 default: 754 675 mcp->status = -EIO; 755 676 complete(&mcp->wait_in_report); ··· 847 702 } 848 703 i2c_set_adapdata(&mcp->adapter, mcp); 849 704 705 + /* Setup GPIO chip */ 706 + mcp->gc = devm_kzalloc(&hdev->dev, sizeof(*mcp->gc), GFP_KERNEL); 707 + if (!mcp->gc) { 708 + ret = -ENOMEM; 709 + goto err_gc; 710 + } 711 + 712 + mcp->gc->label = "mcp2221_gpio"; 713 + mcp->gc->direction_input = mcp_gpio_direction_input; 714 + mcp->gc->direction_output = mcp_gpio_direction_output; 715 + mcp->gc->get_direction = mcp_gpio_get_direction; 716 + mcp->gc->set = mcp_gpio_set; 717 + mcp->gc->get = mcp_gpio_get; 718 + mcp->gc->ngpio = 4; 719 + mcp->gc->base = -1; 720 + mcp->gc->can_sleep = 1; 721 + mcp->gc->parent = &hdev->dev; 722 + 723 + ret = devm_gpiochip_add_data(&hdev->dev, mcp->gc, mcp); 724 + if (ret) 725 + goto err_gc; 726 + 850 727 return 0; 851 728 729 + err_gc: 730 + i2c_del_adapter(&mcp->adapter); 852 731 err_i2c: 853 732 hid_hw_close(mcp->hdev); 854 733 err_hstop:
+23 -37
drivers/hid/hid-multitouch.c
··· 69 69 #define MT_QUIRK_ASUS_CUSTOM_UP BIT(17) 70 70 #define MT_QUIRK_WIN8_PTP_BUTTONS BIT(18) 71 71 #define MT_QUIRK_SEPARATE_APP_REPORT BIT(19) 72 + #define MT_QUIRK_FORCE_MULTI_INPUT BIT(20) 72 73 73 74 #define MT_INPUTMODE_TOUCHSCREEN 0x02 74 75 #define MT_INPUTMODE_TOUCHPAD 0x03 ··· 189 188 /* reserved 0x0011 */ 190 189 #define MT_CLS_WIN_8 0x0012 191 190 #define MT_CLS_EXPORT_ALL_INPUTS 0x0013 192 - #define MT_CLS_WIN_8_DUAL 0x0014 191 + /* reserved 0x0014 */ 192 + #define MT_CLS_WIN_8_FORCE_MULTI_INPUT 0x0015 193 193 194 194 /* vendor specific classes */ 195 195 #define MT_CLS_3M 0x0101 ··· 274 272 .quirks = MT_QUIRK_ALWAYS_VALID | 275 273 MT_QUIRK_CONTACT_CNT_ACCURATE, 276 274 .export_all_inputs = true }, 277 - { .name = MT_CLS_WIN_8_DUAL, 275 + { .name = MT_CLS_WIN_8_FORCE_MULTI_INPUT, 278 276 .quirks = MT_QUIRK_ALWAYS_VALID | 279 277 MT_QUIRK_IGNORE_DUPLICATES | 280 278 MT_QUIRK_HOVERING | 281 279 MT_QUIRK_CONTACT_CNT_ACCURATE | 282 - MT_QUIRK_WIN8_PTP_BUTTONS, 280 + MT_QUIRK_STICKY_FINGERS | 281 + MT_QUIRK_WIN8_PTP_BUTTONS | 282 + MT_QUIRK_FORCE_MULTI_INPUT, 283 283 .export_all_inputs = true }, 284 284 285 285 /* ··· 758 754 MT_STORE_FIELD(inrange_state); 759 755 return 1; 760 756 case HID_DG_CONFIDENCE: 761 - if ((cls->name == MT_CLS_WIN_8 || 762 - cls->name == MT_CLS_WIN_8_DUAL) && 757 + if (cls->name == MT_CLS_WIN_8 && 763 758 (field->application == HID_DG_TOUCHPAD || 764 759 field->application == HID_DG_TOUCHSCREEN)) 765 760 app->quirks |= MT_QUIRK_CONFIDENCE; ··· 1717 1714 if (id->group != HID_GROUP_MULTITOUCH_WIN_8) 1718 1715 hdev->quirks |= HID_QUIRK_MULTI_INPUT; 1719 1716 1717 + if (mtclass->quirks & MT_QUIRK_FORCE_MULTI_INPUT) { 1718 + hdev->quirks &= ~HID_QUIRK_INPUT_PER_APP; 1719 + hdev->quirks |= HID_QUIRK_MULTI_INPUT; 1720 + } 1721 + 1720 1722 timer_setup(&td->release_timer, mt_expired_timeout, 0); 1721 1723 1722 1724 ret = hid_parse(hdev); ··· 1794 1786 MT_USB_DEVICE(USB_VENDOR_ID_3M, 1795 1787 USB_DEVICE_ID_3M3266) }, 1796 1788 1797 - /* Alps devices */ 1798 - { .driver_data = MT_CLS_WIN_8_DUAL, 1799 - HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, 1800 - USB_VENDOR_ID_ALPS_JP, 1801 - HID_DEVICE_ID_ALPS_U1_DUAL_PTP) }, 1802 - { .driver_data = MT_CLS_WIN_8_DUAL, 1803 - HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, 1804 - USB_VENDOR_ID_ALPS_JP, 1805 - HID_DEVICE_ID_ALPS_U1_DUAL_3BTN_PTP) }, 1806 - { .driver_data = MT_CLS_WIN_8_DUAL, 1807 - HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, 1808 - USB_VENDOR_ID_ALPS_JP, 1809 - HID_DEVICE_ID_ALPS_1222) }, 1810 - 1811 - /* Lenovo X1 TAB Gen 2 */ 1812 - { .driver_data = MT_CLS_WIN_8_DUAL, 1813 - HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8, 1814 - USB_VENDOR_ID_LENOVO, 1815 - USB_DEVICE_ID_LENOVO_X1_TAB) }, 1816 - 1817 - /* Lenovo X1 TAB Gen 3 */ 1818 - { .driver_data = MT_CLS_WIN_8_DUAL, 1819 - HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8, 1820 - USB_VENDOR_ID_LENOVO, 1821 - USB_DEVICE_ID_LENOVO_X1_TAB3) }, 1822 - 1823 1789 /* Anton devices */ 1824 1790 { .driver_data = MT_CLS_EXPORT_ALL_INPUTS, 1825 1791 MT_USB_DEVICE(USB_VENDOR_ID_ANTON, ··· 1827 1845 { .driver_data = MT_CLS_NSMU, 1828 1846 MT_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT, 1829 1847 USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) }, 1830 - 1831 - /* Cirque devices */ 1832 - { .driver_data = MT_CLS_WIN_8_DUAL, 1833 - HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, 1834 - I2C_VENDOR_ID_CIRQUE, 1835 - I2C_PRODUCT_ID_CIRQUE_121F) }, 1836 1848 1837 1849 /* CJTouch panels */ 1838 1850 { .driver_data = MT_CLS_NSMU, ··· 1901 1925 { .driver_data = MT_CLS_EGALAX, 1902 1926 MT_USB_DEVICE(USB_VENDOR_ID_DWAV, 1903 1927 USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_C002) }, 1928 + 1929 + /* Elan devices */ 1930 + { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT, 1931 + HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, 1932 + USB_VENDOR_ID_ELAN, 0x313a) }, 1904 1933 1905 1934 /* Elitegroup panel */ 1906 1935 { .driver_data = MT_CLS_SERIAL, ··· 2036 2055 { .driver_data = MT_CLS_CONFIDENCE, 2037 2056 MT_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM, 2038 2057 USB_DEVICE_ID_MTP_STM)}, 2058 + 2059 + /* Synaptics devices */ 2060 + { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT, 2061 + HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, 2062 + USB_VENDOR_ID_SYNAPTICS, 0xce08) }, 2039 2063 2040 2064 /* TopSeed panels */ 2041 2065 { .driver_data = MT_CLS_TOPSEED,
+1
drivers/hid/hid-quirks.c
··· 168 168 { HID_USB_DEVICE(USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS), HID_QUIRK_MULTI_INPUT }, 169 169 { HID_USB_DEVICE(USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882), HID_QUIRK_NOGET }, 170 170 { HID_USB_DEVICE(USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8883), HID_QUIRK_NOGET }, 171 + { HID_USB_DEVICE(USB_VENDOR_ID_TRUST, USB_DEVICE_ID_TRUST_PANORA_TABLET), HID_QUIRK_MULTI_INPUT | HID_QUIRK_HIDINPUT_FORCE }, 171 172 { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD), HID_QUIRK_NOGET }, 172 173 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5), HID_QUIRK_MULTI_INPUT }, 173 174 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60), HID_QUIRK_MULTI_INPUT },
+17
drivers/hid/hid-sony.c
··· 867 867 if (sc->quirks & PS3REMOTE) 868 868 return ps3remote_fixup(hdev, rdesc, rsize); 869 869 870 + /* 871 + * Some knock-off USB dongles incorrectly report their button count 872 + * as 13 instead of 16 causing three non-functional buttons. 873 + */ 874 + if ((sc->quirks & SIXAXIS_CONTROLLER_USB) && *rsize >= 45 && 875 + /* Report Count (13) */ 876 + rdesc[23] == 0x95 && rdesc[24] == 0x0D && 877 + /* Usage Maximum (13) */ 878 + rdesc[37] == 0x29 && rdesc[38] == 0x0D && 879 + /* Report Count (3) */ 880 + rdesc[43] == 0x95 && rdesc[44] == 0x03) { 881 + hid_info(hdev, "Fixing up USB dongle report descriptor\n"); 882 + rdesc[24] = 0x10; 883 + rdesc[38] = 0x10; 884 + rdesc[44] = 0x00; 885 + } 886 + 870 887 return rdesc; 871 888 } 872 889
+8
drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c
··· 389 389 }, 390 390 .driver_data = (void *)&sipodev_desc 391 391 }, 392 + { 393 + .ident = "Schneider SCL142ALM", 394 + .matches = { 395 + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SCHNEIDER"), 396 + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "SCL142ALM"), 397 + }, 398 + .driver_data = (void *)&sipodev_desc 399 + }, 392 400 { } /* Terminate list */ 393 401 }; 394 402
+2
drivers/hid/intel-ish-hid/ishtp-fw-loader.c
··· 480 480 sizeof(ldr_xfer_query_resp)); 481 481 if (rv < 0) { 482 482 client_data->flag_retry = true; 483 + *fw_info = (struct shim_fw_info){}; 483 484 return rv; 484 485 } 485 486 ··· 490 489 "data size %d is not equal to size of loader_xfer_query_response %zu\n", 491 490 rv, sizeof(struct loader_xfer_query_response)); 492 491 client_data->flag_retry = true; 492 + *fw_info = (struct shim_fw_info){}; 493 493 return -EMSGSIZE; 494 494 } 495 495