Skip to content

[Joshua's agent] K114c October series (draft): kiwi touch final state - #2182

Draft
joshuaswarren wants to merge 17 commits into
aurora-silicon:integration/aurorafrom
joshuaswarren:k114c-m5max-kernel
Draft

joshuaswarren wants to merge 17 commits into
aurora-silicon:integration/aurorafrom
joshuaswarren:k114c-m5max-kernel

Conversation

@joshuaswarren

@joshuaswarren joshuaswarren commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Status note: head is 2dd590d, 17 commits: the rebased series without the 27.3 (26C5035r) GPU firmware identification commit, plus one new commit, the kiwi power and reset binding declaration that CHECK_DTBS needs while the dockchannel binding series is open. The identification commit was removed because it needs the 27.2/27.3 M5 layout code, which is not on the tip; 27.3 GPU support will come as its own series with a boot proof.

[Joshua's agent] Preserved series from our October/November K114c work, opened as draft per a patch-id audit: these commits are neither in integration/aurora nor on any PR head. The branch is based on integration/aurora as of 2026-11-12 and is well behind the tip; it needs a rebase before review, and CI should be expected to fail at this base. Draft because it is not rebuilt or booted on the current base.

Series (branch k114c-m5max-kernel, 21 commits): the final state of the kiwi (touch screen) work as a kernel branch — the kiwi pad functions in DTS (clock pin 22, display_sync pin 11), the NUB GPIO block and kiwi interface enabled, the kiwi reset line marked active-low, dockchannel-hid owning the reset and power lines for a power method 2 interface and skipping announced GPIOs the device tree does not wire, plus the same dockchannel/magicmouse clamps as the companion input-series PR. One commit that requested the reset line as a plain output is followed by its revert; both are kept because the branch is preserved as it ran.

Four commits of this branch are patch-id-identical to commits on open PRs #1605, #1568, #2011 and #1602; they are kept so the branch applies exactly as it ran.

Rebased onto integration/aurora tip 59b02d5 as 3774248 (17 commits; the branch is preserved as it ran on the fork at k114c-m5max-kernel-asrun). Rebase decisions (recorded here, not in the commit messages): the pre-m5-parity drm/asahi stack by Rolando Trevino (10 commits) was dropped; I treated it as superseded by the tip's #2085 merge, but the 27.2/27.3 M5 layout part of it is not on the tip; the HID restart fix by "ed" and its revert were dropped as net zero; four commits kept are patch-id-equal to open #1605/#1568/#2011/#1602; the NUB GPIO block now reuses the ps_nub_gpio power state and the wired nub_gpio0 the tip already carries (upstream landed them with interrupts, so the branch's delete-interrupts form was dropped), leaving the enables and the kiwi node. Built at 3774248: vmlinux links (LLVM) with a config that compiles hid-apple-mtp-kiwi.c, hid-magicmouse.c, pinctrl-apple-gpio.c and mailbox.c. Not compiled locally: dockchannel-hid.c and the Rust GPU driver (that config enables neither). At 0609989 apple/t6050-k114c.dtb compiles under CHECK_DTBS with no new findings from this series; the one remaining schema note is the pcie port0 note, which the unmodified tip has too. Never booted: no boot, no touch probe.

The GPU ASC interrupt never reaches the AIC on the M5 Max. Mark both T6050
ASCWrap v6 hardware structs rx_poll_only so the v8 receive poller drives them.
@joshuaswarren
joshuaswarren force-pushed the k114c-m5max-kernel branch 3 times, most recently from 7763de2 to 0609989 Compare November 18, 2026 00:41
joshuaswarren and others added 16 commits November 17, 2026 18:43
The K114c multi-touch descriptor has a Digitizer-page field under a Mouse
application. hid-input reads that as a pen and sets INPUT_PROP_DIRECT, and
udev then tags the trackpad as a touchscreen instead of a touchpad. The
pad is an indirect pointing device: clear the property.
The multi-touch interface of the 14-inch M5 Max MacBook Pro (t6050)
declares its raw touch report as a single Report Size item of 0x80000
bits. hid-core rejects any Report Size above 16384 with "invalid
report_size 524288", so the trackpad never registered although the
firmware, the interface and the keyboard all came up.

hid-magicmouse consumes these reports in raw_event() and never uses the
parsed field layout. Clamp each Report Size item in the copied descriptor
to the hid-core limit before parsing, and log the clamp once per item.
…e maximum

The K114c MTP input descriptor is a raw buffer pipe: usage TouchPad with
REPORT_SIZE 0x80000 bits (64 KiB), one field, no report id; macOS reads
variable-length reports against it. hid core refuses any REPORT_SIZE
above 16384 bits, aborts the whole parse (the invalid report_size 524288
probe failure), and the device ends up with zero registered reports -
which is why finger reports raise the dockchannel interrupt yet nothing
reaches hidraw or the input device.

Walk the descriptor in report_fixup and rewrite any oversized
REPORT_SIZE item in place to 16384 bits, keeping the item length stable.
Real reports are far shorter, and hid core accepts reports shorter than
the declared size. With the parse completing, the mouse usage drop and
the C1FE-family report decode take over.

Checked against the real K114c ADT descriptor bytes: exactly one item is
clamped, the rest of the byte stream is unchanged.
…interface; claim kiwi

A power method 2 interface drove only the shared multi-touch AFE reset
line. The K114c touch-screen (kiwi) interface is power method 2 as well,
but its reset and supply are NUB GPIO pins (ADT function-reset and
function-power), so driving the AFE line for it would reset the trackpad.
Read apple,reset-gpios and apple,power-gpios from the interface node; an
interface without apple,reset-gpios keeps the AFE line. The supply is
driven high when the interface is created and again before the reset is
released.

Booted on a K114c with power method 1 (the default), kiwi receives its
firmware and then fails the comm reset command with 0xe00002c2 and never
reports ready. The ADT says PowerMethod 2 for it.

Also add hid-apple-mtp-kiwi. The kiwi HID device matches the wildcard
BUS_HOST Apple entries of hid-apple and hid-magicmouse, so hid-generic
stands off from it, and both drivers reject it in probe: no driver ever
bound. The new driver claims it by name and exposes the raw report pipe on
hidraw. The interface starts when hidraw is first opened.
…i touch-screen interface

The touch-screen reset and supply are NUB GPIO pins 25 and 26 (ADT function-reset
and function-power). Describe the always-on nub_gpio power domain, give the NUB
GPIO controller its gpio properties without interrupts, and give the kiwi
interface its firmware name, power method 2 and the two lines.
gpiolib refuses to set the value of a line that is an input and returns
-EPERM. The reset line of a power method 2 interface with its own line was
requested with GPIOD_ASIS, so the first start of the kiwi interface failed
with EPERM when hidraw was opened. Request it deasserted (low) instead.
…ethod 2 interface; claim kiwi"

This reverts commit 91a826a.
The touch screen of the M5 Pro MacBook Pro (k114c) sits behind the kiwi
interface of the dockchannel MTP. The interface has a 29-byte HID
descriptor with one opaque 16384-bit input blob, so the contacts are not
described by HID. The chip reports a raw 82 column by 54 row capacitance
image every 8.3 ms and does no contact detection itself.

Claim the interface by name (hid-apple and hid-magicmouse already refuse
BUS_HOST Apple interfaces that are not a keyboard or mouse), keep the
raw pipe on hidraw, and register a direct multi-touch input device with
10 slots over the 3024x1986 panel. The driver:

 - skips the whole-image shift frames the chip sends every 2 s and
   removes a per-row mean from the others,
 - keeps a fixed-point baseline per cell (fast up when a finger left,
   slow drift otherwise),
 - takes 3x3 local maxima 250 counts below baseline, centroids them and
   tracks them frame to frame with a 2 frame miss debounce.

Row 0 of the sensor is the bottom edge of the panel, so y is mirrored.

Tested on a k114c (M5 Pro 14 inch): five taps at the corners and the
centre, in that order, landed at the matching points on a test page, and
evtest shows X/Y changing under a finger. The firmware load and power
sequence of the interface are in a separate patch.

Signed-off-by: Joshua Warren <816217+joshuawarren@users.noreply.github.com>
The touch screen ("kiwi") of the M5 Pro MacBook Pro rides the same
dockchannel MTP as the multi-touch interface and announces itself the
same way, but it owns its power, clock and reset lines instead of
sharing the AFE reset, and its 1.3 MB firmware image is written by the
MTP bootloader over the touch IC SPI, which takes seconds rather than
the 1 s the comm timeout allows.

- A power method 2 interface may decode its own reset, power and clock
  lines from its device node; without its own reset line it keeps
  falling back to the shared AFE reset, so existing multi-touch boards
  are unchanged.
- Announced GPIOs are tracked per interface (the MTP announces
  clock_24MHz_enable, display_sync, power and reset for kiwi) instead
  of failing on the second one, and a GPIO command is matched to its
  announced id. The kiwi clock and display_sync pads are pad functions
  in the device tree, not host GPIOs; their commands are refused as
  before and the chip starts without them.
- While the kiwi firmware load is running, comm commands use a 10 s
  timeout, and the kiwi interface waits 10 s for its ready message.
- The kiwi start sequence power-cycles the chip with a reset pulse
  (the reset line is active low in the device tree), settles 50 ms,
  sends the firmware and then runs the normal power method 2
  transitions. This sequence is fixed code, not tunables.

Compile tested against this tree with W=1; the bring-up sequence and
timeouts are verified on hardware on a 7.2.11 based tree.

Signed-off-by: Joshua Warren <816217+joshuawarren@users.noreply.github.com>
On the K114c the NUB GPIO block comes out of iBoot with bit 4 of the
touch-screen reset and power pins set (0x474210, 0x474212 as read through
/dev/mem). With that bit set, the DATA bit does not latch in output mode:
writing 0x474213 reads back 0x474212, writing 0x474203 reads back 0x474203.
direction_output wrote only bits 1-3 of the mode, so the pin stayed in a
state where the driver's output value never took effect.

Treat bits 1-4 as the mode, so that direction_output and direction_input
clear bit 4. Modes 0-7 are unchanged, and a working output (the PERST# pin
of the K114c, register 0x00076a03) has the bit clear.

(cherry picked from commit 41e310c)
…ines

The K114c touchscreen node uses power method 2 with its own reset and
power gpios; declare them so CHECK_DTBS passes. The properties belong
with the open dockchannel binding series and are dropped or reworked
when it lands.
@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for preserving the as-run October series; it makes the history easy to follow. Comparing it with the open PRs at today's heads, everything here now has a newer home:

If you agree, could this be closed in favour of #1605 and those PRs, with the k114c-m5max-kernel-asrun branch kept as the record? If one of the magicmouse commits (not marking the MTP trackpad as a direct device, clamping REPORT_SIZE to the HID core limit) is not covered by #2180 or #1830, it would be easiest to review as its own small PR with the K114c trackpad libinput debug-events before/after.

The touch row itself is tracked on #1605 (K114c libinput debug-events, s2idle x3 with touch back). Once that lands we can run no-regression rows on our A18 Pro and M4 Pro for the shared dockchannel-hid and magicmouse paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants