From: Emfox Zhou <emfox@debian.org>
To: Even Xu <even.xu@intel.com>, Xinpeng Sun <xinpeng.sun@intel.com>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <bentiss@kernel.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v6 0/5] HID: intel-thc-hid: intel-ipts: support THC IPTS ports
Date: Tue, 17 Nov 2026 15:35:49 +0800 [thread overview]
Message-ID: <20261117073554.11557-1-emfox@debian.org> (raw)
The THC ports on Tiger Lake, Lakefield, Alder Lake and Raptor Lake run in
IPTS mode: plain SPI with a private framing instead of HIDSPI, which is
all intel-thc-hid handles today. This adds a backend for them next to
intel-quickspi and intel-quicki2c, on top of the same core, and is based
on v7.4-rc3.
Register, DMA and interrupt work goes through the exported intel-thc API,
except in four places where the core has no call for it: the reset,
port-supported and quiesce-state bits of THC_M_PRT_CONTROL are accessed
directly. Nothing outside the new directory changes except Kconfig and
Makefile.
The hardware facts - port IDs, configuration block layout, frame codes and
header sizes - come from the ithc driver linux-surface ships, at
https://github.com/quo/ithc-linux 6d53c9c (dual licensed GPL-2.0 /
BSD-2-Clause); no code is taken from it. The layout, the frame format and
the ordering between quiesce, interrupt configuration and the DMA engines
are the parts most likely to need scrutiny; each is argued in the commit
message that relies on it. All of it was confirmed on a Surface Pro 8 with
a 045e:0c37 controller.
The first four patches each leave a state that builds and loads: port
bring-up, DMA and interrupts, HID registration, system sleep. The fifth
documents the frame format and the IPTS handshake.
Link to v5: https://lore.kernel.org/r/20261114234242.177387-1-emfox@debian.org
Changes in v6:
- The buffers are resized on every start instead of being allocated
once. The controller re-reports its frame limits on each start, and a
resume that reports more than the probe did would otherwise leave the
engines writing past the end of the buffer.
- The feature handshake is fail-stop. The request is sent once, and a
timeout shuts the channel until the port restarts. Resets are
counted, so a timeout caused by one can be told apart from a
controller that never answered, though both shut the channel: the
answer may still turn up. A send that fails is reported as such and
shuts nothing, as the frame never reached the wire.
- The frame size the controller reports is bounded by the receive ring,
one page per PRD entry. A larger one used to end in sgl_alloc() with
an allocation error; it is now refused with an explicit message.
- A reset is published before the line is masked, and the thread masks
again on entry: a sharer on the pin can queue a second run of the
thread with no hardirq of ours in between. A port that is resetting
or going away still gets the threaded handler, because the status it
drains is where a transmit completion is delivered; only the ring is
left unread.
- The release from reset is a forced write, like the assert, and a send
that finds no engine reports -ENODEV instead of -EAGAIN, so a
descriptor request does not spend its tries on a reset that is not
there. The descriptor flag is published with a release store.
- Teardown refuses new requests and then waits for one that is already
inside thc_dma_write(), but no longer holds the request lock across
synchronize_irq(): the threaded handler can issue a request of its
own from a HID callback, and the two would wait for each other. The
DMA buffers are released even when the engine did not acknowledge the
quiesce: they are not devm-managed, and thc_dma_unconfigure() clears
the start bits on its way out.
- The receive engines are stopped before the controller is released
from reset. Firmware can leave them armed with a PRD base of its own,
and the frames would then land in stale pages.
- System sleep always tears the port down and rebuilds it. The variant
that parked the engines for a port armed as a wakeup source is gone:
nothing in this driver arms one, so it was only reachable through
sysfs, where it was worse than a rebuild.
- Rebased on v7.4-rc3. The PRD table gap a reset leaves behind is
described as the core's responsibility, not worked around here.
Emfox Zhou (5):
HID: intel-thc-hid: intel-ipts: bring up the port
HID: intel-thc-hid: intel-ipts: receive reports
HID: intel-thc-hid: intel-ipts: register the HID device
HID: intel-thc-hid: intel-ipts: handle system sleep
HID: intel-thc-hid: intel-ipts: document the IPTS mode
Documentation/hid/intel-thc-hid.rst | 95 +-
drivers/hid/intel-thc-hid/Kconfig | 14 +
drivers/hid/intel-thc-hid/Makefile | 4 +
drivers/hid/intel-thc-hid/intel-ipts/ipts.c | 854 ++++++++++++++++++
drivers/hid/intel-thc-hid/intel-ipts/ipts.h | 196 ++++
.../hid/intel-thc-hid/intel-ipts/pci-ipts.c | 194 ++++
6 files changed, 1356 insertions(+), 1 deletion(-)
create mode 100644 drivers/hid/intel-thc-hid/intel-ipts/ipts.c
create mode 100644 drivers/hid/intel-thc-hid/intel-ipts/ipts.h
create mode 100644 drivers/hid/intel-thc-hid/intel-ipts/pci-ipts.c
base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
next reply other threads:[~2026-11-17 7:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 7:35 Emfox Zhou [this message]
2026-11-17 7:35 ` [PATCH v6 1/5] HID: intel-thc-hid: intel-ipts: bring up the port Emfox Zhou
2026-11-17 7:35 ` [PATCH v6 2/5] HID: intel-thc-hid: intel-ipts: receive reports Emfox Zhou
2026-11-17 8:01 ` sashiko-bot
2026-11-17 7:35 ` [PATCH v6 3/5] HID: intel-thc-hid: intel-ipts: register the HID device Emfox Zhou
2026-11-17 7:55 ` sashiko-bot
2026-11-17 7:35 ` [PATCH v6 4/5] HID: intel-thc-hid: intel-ipts: handle system sleep Emfox Zhou
2026-11-17 8:06 ` sashiko-bot
2026-11-17 7:35 ` [PATCH v6 5/5] HID: intel-thc-hid: intel-ipts: document the IPTS mode Emfox Zhou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261117073554.11557-1-emfox@debian.org \
--to=emfox@debian.org \
--cc=bentiss@kernel.org \
--cc=even.xu@intel.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xinpeng.sun@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.