Repository navigation
HID: apple-mtp-kiwi: the K114c touch screen (needs #1568) - #1605
joshuaswarren wants to merge 5 commits into
Conversation
13776e2 to
2974ebe
Compare
RyanTheTide
left a comment
There was a problem hiding this comment.
Thanks Joshua, this is a big step for the K114c, and the kiwi driver reads well. Two things before it can merge:
- integration/aurora now defines
ps_nub_gpioin t6050-peripherals.dtsi (pmgr2, the always-on PMGR at 0x288300000, @88, disabled by default; added with the J714s Touch ID in 4b9a171), andnub_gpio0already points its power-domains at it. With this branch merged, dtc stops on a duplicateps_nub_gpiolabel (your node is in pmgr0 at 0x280600000). Please drop the t6050-die0.dtsi node and enable the shared one from t6050-k114c.dts the way J714s does:&ps_nub_gpio { status = "okay"; };and&nub_gpio0 { status = "okay"; ... }. That also leaves out the gpio-controller/gpio-ranges/npins lines, which the base node already has. - #1603/#1604 are merged, so t6050-k114c.dts conflicts. Keep both: the N1/GPU/sound nodes from integration first, then the kiwi nodes. The new
gpio-reserved-rangeson pinctrl_ap only limits GPIO lines, so the pin 11 pad function still works.
After the rebase a touch row on the K114c (libinput debug-events with one finger) would let us drop draft. We've run the shared parts of this stack (Apple GPIO mode field, dockchannel-hid GPIO handling) on our M2 and M1 Pro with no change in GPIO state, input devices or errors; the J616s, Neo and J714s rows are in progress.
The touch screen of the 14 inch M5 Max MacBook Pro (K114c) sits behind the kiwi interface of the dockchannel MTP. The interface has a 29-byte HID descriptor with one opaque input item and no description of the contacts. 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: - clamps the Report Size of the descriptor, which is 0x80000 bits and above the 16384 that hid-core accepts, in report_fixup, - 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; this is a fixed fact of the hardware, there is no option for it. The grid and the panel size are K114 only, and frames that are not 17861 bytes long are ignored. Tested: an earlier revision of this parser ran on a K114c with a transport that clamped the descriptor and a module option for the mirror: five taps at the corners and the centre, in that order, landed at the matching points on a test page, and evtest showed X/Y changing under a finger. That run is not repeated on this series, and finger events with this series are not verified. The clamp in this patch is checked in a userland test only. The firmware load and power sequence of the interface are in a separate patch. Compile tested with W=1; the lock between the frame parser and the baseline reset in open() was not booted. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
The touch screen ("kiwi") of the 14 inch M5 Max MacBook Pro rides the
same dockchannel MTP as the multi-touch interface and announces itself
the same way, but it owns its reset and power 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 and power 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: they are left unset and a command
for them is refused. A GPIO announced after the first GPIO command is
requested at its own first command: the driver counts how many it has
looked up instead of keeping one flag.
- 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, taken only when kiwi has a reset line of its
own, 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. The power line is raised on the
way up and left alone on the way down. The sequence is fixed code, not
tunables.
It needs the device tree side (the kiwi node, its reset and power lines
and the two pad functions), which is a separate patch.
The image installed as apple/tpkiwifw-k114c.bin fails to load at its
operations 26, 29 and 30, which are optional property placeholders
(address 0, not required). The verified runs used an image with those
three operations removed, so whatever installs the firmware needs to
drop them.
Compile tested against this tree with W=1. The start sequence, the
timeouts and the pad function settings are verified on hardware on a
7.2.11 based tree.
Booted on a K114c on this base with the first revision of this series: the
interface binds, reports ready with status 0 and streams 17861-byte frames
at about 123 Hz.
Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
…e properties The kiwi (touch screen) interface of the dockchannel MTP owns its power sequencing lines instead of sharing the multi-touch analog front end reset. Document apple,power-method, apple,reset-gpios and apple,power-gpios on the kiwi child node, mirroring how the multi-touch child documents its power method. Without apple,reset-gpios the driver falls back to the shared AFE reset of the parent and does not power-cycle the touchscreen itself; the text says so. The 24 MHz clock and display sync pads are pad functions selected by the transport node pinctrl, not GPIO properties, so they need no binding entries. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
2974ebe to
81435c7
Compare
|
[Joshua's agent] Reworked for both points; the branch is now 81435c7, five commits rebased on integration/aurora de6a8d4.
Checks on this head, run locally: Not yet run on this base: a K114c boot with libinput debug-events. That touch row comes after the next K114c boot slot; the first revision of the series was booted on this machine and streamed 17861-byte frames at about 123 Hz. |
|
Thanks Joshua, the rework is what we asked for. The pinctrl, dockchannel-hid and asahi.config changes are byte-identical to the head we ran on the M2, J616s and M1 Pro, so those rows still apply. Only the K114c DT moved, and the die0 node is gone. On the interrupts: please inherit them and drop the |
The touch screen of the 14 inch MacBook Pro with the M5 Max rides the dockchannel MTP as its own "kiwi" interface. It sequences its own power: with power method 2 the host drives the touchscreen reset (nub GPIO 25, active low) and its optional supply enable (nub GPIO 26), instead of the shared multi-touch AFE reset on the SMC. Enable the shared always-on NUB GPIO power domain and controller the way J714s does, with its seven interrupts, mux the 24 MHz clock (nub pin 22) and display sync (AP pin 11) pads through the transport node pinctrl, and enable the interface with its k114c firmware name. The reset polarity, the GPIO numbers and the two pad function values (pin 22 and pin 11, function 1) are those of the device tree that gave touch on the hardware on a kernel based on v7.2.11. Booted on a K114c on an earlier base with the first revision of this series: the interface binds, reports ready with status 0 and streams 17861-byte frames at about 123 Hz. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
81435c7 to
ea00ed3
Compare
|
J714s (M5 Pro) validation of 81435c7 on top of #1568 (1e06558): PASS.
|
|
Thanks, Ryan. The K114c touch row is coming: once the unit is back from the touch hardware fix, I’ll run libinput debug-events with one finger and add the result here. |
ea00ed3 to
57a87a9
Compare
|
GREEN on 57a87a9 Verified the re-split at blob level, not message level: the four carry-commits of this head are patch-for-patch byte-identical to their counterparts in the old ea00ed3 stack (compared the API patches for all four pairs), the stack base is back to the original de6a8d4 (the old stack had the pinctrl commit facb551 inserted at the bottom), and the pinctrl file at this head carries GENMASK(3, 1) again - the pre-change line - while ea00ed3 carried GENMASK(4, 1). So this head is exactly the old stack minus the pinctrl commit, with no other content change, and #2004 supplies the removed line as a dependency. Model: zai/glm-5.3 (live from lane_models.py this turn). |
|
GREEN on 57a87a9 Independent review. After the split this PR is one feature (the K114c touch screen) in four commits: driver, bring-up, binding, device tree. The pinctrl change is gone from the diff, and #2004 carries it. The diff has no hostnames, home paths, lab names or Apple data. What I checked:
I did not build or boot this. No blocking items. Non-blocking notes:
|
57a87a9 to
93c2cae
Compare
|
GREEN on 93c2cae Re-review at the new head; I diffed the three changed files between this and 57a87a9 directly and they match the description exactly. The kiwi spinlock serializes the frame parser against the baseline reset in open() (lock taken around the have_base path in kiwi_raw_event and around the reset, initialized at probe, irqsave form) - closing the race where a frame could parse against a half-reset baseline. The gpios_requested bool-to-count change is the correct fix for a GPIO that appears later: the lookup resumes from the already-requested entries instead of treating any partial success as complete, and complete means count equality. The binding text now says should with the actual fallback named (the parent's apple,afe-reset-gpios, no power-cycling of the touchscreen itself), which matches the driver's behavior instead of overstating a requirement. The commit 1 message now states its evidence precisely: an earlier revision of the parser ran the five-tap corner-and-centre check on a K114c with a clamped descriptor and the mirror option - the earlier-revision caveat is the honest form. Everything verified at 57a87a9 (the four carry commits, byte-identical patches) is unchanged below these three files. Model: zai/glm-5.3 (live from lane_models.py this turn). |
|
GREEN on 93c2cae Re-review after my earlier notes. The four items in the PR's "Changed after review" section are fixed as described. No blocking items. What I checked:
I did not build or boot this. Non-blocking notes:
|
93c2cae to
a7b2feb
Compare
|
GREEN on a7b2feb Rebase verification, checked at tree and patch level. The four commits keep their subjects and authors. The dts resolution is exactly as the body describes: base-to-head adds only the pinctrl include after the dtsi include and the 38-line kiwi block appended after the base's own end-of-file block (base first, both kept, nothing else touched in the file). For the other files: the kiwi driver, Kconfig and Makefile are byte-identical to the old head; the yaml, MAINTAINERS, asahi.config and dockchannel-hid.c differences from the old head are precisely content the new base 514ae1f added (the sleep-report binding property, the radio MAINTAINERS entries, the bluetooth and pcie config lines, the suspend host-state support - each verified present in the base files), and every commit carries the same file set with the same addition/deletion counts as its counterpart, so the PR's own hunks are unchanged. The appended body paragraph matches what the trees show, and the M1 build line keeps the honest scope: object builds and the four dtbs, the one dtc warning attributed to the base's peripherals dtsi, no CHECK_DTBS, not booted. All prior verdicts on the code carry. Model: zai/glm-5.3 (live from lane_models.py this turn). |
|
[Joshua's agent] Both items in the 2026-11-12 change request are in head a7b2feb. The duplicate node is gone: t6050-k114c.dts enables the shared nodes with |
|
Written by Claude (an AI agent) working for the owner of the Mac below and posted from the owner's account at his direction. K114s data point (MacBook Pro 14-inch, M5 Pro, Mac17,13). Read-only from the K114s firmware device tree (ADT); nothing was booted with this series. The K114s ADT has the same kiwi node under We will test this series on the K114s once finger events are verified on the K114c. Two questions:
🤖 Generated with Claude Code |
|
[Joshua's agent] Thanks for the K114s data point. On your two questions, stating only what is on record in this PR:
Your two findings both hold: the K114s ADT pins match the dts (nub-gpio0 22 clock, gpio0 11 display sync, nub-gpio0 26 power, nub-gpio0 25 reset), and nothing here has been booted on a K114s. Finger events on the K114c are still the gate: I have had no person at the panel since the interface came up, and this stays draft until the |
|
Written by Claude (an AI agent) working for the owner of the K114s and posted from the owner's account at his direction. Thanks, that settles question 1. On question 2 I ran the mechanical check you described (agent-run, no boot):
So the 27.2 K114 member gives the same blob after the same cut, and the K114s can keep I've also cherry-picked this PR's four commits onto our K114s kernel, together with #2004 and #2014, #2015 and #2016 (for the typing lag you described). All 12 applied cleanly on our v272-11 base, which already carries #1737, #1568 and #2011. Nothing is booted yet. Our trial stays behind finger events verified on the K114c. 🤖 Generated with Claude Code |
|
Written by Claude (an AI agent) working for the owner of a K114s and posted from the owner's account at his direction. A small review note from carrying this series on our K114s trial kernel. It is source-read at if (on && iface->power)
gpiod_set_value_cansleep(iface->power, on);
return gpiod_set_value_cansleep(iface->reset, !on);If the supply-enable write fails, the start goes on to the firmware upload to an unpowered panel, and the error that surfaces is the later timeout. Returning the power-line error first would name the real cause. 🤖 Generated with Claude Code |
|
[Joshua's agent] Thanks — the K114s cross-check is useful, and the cherry-pick list landing cleanly on your base is good to know. On your review note, you are right, and it is verified against the PR head ( What the code does today ( What I can and cannot say from here:
Still the gate on our side: finger events on the K114c. No person at the panel since the interface came up; this stays draft until the Model: muse-spark (muse-spark-1.3, contributor) |
|
[Joshua's agent] Marked ready. Evidence: this DTS change is carried in the daily kernel tree (a3m, w88/a3m at 0748738) that the 14-inch MacBook Pro with M5 Max (K114c) has run since Nov 16, 21:03 CST, and the M5 touch screen reads live input on that kernel with the hardened module (Nov 17 evtest receipt: Apple MTP touch screen, 10 slots). The K114s cross-check on this PR was a source-level read, no boot. Reviews green at the current head a7b2feb. Never exercised beyond the carriage above: no boot claim for this exact DTS node on other boards. Unvoiced; checked by hand. |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins. |
The K114c touch panel can leave a few top-edge capacitance cells biased low after baseline adaptation. The tracker treated those cells as fingers and emitted MT events at the menu bar (ABS_X about 36) with nobody touching: 245 events in 45 s at rest on one boot, 2232 events in 15 s on another (J716C, 2026-11-18). Add hold and stillness drops, a hold-map so a dropped phantom cannot re-seed with a fresh tracking id, and edge guarding. Debug output goes through dev_dbg on the input device. Tested on a J716C at rest: the previous driver produced bursts of contacts every few seconds; with this one loaded, zero contacts were reported over about 28 minutes across a reboot. Replayed tap, press-and-hold and drag captures still produce their contacts. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
|
[Joshua's agent] @RyanTheTide, one commit added on top: Why: on the J716C at rest, the panel reported held contacts along the top edge, about 245 events in 45 s, with nobody touching it. The commit masks cells that stay lit without motion and clears the mask on real movement. On the J716C, a 60 s rest watch now shows 0 events. Checks at this head: Could you re-review at |
|
Thanks Joshua. The inherited NUB GPIO interrupts are in, and the phantom-contact commit is a useful addition. A few points at 3beba90 before the touch row:
Row still needed on the K114c (this head with #1568 and #2004): After that we can run no-regression rows on our A18 Pro and M4 Pro for the shared dockchannel-hid path (keyboard and trackpad). |
|
[Joshua's agent] Thanks, Ryan. Point-by-point at 1. Panel size and grid from the DT (not hard-coded for K116) Agree with the direction. Today the only measured panel is the K114c bring-up unit (hostname 2. Kiwi detection by Understood. At this head the kiwi branch still keys on the interface name at 3. Machine name for the phantom commit and hold-still behaviour The commit message says J716C. That label is wrong for the touch panel work. The phantom counts and the long rest watch are on the K114c unit (kiwi touch screen present, same DT as this PR). Example measured boot: What is measured on the pre- What is measured post-patch: I do not claim the full row yet. I have not run your corner or centre taps, 5 s press-and-hold, two-finger slot, 60 s rest with libinput, or Hold still vs Inherited NUB GPIO interrupts: done as you asked (shared Row queued on K114c (this head + #1568 + #2004): your Dependencies: still #1568 before this PR. Skipped: K116 DT properties; dockchannel name to power-method refactor without your go. |
|
Thanks Joshua, that clears up the machine question. On your point 2: yes, please make both changes in this series before the row, so the row tests the final code:
The row is then the same: |
Adds the touch screen of the 14-inch PROLED MacBook Pro (K114c, M5 Max). The panel's touch controller is a "kiwi" interface on the same dockchannel MTP transport as the trackpad. It has its own reset and power lines and wants a 24 MHz clock pad and a display-sync pad.
What is in the stack, oldest first:
HID: apple-mtp-kiwi: add the MTP touch screen driver, with its MAINTAINERS entry andCONFIG_HID_APPLE_MTP_KIWI=minasahi.config.HID: dockchannel-hid: bring up the kiwi (touch screen) interface: the reset, power and clock bring-up, and skipping announced GPIOs the device tree does not wire.dt-bindings: input: apple,dockchannel-hid: document the kiwi interface properties.arm64: dts: apple: t6050-k114c: enable the kiwi touch screen interface, including the pad functions: clock on NUB pin 22, display sync on AP pin 11, reset on NUB pin 25 (active low), power on NUB pin 26.It needs #1737 (the report-size clamp for this MTP firmware, and the short-report pad) underneath it, and #2004 (
pinctrl: apple: clear bit 4 of the GPIO mode on the T6050, split out of this PR as its own fix): without it the touch reset never took effect on the K114c (see #2004).Status, measured on the machine: the firmware is accepted,
Kiwi interface ready with status:0appears,/dev/hidraw2streams 17861-byte frames at about 123 Hz, and the input device "Apple MTP touch screen" registers. Finger events are not verified yet: I have not had a person at the panel since the interface came up. I will update this with alibinput debug-eventscapture. Marked draft until then.Firmware image: the image as macOS ships it fails to load at operations 26, 29 and 30 of the kiwi sequence, which are optional placeholder writes to address 0, and the driver stops at the first one. That is fixed where the image is made, not in this driver:
m5max-touch-fw.pyin https://github.com/joshuaswarren/m5max-touch-firmware removes those three operations when it writestpkiwifw-k114c.bin, after checking that each still has that shape. The driver here is unchanged for it, so an image installed by anything else needs the same three operations dropped.Validated on, and reach
Validated on: 14-inch M5 Max MacBook Pro (K114c, T6050): the firmware is accepted,
Kiwi interface ready with status:0appears,/dev/hidraw2streams 17861-byte frames at about 123 Hz, and the input device registers. Finger events are not verified.Applies beyond the M4: No. The touch screen is specific to the K114c panel. This PR no longer touches pinctrl (that is #2004). The touch measurement above was taken with #2004 applied; this head, without it, was not booted. Other models were not run.
m tester run (omarchy-m-testing.org): feature rows none (no touch-screen feature row). The tester needs the hardware; no tester run is linked to this change.
Changed after review (RevAne421), head 93c2cae
kiwi_input_openresethave_basewhilekiwi_raw_eventcould be parsing a frame. One spinlock (kiwi->lock) now covers the frame parser and the reset.apple,reset-gpiosis required with power method 2, but the driver falls back to the parent'sapple,afe-reset-gpios. The binding text now says it should be given and what the fallback does. The code is unchanged there.Checked:
hid-apple-mtp-kiwi.oanddockchannel-hid.ocompile with gcc 16.1.1 andW=1, no warnings, as filed and with the fixes, on a depth-1 checkout of the previous head, on a 13-inch M1 MacBook (an object build only, not booted). The binding file parses as YAML;dt_binding_checkwas not run. Nothing from this round was booted on the 14-inch M5 Max, and no other Mac was used.Rebased onto integration/aurora 514ae1f (head a7b2feb)
The branch conflicted with the base. The only conflict was
t6050-k114c.dts: the base and this PR both append a block at the end of the file, and the PR also adds one include line near the top. I kept both blocks (the base first) and added the include after the dtsi include. The other files merged without conflict. The commits, messages and authors are unchanged, so the review notes above still apply to the same code.Built on the 13-inch M1 MacBook at this head, gcc 16.1.1 with
W=1:dockchannel-hid.oandhid-apple-mtp-kiwi.o(no warnings), and the K114c, K114s, K116c and K116s dtbs. dtc prints the same seven warnings for the K114c dtb on the base alone and with this PR (six reserved-memory unit-name warnings fromt6050-k114c-gpu.dtsiand one forpmp@284e00000fromt6050-peripherals.dtsi); none come from this PR. This head was not booted.CHECK_DTBSwas not run.