Repository navigation
arm: apple: stop the T8140 MTP with an RTKit sleep at OS entry - #37
DjDeveloperr wants to merge 1 commit into
Conversation
U-Boot starts the T8140 MTP for its own keyboard and used to hand the running session to the OS. It reserved the firmware's DRAM buffers, left the DART stream in bypass and set apple,rtkit-handoff = "mtp-live-v1". Linux then had to adopt that session and could never restart it. Stop it before the OS instead. The remove path now asks for an RTKit sleep rather than QUIESCED, clears the run bit and releases the DART bypass, and the OS device tree fixup publishes nothing for this helper. A firmware stopped for a sleep starts again from its reset vector, so the OS can reset the MTP's CPU and run it as its own. U-Boot's keyboard and its INIT replay into the FIFO don't change. J713, J614s and the other helpers keep their handoffs and the QUIESCED stop. A failed stop is now logged. A kernel without the matching rtkit-helper restart loses the internal keyboard and trackpad, as the Kconfig help says. Signed-off-by: Diljit Singh <[email protected]>
|
Same behaviour on the J604 (T8132), in case it helps here: U-Boot's stdio probe starts the MTP, the QUIESCED stop at OS One measurement that may be useful for the save-and-restore idea: on the J604 I dumped the MTP's three segments before |
|
Blockers: 2. Recommend closing this in favour of #49.
|
On T8140 (J700, the Neo) U-Boot starts the MTP for its own keyboard. Until now it handed the running session to the OS at boot: no-map reservations for the firmware's DRAM buffers, the DART stream kept in bypass, and
apple,rtkit-handoff = "mtp-live-v1". Linux had to adopt that session and could never restart it.This PR stops the MTP before the OS instead, so Linux starts it as its own.
rtkit_helper_stop()asks a T8140 MTP for an RTKit sleep (APPLE_RTKIT_PWR_STATE_SLEEP) instead of QUIESCED. It then clears the run bit, frees the RTKit state and releases the DART bypass, as before. A failed stop is now logged.apple_rtkit_helper_fdt_fixup()skips the T8140 helper, so the OS tree gets no reservations, noapple,bypass-handoff-streamsand noapple,rtkit-handoff.rtkit_helper_fdt_publish()is untouched, so arm: apple: enable J613 keyboard input with a live MTP handoff #30 (J613) still has it.A firmware stopped for a sleep only comes back from its reset vector, and the run bit alone doesn't put it there. The matching Linux change resets the MTP's CPU through its always-on PMGR word, then sets the run bit and wakes RTKit. A kernel without that change loses the internal keyboard and trackpad with this U-Boot, so the kernel has to ship first. Kernels with it still adopt a live session from an older U-Boot.
Tests
apple_m1_defconfigwithCONFIG_WERROR=y, GCC 16.1.1 (aarch64): builds with no warnings.test_apple_helper_handoff.pygains two checks: the fixup leaves a T8140 tree byte-for-byte unchanged and stops nothing, and the stop asks for SLEEP on T8140 and QUIESCED elsewhere. Both fail if the T8140 branch is taken out. All 9 tests intest_apple_helper_handoff.pyandtest_apple_mtp_keyboard.pypass on aarch64 Linux.On hardware (J700, 2026-11-08): not working yet
With this U-Boot and a kernel carrying aurora-silicon/linux-aurora#63:
versiontyped on the built-in keyboard at the prompt ran, and GRUB then booted the kernel through EFI. The stop at OS entry logged no error.CPU reset in place: 0x1f0003ff before, 0x9f0007ff held, 0x1f0003ff after, SRAM 0x1f0002ff), sets the run bit and sends INIT. The firmware never reads that message: it stays in the inbox, the outbox stays empty, and CPU status reads0x48(running, not idle). RTKit gives up withendpoint discovery failed: -62. So this U-Boot as it stands loses the internal keyboard and trackpad in Linux.APPLE_MTP_KEYBoff):MTP Says Hello, keyboard ready, and the firmware announces its interfaces itself.0x314c00000, 1 MiB, the reset vector's target): the firmware's code (0x0–0x4ffff) doesn't change while it runs, but its data (0x50000–0x5ffff) and runtime areas do. After a run, MTP_CPU also has AUTO_ENABLE set and shows it was power-gated (0x1f0003ff, against0x0f0000ffbefore any run).Older U-Boot (#32) with the same kernel still adopts the live session, and the keyboard and trackpad work.
🤖 Generated with Claude Code