Skip to content

arm64: dts: apple: t8142-j704: Enable SEP and suspend-to-RAM - #3791

Open
rjianwei wants to merge 5 commits into
aurora-silicon:mainfrom
rjianwei:feat/j704-s2r
Open

rjianwei wants to merge 5 commits into
aurora-silicon:mainfrom
rjianwei:feat/j704-s2r

Conversation

@rjianwei

@rjianwei rjianwei commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

What: Enable Secure Enclave (sep@30a600000) and deep suspend-to-RAM (apple,t8142-sleep) on J704 (MacBook Pro 14-inch, M5), including deferred late SMC sleep notice (apple,j704) and USB-C PD S3 support.
Tested: J704 MacBook Pro 14-inch M5 at 96b26cf9 (clean rebase of ba75aa3d onto latest main, zero patch diff): PASS — mem_sleep: s2idle [deep], apple_sep ready (12 endpoints, hwrng), full hardware deep sleep (systemctl suspend) with 10 coprocessors up and stopped, TEST: SMC notice after peer stops: 0, 0 spurious wakes, clean keyboard wake (boot object resumes 0 -> 1) with Wi-Fi PCIe retrain, M5 GPU restart, and GNOME/Hyprland desktop recovery; checkpatch.pl 0 errors/warnings.
Risk: two-way · M5 J704 (T8142) only; shared sleep.c/macsmc.c checks are strictly gated on of_machine_is_compatible("apple,j704"), zero impact on other Macs.
Not yet: External HDMI/USB-C display hotplug across deep sleep on J704; requires ps_pmp { apple,always-on; } (#1847) so PMP stays powered across hardware sleep (confirmed by A/B DTB testing: omitting apple,always-on on ps_pmp causes real Deep S2R wake to hang, matching t8142-j813-peripherals.dtsi ceaab64d4f7).

Details
  1. soc: apple: sleep, mfd: macsmc: enable deferred late SMC notice on J704 (765d3de77):

    • Add apple,j704 alongside apple,j813 in apple_sleep_smc_defer_notice() and apple_smc_probe() so SMC uses the saved IRQ-independent RTKit transport and receives the sleep notice after SEP/peer stops.
    • Without this, J704 wakes immediately after commit with wake source: SMC.OutboxNotEmpty.
    • (If soc: apple: sleep, mfd: macsmc: take the T8142 late SMC notice from the DT #3736 lands first and moves this to a DT property, happy to rebase and switch J704 to the DT property instead.)
  2. arm64: dts: apple: t8142-j704: Enable SEP and suspend-to-RAM (ba75aa3df):

    • Add cluster_pwrgate, dcp_power, and DART ps-wr-dis properties for dcp, dcpext0 (USB-C), and dcpext1 (HDMI).
    • Include t8142-j813-sep.dtsi and t8142-j813-j815-sleep.dtsi.
    • Wire all three display coprocessors (<&dcp &dcpext0 &dcpext1>) into &sleep.
    • Enable apple,sleep-ssps and apple,sleep-ssps-rules on all three USB-C PD controllers (hpm0, hpm1, hpm3).
Evidence

Tested on MacBook Pro (14-inch, M5, 24 GB, apple,j704) running macOS 27.2 stub, Aura Stage 2 (1.0.0b17-g378497cf), and Arch Linux ARM with this series + #3782 (J704 GPU) + #1847 (PMP always-on / MCC / actuator):

  • mem_sleep: s2idle [deep], apple-sleep 380700000.sleep-controller: deep sleep is the default: boot object resumes 0
  • apple_sep 30a600000.sep: ready in 1450 ms, 12 endpoints, key store open, hwrng registered
  • All 3 USB-C PD controllers (0-0a, 0-0c, 1-0c) enter S3 cleanly in 10–11 ms
  • Real deep sleep (systemctl suspend):
    • 10 coprocessors up and stopped
    • TEST: SMC notice after peer stops: 0
    • Stayed asleep cleanly with 0 spurious wakes until built-in keyboard press (wake source: MTP.DOCK.CHANNELS.AP0.IRQ)
    • back from sleep, boot object resumes 0 -> 1
    • the radio's PCIe link trained again after the wake
    • aurora 582600000.gpu restarted cleanly; both GNOME and Hyprland desktops + Wi-Fi + Bluetooth + audio resumed with 0 errors
  • scripts/checkpatch.pl: 0 errors, 0 warnings across both commits.

@rjianwei
rjianwei requested review from a team as code owners December 1, 2026 14:15
@rjianwei
rjianwei requested review from Acelogic and maralcbr December 1, 2026 14:15
@github-actions github-actions Bot added area:bringup Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) area:power Area from CODEOWNERS (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Merge readiness at 7e2fb616: not ready yet

Check Detail
CI at head ok 5 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes no requested by DjDeveloperr
Hardware row at head no no line with the head SHA 7e2fb616, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text ok Risk: two-way · M5 J704 (T8142) only; shared sleep.c/macsmc.c checks are strictly gated on ofmachineiscompatible("apple,j704"), zero impact on other Macs.

Areas: area:bringup, area:platform, area:power

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@github-actions github-actions Bot added blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) and removed needs-hw-row No hardware row at the PR head (bot) needs-template PR body lacks Tested or Risk (bot) labels Dec 1, 2026
@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Dec 1, 2026
Like J813, J704 (MacBook Pro 14-inch, M5) needs the SMC sleep notice
deferred until after SEP and peer coprocessors stop, using the saved
IRQ-independent RTKit transport. Without this, SMC raises
SMC.OutboxNotEmpty right at commit and immediately wakes the machine
from deep sleep.

With this enabled on J704, deep sleep stays asleep until woken by the
built-in keyboard (MTP.DOCK.CHANNELS.AP0.IRQ) with TEST: SMC notice
after peer stops: 0.

Signed-off-by: WJW <rjianwei@gmail.com>
Wire up the shared T8142 Secure Enclave (t8142-j813-sep.dtsi) and
suspend-to-RAM (t8142-j813-j815-sleep.dtsi) descriptions on J704
(MacBook Pro 14-inch, M5):
- Add cluster_pwrgate, dcp_power, and DART ps-wr-dis properties for
  dcp, dcpext0 (USB-C), and dcpext1 (HDMI).
- List all three display coprocessors in &sleep.
- Enable apple,sleep-ssps and apple,sleep-ssps-rules on all three
  USB-C PD controllers (hpm0, hpm1, hpm3).

Tested on MacBook Pro (14-inch, M5, 24 GB, J704) running macOS 27.2
stub with Aura Stage 2 (1.0.0b17-g378497cf) alongside aurora-silicon#3782 and aurora-silicon#1847:
- apple_sep 30a600000.sep ready with 12 endpoints and hwrng registered.
- All 3 USB-C PD controllers enter S3 cleanly in 10-11 ms.
- 10 coprocessors stop cleanly; real deep sleep (boot object resumes
  0 -> 1) stays asleep until built-in keyboard wake
  (MTP.DOCK.CHANNELS.AP0.IRQ).
- Radio PCIe link retrains cleanly, M5 GPU restarts cleanly, and
  desktop/Wi-Fi resume with 0 errors.

Signed-off-by: WJW <rjianwei@gmail.com>
@github-actions github-actions Bot removed the ci-failing A check failed at the PR head (bot) label Dec 2, 2026
@rjianwei

rjianwei commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Additional external-display Deep S2R test results on J704 (with #1847 + #3782 + #3791 + #3823):

  • USB-C DisplayPort (DP-1 / 506e00000.dcp dcpext0): PASS — 4K@60Hz (3840x2160@60) works on hotplug and recovers cleanly after systemctl suspend (boot object resumes 2 -> 3, dcp_hotplug() connected:1 valid_mode:1 nr_modes:23).
  • Lid-close Deep S2R + Touch ID unlock: PASS — Lid closed. -> PM: suspend entry (deep) -> 21.5 s sleep with 0 spurious wakes -> macsmc-input: lid open ... wakeup (boot object resumes 1 -> 2) -> post-wake Touch ID lock-screen unlock succeeds.
  • Built-in HDMI (HDMI-A-1 / 3aae00000.dcp dcpext1, atcphy2 + DP2HDMI): fixed by drm/apple: reinit fixed HDMI PHY and crossbar after deep sleep #3867 — without drm/apple: reinit fixed HDMI PHY and crossbar after deep sleep #3867, HDMI worked at 3840x2160@60 on cold boot but failed after Deep S2R with DPTXPort: firmware reports link fault 22/24 (HDMI DPTX connect failed: -110) because dcp_s2r_restart_done() skipped dcp_fabric_hdmi_reinit() on non-external_native dcpext pipelines. With drm/apple: reinit fixed HDMI PHY and crossbar after deep sleep #3867 applied, HDMI reinitializes and recovers 3840x2160@60 immediately on wake with 0 link faults.

DjDeveloperr pushed a commit that referenced this pull request Dec 2, 2026
Add the SPI2 controller (ps_spi2, spi@3a5108000) and Mesa Touch ID
fingerprint sensor node (apple,mesa-fingerprint, NUB GPIO 36 power,
AP GPIO 200 data-ready IRQ, per-device apple/mesacal-j704.bin and
apple/msrk-j704.bin) to t8142-j704.dts, matching t8142-j813.dts and
t8142-j815.dts.

Expose AP GPIO 200 and NUB GPIO 36 in pinctrl_ap and pinctrl_nub
gpio-reserved-ranges alongside the existing audio pins.

Verified on MacBook Pro 14-inch (M5 / J704) with SEP enabled (#3791):
apple-mesa binds on spi0.0 at 8 MHz, aurora-touchid-setup builds
mesacal-j704.bin and msrk-j704.bin from factory data, aurora-sep-ready
activates Touch ID, and fprintd-enroll + fprintd-verify succeed with
enclave identity match and persisted template update.

Signed-off-by: WJW <rjianwei@gmail.com>

@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 thorough J704 testing. The DT and the SMC/sleep parts look right. Two blockers.

Blocker: this PR makes deep sleep the default on J704, but J704 doesn't keep the PMP domain on, and every row here ran with #1847.

  • t8142-j813-j815-sleep.dtsi turns on deep sleep (mem_sleep defaults to deep, as your log shows).
  • On main, ps_pmp in t8142-j704-peripherals.dtsi:55 has no apple,always-on. The J813 node has it.
  • Your "Not yet" line says the A/B test without apple,always-on on ps_pmp hangs on a real deep-sleep wake. Every row in the body and the 03:34 comment ran with #1847, which adds it, and #1847 is still a draft.
  • So if this merges alone, the next systemctl suspend on a J704 can hang on wake.

Fix: add the one property to this PR (the part of #1847 your rows depend on):

/* t8142-j704-peripherals.dtsi, in ps_pmp */
		apple,always-on;

Then post one J704 deep-sleep row at the new head without the rest of #1847: sleep, wake, and the desktop coming back are enough. #1847 can keep the actuator and MCC parts.

Blocker 2: the new of_machine_is_compatible("apple,j704") checks in sleep.c and macsmc.c. The merge policy treats a board gate that a hardware property could replace as blocking, and #3736 adds exactly that property: apple,sleep-late-notice on the SMC node. Fix: once #3736 lands, merge main, drop both compatible checks and add apple,sleep-late-notice; to the J704 SMC node. The DT-only result is the cleanest version of this PR. If #3736 is still open when you're ready, say so here and we'll land it first.

@github-actions github-actions Bot added changes-requested A reviewer requested changes (bot) merge-conflict Conflicts with the base branch (bot) labels Dec 2, 2026
@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Dec 2, 2026
@rjianwei

rjianwei commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the clear review! Both items make total sense:

  1. I will include apple,always-on; on ps_pmp in t8142-j704-peripherals.dtsi and post a fresh J704 deep-sleep row at the new head without the rest of arm64: dts: apple: t8142-j704: PMP always-on, trackpad actuator, MCC #1847.
  2. soc: apple: sleep, mfd: macsmc: take the T8142 late SMC notice from the DT #3736 is currently still open — please go ahead and land soc: apple: sleep, mfd: macsmc: take the T8142 late SMC notice from the DT #3736 first when ready, and I will immediately merge main, drop the of_machine_is_compatible("apple,j704") checks, and switch J704 to apple,sleep-late-notice; on the SMC node.

@github-actions github-actions Bot added merge-conflict Conflicts with the base branch (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Dec 2, 2026
# Conflicts:
#	arch/arm64/boot/dts/apple/t8142-j704.dts
Keep the J704 PMP power domain always on, matching J813. Without
apple,always-on on ps_pmp, waking from deep suspend-to-RAM hangs on
J704; including it here ensures this PR is self-contained without
depending on draft PR aurora-silicon#1847.

Signed-off-by: WJW <rjianwei@gmail.com>
@rjianwei

rjianwei commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Updated feat/j704-s2r to a483bfaaf5a7:

  • Merged main cleanly (resolving the #3823 Touch ID conflict in t8142-j704.dts).
  • Added apple,always-on; to ps_pmp in t8142-j704-peripherals.dtsi so this PR no longer depends on #1847.

@DjDeveloperr #3736 is still open — once it lands, I will merge main, drop both of_machine_is_compatible("apple,j704") checks in favor of apple,sleep-late-notice; on &smc, and post a fresh standalone J704 deep-sleep test row (without #1847) at the final DT-only head.

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) and removed ci-failing A check failed at the PR head (bot) merge-conflict Conflicts with the base branch (bot) labels Dec 2, 2026
RyanTheTide pushed a commit that referenced this pull request Dec 2, 2026
In dcp_s2r_restart_done(), dcp_fabric_hdmi_reinit() was gated on
dcp->external_native (apple,t6030-dcpext). On fixed-HDMI external
pipelines that are not external_native (such as T8142 J704 dcpext1
driving atcphy2 and dpxbar2), deep sleep drops the PHY common power
domain and crossbar state behind genpd's back, causing
atcphy_resume_noirq() to mark pd_was_off so the next mux update restores
the PHY.

Because dcp_s2r_restart_done() only re-asserted the converter power GPIOs
without calling dcp_fabric_hdmi_reinit(), atcphy2 and dpxbar2 stayed
unconfigured after deep sleep and dcp_fixed_hdmi_reconnect() timed out
with firmware link fault 22/24 (-110).

Allow dcp_fixed_hdmi_reinit_locked() whenever dcp->fixed_phy and
dcp->hdmi_hpd are present, and call dcp_fabric_hdmi_reinit() from
dcp_s2r_restart_done() for any fixed-PHY HDMI pipeline. Leave the
non-S2R dcp_resume() caller gated on dcp->external_native so s2idle
behavior on other platforms is unchanged.

Tested on MacBook Pro (14-inch, M5, 24 GB, apple,j704) running macOS 27.2
stub with #1847 + #3782 + #3791 + #3823:
- Before: HDMI (3aae00000.dcp, 3840x2160@60) worked on cold boot, but
  failed after deep sleep with DPTXPort link fault 22/24 and
  'HDMI DPTX connect failed: -110'.
- After: 'HDMI: setting up the output again (after deep sleep)' runs on
  wake; 3aae00000.dcp reconnects immediately with 0 link faults and
  restores 3840x2160@60 alongside eDP-1.

Signed-off-by: WJW <rjianwei@gmail.com>
@github-actions github-actions Bot added the merge-conflict Conflicts with the base branch (bot) label Dec 2, 2026
t8142-j704.dts: aurora-silicon#3782 appended the J704 GPU nodes (fw-text, opp13,
gpu memory regions) where this branch appends the SEP and sleep nodes.
Keep both blocks.

Signed-off-by: DjDeveloperr <hey@djdev.me>
@DjDeveloperr

Copy link
Copy Markdown
Contributor

#3782 (the J704 GPU DT) just landed and appends to the end of t8142-j704.dts too, so this branch conflicted. I merged main into it as 7e2fb616082b (a merge commit, no force push) and kept both blocks: your SEP and sleep nodes, then the GPU's fw-text, opp13 and memory regions.

Against main d7d325dba5f9, the merge changes the same 4 files as before (+77/−1). Local checks on the merge (arm64, LLVM=1):

  • t8142-j704.dtb builds with CHECK_DTBS=y. Its only schema message is the existing disp0_piodma alias.
  • The W=1 build of sleep.o and macsmc.o gives 0 warnings.

The plan from the review is unchanged: once #3736 lands, merge main again, switch J704 to apple,sleep-late-notice on &smc, drop the two apple,j704 checks, and post the standalone J704 deep-sleep row at that head. #3736 is now merged up with main and waiting on its J813/J815 rows.

@github-actions github-actions Bot removed the merge-conflict Conflicts with the base branch (bot) label Dec 2, 2026

@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.

Verdict: two points left at 7e2fb616082b. apple,always-on on ps_pmp is in, so that blocker is gone.

  1. The two apple,j704 checks in sleep.c and macsmc.c. They go once either #3736 or #2384 is in main:

    • With #3736: add apple,sleep-late-notice; to smc@38c600000 in t8142-j704-peripherals.dtsi.
    • With #2384: nothing to add, the apple,t8142-sleep profile covers the J704.

    Either way this PR becomes DT only. Both wait on a J815 deep-sleep row, not on you; we'll land one of them.

  2. A J704 row at that head, without #1847: boot, deep sleep, wake, desktop back, TEST: SMC notice after peer stops: 0.

The branch merges cleanly with main f7e3388dd07d, so nothing needs a push before then.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

I recommend #3736: its SMC DT property selects both the late notice and IRQ-independent transport and removes the test module parameter. Once it lands, #3791 can add that property to J704’s SMC node and drop both board-name checks.

This branch has not been deployed

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

Labels

area:bringup Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) area:power Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) changes-requested A reviewer requested changes (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants