Skip to content

Commit 32d27cf

Browse files
committed
Merge tag 'hid-for-linus-2025092201' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID fixes from Jiri Kosina: - work data memory corruption fix in amd_sfh (Basavaraj Natikar) - fix for regression in cp2112 where setting a GPIO value would always fail (Sébastien Szymanski) - fix for regression in hid-lenovo causing driver to fail on non-ACPI systems (Janne Grunau) - a couple device ID additions and tiny device-specific quirks * tag 'hid-for-linus-2025092201' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: HID: amd_sfh: Add sync across amd sfh work functions HID: asus: add support for missing PX series fn keys HID: cp2112: fix setter callbacks return value HID: lenovo: Use KEY_PERFORMANCE instead of ACPI's platform_profile HID: intel-thc-hid: intel-quickspi: Add WCL Device IDs HID: intel-thc-hid: intel-quicki2c: Add WCL Device IDs
2 parents 33468b5 + bba920e commit 32d27cf

11 files changed

Lines changed: 34 additions & 12 deletions

File tree

drivers/hid/Kconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,6 @@ config HID_LED
597597

598598
config HID_LENOVO
599599
tristate "Lenovo / Thinkpad devices"
600-
depends on ACPI
601-
select ACPI_PLATFORM_PROFILE
602600
select NEW_LEDS
603601
select LEDS_CLASS
604602
help

drivers/hid/amd-sfh-hid/amd_sfh_client.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,12 @@ int amd_sfh_get_report(struct hid_device *hid, int report_id, int report_type)
3939
struct amdtp_hid_data *hid_data = hid->driver_data;
4040
struct amdtp_cl_data *cli_data = hid_data->cli_data;
4141
struct request_list *req_list = &cli_data->req_list;
42+
struct amd_input_data *in_data = cli_data->in_data;
43+
struct amd_mp2_dev *mp2;
4244
int i;
4345

46+
mp2 = container_of(in_data, struct amd_mp2_dev, in_data);
47+
guard(mutex)(&mp2->lock);
4448
for (i = 0; i < cli_data->num_hid_devices; i++) {
4549
if (cli_data->hid_sensor_hubs[i] == hid) {
4650
struct request_list *new = kzalloc(sizeof(*new), GFP_KERNEL);
@@ -75,6 +79,8 @@ void amd_sfh_work(struct work_struct *work)
7579
u8 report_id, node_type;
7680
u8 report_size = 0;
7781

82+
mp2 = container_of(in_data, struct amd_mp2_dev, in_data);
83+
guard(mutex)(&mp2->lock);
7884
req_node = list_last_entry(&req_list->list, struct request_list, list);
7985
list_del(&req_node->list);
8086
current_index = req_node->current_index;
@@ -83,7 +89,6 @@ void amd_sfh_work(struct work_struct *work)
8389
node_type = req_node->report_type;
8490
kfree(req_node);
8591

86-
mp2 = container_of(in_data, struct amd_mp2_dev, in_data);
8792
mp2_ops = mp2->mp2_ops;
8893
if (node_type == HID_FEATURE_REPORT) {
8994
report_size = mp2_ops->get_feat_rep(sensor_index, report_id,
@@ -107,6 +112,8 @@ void amd_sfh_work(struct work_struct *work)
107112
cli_data->cur_hid_dev = current_index;
108113
cli_data->sensor_requested_cnt[current_index] = 0;
109114
amdtp_hid_wakeup(cli_data->hid_sensor_hubs[current_index]);
115+
if (!list_empty(&req_list->list))
116+
schedule_delayed_work(&cli_data->work, 0);
110117
}
111118

112119
void amd_sfh_work_buffer(struct work_struct *work)
@@ -117,9 +124,10 @@ void amd_sfh_work_buffer(struct work_struct *work)
117124
u8 report_size;
118125
int i;
119126

127+
mp2 = container_of(in_data, struct amd_mp2_dev, in_data);
128+
guard(mutex)(&mp2->lock);
120129
for (i = 0; i < cli_data->num_hid_devices; i++) {
121130
if (cli_data->sensor_sts[i] == SENSOR_ENABLED) {
122-
mp2 = container_of(in_data, struct amd_mp2_dev, in_data);
123131
report_size = mp2->mp2_ops->get_in_rep(i, cli_data->sensor_idx[i],
124132
cli_data->report_id[i], in_data);
125133
hid_input_report(cli_data->hid_sensor_hubs[i], HID_INPUT_REPORT,

drivers/hid/amd-sfh-hid/amd_sfh_common.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#ifndef AMD_SFH_COMMON_H
1111
#define AMD_SFH_COMMON_H
1212

13+
#include <linux/mutex.h>
1314
#include <linux/pci.h>
1415
#include "amd_sfh_hid.h"
1516

@@ -59,6 +60,8 @@ struct amd_mp2_dev {
5960
u32 mp2_acs;
6061
struct sfh_dev_status dev_en;
6162
struct work_struct work;
63+
/* mp2 to protect data */
64+
struct mutex lock;
6265
u8 init_done;
6366
u8 rver;
6467
};

drivers/hid/amd-sfh-hid/amd_sfh_pcie.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,10 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
466466
if (!privdata->cl_data)
467467
return -ENOMEM;
468468

469+
rc = devm_mutex_init(&pdev->dev, &privdata->lock);
470+
if (rc)
471+
return rc;
472+
469473
privdata->sfh1_1_ops = (const struct amd_sfh1_1_ops *)id->driver_data;
470474
if (privdata->sfh1_1_ops) {
471475
if (boot_cpu_data.x86 >= 0x1A)

drivers/hid/hid-asus.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,10 @@ static int asus_input_mapping(struct hid_device *hdev,
974974
case 0xc4: asus_map_key_clear(KEY_KBDILLUMUP); break;
975975
case 0xc5: asus_map_key_clear(KEY_KBDILLUMDOWN); break;
976976
case 0xc7: asus_map_key_clear(KEY_KBDILLUMTOGGLE); break;
977+
case 0x4e: asus_map_key_clear(KEY_FN_ESC); break;
978+
case 0x7e: asus_map_key_clear(KEY_EMOJI_PICKER); break;
977979

980+
case 0x8b: asus_map_key_clear(KEY_PROG1); break; /* ProArt Creator Hub key */
978981
case 0x6b: asus_map_key_clear(KEY_F21); break; /* ASUS touchpad toggle */
979982
case 0x38: asus_map_key_clear(KEY_PROG1); break; /* ROG key */
980983
case 0xba: asus_map_key_clear(KEY_PROG2); break; /* Fn+C ASUS Splendid */

drivers/hid/hid-cp2112.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,12 @@ static int cp2112_gpio_set_unlocked(struct cp2112_device *dev,
229229
ret = hid_hw_raw_request(hdev, CP2112_GPIO_SET, buf,
230230
CP2112_GPIO_SET_LENGTH, HID_FEATURE_REPORT,
231231
HID_REQ_SET_REPORT);
232-
if (ret < 0)
232+
if (ret != CP2112_GPIO_SET_LENGTH) {
233233
hid_err(hdev, "error setting GPIO values: %d\n", ret);
234+
return ret < 0 ? ret : -EIO;
235+
}
234236

235-
return ret;
237+
return 0;
236238
}
237239

238240
static int cp2112_gpio_set(struct gpio_chip *chip, unsigned int offset,
@@ -309,9 +311,7 @@ static int cp2112_gpio_direction_output(struct gpio_chip *chip,
309311
* Set gpio value when output direction is already set,
310312
* as specified in AN495, Rev. 0.2, cpt. 4.4
311313
*/
312-
cp2112_gpio_set_unlocked(dev, offset, value);
313-
314-
return 0;
314+
return cp2112_gpio_set_unlocked(dev, offset, value);
315315
}
316316

317317
static int cp2112_hid_get(struct hid_device *hdev, unsigned char report_number,

drivers/hid/hid-lenovo.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
#include <linux/leds.h>
3333
#include <linux/workqueue.h>
3434

35-
#include <linux/platform_profile.h>
36-
3735
#include "hid-ids.h"
3836

3937
/* Userspace expects F20 for mic-mute KEY_MICMUTE does not work */
@@ -734,7 +732,7 @@ static int lenovo_raw_event_TP_X12_tab(struct hid_device *hdev, u32 raw_data)
734732
report_key_event(input, KEY_RFKILL);
735733
return 1;
736734
}
737-
platform_profile_cycle();
735+
report_key_event(input, KEY_PERFORMANCE);
738736
return 1;
739737
case TP_X12_RAW_HOTKEY_FN_F10:
740738
/* TAB1 has PICKUP Phone and TAB2 use Snipping tool*/

drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,8 @@ static const struct pci_device_id quicki2c_pci_tbl[] = {
997997
{ PCI_DEVICE_DATA(INTEL, THC_PTL_H_DEVICE_ID_I2C_PORT2, &ptl_ddata) },
998998
{ PCI_DEVICE_DATA(INTEL, THC_PTL_U_DEVICE_ID_I2C_PORT1, &ptl_ddata) },
999999
{ PCI_DEVICE_DATA(INTEL, THC_PTL_U_DEVICE_ID_I2C_PORT2, &ptl_ddata) },
1000+
{ PCI_DEVICE_DATA(INTEL, THC_WCL_DEVICE_ID_I2C_PORT1, &ptl_ddata) },
1001+
{ PCI_DEVICE_DATA(INTEL, THC_WCL_DEVICE_ID_I2C_PORT2, &ptl_ddata) },
10001002
{ }
10011003
};
10021004
MODULE_DEVICE_TABLE(pci, quicki2c_pci_tbl);

drivers/hid/intel-thc-hid/intel-quicki2c/quicki2c-dev.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#define PCI_DEVICE_ID_INTEL_THC_PTL_H_DEVICE_ID_I2C_PORT2 0xE34A
1414
#define PCI_DEVICE_ID_INTEL_THC_PTL_U_DEVICE_ID_I2C_PORT1 0xE448
1515
#define PCI_DEVICE_ID_INTEL_THC_PTL_U_DEVICE_ID_I2C_PORT2 0xE44A
16+
#define PCI_DEVICE_ID_INTEL_THC_WCL_DEVICE_ID_I2C_PORT1 0x4D48
17+
#define PCI_DEVICE_ID_INTEL_THC_WCL_DEVICE_ID_I2C_PORT2 0x4D4A
1618

1719
/* Packet size value, the unit is 16 bytes */
1820
#define MAX_PACKET_SIZE_VALUE_LNL 256

drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,8 @@ static const struct pci_device_id quickspi_pci_tbl[] = {
976976
{PCI_DEVICE_DATA(INTEL, THC_PTL_H_DEVICE_ID_SPI_PORT2, &ptl), },
977977
{PCI_DEVICE_DATA(INTEL, THC_PTL_U_DEVICE_ID_SPI_PORT1, &ptl), },
978978
{PCI_DEVICE_DATA(INTEL, THC_PTL_U_DEVICE_ID_SPI_PORT2, &ptl), },
979+
{PCI_DEVICE_DATA(INTEL, THC_WCL_DEVICE_ID_SPI_PORT1, &ptl), },
980+
{PCI_DEVICE_DATA(INTEL, THC_WCL_DEVICE_ID_SPI_PORT2, &ptl), },
979981
{}
980982
};
981983
MODULE_DEVICE_TABLE(pci, quickspi_pci_tbl);

0 commit comments

Comments
 (0)