Skip to content

Commit 5e06802

Browse files
committed
Merge tag 'hid-for-linus-2025032601' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID updates from Jiri Kosina: - PlayStation 5 controllers support (Alex Henrie) - big revamp and modernization of the aged hid-pidff force feedback driver (Tomasz Pakuła) - conversion of hid-lg-g15 to standard multicolor LED API (Kate Hsuan) - improvement of behavior of Human Presence Sensor (HPD) in amd_sfh driver (Mario Limonciello) - other assorted fixes, code cleanups and device ID additions * tag 'hid-for-linus-2025032601' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (70 commits) HID: remove superfluous (and wrong) Makefile entry for CONFIG_INTEL_ISH_FIRMWARE_DOWNLOADER HID: Intel-thc-hid: Intel-quickspi: Correct device state names gramatically HID: wacom: Remove static WACOM_PKGLEN_MAX limit HID: amd_sfh: Don't show wrong status for amd_sfh_hpd_info() HID: amd_sfh: Default to HPD disabled HID: amd_sfh: Allow configuring whether HPD is enabled or disabled HID: pidff: Fix set_device_control() HID: pidff: Fix 90 degrees direction name North -> East HID: pidff: Compute INFINITE value instead of using hardcoded 0xffff HID: pidff: Clamp effect playback LOOP_COUNT value HID: pidff: Rename two functions to align them with naming convention HID: lenovo: silence unreachable code warning HID: lenovo: Fix to ensure the data as __le32 instead of u32 HID: bpf: add a v6.11+ compatible BPF fixup for the XPPen ACK05 remote HID: bpf: new hid_bpf_async.h common header HID: bpf: import new kfunc from v6.10 & v6.11 HID: bpf: add support for the XP-Pen Artist Pro 19 (gen2) HID: bpf: Added updated Kamvas Pro 19 descriptor HID: bpf: Suppress bogus F13 trigger on Sirius keyboard full fan shortcut HID: bpf: Add support for the default firmware mode of the Huion K20 ...
2 parents fb1ceb2 + 4ee4d7b commit 5e06802

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3056
-439
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
What: /sys/bus/pci/drivers/pcie_mp2_amd/*/hpd
2+
Date: April 2025
3+
Contact: mario.limonciello@amd.com
4+
Description:
5+
Human presence detection (HPD) enable/disable.
6+
When HPD is enabled, the device will be able to detect the
7+
presence of a human and will send an interrupt that can be
8+
used to wake the system from a low power state.
9+
When HPD is disabled, the device will not be able to detect
10+
the presence of a human.
11+
12+
Access: Read/Write
13+
Valid values: enabled/disabled
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
What: /sys/bus/hid/drivers/hid-appletb-kbd/<dev>/mode
2+
Date: September, 2023
3+
KernelVersion: 6.5
4+
Contact: linux-input@vger.kernel.org
5+
Description:
6+
The set of keys displayed on the Touch Bar.
7+
Valid values are:
8+
== =================
9+
0 Escape key only
10+
1 Function keys
11+
2 Media/brightness keys
12+
3 None
13+
== =================

MAINTAINERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10364,6 +10364,14 @@ F: drivers/hid/hid-sensor-*
1036410364
F: drivers/iio/*/hid-*
1036510365
F: include/linux/hid-sensor-*
1036610366

10367+
HID UNIVERSAL PIDFF DRIVER
10368+
M: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
10369+
M: Oleg Makarenko <oleg@makarenk.ooo>
10370+
L: linux-input@vger.kernel.org
10371+
S: Maintained
10372+
B: https://github.com/JacKeTUs/universal-pidff/issues
10373+
F: drivers/hid/hid-universal-pidff.c
10374+
1036710375
HID VRC-2 CAR CONTROLLER DRIVER
1036810376
M: Marcus Folkesson <marcus.folkesson@gmail.com>
1036910377
L: linux-input@vger.kernel.org

drivers/hid/Kconfig

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,31 @@ config HID_APPLEIR
148148

149149
Say Y here if you want support for Apple infrared remote control.
150150

151+
config HID_APPLETB_BL
152+
tristate "Apple Touch Bar Backlight"
153+
depends on BACKLIGHT_CLASS_DEVICE
154+
help
155+
Say Y here if you want support for the backlight of Touch Bars on x86
156+
MacBook Pros.
157+
158+
To compile this driver as a module, choose M here: the
159+
module will be called hid-appletb-bl.
160+
161+
config HID_APPLETB_KBD
162+
tristate "Apple Touch Bar Keyboard Mode"
163+
depends on USB_HID
164+
depends on BACKLIGHT_CLASS_DEVICE
165+
depends on INPUT
166+
select INPUT_SPARSEKMAP
167+
select HID_APPLETB_BL
168+
help
169+
Say Y here if you want support for the keyboard mode (escape,
170+
function, media and brightness keys) of Touch Bars on x86 MacBook
171+
Pros.
172+
173+
To compile this driver as a module, choose M here: the
174+
module will be called hid-appletb-kbd.
175+
151176
config HID_ASUS
152177
tristate "Asus"
153178
depends on USB_HID
@@ -603,6 +628,7 @@ config HID_LOGITECH
603628
tristate "Logitech devices"
604629
depends on USB_HID
605630
depends on LEDS_CLASS
631+
depends on LEDS_CLASS_MULTICOLOR
606632
default !EXPERT
607633
help
608634
Support for Logitech devices that are not fully compliant with HID standard.
@@ -1220,6 +1246,20 @@ config HID_U2FZERO
12201246
allow setting the brightness to anything but 1, which will
12211247
trigger a single blink and immediately reset back to 0.
12221248

1249+
config HID_UNIVERSAL_PIDFF
1250+
tristate "universal-pidff: extended USB PID driver compatibility and usage"
1251+
depends on USB_HID
1252+
depends on HID_PID
1253+
help
1254+
Extended PID support for selected devices.
1255+
1256+
Contains report fixups, extended usable button range and
1257+
pidff quirk management to extend compatibility with slightly
1258+
non-compliant USB PID devices and better fuzz/flat values for
1259+
high precision direct drive devices.
1260+
1261+
Supports Moza Racing, Cammus, VRS, FFBeast and more.
1262+
12231263
config HID_WACOM
12241264
tristate "Wacom Intuos/Graphire tablet support (USB)"
12251265
depends on USB_HID

drivers/hid/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ obj-$(CONFIG_HID_ALPS) += hid-alps.o
2929
obj-$(CONFIG_HID_ACRUX) += hid-axff.o
3030
obj-$(CONFIG_HID_APPLE) += hid-apple.o
3131
obj-$(CONFIG_HID_APPLEIR) += hid-appleir.o
32+
obj-$(CONFIG_HID_APPLETB_BL) += hid-appletb-bl.o
33+
obj-$(CONFIG_HID_APPLETB_KBD) += hid-appletb-kbd.o
3234
obj-$(CONFIG_HID_CREATIVE_SB0540) += hid-creative-sb0540.o
3335
obj-$(CONFIG_HID_ASUS) += hid-asus.o
3436
obj-$(CONFIG_HID_AUREAL) += hid-aureal.o
@@ -140,6 +142,7 @@ hid-uclogic-objs := hid-uclogic-core.o \
140142
hid-uclogic-params.o
141143
obj-$(CONFIG_HID_UCLOGIC) += hid-uclogic.o
142144
obj-$(CONFIG_HID_UDRAW_PS3) += hid-udraw-ps3.o
145+
obj-$(CONFIG_HID_UNIVERSAL_PIDFF) += hid-universal-pidff.o
143146
obj-$(CONFIG_HID_LED) += hid-led.o
144147
obj-$(CONFIG_HID_XIAOMI) += hid-xiaomi.o
145148
obj-$(CONFIG_HID_XINMO) += hid-xinmo.o
@@ -166,7 +169,6 @@ obj-$(CONFIG_USB_KBD) += usbhid/
166169
obj-$(CONFIG_I2C_HID_CORE) += i2c-hid/
167170

168171
obj-$(CONFIG_INTEL_ISH_HID) += intel-ish-hid/
169-
obj-$(INTEL_ISH_FIRMWARE_DOWNLOADER) += intel-ish-hid/
170172

171173
obj-$(CONFIG_AMD_SFH_HID) += amd-sfh-hid/
172174

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ struct amd_mp2_sensor_info {
4242

4343
struct sfh_dev_status {
4444
bool is_hpd_present;
45+
bool is_hpd_enabled;
4546
bool is_als_present;
4647
bool is_sra_present;
4748
};

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

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/iopoll.h>
1919
#include <linux/module.h>
2020
#include <linux/slab.h>
21+
#include <linux/string_choices.h>
2122

2223
#include "amd_sfh_pcie.h"
2324
#include "sfh1_1/amd_sfh_init.h"
@@ -330,6 +331,57 @@ static const struct dmi_system_id dmi_nodevs[] = {
330331
{ }
331332
};
332333

334+
static ssize_t hpd_show(struct device *dev, struct device_attribute *attr, char *buf)
335+
{
336+
struct amd_mp2_dev *mp2 = dev_get_drvdata(dev);
337+
338+
return sysfs_emit(buf, "%s\n", str_enabled_disabled(mp2->dev_en.is_hpd_enabled));
339+
}
340+
341+
static ssize_t hpd_store(struct device *dev,
342+
struct device_attribute *attr,
343+
const char *buf, size_t count)
344+
{
345+
struct amd_mp2_dev *mp2 = dev_get_drvdata(dev);
346+
bool enabled;
347+
int ret;
348+
349+
ret = kstrtobool(buf, &enabled);
350+
if (ret)
351+
return ret;
352+
353+
mp2->sfh1_1_ops->toggle_hpd(mp2, enabled);
354+
355+
return count;
356+
}
357+
static DEVICE_ATTR_RW(hpd);
358+
359+
static umode_t sfh_attr_is_visible(struct kobject *kobj, struct attribute *attr, int idx)
360+
{
361+
struct device *dev = kobj_to_dev(kobj);
362+
struct amd_mp2_dev *mp2 = dev_get_drvdata(dev);
363+
364+
if (!mp2->sfh1_1_ops || !mp2->dev_en.is_hpd_present)
365+
return 0;
366+
367+
return attr->mode;
368+
}
369+
370+
static struct attribute *sfh_attrs[] = {
371+
&dev_attr_hpd.attr,
372+
NULL,
373+
};
374+
375+
static struct attribute_group sfh_attr_group = {
376+
.attrs = sfh_attrs,
377+
.is_visible = sfh_attr_is_visible,
378+
};
379+
380+
static const struct attribute_group *amd_sfh_groups[] = {
381+
&sfh_attr_group,
382+
NULL,
383+
};
384+
333385
static void sfh1_1_init_work(struct work_struct *work)
334386
{
335387
struct amd_mp2_dev *mp2 = container_of(work, struct amd_mp2_dev, work);
@@ -341,6 +393,11 @@ static void sfh1_1_init_work(struct work_struct *work)
341393

342394
amd_sfh_clear_intr(mp2);
343395
mp2->init_done = 1;
396+
397+
rc = sysfs_update_group(&mp2->pdev->dev.kobj, &sfh_attr_group);
398+
if (rc)
399+
dev_warn(&mp2->pdev->dev, "failed to update sysfs group\n");
400+
344401
}
345402

346403
static void sfh_init_work(struct work_struct *work)
@@ -487,6 +544,7 @@ static struct pci_driver amd_mp2_pci_driver = {
487544
.driver.pm = &amd_mp2_pm_ops,
488545
.shutdown = amd_sfh_shutdown,
489546
.remove = amd_sfh_remove,
547+
.dev_groups = amd_sfh_groups,
490548
};
491549
module_pci_driver(amd_mp2_pci_driver);
492550

drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ static int amd_sfh1_1_hid_client_init(struct amd_mp2_dev *privdata)
212212
switch (cl_data->sensor_idx[i]) {
213213
case HPD_IDX:
214214
privdata->dev_en.is_hpd_present = true;
215+
privdata->dev_en.is_hpd_enabled = true;
216+
amd_sfh_toggle_hpd(privdata, false);
215217
break;
216218
case ALS_IDX:
217219
privdata->dev_en.is_als_present = true;
@@ -255,6 +257,10 @@ static void amd_sfh_resume(struct amd_mp2_dev *mp2)
255257
}
256258

257259
for (i = 0; i < cl_data->num_hid_devices; i++) {
260+
/* leave HPD alone; policy is controlled by sysfs */
261+
if (cl_data->sensor_idx[i] == HPD_IDX)
262+
continue;
263+
258264
if (cl_data->sensor_sts[i] == SENSOR_DISABLED) {
259265
info.sensor_idx = cl_data->sensor_idx[i];
260266
mp2->mp2_ops->start(mp2, info);
@@ -285,8 +291,10 @@ static void amd_sfh_suspend(struct amd_mp2_dev *mp2)
285291
}
286292

287293
for (i = 0; i < cl_data->num_hid_devices; i++) {
288-
if (cl_data->sensor_idx[i] != HPD_IDX &&
289-
cl_data->sensor_sts[i] == SENSOR_ENABLED) {
294+
/* leave HPD alone; policy is controlled by sysfs */
295+
if (cl_data->sensor_idx[i] == HPD_IDX)
296+
continue;
297+
if (cl_data->sensor_sts[i] == SENSOR_ENABLED) {
290298
mp2->mp2_ops->stop(mp2, cl_data->sensor_idx[i]);
291299
status = amd_sfh_wait_for_response
292300
(mp2, cl_data->sensor_idx[i], DISABLE_SENSOR);
@@ -304,6 +312,44 @@ static void amd_sfh_suspend(struct amd_mp2_dev *mp2)
304312
amd_sfh_clear_intr(mp2);
305313
}
306314

315+
void amd_sfh_toggle_hpd(struct amd_mp2_dev *mp2, bool enabled)
316+
{
317+
struct amdtp_cl_data *cl_data = mp2->cl_data;
318+
struct amd_mp2_sensor_info info;
319+
int i, status;
320+
321+
if (mp2->dev_en.is_hpd_enabled == enabled)
322+
return;
323+
324+
for (i = 0; i < cl_data->num_hid_devices; i++) {
325+
if (cl_data->sensor_idx[i] != HPD_IDX)
326+
continue;
327+
info.sensor_idx = cl_data->sensor_idx[i];
328+
if (enabled) {
329+
mp2->mp2_ops->start(mp2, info);
330+
status = amd_sfh_wait_for_response
331+
(mp2, cl_data->sensor_idx[i], ENABLE_SENSOR);
332+
if (status == 0)
333+
status = SENSOR_ENABLED;
334+
if (status == SENSOR_ENABLED)
335+
cl_data->sensor_sts[i] = SENSOR_ENABLED;
336+
} else {
337+
mp2->mp2_ops->stop(mp2, cl_data->sensor_idx[i]);
338+
status = amd_sfh_wait_for_response
339+
(mp2, cl_data->sensor_idx[i], DISABLE_SENSOR);
340+
if (status == 0)
341+
status = SENSOR_DISABLED;
342+
if (status != SENSOR_ENABLED)
343+
cl_data->sensor_sts[i] = SENSOR_DISABLED;
344+
}
345+
dev_dbg(&mp2->pdev->dev, "toggle sid 0x%x (%s) status 0x%x\n",
346+
cl_data->sensor_idx[i], get_sensor_name(cl_data->sensor_idx[i]),
347+
cl_data->sensor_sts[i]);
348+
break;
349+
}
350+
mp2->dev_en.is_hpd_enabled = enabled;
351+
}
352+
307353
static void amd_mp2_pci_remove(void *privdata)
308354
{
309355
struct amd_mp2_dev *mp2 = privdata;

drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515

1616
struct amd_sfh1_1_ops {
1717
int (*init)(struct amd_mp2_dev *mp2);
18+
void (*toggle_hpd)(struct amd_mp2_dev *mp2, bool enable);
1819
};
1920

2021
int amd_sfh1_1_init(struct amd_mp2_dev *mp2);
22+
void amd_sfh_toggle_hpd(struct amd_mp2_dev *mp2, bool enabled);
2123

2224
static const struct amd_sfh1_1_ops __maybe_unused sfh1_1_ops = {
2325
.init = amd_sfh1_1_init,
26+
.toggle_hpd = amd_sfh_toggle_hpd,
2427
};
2528

2629
#endif

drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static int amd_sfh_hpd_info(u8 *user_present)
129129
if (!user_present)
130130
return -EINVAL;
131131

132-
if (!emp2 || !emp2->dev_en.is_hpd_present)
132+
if (!emp2 || !emp2->dev_en.is_hpd_present || !emp2->dev_en.is_hpd_enabled)
133133
return -ENODEV;
134134

135135
hpdstatus.val = readl(emp2->mmio + amd_get_c2p_val(emp2, 4));

0 commit comments

Comments
 (0)