Skip to content

Commit 58c9bf3

Browse files
committed
Merge tag 'hid-for-linus-2025021001' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID fixes from Jiri Kosina: - build/dependency fixes for hid-lenovo and hid-intel-thc (Arnd Bergmann) - functional fixes for hid-corsair-void (Stuart Hayhurst) - workqueue handling and ordering fix for hid-steam (Vicki Pfau) - Gamepad mode vs. Lizard mode fix for hid-steam (Vicki Pfau) - OOB read fix for hid-thrustmaster (Tulio Fernandes) - fix for very long timeout on certain firmware in intel-ish-hid (Zhang Lixu) - other assorted small code fixes and device ID additions * tag 'hid-for-linus-2025021001' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: HID: hid-steam: Don't use cancel_delayed_work_sync in IRQ context HID: hid-steam: Move hidraw input (un)registering to work HID: hid-thrustmaster: fix stack-out-of-bounds read in usb_check_int_endpoints() HID: apple: fix up the F6 key on the Omoton KB066 keyboard HID: hid-apple: Apple Magic Keyboard a3203 USB-C support samples/hid: fix broken vmlinux path for VMLINUX_BTF samples/hid: remove unnecessary -I flags from libbpf EXTRA_CFLAGS HID: topre: Fix n-key rollover on Realforce R3S TKL boards HID: intel-ish-hid: ipc: Add Panther Lake PCI device IDs HID: multitouch: Add NULL check in mt_input_configured HID: winwing: Add NULL check in winwing_init_led() HID: hid-steam: Fix issues with disabling both gamepad mode and lizard mode HID: ignore non-functional sensor in HP 5MP Camera HID: intel-thc: fix CONFIG_HID dependency HID: lenovo: select CONFIG_ACPI_PLATFORM_PROFILE HID: intel-ish-hid: Send clock sync message immediately after reset HID: intel-ish-hid: fix the length of MNG_SYNC_FW_CLOCK in doorbell HID: corsair-void: Initialise memory for psy_cfg HID: corsair-void: Add missing delayed work cancel for headset status
2 parents c581f8c + b051ffa commit 58c9bf3

File tree

23 files changed

+104
-47
lines changed

23 files changed

+104
-47
lines changed

drivers/hid/Kconfig

+10-5
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,8 @@ config HID_LED
570570

571571
config HID_LENOVO
572572
tristate "Lenovo / Thinkpad devices"
573+
depends on ACPI
574+
select ACPI_PLATFORM_PROFILE
573575
select NEW_LEDS
574576
select LEDS_CLASS
575577
help
@@ -1167,7 +1169,8 @@ config HID_TOPRE
11671169
tristate "Topre REALFORCE keyboards"
11681170
depends on HID
11691171
help
1170-
Say Y for N-key rollover support on Topre REALFORCE R2 108/87 key keyboards.
1172+
Say Y for N-key rollover support on Topre REALFORCE R2 108/87 key and
1173+
Topre REALFORCE R3S 87 key keyboards.
11711174

11721175
config HID_THINGM
11731176
tristate "ThingM blink(1) USB RGB LED"
@@ -1374,10 +1377,6 @@ endmenu
13741377

13751378
source "drivers/hid/bpf/Kconfig"
13761379

1377-
endif # HID
1378-
1379-
source "drivers/hid/usbhid/Kconfig"
1380-
13811380
source "drivers/hid/i2c-hid/Kconfig"
13821381

13831382
source "drivers/hid/intel-ish-hid/Kconfig"
@@ -1388,4 +1387,10 @@ source "drivers/hid/surface-hid/Kconfig"
13881387

13891388
source "drivers/hid/intel-thc-hid/Kconfig"
13901389

1390+
endif # HID
1391+
1392+
# USB support may be used with HID disabled
1393+
1394+
source "drivers/hid/usbhid/Kconfig"
1395+
13911396
endif # HID_SUPPORT

drivers/hid/amd-sfh-hid/Kconfig

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ menu "AMD SFH HID Support"
55

66
config AMD_SFH_HID
77
tristate "AMD Sensor Fusion Hub"
8-
depends on HID
98
depends on X86
109
help
1110
If you say yes to this option, support will be included for the

drivers/hid/hid-apple.c

+8
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
474474
hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2015)
475475
table = magic_keyboard_2015_fn_keys;
476476
else if (hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021 ||
477+
hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024 ||
477478
hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021 ||
478479
hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021)
479480
table = apple2021_fn_keys;
@@ -545,6 +546,9 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
545546
}
546547
}
547548

549+
if (usage->hid == 0xc0301) /* Omoton KB066 quirk */
550+
code = KEY_F6;
551+
548552
if (usage->code != code) {
549553
input_event_with_scancode(input, usage->type, code, usage->hid, value);
550554

@@ -1150,6 +1154,10 @@ static const struct hid_device_id apple_devices[] = {
11501154
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY },
11511155
{ HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021),
11521156
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
1157+
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024),
1158+
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY },
1159+
{ HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024),
1160+
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
11531161
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021),
11541162
.driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY },
11551163
{ HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021),

drivers/hid/hid-corsair-void.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ static void corsair_void_battery_remove_work_handler(struct work_struct *work)
553553
static void corsair_void_battery_add_work_handler(struct work_struct *work)
554554
{
555555
struct corsair_void_drvdata *drvdata;
556-
struct power_supply_config psy_cfg;
556+
struct power_supply_config psy_cfg = {};
557557
struct power_supply *new_supply;
558558

559559
drvdata = container_of(work, struct corsair_void_drvdata,
@@ -726,6 +726,7 @@ static void corsair_void_remove(struct hid_device *hid_dev)
726726
if (drvdata->battery)
727727
power_supply_unregister(drvdata->battery);
728728

729+
cancel_delayed_work_sync(&drvdata->delayed_status_work);
729730
cancel_delayed_work_sync(&drvdata->delayed_firmware_work);
730731
sysfs_remove_group(&hid_dev->dev.kobj, &corsair_void_attr_group);
731732
}

drivers/hid/hid-ids.h

+3
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@
184184
#define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242
185185
#define USB_DEVICE_ID_APPLE_IRCONTROL5 0x8243
186186
#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021 0x029c
187+
#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024 0x0320
187188
#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021 0x029a
188189
#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021 0x029f
189190
#define USB_DEVICE_ID_APPLE_TOUCHBAR_BACKLIGHT 0x8102
@@ -1095,6 +1096,7 @@
10951096
#define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001 0x3001
10961097
#define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3003 0x3003
10971098
#define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008 0x3008
1099+
#define USB_DEVICE_ID_QUANTA_HP_5MP_CAMERA_5473 0x5473
10981100

10991101
#define I2C_VENDOR_ID_RAYDIUM 0x2386
11001102
#define I2C_PRODUCT_ID_RAYDIUM_4B33 0x4b33
@@ -1301,6 +1303,7 @@
13011303
#define USB_VENDOR_ID_TOPRE 0x0853
13021304
#define USB_DEVICE_ID_TOPRE_REALFORCE_R2_108 0x0148
13031305
#define USB_DEVICE_ID_TOPRE_REALFORCE_R2_87 0x0146
1306+
#define USB_DEVICE_ID_TOPRE_REALFORCE_R3S_87 0x0313
13041307

13051308
#define USB_VENDOR_ID_TOPSEED 0x0766
13061309
#define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204

drivers/hid/hid-lenovo.c

+1-6
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232
#include <linux/leds.h>
3333
#include <linux/workqueue.h>
3434

35-
#if IS_ENABLED(CONFIG_ACPI_PLATFORM_PROFILE)
3635
#include <linux/platform_profile.h>
37-
#endif /* CONFIG_ACPI_PLATFORM_PROFILE */
3836

3937
#include "hid-ids.h"
4038

@@ -730,13 +728,10 @@ static int lenovo_raw_event_TP_X12_tab(struct hid_device *hdev, u32 raw_data)
730728
if (hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB) {
731729
report_key_event(input, KEY_RFKILL);
732730
return 1;
733-
}
734-
#if IS_ENABLED(CONFIG_ACPI_PLATFORM_PROFILE)
735-
else {
731+
} else {
736732
platform_profile_cycle();
737733
return 1;
738734
}
739-
#endif /* CONFIG_ACPI_PLATFORM_PROFILE */
740735
return 0;
741736
case TP_X12_RAW_HOTKEY_FN_F10:
742737
/* TAB1 has PICKUP Phone and TAB2 use Snipping tool*/

drivers/hid/hid-multitouch.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -1679,9 +1679,12 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
16791679
break;
16801680
}
16811681

1682-
if (suffix)
1682+
if (suffix) {
16831683
hi->input->name = devm_kasprintf(&hdev->dev, GFP_KERNEL,
16841684
"%s %s", hdev->name, suffix);
1685+
if (!hi->input->name)
1686+
return -ENOMEM;
1687+
}
16851688

16861689
return 0;
16871690
}

drivers/hid/hid-quirks.c

+1
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,7 @@ static const struct hid_device_id hid_ignore_list[] = {
891891
{ HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DPAD) },
892892
#endif
893893
{ HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) },
894+
{ HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_HP_5MP_CAMERA_5473) },
894895
{ }
895896
};
896897

drivers/hid/hid-steam.c

+35-11
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ struct steam_device {
313313
u16 rumble_left;
314314
u16 rumble_right;
315315
unsigned int sensor_timestamp_us;
316+
struct work_struct unregister_work;
316317
};
317318

318319
static int steam_recv_report(struct steam_device *steam,
@@ -1050,10 +1051,10 @@ static void steam_mode_switch_cb(struct work_struct *work)
10501051
struct steam_device, mode_switch);
10511052
unsigned long flags;
10521053
bool client_opened;
1053-
steam->gamepad_mode = !steam->gamepad_mode;
10541054
if (!lizard_mode)
10551055
return;
10561056

1057+
steam->gamepad_mode = !steam->gamepad_mode;
10571058
if (steam->gamepad_mode)
10581059
steam_set_lizard_mode(steam, false);
10591060
else {
@@ -1072,6 +1073,31 @@ static void steam_mode_switch_cb(struct work_struct *work)
10721073
}
10731074
}
10741075

1076+
static void steam_work_unregister_cb(struct work_struct *work)
1077+
{
1078+
struct steam_device *steam = container_of(work, struct steam_device,
1079+
unregister_work);
1080+
unsigned long flags;
1081+
bool connected;
1082+
bool opened;
1083+
1084+
spin_lock_irqsave(&steam->lock, flags);
1085+
opened = steam->client_opened;
1086+
connected = steam->connected;
1087+
spin_unlock_irqrestore(&steam->lock, flags);
1088+
1089+
if (connected) {
1090+
if (opened) {
1091+
steam_sensors_unregister(steam);
1092+
steam_input_unregister(steam);
1093+
} else {
1094+
steam_set_lizard_mode(steam, lizard_mode);
1095+
steam_input_register(steam);
1096+
steam_sensors_register(steam);
1097+
}
1098+
}
1099+
}
1100+
10751101
static bool steam_is_valve_interface(struct hid_device *hdev)
10761102
{
10771103
struct hid_report_enum *rep_enum;
@@ -1117,8 +1143,7 @@ static int steam_client_ll_open(struct hid_device *hdev)
11171143
steam->client_opened++;
11181144
spin_unlock_irqrestore(&steam->lock, flags);
11191145

1120-
steam_sensors_unregister(steam);
1121-
steam_input_unregister(steam);
1146+
schedule_work(&steam->unregister_work);
11221147

11231148
return 0;
11241149
}
@@ -1135,11 +1160,7 @@ static void steam_client_ll_close(struct hid_device *hdev)
11351160
connected = steam->connected && !steam->client_opened;
11361161
spin_unlock_irqrestore(&steam->lock, flags);
11371162

1138-
if (connected) {
1139-
steam_set_lizard_mode(steam, lizard_mode);
1140-
steam_input_register(steam);
1141-
steam_sensors_register(steam);
1142-
}
1163+
schedule_work(&steam->unregister_work);
11431164
}
11441165

11451166
static int steam_client_ll_raw_request(struct hid_device *hdev,
@@ -1231,6 +1252,7 @@ static int steam_probe(struct hid_device *hdev,
12311252
INIT_LIST_HEAD(&steam->list);
12321253
INIT_WORK(&steam->rumble_work, steam_haptic_rumble_cb);
12331254
steam->sensor_timestamp_us = 0;
1255+
INIT_WORK(&steam->unregister_work, steam_work_unregister_cb);
12341256

12351257
/*
12361258
* With the real steam controller interface, do not connect hidraw.
@@ -1291,6 +1313,7 @@ static int steam_probe(struct hid_device *hdev,
12911313
cancel_work_sync(&steam->work_connect);
12921314
cancel_delayed_work_sync(&steam->mode_switch);
12931315
cancel_work_sync(&steam->rumble_work);
1316+
cancel_work_sync(&steam->unregister_work);
12941317

12951318
return ret;
12961319
}
@@ -1307,6 +1330,7 @@ static void steam_remove(struct hid_device *hdev)
13071330
cancel_delayed_work_sync(&steam->mode_switch);
13081331
cancel_work_sync(&steam->work_connect);
13091332
cancel_work_sync(&steam->rumble_work);
1333+
cancel_work_sync(&steam->unregister_work);
13101334
hid_destroy_device(steam->client_hdev);
13111335
steam->client_hdev = NULL;
13121336
steam->client_opened = 0;
@@ -1593,13 +1617,13 @@ static void steam_do_deck_input_event(struct steam_device *steam,
15931617

15941618
if (!(b9 & BIT(6)) && steam->did_mode_switch) {
15951619
steam->did_mode_switch = false;
1596-
cancel_delayed_work_sync(&steam->mode_switch);
1620+
cancel_delayed_work(&steam->mode_switch);
15971621
} else if (!steam->client_opened && (b9 & BIT(6)) && !steam->did_mode_switch) {
15981622
steam->did_mode_switch = true;
15991623
schedule_delayed_work(&steam->mode_switch, 45 * HZ / 100);
16001624
}
16011625

1602-
if (!steam->gamepad_mode)
1626+
if (!steam->gamepad_mode && lizard_mode)
16031627
return;
16041628

16051629
lpad_touched = b10 & BIT(3);
@@ -1669,7 +1693,7 @@ static void steam_do_deck_sensors_event(struct steam_device *steam,
16691693
*/
16701694
steam->sensor_timestamp_us += 4000;
16711695

1672-
if (!steam->gamepad_mode)
1696+
if (!steam->gamepad_mode && lizard_mode)
16731697
return;
16741698

16751699
input_event(sensors, EV_MSC, MSC_TIMESTAMP, steam->sensor_timestamp_us);

drivers/hid/hid-thrustmaster.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static void thrustmaster_interrupts(struct hid_device *hdev)
171171
b_ep = ep->desc.bEndpointAddress;
172172

173173
/* Are the expected endpoints present? */
174-
u8 ep_addr[1] = {b_ep};
174+
u8 ep_addr[2] = {b_ep, 0};
175175

176176
if (!usb_check_int_endpoints(usbif, ep_addr)) {
177177
hid_err(hdev, "Unexpected non-int endpoint\n");

drivers/hid/hid-topre.c

+7
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ static const __u8 *topre_report_fixup(struct hid_device *hdev, __u8 *rdesc,
2929
hid_info(hdev,
3030
"fixing up Topre REALFORCE keyboard report descriptor\n");
3131
rdesc[72] = 0x02;
32+
} else if (*rsize >= 106 && rdesc[28] == 0x29 && rdesc[29] == 0xe7 &&
33+
rdesc[30] == 0x81 && rdesc[31] == 0x00) {
34+
hid_info(hdev,
35+
"fixing up Topre REALFORCE keyboard report descriptor\n");
36+
rdesc[31] = 0x02;
3237
}
3338
return rdesc;
3439
}
@@ -38,6 +43,8 @@ static const struct hid_device_id topre_id_table[] = {
3843
USB_DEVICE_ID_TOPRE_REALFORCE_R2_108) },
3944
{ HID_USB_DEVICE(USB_VENDOR_ID_TOPRE,
4045
USB_DEVICE_ID_TOPRE_REALFORCE_R2_87) },
46+
{ HID_USB_DEVICE(USB_VENDOR_ID_TOPRE,
47+
USB_DEVICE_ID_TOPRE_REALFORCE_R3S_87) },
4148
{ }
4249
};
4350
MODULE_DEVICE_TABLE(hid, topre_id_table);

drivers/hid/hid-winwing.c

+2
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ static int winwing_init_led(struct hid_device *hdev,
106106
"%s::%s",
107107
dev_name(&input->dev),
108108
info->led_name);
109+
if (!led->cdev.name)
110+
return -ENOMEM;
109111

110112
ret = devm_led_classdev_register(&hdev->dev, &led->cdev);
111113
if (ret)

drivers/hid/i2c-hid/Kconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
menuconfig I2C_HID
33
tristate "I2C HID support"
44
default y
5-
depends on I2C && INPUT && HID
5+
depends on I2C
66

77
if I2C_HID
88

drivers/hid/intel-ish-hid/Kconfig

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ config INTEL_ISH_HID
66
tristate "Intel Integrated Sensor Hub"
77
default n
88
depends on X86
9-
depends on HID
109
help
1110
The Integrated Sensor Hub (ISH) enables the ability to offload
1211
sensor polling and algorithm processing to a dedicated low power

drivers/hid/intel-ish-hid/ipc/hw-ish.h

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
#define PCI_DEVICE_ID_INTEL_ISH_ARL_H 0x7745
3737
#define PCI_DEVICE_ID_INTEL_ISH_ARL_S 0x7F78
3838
#define PCI_DEVICE_ID_INTEL_ISH_LNL_M 0xA845
39+
#define PCI_DEVICE_ID_INTEL_ISH_PTL_H 0xE345
40+
#define PCI_DEVICE_ID_INTEL_ISH_PTL_P 0xE445
3941

4042
#define REVISION_ID_CHT_A0 0x6
4143
#define REVISION_ID_CHT_Ax_SI 0x0

drivers/hid/intel-ish-hid/ipc/ipc.c

+9-6
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,10 @@ static int ish_fw_reset_handler(struct ishtp_device *dev)
517517
/* ISH FW is dead */
518518
if (!ish_is_input_ready(dev))
519519
return -EPIPE;
520+
521+
/* Send clock sync at once after reset */
522+
ishtp_dev->prev_sync = 0;
523+
520524
/*
521525
* Set HOST2ISH.ILUP. Apparently we need this BEFORE sending
522526
* RESET_NOTIFY_ACK - FW will be checking for it
@@ -577,15 +581,14 @@ static void fw_reset_work_fn(struct work_struct *work)
577581
*/
578582
static void _ish_sync_fw_clock(struct ishtp_device *dev)
579583
{
580-
static unsigned long prev_sync;
581-
uint64_t usec;
584+
struct ipc_time_update_msg time = {};
582585

583-
if (prev_sync && time_before(jiffies, prev_sync + 20 * HZ))
586+
if (dev->prev_sync && time_before(jiffies, dev->prev_sync + 20 * HZ))
584587
return;
585588

586-
prev_sync = jiffies;
587-
usec = ktime_to_us(ktime_get_boottime());
588-
ipc_send_mng_msg(dev, MNG_SYNC_FW_CLOCK, &usec, sizeof(uint64_t));
589+
dev->prev_sync = jiffies;
590+
/* The fields of time would be updated while sending message */
591+
ipc_send_mng_msg(dev, MNG_SYNC_FW_CLOCK, &time, sizeof(time));
589592
}
590593

591594
/**

0 commit comments

Comments
 (0)