for-linus-2023100502
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIVAwUAZR6/paZi849r7WBJAQJf3hAAl5XpAFPj5uPeC46y0DxuPHMm8uaoHR0H N89v60wiNr2l1mf4aeo+PHjzb4+IGYF1SBabJmDOXODef86zRfBoK8V1gAyeTViL UQ4UtpsSbIQyspgq7uyJl6eSDOQrWSLaurpPT3aLGOLyhLapMIuZ2cCbP1nY0+/d JmocbCAJQm/VDuV+7LvX3BMb/57Q01QEhz0zJcNpqvQOwTrgieHpqXkUfmIy2nzq VI2Av9O35BJ9sqaxyN8HcFV4b7FhY1f5p+i8f10lzLSkIq4xUNofV/bZ3UR2CrUl w4MhFu0w6QwvmsGpvnBX+wHdI2I5Qg4BZfriuIF8m1ms8e3skwSL4gVmxyc/xf6U mO1ttjpLCTYo4y6aH152peSe8W8k2jlALCcaAtHvZLSK/KVRB4tZU2OW58XJoZpL HnKaTqDpnpSTqpscRl6HGVzq8+muTz0OGH+wMGhlgHFjcSF0FS6migCltUurfenZ DCCiL+advroC2Fxgg0YIT7OSoT0f6qqhJ6/U3lndHCTb/3BHWe4V0LpD0yzygUYX JAVuR6yvajYGbrVQLzSp9Tjv3bhXUbAlHg5HE8/cBOuu2DlWJzuyb0lfgBgHsRjl 1FSTYSbGVzXC10HtT3KwytC0FC6LtkG6d/oizbG8njWkKhhT1RnSYb09kOPWuB74 TYIighZhaN8= =rK8d -----END PGP SIGNATURE----- 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()
This commit is contained in:
commit
19fbf677b2
@ -799,6 +799,8 @@ config HID_NVIDIA_SHIELD
|
||||
tristate "NVIDIA SHIELD devices"
|
||||
depends on USB_HID
|
||||
depends on BT_HIDP
|
||||
depends on LEDS_CLASS
|
||||
select POWER_SUPPLY
|
||||
help
|
||||
Support for NVIDIA SHIELD accessories.
|
||||
|
||||
|
@ -130,6 +130,10 @@ static int holtek_kbd_input_event(struct input_dev *dev, unsigned int type,
|
||||
return -ENODEV;
|
||||
|
||||
boot_hid = usb_get_intfdata(boot_interface);
|
||||
if (list_empty(&boot_hid->inputs)) {
|
||||
hid_err(hid, "no inputs found\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
boot_hid_input = list_first_entry(&boot_hid->inputs,
|
||||
struct hid_input, list);
|
||||
|
||||
|
@ -425,6 +425,7 @@
|
||||
#define I2C_DEVICE_ID_HP_SPECTRE_X360_13T_AW100 0x29F5
|
||||
#define I2C_DEVICE_ID_HP_SPECTRE_X360_14T_EA100_V1 0x2BED
|
||||
#define I2C_DEVICE_ID_HP_SPECTRE_X360_14T_EA100_V2 0x2BEE
|
||||
#define I2C_DEVICE_ID_HP_ENVY_X360_15_EU0556NG 0x2D02
|
||||
|
||||
#define USB_VENDOR_ID_ELECOM 0x056e
|
||||
#define USB_DEVICE_ID_ELECOM_BM084 0x0061
|
||||
|
@ -409,6 +409,8 @@ static const struct hid_device_id hid_battery_quirks[] = {
|
||||
HID_BATTERY_QUIRK_IGNORE },
|
||||
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_14T_EA100_V2),
|
||||
HID_BATTERY_QUIRK_IGNORE },
|
||||
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15_EU0556NG),
|
||||
HID_BATTERY_QUIRK_IGNORE },
|
||||
{}
|
||||
};
|
||||
|
||||
|
@ -4677,6 +4677,8 @@ static const struct hid_device_id hidpp_devices[] = {
|
||||
HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb008) },
|
||||
{ /* MX Master mouse over Bluetooth */
|
||||
HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb012) },
|
||||
{ /* M720 Triathlon mouse over Bluetooth */
|
||||
HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb015) },
|
||||
{ /* MX Ergo trackball over Bluetooth */
|
||||
HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01d) },
|
||||
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01e) },
|
||||
|
@ -2144,6 +2144,10 @@ static const struct hid_device_id mt_devices[] = {
|
||||
USB_DEVICE_ID_MTP_STM)},
|
||||
|
||||
/* Synaptics devices */
|
||||
{ .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,
|
||||
HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
|
||||
USB_VENDOR_ID_SYNAPTICS, 0xcd7e) },
|
||||
|
||||
{ .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,
|
||||
HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
|
||||
USB_VENDOR_ID_SYNAPTICS, 0xce08) },
|
||||
|
@ -2088,7 +2088,9 @@ static int joycon_read_info(struct joycon_ctlr *ctlr)
|
||||
struct joycon_input_report *report;
|
||||
|
||||
req.subcmd_id = JC_SUBCMD_REQ_DEV_INFO;
|
||||
mutex_lock(&ctlr->output_mutex);
|
||||
ret = joycon_send_subcmd(ctlr, &req, 0, HZ);
|
||||
mutex_unlock(&ctlr->output_mutex);
|
||||
if (ret) {
|
||||
hid_err(ctlr->hdev, "Failed to get joycon info; ret=%d\n", ret);
|
||||
return ret;
|
||||
@ -2117,6 +2119,85 @@ static int joycon_read_info(struct joycon_ctlr *ctlr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int joycon_init(struct hid_device *hdev)
|
||||
{
|
||||
struct joycon_ctlr *ctlr = hid_get_drvdata(hdev);
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&ctlr->output_mutex);
|
||||
/* if handshake command fails, assume ble pro controller */
|
||||
if ((jc_type_is_procon(ctlr) || jc_type_is_chrggrip(ctlr)) &&
|
||||
!joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ)) {
|
||||
hid_dbg(hdev, "detected USB controller\n");
|
||||
/* set baudrate for improved latency */
|
||||
ret = joycon_send_usb(ctlr, JC_USB_CMD_BAUDRATE_3M, HZ);
|
||||
if (ret) {
|
||||
hid_err(hdev, "Failed to set baudrate; ret=%d\n", ret);
|
||||
goto out_unlock;
|
||||
}
|
||||
/* handshake */
|
||||
ret = joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ);
|
||||
if (ret) {
|
||||
hid_err(hdev, "Failed handshake; ret=%d\n", ret);
|
||||
goto out_unlock;
|
||||
}
|
||||
/*
|
||||
* Set no timeout (to keep controller in USB mode).
|
||||
* This doesn't send a response, so ignore the timeout.
|
||||
*/
|
||||
joycon_send_usb(ctlr, JC_USB_CMD_NO_TIMEOUT, HZ/10);
|
||||
} else if (jc_type_is_chrggrip(ctlr)) {
|
||||
hid_err(hdev, "Failed charging grip handshake\n");
|
||||
ret = -ETIMEDOUT;
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
/* get controller calibration data, and parse it */
|
||||
ret = joycon_request_calibration(ctlr);
|
||||
if (ret) {
|
||||
/*
|
||||
* We can function with default calibration, but it may be
|
||||
* inaccurate. Provide a warning, and continue on.
|
||||
*/
|
||||
hid_warn(hdev, "Analog stick positions may be inaccurate\n");
|
||||
}
|
||||
|
||||
/* get IMU calibration data, and parse it */
|
||||
ret = joycon_request_imu_calibration(ctlr);
|
||||
if (ret) {
|
||||
/*
|
||||
* We can function with default calibration, but it may be
|
||||
* inaccurate. Provide a warning, and continue on.
|
||||
*/
|
||||
hid_warn(hdev, "Unable to read IMU calibration data\n");
|
||||
}
|
||||
|
||||
/* Set the reporting mode to 0x30, which is the full report mode */
|
||||
ret = joycon_set_report_mode(ctlr);
|
||||
if (ret) {
|
||||
hid_err(hdev, "Failed to set report mode; ret=%d\n", ret);
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
/* Enable rumble */
|
||||
ret = joycon_enable_rumble(ctlr);
|
||||
if (ret) {
|
||||
hid_err(hdev, "Failed to enable rumble; ret=%d\n", ret);
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
/* Enable the IMU */
|
||||
ret = joycon_enable_imu(ctlr);
|
||||
if (ret) {
|
||||
hid_err(hdev, "Failed to enable the IMU; ret=%d\n", ret);
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
out_unlock:
|
||||
mutex_unlock(&ctlr->output_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Common handler for parsing inputs */
|
||||
static int joycon_ctlr_read_handler(struct joycon_ctlr *ctlr, u8 *data,
|
||||
int size)
|
||||
@ -2248,85 +2329,19 @@ static int nintendo_hid_probe(struct hid_device *hdev,
|
||||
|
||||
hid_device_io_start(hdev);
|
||||
|
||||
/* Initialize the controller */
|
||||
mutex_lock(&ctlr->output_mutex);
|
||||
/* if handshake command fails, assume ble pro controller */
|
||||
if ((jc_type_is_procon(ctlr) || jc_type_is_chrggrip(ctlr)) &&
|
||||
!joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ)) {
|
||||
hid_dbg(hdev, "detected USB controller\n");
|
||||
/* set baudrate for improved latency */
|
||||
ret = joycon_send_usb(ctlr, JC_USB_CMD_BAUDRATE_3M, HZ);
|
||||
if (ret) {
|
||||
hid_err(hdev, "Failed to set baudrate; ret=%d\n", ret);
|
||||
goto err_mutex;
|
||||
}
|
||||
/* handshake */
|
||||
ret = joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ);
|
||||
if (ret) {
|
||||
hid_err(hdev, "Failed handshake; ret=%d\n", ret);
|
||||
goto err_mutex;
|
||||
}
|
||||
/*
|
||||
* Set no timeout (to keep controller in USB mode).
|
||||
* This doesn't send a response, so ignore the timeout.
|
||||
*/
|
||||
joycon_send_usb(ctlr, JC_USB_CMD_NO_TIMEOUT, HZ/10);
|
||||
} else if (jc_type_is_chrggrip(ctlr)) {
|
||||
hid_err(hdev, "Failed charging grip handshake\n");
|
||||
ret = -ETIMEDOUT;
|
||||
goto err_mutex;
|
||||
}
|
||||
|
||||
/* get controller calibration data, and parse it */
|
||||
ret = joycon_request_calibration(ctlr);
|
||||
ret = joycon_init(hdev);
|
||||
if (ret) {
|
||||
/*
|
||||
* We can function with default calibration, but it may be
|
||||
* inaccurate. Provide a warning, and continue on.
|
||||
*/
|
||||
hid_warn(hdev, "Analog stick positions may be inaccurate\n");
|
||||
}
|
||||
|
||||
/* get IMU calibration data, and parse it */
|
||||
ret = joycon_request_imu_calibration(ctlr);
|
||||
if (ret) {
|
||||
/*
|
||||
* We can function with default calibration, but it may be
|
||||
* inaccurate. Provide a warning, and continue on.
|
||||
*/
|
||||
hid_warn(hdev, "Unable to read IMU calibration data\n");
|
||||
}
|
||||
|
||||
/* Set the reporting mode to 0x30, which is the full report mode */
|
||||
ret = joycon_set_report_mode(ctlr);
|
||||
if (ret) {
|
||||
hid_err(hdev, "Failed to set report mode; ret=%d\n", ret);
|
||||
goto err_mutex;
|
||||
}
|
||||
|
||||
/* Enable rumble */
|
||||
ret = joycon_enable_rumble(ctlr);
|
||||
if (ret) {
|
||||
hid_err(hdev, "Failed to enable rumble; ret=%d\n", ret);
|
||||
goto err_mutex;
|
||||
}
|
||||
|
||||
/* Enable the IMU */
|
||||
ret = joycon_enable_imu(ctlr);
|
||||
if (ret) {
|
||||
hid_err(hdev, "Failed to enable the IMU; ret=%d\n", ret);
|
||||
goto err_mutex;
|
||||
hid_err(hdev, "Failed to initialize controller; ret=%d\n", ret);
|
||||
goto err_close;
|
||||
}
|
||||
|
||||
ret = joycon_read_info(ctlr);
|
||||
if (ret) {
|
||||
hid_err(hdev, "Failed to retrieve controller info; ret=%d\n",
|
||||
ret);
|
||||
goto err_mutex;
|
||||
goto err_close;
|
||||
}
|
||||
|
||||
mutex_unlock(&ctlr->output_mutex);
|
||||
|
||||
/* Initialize the leds */
|
||||
ret = joycon_leds_create(ctlr);
|
||||
if (ret) {
|
||||
@ -2352,8 +2367,6 @@ static int nintendo_hid_probe(struct hid_device *hdev,
|
||||
hid_dbg(hdev, "probe - success\n");
|
||||
return 0;
|
||||
|
||||
err_mutex:
|
||||
mutex_unlock(&ctlr->output_mutex);
|
||||
err_close:
|
||||
hid_hw_close(hdev);
|
||||
err_stop:
|
||||
@ -2383,6 +2396,20 @@ static void nintendo_hid_remove(struct hid_device *hdev)
|
||||
hid_hw_stop(hdev);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
static int nintendo_hid_resume(struct hid_device *hdev)
|
||||
{
|
||||
int ret = joycon_init(hdev);
|
||||
|
||||
if (ret)
|
||||
hid_err(hdev, "Failed to restore controller after resume");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static const struct hid_device_id nintendo_hid_devices[] = {
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_NINTENDO,
|
||||
USB_DEVICE_ID_NINTENDO_PROCON) },
|
||||
@ -2404,6 +2431,10 @@ static struct hid_driver nintendo_hid_driver = {
|
||||
.probe = nintendo_hid_probe,
|
||||
.remove = nintendo_hid_remove,
|
||||
.raw_event = nintendo_hid_event,
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
.resume = nintendo_hid_resume,
|
||||
#endif
|
||||
};
|
||||
module_hid_driver(nintendo_hid_driver);
|
||||
|
||||
|
@ -801,7 +801,7 @@ static inline int thunderstrike_led_create(struct thunderstrike *ts)
|
||||
led->name = devm_kasprintf(&ts->base.hdev->dev, GFP_KERNEL,
|
||||
"thunderstrike%d:blue:led", ts->id);
|
||||
led->max_brightness = 1;
|
||||
led->flags = LED_CORE_SUSPENDRESUME;
|
||||
led->flags = LED_CORE_SUSPENDRESUME | LED_RETAIN_AT_SHUTDOWN;
|
||||
led->brightness_get = &thunderstrike_led_get_brightness;
|
||||
led->brightness_set = &thunderstrike_led_set_brightness;
|
||||
|
||||
@ -1058,7 +1058,7 @@ static int shield_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
||||
ret = hid_hw_start(hdev, HID_CONNECT_HIDINPUT);
|
||||
if (ret) {
|
||||
hid_err(hdev, "Failed to start HID device\n");
|
||||
goto err_haptics;
|
||||
goto err_ts_create;
|
||||
}
|
||||
|
||||
ret = hid_hw_open(hdev);
|
||||
@ -1073,9 +1073,12 @@ static int shield_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
||||
|
||||
err_stop:
|
||||
hid_hw_stop(hdev);
|
||||
err_haptics:
|
||||
err_ts_create:
|
||||
power_supply_unregister(ts->base.battery_dev.psy);
|
||||
if (ts->haptics_dev)
|
||||
input_unregister_device(ts->haptics_dev);
|
||||
led_classdev_unregister(&ts->led_dev);
|
||||
ida_free(&thunderstrike_ida, ts->id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -2155,6 +2155,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
||||
return ret;
|
||||
|
||||
err:
|
||||
usb_free_urb(sc->ghl_urb);
|
||||
|
||||
hid_hw_stop(hdev);
|
||||
return ret;
|
||||
}
|
||||
|
@ -390,7 +390,7 @@ static int steelseries_headset_arctis_1_fetch_battery(struct hid_device *hdev)
|
||||
ret = hid_hw_raw_request(hdev, arctis_1_battery_request[0],
|
||||
write_buf, sizeof(arctis_1_battery_request),
|
||||
HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
|
||||
if (ret < sizeof(arctis_1_battery_request)) {
|
||||
if (ret < (int)sizeof(arctis_1_battery_request)) {
|
||||
hid_err(hdev, "hid_hw_raw_request() failed with %d\n", ret);
|
||||
ret = -ENODATA;
|
||||
}
|
||||
|
@ -133,6 +133,14 @@ static int enable_gpe(struct device *dev)
|
||||
}
|
||||
wakeup = &adev->wakeup;
|
||||
|
||||
/*
|
||||
* Call acpi_disable_gpe(), so that reference count
|
||||
* gpe_event_info->runtime_count doesn't overflow.
|
||||
* When gpe_event_info->runtime_count = 0, the call
|
||||
* to acpi_disable_gpe() simply return.
|
||||
*/
|
||||
acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number);
|
||||
|
||||
acpi_sts = acpi_enable_gpe(wakeup->gpe_device, wakeup->gpe_number);
|
||||
if (ACPI_FAILURE(acpi_sts)) {
|
||||
dev_err(dev, "enable ose_gpe failed\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user