Skip to content

arm: apple: hand an MTP over running when its device tree says its firmware cannot be restarted - #67

Merged
DjDeveloperr merged 3 commits into
aurora-wipfrom
satchlj/t8112-mtp-live-handoff
Nov 20, 2026
Merged

DjDeveloperr merged 3 commits into
aurora-wipfrom
satchlj/t8112-mtp-live-handoff

Conversation

@satchlj

@satchlj satchlj commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Claude Opus 5.5 on @satchlj's behalf.

arm: apple: hand an MTP over running wherever its device tree says its firmware cannot be restarted, instead of matching a board or SoC.

Why: some MTP firmware cannot be restarted once quiesced, so U-Boot has to hand its first epoch to the OS running: J613, and T8112 (MacBook Air M2, J413) on the macOS 27.2 stub. On J413 a quiesced 27.2 MTP leaves Linux's trackpad answering "Received unknown power state (1)" and timing out.

Selection: apple,rtkit-keep-running on the MTP helper node, set by the board device tree (aurora-silicon/linux#2525 adds the binding, sets it in t8122-j613.dts, and adds t8112-j413-fw27.dts). That one property replaces U-Boot's J613 board check, the earlier T8112-plus-firmware-27 check, and the J613 entries in the keyboard's discovery-replay check. It selects the existing retained-epoch path, rtkit_helper_fdt_publish() with the buffer inventory. The DART must still keep its bypass, and the session must still publish. J713/J614s and T8140 keep their own handoffs (a different publication, and the opt-in DRAM path).

Trackpad power: the two-stage power command (apple,power-method = <2>) is no longer patched into the OS DT by U-Boot. The board DT carries it, as t8122-j613-25g83.dts already does.

CI: apple_rtkit_helper_keeps_running() and apple_rtkit_helper_any_keeps_running() have inline stubs without CONFIG_APPLE_MTP_KEYB, so apple_j873 links again.

Merge order: J613 now needs the property in its DT. Merge linux#2525's DT commit first, or J613 loses its handoff.

Testing

  • apple_m1_defconfig and apple_j873_defconfig build and link.
  • J413 on the 27.2 stub, one-shot Stage 2: phellos's default Aura + this branch + t8112-j413-fw27.dtb. That DTB is the default t8112-j413.dtb plus exactly the two properties. Result: pass. Details are in the comment below.
  • Not tested: J613 (the property replaces its board check), J415/J493, and any other MTP.

🤖 Generated with Claude Code

@satchlj

satchlj commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

Hardware result on MacBook Air M2 (J413, T8112), macOS 27.2 (26B123) stub: pass. The change is now part of phellos's default.

Tested in phellos's upstream-first build, and it is now the default (one-shot 3957f65b, then default boots a10e0f07 and bef932e9, 2026-11-20):

  • kernel: integration/aurora 61295c26 + linux#2519, #1832, #1831, #2264, #2525, #2526;

  • Stage 2: Aura main 5cf061ca + aura#377, #227 (its isp.c), #381, #382;

  • U-Boot: aurora-wip 37baf8f + u-boot#67.

  • apple_t8112_mtp_live_epoch() was true (apple,t8112-mtp, asahi,os-fw-version 27.2). U-Boot published mtp-live-v1, the DART stream and the four endpoint records, and Linux adopted the running session.

  • Second commit: without apple,power-method = <2> Linux's trackpad timed out ("iface multi-touch start timed out"). With the fixup it reports "Interface multi-touch is now ready".

  • Not tested on hardware: GRUB menu keyboard input under this build (it needs a person at the keyboard), and J415/J493.

🤖 Generated with Claude Code

@satchlj
satchlj marked this pull request as ready for review November 20, 2026 06:16
@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for this, and for finding the two-stage power command the trackpad needs.

The reason given, that this MTP firmware cannot be restarted once it is quiesced, also applies to the J613, J713 and T8140, which already hand the MTP over running through their own checks. This adds a third, chip-specific one:

  • arch/arm/mach-apple/rtkit_helper.c:70-85 apple_t8112_mtp_live_epoch() (an apple,t8112-mtp node and OS firmware >= 27), used again at board.c:1711, apple_mtp_kbd.c:524 and rtkit_helper.c:673-678.

We'd prefer one policy for every MTP SoC: hand the MTP over running wherever the helper's DART can stay in bypass and the OS can adopt the session, chosen from the device tree, not by SoC or board. The apple,power-method = <2> fixup could follow the trackpad firmware version on any MTP, or be described in the board's device tree. That would also fix the CI build, which fails on apple_j873 with an undefined reference to apple_t8112_mtp_live_epoch (board.c:1711).

If you go that way, we can run rows on our M2 (T8112), M1 Pro, M4 Pro and A18 Pro.

@satchlj satchlj changed the title arm: apple: hand the T8112 MTP over running on macOS 27 firmware arm: apple: hand an MTP over running when its device tree says its firmware cannot be restarted Nov 20, 2026
@satchlj

satchlj commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf.

Thanks. Reworked in a new commit, b9efd22a, with no force-push:

  • One property, the existing path. apple_t8112_mtp_live_epoch() is gone. So is the J613 board check in rtkit_helper_inventory_handoff(). Both now read apple,rtkit-keep-running on the MTP helper node and go through the existing retained-epoch handoff (rtkit_helper_fdt_publish() with the inventory). The DART bypass check and the session's own publication checks still decide whether it actually happens. The same property replaces the T8112/J613 terms at board.c:1711 (EFI path / U-Boot keyboard) and apple_mtp_kbd.c:524 (preserve discovery frames for Linux).
  • Power method from the board DT. The apple,power-method = <2> fixup is removed from U-Boot. The board DT now carries it, following t8122-j613-25g83.dts. The trackpad firmware's own version isn't visible to U-Boot, so the board DT was the option I could implement.
  • The DT half is in iommu/apple-dart, soc: apple: rtkit-helper: take a live MTP handoff by its properties, not by board linux#2525 (new commit 64ea0f87): the binding for apple,rtkit-keep-running, the property in t8122-j613.dts (to keep J613 as it was), and t8112-j413-fw27.dts with the property plus the power method.
  • CI: inline stubs without CONFIG_APPLE_MTP_KEYB. apple_j873_defconfig builds and links locally now.

What I did not merge: J713/J614s (rtkit_helper_fdt_publish_j713(), a different publication and contract) and the opt-in T8140 DRAM path. They could take the same property for the "hand over running" decision, but their publication stays separate. I can't test them, so I left that for your rows. Tell me if you'd rather I fold their selectors into the property now.

Hardware, J413 / 27.2 stub, one-shot Stage 2 (a1f06a10…, boot 115b0f8e, under WD1): phellos's default Aura + this branch + t8112-j413-fw27.dtb. I rebuilt the default t8112-j413.dtb byte for byte; the fw27 DTB differs from it only by the two properties. Result:

  • apple,rtkit-handoff = "mtp-live-v1" with the 20-cell (4-buffer) inventory;
  • Linux: "adopted the running RTKit session (4 retained buffers)", then stm, keyboard, actuator and multi-touch "now ready";
  • apple,power-method = <2> reached Linux from the DT, not from U-Boot.

Not tested: GRUB keyboard input (it needs a person), J613 with the property in place of its board check, J415/J493. Merge order: linux#2525's DT commit before this, or J613 loses its handoff. Your M2, M1 Pro, M4 Pro and A18 Pro rows would be very welcome.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for b9efd22. One apple,rtkit-keep-running property on the MTP helper node feeding the existing retained-epoch handoff, with the power method in the board DT, is what we hoped for. Noted that linux#2525's DT commit must land first.

Leaving the J713/J614s and T8140 publication paths separate in this PR is fine. Moving their "hand over running" decision onto the same property can be a follow-up. We will run rows on our M2, M1 Pro, M4 Pro and A18 Pro on this head with the linux#2525 DTBs.

@satchlj

satchlj commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf: hardware run.

PR head Checked Result
b9efd22a With linux#2525's t8112-j413-fw27.dtb (U-Boot no longer patches the trackpad power method): MTP handed over running, adopted by Linux, keyboard and trackpad registered, kept across s2idle. Not checked by a person: GRUB-menu keyboard Pass

Build: phellos (MacBook Air M2, J413, macOS 27.2 / 26B123 stub), default rebuilt 2026-11-20 = linux integration/aurora 458f759d + aurora-silicon/linux#2519 aurora-silicon/linux#1832 aurora-silicon/linux#1831 aurora-silicon/linux#2264 aurora-silicon/linux#2525 aurora-silicon/linux#2526 aurora-silicon/linux#2543 aurora-silicon/linux#2544 aurora-silicon/linux#2545; Aura main 0beafec9 + aurora-silicon/aura#377 aurora-silicon/aura#227 (isp.c only) aurora-silicon/aura#381 aurora-silicon/aura#382; U-Boot aurora-wip 37baf8f + #67; Stage 2 DTB t8112-j413-fw27.dtb. One-shot boot under the SoC watchdog, then made the default (two default boots healthy).

@RyanTheTide

Copy link
Copy Markdown
Contributor

J615 row (15-inch MacBook Air M3, T8122), 27.2 stub, this PR at b9efd22 built unmodified (apple_m1_defconfig).

Stage 1 aura tip-dev; one-shot Stage 2 = aura 1.0.0b13.1 (or 1.0.0b13.1 with the 27.2 DCP picks) + a J615 DTB with apple,rtkit-keep-running on &mtp and apple,power-method = <2> on the trackpad + this U-Boot; kernel with linux#2525.

  • 7 of 7 boots: U-Boot started the MTP for its keyboard and handed the session over; Linux adopted the running RTKit session (4 retained buffers), keyboard, trackpad, stm and actuator interfaces ready, no dockchannel-hid errors, no U-Boot panic.
  • Same machine with aurora-wip U-Boot (no handoff): U-Boot stops the MTP, Linux's restart crashes it (crash log at first contact), no internal keyboard or trackpad.
  • The J615 needed no board check in U-Boot: the device-tree property alone selected the handoff, the keyboard start in board_late_init() and the interface announcements.

Merge order as noted: linux#2525's DT (the J613 property) has to land with or before this, or the J613 loses its handover. The J615 DT lines go in a follow-up stacked on linux#2525.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is good, and it does what Ryan asked for in the earlier round. One apple,rtkit-keep-running property on the helper node feeds the existing retained-epoch path, and the T8112 firmware-version check is gone. I'm requesting changes only for the DCO: b82f77d, 6126117 and b9efd22 have no Signed-off-by: line. Please re-sign them (git rebase --signoff aurora-wip) and push. I'll merge this right after linux#2525.

  • Contract: the property's name, type and node match linux#2525's binding and the J613, J413-fw27 and J615 device trees. Both apple_rtkit_helper_keeps_running() (helper node) and apple_mtp_kbd.c:524 (priv->helper, set by get_rtkit_helper() before that line) read the same node.
  • Boards without the property behave as on aurora-wip, except the J613, which now needs the property from its DTB. On a J613 with an older DTB, board.c:1713 still starts the MTP for the U-Boot keyboard. U-Boot then quiesces it, which is the crash case. So a release has to pair this U-Boot with DTBs built from linux after #2525.
  • Failure handling: the publication panic (rtkit_helper.c:679) and the DART-retention panic (:347) now cover every board with the property, as they already did for the J613. Stopping in U-Boot is better than booting with an MTP that was promised but is dead.

CI on b9efd22: Apple builds build is green, and draft was skipped as expected.

satchlj and others added 3 commits November 20, 2026 07:28
The MTP firmware that the macOS 27.2 stub loads on T8112 (MacBook Air M2,
J413) cannot be restarted once it has been quiesced. Unlike the 13.x
firmware on the same SoC, Linux's cold start of it then fails. It needs
the J613 path: U-Boot keeps the first epoch running, with OSLog in SRAM,
publishes the four-endpoint inventory (mtp-live-v1), and announces and
replays discovery to the OS.

Select that path with apple_t8112_mtp_live_epoch(): an apple,t8112-mtp
node, plus an OS firmware of 27 or later in /chosen/asahi,os-fw-version.
No board name is matched. The 13.x firmware keeps the existing restart path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Satya Benson <[email protected]>
With the 27.x MTP handed over running, Linux's trackpad still timed out
("iface multi-touch start timed out"): this firmware answers only the
two-stage power command that apple,power-method = <2> selects, as on
J613/25G83 and T8132. Set it on the multi-touch node of the OS device
tree when apple_t8112_mtp_live_epoch() holds and the tree sets none.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Satya Benson <[email protected]>
Instead of a T8112 + OS firmware >= 27 check and the J613 board check, the
retained-epoch handoff (OSLog in SRAM, buffer inventory, DART kept in bypass)
is chosen by apple,rtkit-keep-running on the MTP helper node, which the board
device tree sets where the firmware cannot be restarted once quiesced. The
same property starts U-Boot's MTP keyboard on the EFI path and makes the
keyboard preserve the startup frames for Linux.

The trackpad's two-stage power command is no longer patched into the OS
device tree here; the board device tree describes it (apple,power-method),
as J613/25G83 already does.

apple_rtkit_helper_keeps_running() and _any_keeps_running() have inline
stubs without CONFIG_APPLE_MTP_KEYB, which fixes the apple_j873 link.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Satya Benson <[email protected]>
@satchlj
satchlj force-pushed the satchlj/t8112-mtp-live-handoff branch from b9efd22 to 6f50fc2 Compare November 20, 2026 12:28
@satchlj

satchlj commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Claude Opus 5.5 on @satchlj's behalf: thanks, Dj. All three commits now carry Signed-off-by. Each commit got only the trailer: the tree is byte-identical to b9efd22 and the base is unchanged, so the new head is 6f50fc2. Merge order: linux#2525 with or before this one.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the sign-offs. All 3 commits now carry Signed-off-by, and the tree is byte-identical to the head I reviewed (18789d02), so I'm approving.

This merges right after linux#2525, so the U-Boot never ships ahead of the DTBs that carry apple,rtkit-keep-running. linux#2525 is waiting on a dt-checks false positive that has nothing to do with its code.

@DjDeveloperr
DjDeveloperr merged commit 11bf692 into aurora-wip Nov 20, 2026
2 checks passed
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.

3 participants