History

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

Pull HID fixes from Jiri Kosina: - power management fix for intel-ish-hid (Srinivas Pandruvada) - power management fix for hid-nintendo (Martino Fontana) - error handling fixes for nvidia-shield (Christophe JAILLET) - memory leak fix for hid-sony (Christophe JAILLET) - fix for slab out-of-bound write in hid-holtek (Ma Ke) - other assorted smaller fixes and device ID / quirk entry additions * tag 'for-linus-2023100502' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: HID: Add quirk to ignore the touchscreen battery on HP ENVY 15-eu0556ng HID: intel-ish-hid: ipc: Disable and reenable ACPI GPE bit HID: sony: remove duplicate NULL check before calling usb_free_urb() HID: nintendo: reinitialize USB Pro Controller after resuming from suspend HID: nvidia-shield: Fix some missing function calls() in the probe error handling path HID: nvidia-shield: Fix a missing led_classdev_unregister() in the probe error handling path HID: multitouch: Add required quirk for Synaptics 0xcd7e device HID: nvidia-shield: Select POWER_SUPPLY Kconfig option HID: holtek: fix slab-out-of-bounds Write in holtek_kbd_input_event HID: nvidia-shield: add LEDS_CLASS dependency HID: logitech-hidpp: Add Bluetooth ID for the Logitech M720 Triathlon mouse HID: steelseries: Fix signedness bug in steelseries_headset_arctis_1_fetch_battery() HID: sony: Fix a potential memory leak in sony_probe()

Linus Torvalds committed 3 years ago

Commit 19fbf672 parents f291209 b009aa311 files · +135 −76Browse files

Unified · Split

11 files
  1. drivers/hid/Kconfig +2 −0
  2. drivers/hid/hid-holtek-kbd.c +4 −0
  3. drivers/hid/hid-ids.h +1 −0
  4. drivers/hid/hid-input.c +2 −0
  5. drivers/hid/hid-logitech-hidpp.c +2 −0
  6. drivers/hid/hid-multitouch.c +4 −0
  7. drivers/hid/hid-nintendo.c +103 −72
  8. drivers/hid/hid-nvidia-shield.c +6 −3
  9. drivers/hid/hid-sony.c +2 −0
  10. drivers/hid/hid-steelseries.c +1 −1
  11. drivers/hid/intel-ish-hid/ipc/pci-ish.c +8 −0
drivers/hid/Kconfig+2−0
@@ -799,6 +799,8 @@ config HID_NVIDIA_SHIELD · 798 unmodified lines
799 tristate "NVIDIA SHIELD devices"799 tristate "NVIDIA SHIELD devices"
800 depends on USB_HID800 depends on USB_HID
801 depends on BT_HIDP801 depends on BT_HIDP
802 depends on LEDS_CLASS
803 select POWER_SUPPLY
802 help804 help
803 Support for NVIDIA SHIELD accessories.805 Support for NVIDIA SHIELD accessories.
804 806
drivers/hid/hid-holtek-kbd.c+4−0
@@ -130,6 +130,10 @@ static int holtek_kbd_input_event(struct input_dev *dev, unsigned int type, · 129 unmodified lines
130 return -ENODEV;130 return -ENODEV;
131 131
132 boot_hid = usb_get_intfdata(boot_interface);132 boot_hid = usb_get_intfdata(boot_interface);
133 if (list_empty(&boot_hid->inputs)) {
134 hid_err(hid, "no inputs found\n");
135 return -ENODEV;
136 }
133 boot_hid_input = list_first_entry(&boot_hid->inputs,137 boot_hid_input = list_first_entry(&boot_hid->inputs,
134 struct hid_input, list);138 struct hid_input, list);
135 139
drivers/hid/hid-ids.h+1−0
@@ -425,6 +425,7 @@ · 424 unmodified lines
425#define I2C_DEVICE_ID_HP_SPECTRE_X360_13T_AW100 0x29F5425#define I2C_DEVICE_ID_HP_SPECTRE_X360_13T_AW100 0x29F5
426#define I2C_DEVICE_ID_HP_SPECTRE_X360_14T_EA100_V1 0x2BED426#define I2C_DEVICE_ID_HP_SPECTRE_X360_14T_EA100_V1 0x2BED
427#define I2C_DEVICE_ID_HP_SPECTRE_X360_14T_EA100_V2 0x2BEE427#define I2C_DEVICE_ID_HP_SPECTRE_X360_14T_EA100_V2 0x2BEE
428#define I2C_DEVICE_ID_HP_ENVY_X360_15_EU0556NG 0x2D02
428 429
429#define USB_VENDOR_ID_ELECOM 0x056e430#define USB_VENDOR_ID_ELECOM 0x056e
430#define USB_DEVICE_ID_ELECOM_BM084 0x0061431#define USB_DEVICE_ID_ELECOM_BM084 0x0061
drivers/hid/hid-input.c+2−0
@@ -409,6 +409,8 @@ static const struct hid_device_id hid_battery_quirks[] = { · 408 unmodified lines
409 HID_BATTERY_QUIRK_IGNORE },409 HID_BATTERY_QUIRK_IGNORE },
410 { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_14T_EA100_V2),410 { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_14T_EA100_V2),
411 HID_BATTERY_QUIRK_IGNORE },411 HID_BATTERY_QUIRK_IGNORE },
412 { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15_EU0556NG),
413 HID_BATTERY_QUIRK_IGNORE },
412 {}414 {}
413};415};
414 416
drivers/hid/hid-logitech-hidpp.c+2−0
@@ -4677,6 +4677,8 @@ static const struct hid_device_id hidpp_devices[] = { · 4676 unmodified lines
4677 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb008) },4677 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb008) },
4678 { /* MX Master mouse over Bluetooth */4678 { /* MX Master mouse over Bluetooth */
4679 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb012) },4679 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb012) },
4680 { /* M720 Triathlon mouse over Bluetooth */
4681 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb015) },
4680 { /* MX Ergo trackball over Bluetooth */4682 { /* MX Ergo trackball over Bluetooth */
4681 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01d) },4683 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01d) },
4682 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01e) },4684 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01e) },
drivers/hid/hid-multitouch.c+4−0
@@ -2144,6 +2144,10 @@ static const struct hid_device_id mt_devices[] = { · 2143 unmodified lines
2144 USB_DEVICE_ID_MTP_STM)},2144 USB_DEVICE_ID_MTP_STM)},
2145 2145
2146 /* Synaptics devices */2146 /* Synaptics devices */
2147 { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,
2148 HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
2149 USB_VENDOR_ID_SYNAPTICS, 0xcd7e) },
2150
2147 { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,2151 { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,
2148 HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,2152 HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
2149 USB_VENDOR_ID_SYNAPTICS, 0xce08) },2153 USB_VENDOR_ID_SYNAPTICS, 0xce08) },
drivers/hid/hid-nintendo.c+103−72
@@ -2088,7 +2088,9 @@ static int joycon_read_info(struct joycon_ctlr *ctlr) · 2087 unmodified lines
2088 struct joycon_input_report *report;2088 struct joycon_input_report *report;
2089 2089
2090 req.subcmd_id = JC_SUBCMD_REQ_DEV_INFO;2090 req.subcmd_id = JC_SUBCMD_REQ_DEV_INFO;
2091 mutex_lock(&ctlr->output_mutex);
2091 ret = joycon_send_subcmd(ctlr, &req, 0, HZ);2092 ret = joycon_send_subcmd(ctlr, &req, 0, HZ);
2093 mutex_unlock(&ctlr->output_mutex);
2092 if (ret) {2094 if (ret) {
2093 hid_err(ctlr->hdev, "Failed to get joycon info; ret=%d\n", ret);2095 hid_err(ctlr->hdev, "Failed to get joycon info; ret=%d\n", ret);
2094 return ret;2096 return ret;
@@ -2117,6 +2119,85 @@ static int joycon_read_info(struct joycon_ctlr *ctlr) · 22 unmodified lines
2117 return 0;2119 return 0;
2118}2120}
2119 2121
2122static int joycon_init(struct hid_device *hdev)
2123{
2124 struct joycon_ctlr *ctlr = hid_get_drvdata(hdev);
2125 int ret = 0;
2126
2127 mutex_lock(&ctlr->output_mutex);
2128 /* if handshake command fails, assume ble pro controller */
2129 if ((jc_type_is_procon(ctlr) || jc_type_is_chrggrip(ctlr)) &&
2130 !joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ)) {
2131 hid_dbg(hdev, "detected USB controller\n");
2132 /* set baudrate for improved latency */
2133 ret = joycon_send_usb(ctlr, JC_USB_CMD_BAUDRATE_3M, HZ);
2134 if (ret) {
2135 hid_err(hdev, "Failed to set baudrate; ret=%d\n", ret);
2136 goto out_unlock;
2137 }
2138 /* handshake */
2139 ret = joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ);
2140 if (ret) {
2141 hid_err(hdev, "Failed handshake; ret=%d\n", ret);
2142 goto out_unlock;
2143 }
2144 /*
2145 * Set no timeout (to keep controller in USB mode).
2146 * This doesn't send a response, so ignore the timeout.
2147 */
2148 joycon_send_usb(ctlr, JC_USB_CMD_NO_TIMEOUT, HZ/10);
2149 } else if (jc_type_is_chrggrip(ctlr)) {
2150 hid_err(hdev, "Failed charging grip handshake\n");
2151 ret = -ETIMEDOUT;
2152 goto out_unlock;
2153 }
2154
2155 /* get controller calibration data, and parse it */
2156 ret = joycon_request_calibration(ctlr);
2157 if (ret) {
2158 /*
2159 * We can function with default calibration, but it may be
2160 * inaccurate. Provide a warning, and continue on.
2161 */
2162 hid_warn(hdev, "Analog stick positions may be inaccurate\n");
2163 }
2164
2165 /* get IMU calibration data, and parse it */
2166 ret = joycon_request_imu_calibration(ctlr);
2167 if (ret) {
2168 /*
2169 * We can function with default calibration, but it may be
2170 * inaccurate. Provide a warning, and continue on.
2171 */
2172 hid_warn(hdev, "Unable to read IMU calibration data\n");
2173 }
2174
2175 /* Set the reporting mode to 0x30, which is the full report mode */
2176 ret = joycon_set_report_mode(ctlr);
2177 if (ret) {
2178 hid_err(hdev, "Failed to set report mode; ret=%d\n", ret);
2179 goto out_unlock;
2180 }
2181
2182 /* Enable rumble */
2183 ret = joycon_enable_rumble(ctlr);
2184 if (ret) {
2185 hid_err(hdev, "Failed to enable rumble; ret=%d\n", ret);
2186 goto out_unlock;
2187 }
2188
2189 /* Enable the IMU */
2190 ret = joycon_enable_imu(ctlr);
2191 if (ret) {
2192 hid_err(hdev, "Failed to enable the IMU; ret=%d\n", ret);
2193 goto out_unlock;
2194 }
2195
2196out_unlock:
2197 mutex_unlock(&ctlr->output_mutex);
2198 return ret;
2199}
2200
2120/* Common handler for parsing inputs */2201/* Common handler for parsing inputs */
2121static int joycon_ctlr_read_handler(struct joycon_ctlr *ctlr, u8 *data,2202static int joycon_ctlr_read_handler(struct joycon_ctlr *ctlr, u8 *data,
2122 int size)2203 int size)
@@ -2248,85 +2329,19 @@ static int nintendo_hid_probe(struct hid_device *hdev, · 125 unmodified lines
2248 2329
2249 hid_device_io_start(hdev);2330 hid_device_io_start(hdev);
2250 2331
2251 /* Initialize the controller */2332 ret = joycon_init(hdev);
2252 mutex_lock(&ctlr->output_mutex);
2253 /* if handshake command fails, assume ble pro controller */
2254 if ((jc_type_is_procon(ctlr) || jc_type_is_chrggrip(ctlr)) &&
2255 !joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ)) {
2256 hid_dbg(hdev, "detected USB controller\n");
2257 /* set baudrate for improved latency */
2258 ret = joycon_send_usb(ctlr, JC_USB_CMD_BAUDRATE_3M, HZ);
2259 if (ret) {
2260 hid_err(hdev, "Failed to set baudrate; ret=%d\n", ret);
2261 goto err_mutex;
2262 }
2263 /* handshake */
2264 ret = joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ);
2265 if (ret) {
2266 hid_err(hdev, "Failed handshake; ret=%d\n", ret);
2267 goto err_mutex;
2268 }
2269 /*
2270 * Set no timeout (to keep controller in USB mode).
2271 * This doesn't send a response, so ignore the timeout.
2272 */
2273 joycon_send_usb(ctlr, JC_USB_CMD_NO_TIMEOUT, HZ/10);
2274 } else if (jc_type_is_chrggrip(ctlr)) {
2275 hid_err(hdev, "Failed charging grip handshake\n");
2276 ret = -ETIMEDOUT;
2277 goto err_mutex;
2278 }
2279
2280 /* get controller calibration data, and parse it */
2281 ret = joycon_request_calibration(ctlr);
2282 if (ret) {2333 if (ret) {
2283 /*2334 hid_err(hdev, "Failed to initialize controller; ret=%d\n", ret);
2284 * We can function with default calibration, but it may be2335 goto err_close;
2285 * inaccurate. Provide a warning, and continue on.
2286 */
2287 hid_warn(hdev, "Analog stick positions may be inaccurate\n");
2288 }
2289
2290 /* get IMU calibration data, and parse it */
2291 ret = joycon_request_imu_calibration(ctlr);
2292 if (ret) {
2293 /*
2294 * We can function with default calibration, but it may be
2295 * inaccurate. Provide a warning, and continue on.
2296 */
2297 hid_warn(hdev, "Unable to read IMU calibration data\n");
2298 }
2299
2300 /* Set the reporting mode to 0x30, which is the full report mode */
2301 ret = joycon_set_report_mode(ctlr);
2302 if (ret) {
2303 hid_err(hdev, "Failed to set report mode; ret=%d\n", ret);
2304 goto err_mutex;
2305 }
2306
2307 /* Enable rumble */
2308 ret = joycon_enable_rumble(ctlr);
2309 if (ret) {
2310 hid_err(hdev, "Failed to enable rumble; ret=%d\n", ret);
2311 goto err_mutex;
2312 }
2313
2314 /* Enable the IMU */
2315 ret = joycon_enable_imu(ctlr);
2316 if (ret) {
2317 hid_err(hdev, "Failed to enable the IMU; ret=%d\n", ret);
2318 goto err_mutex;
2319 }2336 }
2320 2337
2321 ret = joycon_read_info(ctlr);2338 ret = joycon_read_info(ctlr);
2322 if (ret) {2339 if (ret) {
2323 hid_err(hdev, "Failed to retrieve controller info; ret=%d\n",2340 hid_err(hdev, "Failed to retrieve controller info; ret=%d\n",
2324 ret);2341 ret);
2325 goto err_mutex;2342 goto err_close;
2326 }2343 }
2327 2344
2328 mutex_unlock(&ctlr->output_mutex);
2329
2330 /* Initialize the leds */2345 /* Initialize the leds */
2331 ret = joycon_leds_create(ctlr);2346 ret = joycon_leds_create(ctlr);
2332 if (ret) {2347 if (ret) {
@@ -2352,8 +2367,6 @@ static int nintendo_hid_probe(struct hid_device *hdev, · 19 unmodified lines
2352 hid_dbg(hdev, "probe - success\n");2367 hid_dbg(hdev, "probe - success\n");
2353 return 0;2368 return 0;
2354 2369
2355err_mutex:
2356 mutex_unlock(&ctlr->output_mutex);
2357err_close:2370err_close:
2358 hid_hw_close(hdev);2371 hid_hw_close(hdev);
2359err_stop:2372err_stop:
@@ -2383,6 +2396,20 @@ static void nintendo_hid_remove(struct hid_device *hdev) · 23 unmodified lines
2383 hid_hw_stop(hdev);2396 hid_hw_stop(hdev);
2384}2397}
2385 2398
2399#ifdef CONFIG_PM
2400
2401static int nintendo_hid_resume(struct hid_device *hdev)
2402{
2403 int ret = joycon_init(hdev);
2404
2405 if (ret)
2406 hid_err(hdev, "Failed to restore controller after resume");
2407
2408 return ret;
2409}
2410
2411#endif
2412
2386static const struct hid_device_id nintendo_hid_devices[] = {2413static const struct hid_device_id nintendo_hid_devices[] = {
2387 { HID_USB_DEVICE(USB_VENDOR_ID_NINTENDO,2414 { HID_USB_DEVICE(USB_VENDOR_ID_NINTENDO,
2388 USB_DEVICE_ID_NINTENDO_PROCON) },2415 USB_DEVICE_ID_NINTENDO_PROCON) },
@@ -2404,6 +2431,10 @@ static struct hid_driver nintendo_hid_driver = { · 15 unmodified lines
2404 .probe = nintendo_hid_probe,2431 .probe = nintendo_hid_probe,
2405 .remove = nintendo_hid_remove,2432 .remove = nintendo_hid_remove,
2406 .raw_event = nintendo_hid_event,2433 .raw_event = nintendo_hid_event,
2434
2435#ifdef CONFIG_PM
2436 .resume = nintendo_hid_resume,
2437#endif
2407};2438};
2408module_hid_driver(nintendo_hid_driver);2439module_hid_driver(nintendo_hid_driver);
2409 2440
drivers/hid/hid-nvidia-shield.c+6−3
@@ -801,7 +801,7 @@ static inline int thunderstrike_led_create(struct thunderstrike *ts) · 800 unmodified lines
801 led->name = devm_kasprintf(&ts->base.hdev->dev, GFP_KERNEL,801 led->name = devm_kasprintf(&ts->base.hdev->dev, GFP_KERNEL,
802 "thunderstrike%d:blue:led", ts->id);802 "thunderstrike%d:blue:led", ts->id);
803 led->max_brightness = 1;803 led->max_brightness = 1;
804 led->flags = LED_CORE_SUSPENDRESUME;804 led->flags = LED_CORE_SUSPENDRESUME | LED_RETAIN_AT_SHUTDOWN;
805 led->brightness_get = &thunderstrike_led_get_brightness;805 led->brightness_get = &thunderstrike_led_get_brightness;
806 led->brightness_set = &thunderstrike_led_set_brightness;806 led->brightness_set = &thunderstrike_led_set_brightness;
807 807
@@ -1058,7 +1058,7 @@ static int shield_probe(struct hid_device *hdev, const struct hid_device_id *id) · 250 unmodified lines
1058 ret = hid_hw_start(hdev, HID_CONNECT_HIDINPUT);1058 ret = hid_hw_start(hdev, HID_CONNECT_HIDINPUT);
1059 if (ret) {1059 if (ret) {
1060 hid_err(hdev, "Failed to start HID device\n");1060 hid_err(hdev, "Failed to start HID device\n");
1061 goto err_haptics;1061 goto err_ts_create;
1062 }1062 }
1063 1063
1064 ret = hid_hw_open(hdev);1064 ret = hid_hw_open(hdev);
@@ -1073,9 +1073,12 @@ static int shield_probe(struct hid_device *hdev, const struct hid_device_id *id) · 8 unmodified lines
1073 1073
1074err_stop:1074err_stop:
1075 hid_hw_stop(hdev);1075 hid_hw_stop(hdev);
1076err_haptics:1076err_ts_create:
1077 power_supply_unregister(ts->base.battery_dev.psy);
1077 if (ts->haptics_dev)1078 if (ts->haptics_dev)
1078 input_unregister_device(ts->haptics_dev);1079 input_unregister_device(ts->haptics_dev);
1080 led_classdev_unregister(&ts->led_dev);
1081 ida_free(&thunderstrike_ida, ts->id);
1079 return ret;1082 return ret;
1080}1083}
1081 1084
drivers/hid/hid-sony.c+2−0
@@ -2155,6 +2155,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) · 2154 unmodified lines
2155 return ret;2155 return ret;
2156 2156
2157err:2157err:
2158 usb_free_urb(sc->ghl_urb);
2159
2158 hid_hw_stop(hdev);2160 hid_hw_stop(hdev);
2159 return ret;2161 return ret;
2160}2162}
drivers/hid/hid-steelseries.c+1−1
@@ -390,7 +390,7 @@ static int steelseries_headset_arctis_1_fetch_battery(struct hid_device *hdev) · 389 unmodified lines
390 ret = hid_hw_raw_request(hdev, arctis_1_battery_request[0],390 ret = hid_hw_raw_request(hdev, arctis_1_battery_request[0],
391 write_buf, sizeof(arctis_1_battery_request),391 write_buf, sizeof(arctis_1_battery_request),
392 HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);392 HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
393 if (ret < sizeof(arctis_1_battery_request)) {393 if (ret < (int)sizeof(arctis_1_battery_request)) {
394 hid_err(hdev, "hid_hw_raw_request() failed with %d\n", ret);394 hid_err(hdev, "hid_hw_raw_request() failed with %d\n", ret);
395 ret = -ENODATA;395 ret = -ENODATA;
396 }396 }
drivers/hid/intel-ish-hid/ipc/pci-ish.c+8−0
@@ -133,6 +133,14 @@ static int enable_gpe(struct device *dev) · 132 unmodified lines
133 }133 }
134 wakeup = &adev->wakeup;134 wakeup = &adev->wakeup;
135 135
136 /*
137 * Call acpi_disable_gpe(), so that reference count
138 * gpe_event_info->runtime_count doesn't overflow.
139 * When gpe_event_info->runtime_count = 0, the call
140 * to acpi_disable_gpe() simply return.
141 */
142 acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number);
143
136 acpi_sts = acpi_enable_gpe(wakeup->gpe_device, wakeup->gpe_number);144 acpi_sts = acpi_enable_gpe(wakeup->gpe_device, wakeup->gpe_number);
137 if (ACPI_FAILURE(acpi_sts)) {145 if (ACPI_FAILURE(acpi_sts)) {
138 dev_err(dev, "enable ose_gpe failed\n");146 dev_err(dev, "enable ose_gpe failed\n");

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t