Skip to content

Commit 614da38

Browse files
committed
Merge tag 'hid-for-linus-2024051401' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID updates from Jiri Kosina: - Firmware loading from host support in intel-ish driver, needed to support Lunar Lake and later (Zhang Lixu) - updates to HID-BPF infrastructure, with some of the specific fixes (e.g. rdesc fixups) abstracted into separate BPF programs for consumption from libevdev/udev-hid-bpf (Benjamin Tissoires) - support for Deck IMU in hid-steam (Max Maisel) - fixes for better support of 3rd party playstation DS4 controllers (Max Staudt) - support for missing mappings and codes from HUT 1.5 in hid-debug (Thomas Kuehne) - initial support for ROG Ally and ROG X13 devices (Luke D. Jones) - full support for WinWing Orion2 (Ivan Gorinov) * tag 'hid-for-linus-2024051401' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (74 commits) selftests/hid: skip tests with HID-BPF if udev-hid-bpf is not installed selftests/hid: add tests for the Raptor Mach 2 joystick selftests/hid: move the gamepads definitions in the test file selftests/hid: import base_gamepad.py from hid-tools selftests/hid: add Huion Kamvas Pro 19 tests selftests/hid: tablets: also check for XP-Pen offset correction selftests/hid: tablets: add a couple of XP-PEN tablets selftests/hid: tablets: reduce the number of pen state selftests/hid: add support for HID-BPF pre-loading before starting a test selftests/hid: import base_device.py from hid-tools HID: bpf: add in-tree HID-BPF fix for the Raptor Mach 2 HID: bpf: add in-tree HID-BPF fix for the Huion Kamvas Pro 19 HID: bpf: add in-tree HID-BPF fix for the XBox Elite 2 over Bluetooth HID: bpf: add in-tree HID-BPF fix for the Wacom ArtPen HID: bpf: add in-tree HID-BPF fix for the IOGear Kaliber Gaming MMOmentum mouse HID: bpf: add in-tree HID-BPF fix for the HP Elite Presenter Mouse HID: bpf: add in-tree HID-BPF fix for the XPPen Artist 16 HID: bpf: add first in-tree HID-BPF fix for the XPPen Artist 24 HID: do not assume HAT Switch logical max < 8 HID: amd_sfh: Use amd_get_c2p_val() to read C2P register ...
2 parents ce952d8 + c9c92fc commit 614da38

Some content is hidden

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

66 files changed

+8301
-1093
lines changed

Documentation/hid/hid-bpf.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ Available API that can be used in syscall HID-BPF programs:
179179
-----------------------------------------------------------
180180

181181
.. kernel-doc:: drivers/hid/bpf/hid_bpf_dispatch.c
182-
:functions: hid_bpf_attach_prog hid_bpf_hw_request hid_bpf_allocate_context hid_bpf_release_context
182+
:functions: hid_bpf_attach_prog hid_bpf_hw_request hid_bpf_hw_output_report hid_bpf_input_report hid_bpf_allocate_context hid_bpf_release_context
183183

184184
General overview of a HID-BPF program
185185
=====================================

Documentation/hid/intel-ish-hid.rst

Lines changed: 101 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ These ISH also comply to HID sensor specification, but the difference is the
1818
transport protocol used for communication. The current external sensor hubs
1919
mainly use HID over I2C or USB. But ISH doesn't use either I2C or USB.
2020

21-
1. Overview
22-
===========
21+
Overview
22+
========
2323

2424
Using a analogy with a usbhid implementation, the ISH follows a similar model
2525
for a very high speed communication::
@@ -58,8 +58,8 @@ implemented as a bus. Each client application executing in the ISH processor
5858
is registered as a device on this bus. The driver, which binds each device
5959
(ISH HID driver) identifies the device type and registers with the HID core.
6060

61-
2. ISH Implementation: Block Diagram
62-
====================================
61+
ISH Implementation: Block Diagram
62+
=================================
6363

6464
::
6565

@@ -96,27 +96,27 @@ is registered as a device on this bus. The driver, which binds each device
9696
| ISH Hardware/Firmware(FW) |
9797
----------------------------
9898

99-
3. High level processing in above blocks
100-
========================================
99+
High level processing in above blocks
100+
=====================================
101101

102-
3.1 Hardware Interface
103-
----------------------
102+
Hardware Interface
103+
------------------
104104

105105
The ISH is exposed as "Non-VGA unclassified PCI device" to the host. The PCI
106106
product and vendor IDs are changed from different generations of processors. So
107107
the source code which enumerates drivers needs to update from generation to
108108
generation.
109109

110-
3.2 Inter Processor Communication (IPC) driver
111-
----------------------------------------------
110+
Inter Processor Communication (IPC) driver
111+
------------------------------------------
112112

113113
Location: drivers/hid/intel-ish-hid/ipc
114114

115115
The IPC message uses memory mapped I/O. The registers are defined in
116116
hw-ish-regs.h.
117117

118-
3.2.1 IPC/FW message types
119-
^^^^^^^^^^^^^^^^^^^^^^^^^^
118+
IPC/FW message types
119+
^^^^^^^^^^^^^^^^^^^^
120120

121121
There are two types of messages, one for management of link and another for
122122
messages to and from transport layers.
@@ -142,20 +142,20 @@ register has the following format::
142142
Bit 31: doorbell trigger (signal H/W interrupt to the other side)
143143
Other bits are reserved, should be 0.
144144

145-
3.2.2 Transport layer interface
146-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
145+
Transport layer interface
146+
^^^^^^^^^^^^^^^^^^^^^^^^^
147147

148148
To abstract HW level IPC communication, a set of callbacks is registered.
149149
The transport layer uses them to send and receive messages.
150150
Refer to struct ishtp_hw_ops for callbacks.
151151

152-
3.3 ISH Transport layer
153-
-----------------------
152+
ISH Transport layer
153+
-------------------
154154

155155
Location: drivers/hid/intel-ish-hid/ishtp/
156156

157-
3.3.1 A Generic Transport Layer
158-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
157+
A Generic Transport Layer
158+
^^^^^^^^^^^^^^^^^^^^^^^^^
159159

160160
The transport layer is a bi-directional protocol, which defines:
161161
- Set of commands to start, stop, connect, disconnect and flow control
@@ -166,8 +166,8 @@ This protocol resembles bus messages described in the following document:
166166
http://www.intel.com/content/dam/www/public/us/en/documents/technical-\
167167
specifications/dcmi-hi-1-0-spec.pdf "Chapter 7: Bus Message Layer"
168168

169-
3.3.2 Connection and Flow Control Mechanism
170-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
169+
Connection and Flow Control Mechanism
170+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
171171

172172
Each FW client and a protocol is identified by a UUID. In order to communicate
173173
to a FW client, a connection must be established using connect request and
@@ -181,8 +181,8 @@ before receiving the next flow control credit.
181181
Either side can send disconnect request bus message to end communication. Also
182182
the link will be dropped if major FW reset occurs.
183183

184-
3.3.3 Peer to Peer data transfer
185-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
184+
Peer to Peer data transfer
185+
^^^^^^^^^^^^^^^^^^^^^^^^^^
186186

187187
Peer to Peer data transfer can happen with or without using DMA. Depending on
188188
the sensor bandwidth requirement DMA can be enabled by using module parameter
@@ -217,8 +217,8 @@ In principle, multiple DMA_XFER and DMA_XFER_ACK messages may be sent at once
217217
Currently, ISH FW decides to send over DMA if ISHTP message is more than 3 IPC
218218
fragments and via IPC otherwise.
219219

220-
3.3.4 Ring Buffers
221-
^^^^^^^^^^^^^^^^^^
220+
Ring Buffers
221+
^^^^^^^^^^^^
222222

223223
When a client initiates a connection, a ring of RX and TX buffers is allocated.
224224
The size of ring can be specified by the client. HID client sets 16 and 32 for
@@ -228,8 +228,8 @@ bus message protocol. These buffers are required because the FW may have not
228228
have processed the last message and may not have enough flow control credits
229229
to send. Same thing holds true on receive side and flow control is required.
230230

231-
3.3.5 Host Enumeration
232-
^^^^^^^^^^^^^^^^^^^^^^
231+
Host Enumeration
232+
^^^^^^^^^^^^^^^^
233233

234234
The host enumeration bus command allows discovery of clients present in the FW.
235235
There can be multiple sensor clients and clients for calibration function.
@@ -252,8 +252,8 @@ Enumeration sequence of messages:
252252
- Once host received properties for that last discovered client, it considers
253253
ISHTP device fully functional (and allocates DMA buffers)
254254

255-
3.4 HID over ISH Client
256-
-----------------------
255+
HID over ISH Client
256+
-------------------
257257

258258
Location: drivers/hid/intel-ish-hid
259259

@@ -265,16 +265,16 @@ The ISHTP client driver is responsible for:
265265
- Process Get/Set feature request
266266
- Get input reports
267267

268-
3.5 HID Sensor Hub MFD and IIO sensor drivers
269-
---------------------------------------------
268+
HID Sensor Hub MFD and IIO sensor drivers
269+
-----------------------------------------
270270

271271
The functionality in these drivers is the same as an external sensor hub.
272272
Refer to
273273
Documentation/hid/hid-sensor.rst for HID sensor
274274
Documentation/ABI/testing/sysfs-bus-iio for IIO ABIs to user space.
275275

276-
3.6 End to End HID transport Sequence Diagram
277-
---------------------------------------------
276+
End to End HID transport Sequence Diagram
277+
-----------------------------------------
278278

279279
::
280280

@@ -339,16 +339,81 @@ Documentation/ABI/testing/sysfs-bus-iio for IIO ABIs to user space.
339339
| | | |
340340

341341

342-
3.7 ISH Debugging
343-
-----------------
342+
ISH Firmware Loading from Host Flow
343+
-----------------------------------
344+
345+
Starting from the Lunar Lake generation, the ISH firmware has been divided into two components for better space optimization and increased flexibility. These components include a bootloader that is integrated into the BIOS, and a main firmware that is stored within the operating system's file system.
346+
347+
The process works as follows:
348+
349+
- Initially, the ISHTP driver sends a command, HOST_START_REQ_CMD, to the ISH bootloader. In response, the bootloader sends back a HOST_START_RES_CMD. This response includes the ISHTP_SUPPORT_CAP_LOADER bit. Subsequently, the ISHTP driver checks if this bit is set. If it is, the firmware loading process from the host begins.
350+
351+
- During this process, the ISHTP driver first invokes the request_firmware() function, followed by sending a LOADER_CMD_XFER_QUERY command. Upon receiving a response from the bootloader, the ISHTP driver sends a LOADER_CMD_XFER_FRAGMENT command. After receiving another response, the ISHTP driver sends a LOADER_CMD_START command. The bootloader responds and then proceeds to the Main Firmware.
352+
353+
- After the process concludes, the ISHTP driver calls the release_firmware() function.
354+
355+
For more detailed information, please refer to the flow descriptions provided below:
356+
357+
::
358+
359+
+---------------+ +-----------------+
360+
| ISHTP Driver | | ISH Bootloader |
361+
+---------------+ +-----------------+
362+
| |
363+
|~~~Send HOST_START_REQ_CMD~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>|
364+
| |
365+
|<--Send HOST_START_RES_CMD(Includes ISHTP_SUPPORT_CAP_LOADER bit)----|
366+
| |
367+
****************************************************************************************
368+
* if ISHTP_SUPPORT_CAP_LOADER bit is set *
369+
****************************************************************************************
370+
| |
371+
|~~~start loading firmware from host process~~~+ |
372+
| | |
373+
|<---------------------------------------------+ |
374+
| |
375+
--------------------------- |
376+
| Call request_firmware() | |
377+
--------------------------- |
378+
| |
379+
|~~~Send LOADER_CMD_XFER_QUERY~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>|
380+
| |
381+
|<--Send response-----------------------------------------------------|
382+
| |
383+
|~~~Send LOADER_CMD_XFER_FRAGMENT~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>|
384+
| |
385+
|<--Send response-----------------------------------------------------|
386+
| |
387+
|~~~Send LOADER_CMD_START~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~>|
388+
| |
389+
|<--Send response-----------------------------------------------------|
390+
| |
391+
| |~~~Jump to Main Firmware~~~+
392+
| | |
393+
| |<--------------------------+
394+
| |
395+
--------------------------- |
396+
| Call release_firmware() | |
397+
--------------------------- |
398+
| |
399+
****************************************************************************************
400+
* end if *
401+
****************************************************************************************
402+
| |
403+
+---------------+ +-----------------+
404+
| ISHTP Driver | | ISH Bootloader |
405+
+---------------+ +-----------------+
406+
407+
ISH Debugging
408+
-------------
344409

345410
To debug ISH, event tracing mechanism is used. To enable debug logs::
346411

347412
echo 1 > /sys/kernel/tracing/events/intel_ish/enable
348413
cat /sys/kernel/tracing/trace
349414

350-
3.8 ISH IIO sysfs Example on Lenovo thinkpad Yoga 260
351-
-----------------------------------------------------
415+
ISH IIO sysfs Example on Lenovo thinkpad Yoga 260
416+
-------------------------------------------------
352417

353418
::
354419

drivers/hid/Kconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,22 @@ config HID_WIIMOTE
12361236
To compile this driver as a module, choose M here: the
12371237
module will be called hid-wiimote.
12381238

1239+
config HID_WINWING
1240+
tristate "WinWing Orion2 throttle support"
1241+
depends on USB_HID
1242+
depends on NEW_LEDS
1243+
depends on LEDS_CLASS
1244+
help
1245+
Support for WinWing Orion2 throttle base with the following grips:
1246+
1247+
* TGRIP-16EX
1248+
* TGRIP-18
1249+
1250+
This driver enables all buttons and switches on the throttle base.
1251+
1252+
To compile this driver as a module, choose M here: the
1253+
module will be called hid-winwing.
1254+
12391255
config HID_XINMO
12401256
tristate "Xin-Mo non-fully compliant devices"
12411257
help

drivers/hid/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ wacom-objs := wacom_wac.o wacom_sys.o
150150
obj-$(CONFIG_HID_WACOM) += wacom.o
151151
obj-$(CONFIG_HID_WALTOP) += hid-waltop.o
152152
obj-$(CONFIG_HID_WIIMOTE) += hid-wiimote.o
153+
obj-$(CONFIG_HID_WINWING) += hid-winwing.o
153154
obj-$(CONFIG_HID_SENSOR_HUB) += hid-sensor-hub.o
154155
obj-$(CONFIG_HID_SENSOR_CUSTOM_SENSOR) += hid-sensor-custom.o
155156

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,14 +333,11 @@ static const struct dmi_system_id dmi_nodevs[] = {
333333
static void sfh1_1_init_work(struct work_struct *work)
334334
{
335335
struct amd_mp2_dev *mp2 = container_of(work, struct amd_mp2_dev, work);
336-
struct pci_dev *pdev = mp2->pdev;
337336
int rc;
338337

339338
rc = mp2->sfh1_1_ops->init(mp2);
340-
if (rc) {
341-
dev_err(&pdev->dev, "sfh1_1_init failed err %d\n", rc);
339+
if (rc)
342340
return;
343-
}
344341

345342
amd_sfh_clear_intr(mp2);
346343
mp2->init_done = 1;

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ static int amd_sfh1_1_hid_client_init(struct amd_mp2_dev *privdata)
202202
}
203203

204204
if (!cl_data->is_any_sensor_enabled) {
205-
dev_warn(dev, "Failed to discover, sensors not enabled is %d\n",
205+
dev_warn(dev, "No sensor registered, sensors not enabled is %d\n",
206206
cl_data->is_any_sensor_enabled);
207207
rc = -EOPNOTSUPP;
208208
goto cleanup;
@@ -227,6 +227,11 @@ static void amd_sfh_resume(struct amd_mp2_dev *mp2)
227227
struct amd_mp2_sensor_info info;
228228
int i, status;
229229

230+
if (!cl_data->is_any_sensor_enabled) {
231+
amd_sfh_clear_intr(mp2);
232+
return;
233+
}
234+
230235
for (i = 0; i < cl_data->num_hid_devices; i++) {
231236
if (cl_data->sensor_sts[i] == SENSOR_DISABLED) {
232237
info.sensor_idx = cl_data->sensor_idx[i];
@@ -252,6 +257,11 @@ static void amd_sfh_suspend(struct amd_mp2_dev *mp2)
252257
struct amdtp_cl_data *cl_data = mp2->cl_data;
253258
int i, status;
254259

260+
if (!cl_data->is_any_sensor_enabled) {
261+
amd_sfh_clear_intr(mp2);
262+
return;
263+
}
264+
255265
for (i = 0; i < cl_data->num_hid_devices; i++) {
256266
if (cl_data->sensor_idx[i] != HPD_IDX &&
257267
cl_data->sensor_sts[i] == SENSOR_ENABLED) {
@@ -320,7 +330,7 @@ int amd_sfh1_1_init(struct amd_mp2_dev *mp2)
320330

321331
memcpy_fromio(&binfo, mp2->vsbase, sizeof(struct sfh_base_info));
322332
if (binfo.sbase.fw_info.fw_ver == 0 || binfo.sbase.s_list.sl.sensors == 0) {
323-
dev_dbg(dev, "failed to get sensors\n");
333+
dev_dbg(dev, "No sensor registered\n");
324334
return -EOPNOTSUPP;
325335
}
326336
dev_dbg(dev, "firmware version 0x%x\n", binfo.sbase.fw_info.fw_ver);
@@ -337,7 +347,8 @@ int amd_sfh1_1_init(struct amd_mp2_dev *mp2)
337347
rc = amd_sfh1_1_hid_client_init(mp2);
338348
if (rc) {
339349
sfh_deinit_emp2();
340-
dev_err(dev, "amd_sfh1_1_hid_client_init failed\n");
350+
if ((rc != -ENODEV) && (rc != -EOPNOTSUPP))
351+
dev_err(dev, "amd_sfh1_1_hid_client_init failed\n");
341352
return rc;
342353
}
343354

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
@@ -97,7 +97,7 @@ static int amd_sfh_hpd_info(u8 *user_present)
9797
if (!emp2 || !emp2->dev_en.is_hpd_present)
9898
return -ENODEV;
9999

100-
hpdstatus.val = readl(emp2->mmio + AMD_C2P_MSG(4));
100+
hpdstatus.val = readl(emp2->mmio + amd_get_c2p_val(emp2, 4));
101101
*user_present = hpdstatus.shpd.presence;
102102

103103
return 0;

0 commit comments

Comments
 (0)