Commit 54ba6d9b authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull HID updates from Benjamin Tissoires:

 - haptic touchpad support (Angela Czubak and Jonathan Denose)

 - support for audio jack handling on DualSense Playstation controllers
   (Cristian Ciocaltea)

 - allow HID-BPF to rebind a driver to hid-multitouch (Benjamin
   Tissoires)

 - rework hidraw ioctls to make them safer (and tested) (Benjamin
   Tissoires)

 - various PIDFF and universal-PIDFF fixes/improvements (Tomasz Pakuła)

 - better configuration of Intel QuickI2C through ACPI (Xinpeng Sun)

 - other assorted cleanups and fixes

* tag 'hid-for-linus-2025093001' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (58 commits)
  HID: playstation: Switch to scoped_guard() in {dualsense|dualshock4}_output_worker()
  HID: playstation: Silence sparse warnings for locking context imbalances
  HID: playstation: Update SP preamp gain comment line
  HID: intel-thc-hid: intel-quicki2c: support ACPI config for advanced features
  HID: core: Change hid_driver to use a const char* for name
  HID: hidraw: tighten ioctl command parsing
  selftests/hid: hidraw: forge wrong ioctls and tests them
  selftests/hid: hidraw: add more coverage for hidraw ioctls
  selftests/hid: update vmtest.sh for virtme-ng
  HID: playstation: Support DualSense audio jack event reporting
  HID: playstation: Support DualSense audio jack hotplug detection
  HID: playstation: Redefine DualSense input report status field
  HID: playstation: Prefer kzalloc(sizeof(*buf)...)
  HID: playstation: Document spinlock_t usage
  HID: playstation: Fix all alignment and line length issues
  HID: playstation: Correct spelling in comment sections
  HID: playstation: Replace uint{32,16,8}_t with u{32,16,8}
  HID: playstation: Simplify locking with guard() and scoped_guard()
  HID: playstation: Add spaces around arithmetic operators
  HID: playstation: Make use of bitfield macros
  ...
parents b6645172 cd377067
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -400,6 +400,20 @@ can report through the rotational axes (absolute and/or relative rx, ry, rz).
All other axes retain their meaning. A device must not mix
regular directional axes and accelerometer axes on the same event node.

INPUT_PROP_HAPTIC_TOUCHPAD
--------------------------

The INPUT_PROP_HAPTIC_TOUCHPAD property indicates that device:
- supports simple haptic auto and manual triggering
- can differentiate between at least 5 fingers
- uses correct resolution for the X/Y (units and value)
- reports correct force per touch, and correct units for them (newtons or grams)
- follows the MT protocol type B

Summing up, such devices follow the MS spec for input devices in
Win8 and Win8.1, and in addition support the Simple haptic controller HID table,
and report correct units for the pressure.

Guidelines
==========

+11 −0
Original line number Diff line number Diff line
@@ -92,6 +92,17 @@ config HID_GENERIC

	If unsure, say Y.

config HID_HAPTIC
	tristate "Haptic touchpad support"
	default n
	help
	Support for touchpads with force sensors and haptic actuators instead of a
	traditional button.
	Adds extra parsing and FF device for the hid multitouch driver.
	It can be used for Elan 2703 haptic touchpad.

	If unsure, say N.

menu "Special HID drivers"

config HID_A4TECH
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
#
hid-y			:= hid-core.o hid-input.o hid-quirks.o
hid-$(CONFIG_DEBUG_FS)		+= hid-debug.o
hid-$(CONFIG_HID_HAPTIC)	+= hid-haptic.o

obj-$(CONFIG_HID_BPF)		+= bpf/

+3 −3
Original line number Diff line number Diff line
@@ -1387,9 +1387,6 @@ static const struct hid_device_id asus_devices[] = {
	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
	    USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD2),
	  QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
	    USB_DEVICE_ID_ASUSTEK_ROG_NKEY_KEYBOARD3),
	  QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
	{ HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
	    USB_DEVICE_ID_ASUSTEK_ROG_Z13_LIGHTBAR),
	  QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
@@ -1419,6 +1416,9 @@ static const struct hid_device_id asus_devices[] = {
	 * Note bind to the HID_GROUP_GENERIC group, so that we only bind to the keyboard
	 * part, while letting hid-multitouch.c handle the touchpad.
	 */
	{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
		USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_Z13_FOLIO),
	  QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD },
	{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
		USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_T101HA_KEYBOARD) },
	{ }
+36 −8
Original line number Diff line number Diff line
@@ -943,6 +943,15 @@ static int hid_scan_report(struct hid_device *hid)
	parser->device = hid;
	hid->group = HID_GROUP_GENERIC;

	/*
	 * In case we are re-scanning after a BPF has been loaded,
	 * we need to use the bpf report descriptor, not the original one.
	 */
	if (hid->bpf_rdesc && hid->bpf_rsize) {
		start = hid->bpf_rdesc;
		end = start + hid->bpf_rsize;
	}

	/*
	 * The parsing is simpler than the one in hid_open_report() as we should
	 * be robust against hid errors. Those errors will be raised by
@@ -2708,12 +2717,32 @@ static bool hid_check_device_match(struct hid_device *hdev,
	return !hid_ignore_special_drivers && !(hdev->quirks & HID_QUIRK_IGNORE_SPECIAL_DRIVER);
}

static void hid_set_group(struct hid_device *hdev)
{
	int ret;

	if (hid_ignore_special_drivers) {
		hdev->group = HID_GROUP_GENERIC;
	} else if (!hdev->group &&
		   !(hdev->quirks & HID_QUIRK_HAVE_SPECIAL_DRIVER)) {
		ret = hid_scan_report(hdev);
		if (ret)
			hid_warn(hdev, "bad device descriptor (%d)\n", ret);
	}
}

static int __hid_device_probe(struct hid_device *hdev, struct hid_driver *hdrv)
{
	const struct hid_device_id *id;
	int ret;

	if (!hdev->bpf_rsize) {
		/* we keep a reference to the currently scanned report descriptor */
		const __u8  *original_rdesc = hdev->bpf_rdesc;

		if (!original_rdesc)
			original_rdesc = hdev->dev_rdesc;

		/* in case a bpf program gets detached, we need to free the old one */
		hid_free_bpf_rdesc(hdev);

@@ -2723,6 +2752,12 @@ static int __hid_device_probe(struct hid_device *hdev, struct hid_driver *hdrv)
		/* call_hid_bpf_rdesc_fixup will always return a valid pointer */
		hdev->bpf_rdesc = call_hid_bpf_rdesc_fixup(hdev, hdev->dev_rdesc,
							   &hdev->bpf_rsize);

		/* the report descriptor changed, we need to re-scan it */
		if (original_rdesc != hdev->bpf_rdesc) {
			hdev->group = 0;
			hid_set_group(hdev);
		}
	}

	if (!hid_check_device_match(hdev, hdrv, &id))
@@ -2903,14 +2938,7 @@ int hid_add_device(struct hid_device *hdev)
	/*
	 * Scan generic devices for group information
	 */
	if (hid_ignore_special_drivers) {
		hdev->group = HID_GROUP_GENERIC;
	} else if (!hdev->group &&
		   !(hdev->quirks & HID_QUIRK_HAVE_SPECIAL_DRIVER)) {
		ret = hid_scan_report(hdev);
		if (ret)
			hid_warn(hdev, "bad device descriptor (%d)\n", ret);
	}
	hid_set_group(hdev);

	hdev->id = atomic_inc_return(&id);

Loading