From ea28c1d0759baadece6350211a7568034eb7b3db Mon Sep 17 00:00:00 2001 From: WJW Date: Tue, 1 Dec 2026 22:14:45 +0800 Subject: [PATCH 1/4] soc: apple: sleep, mfd: macsmc: enable deferred late SMC notice on J704 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 --- drivers/mfd/macsmc.c | 1 + drivers/soc/apple/sleep.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/macsmc.c b/drivers/mfd/macsmc.c index 781dc7699438b..1df7eeafd1376 100644 --- a/drivers/mfd/macsmc.c +++ b/drivers/mfd/macsmc.c @@ -768,6 +768,7 @@ static int apple_smc_probe(struct platform_device *pdev) * its SMC hears last, after SEP and the other coprocessors stopped. */ if (of_machine_is_compatible("apple,j813") || + of_machine_is_compatible("apple,j704") || of_device_is_compatible(dev->of_node, "apple,t8103-smc") || of_device_is_compatible(dev->of_node, "apple,t8112-smc")) smc->saved_enabled = true; diff --git a/drivers/soc/apple/sleep.c b/drivers/soc/apple/sleep.c index 773fd10ae199d..86648c2764438 100644 --- a/drivers/soc/apple/sleep.c +++ b/drivers/soc/apple/sleep.c @@ -2096,7 +2096,9 @@ bool apple_sleep_smc_defer_notice(void) /* Gen 1 (T8103): SEP sleeps before the SMC is told, as on macOS and t6000. */ if (apple_sleep->soc->smc_gen1_keys) return true; - return READ_ONCE(sleep_j813_smc_late) && of_machine_is_compatible("apple,j813"); + return READ_ONCE(sleep_j813_smc_late) && + (of_machine_is_compatible("apple,j813") || + of_machine_is_compatible("apple,j704")); } EXPORT_SYMBOL_GPL(apple_sleep_smc_defer_notice); From 96b26cf9a0ed2d22e765bb1c2a7e53919771f443 Mon Sep 17 00:00:00 2001 From: WJW Date: Tue, 1 Dec 2026 22:15:25 +0800 Subject: [PATCH 2/4] arm64: dts: apple: t8142-j704: Enable SEP and suspend-to-RAM 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 #3782 and #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 --- arch/arm64/boot/dts/apple/t8142-j704.dts | 72 ++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/arch/arm64/boot/dts/apple/t8142-j704.dts b/arch/arm64/boot/dts/apple/t8142-j704.dts index 3c6947a2b4a49..d5b0a771e277a 100644 --- a/arch/arm64/boot/dts/apple/t8142-j704.dts +++ b/arch/arm64/boot/dts/apple/t8142-j704.dts @@ -329,3 +329,75 @@ #include "t8142-j704-hdmi.dtsi" #include "t8142-j704-audio.dtsi" #include "t8142-j704-usbc-display.dtsi" + +&{/soc} { + /* + * The CPU clusters' power-gate enables (E at +0x0, P at +0x60) and + * display power words, shared across T8142. + */ + cluster_pwrgate: power-gate@380724000 { + compatible = "apple,t8142-cluster-pwrgate", "apple,cluster-pwrgate"; + reg = <0x3 0x80724000 0x0 0x4>, + <0x3 0x80724060 0x0 0x4>; + }; + + dcp_power: display-power@380724000 { + compatible = "apple,t8142-display-power"; + reg = <3 0x80724000 0 0x2000>, + <3 0x80700000 0 0x14000>; + reg-names = "pwrgate", "ps"; + }; +}; + +&dcp { + apple,display-power = <&dcp_power>; +}; + +&dcp_dart { + reg = <2 0x86340000 0 0x20000>, + <3 0x80717fdc 0 0x4>; + reg-names = "dart", "ps-wr-dis"; + apple,ps-wr-dis-bit = <6>; +}; + +&dcpext0 { + apple,display-power = <&dcp_power>; +}; + +&dcpext1 { + apple,display-power = <&dcp_power>; +}; + +&dcpext0_dart { + reg = <5 0x06340000 0 0x20000>, + <3 0x80717fe8 0 0x4>; + reg-names = "dart", "ps-wr-dis"; + apple,ps-wr-dis-bit = <15>; +}; + +&dcpext1_dart { + reg = <3 0xaa340000 0 0x20000>, + <3 0x80717fec 0 0x4>; + reg-names = "dart", "ps-wr-dis"; + apple,ps-wr-dis-bit = <31>; +}; + +#include "t8142-j813-sep.dtsi" +#include "t8142-j813-j815-sleep.dtsi" + +&sleep { + apple,display-coprocessors = <&dcp &dcpext0 &dcpext1>; +}; + +&hpm0 { + apple,sleep-ssps-rules; +}; + +&hpm1 { + apple,sleep-ssps-rules; +}; + +&hpm3 { + apple,sleep-ssps; + apple,sleep-ssps-rules; +}; From a483bfaaf5a7e13f0f7822b0131f121832e1eefc Mon Sep 17 00:00:00 2001 From: WJW Date: Wed, 2 Dec 2026 21:01:15 +0800 Subject: [PATCH 3/4] arm64: dts: apple: t8142-j704-peripherals: mark ps_pmp apple,always-on 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 #1847. Signed-off-by: WJW --- arch/arm64/boot/dts/apple/t8142-j704-peripherals.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/apple/t8142-j704-peripherals.dtsi b/arch/arm64/boot/dts/apple/t8142-j704-peripherals.dtsi index 92df2e36ec430..f61cf008c2877 100644 --- a/arch/arm64/boot/dts/apple/t8142-j704-peripherals.dtsi +++ b/arch/arm64/boot/dts/apple/t8142-j704-peripherals.dtsi @@ -60,6 +60,7 @@ label = "pmp"; /* The PMP's SRAM, which the driver reads first. */ power-domains = <&ps_pms_sram>; + apple,always-on; }; ps_pms_sram: power-controller@5a0 { From cb2cb83078a7fadcda44e65b27f5b8c35b50df1b Mon Sep 17 00:00:00 2001 From: WJW Date: Sat, 5 Dec 2026 16:39:03 +0800 Subject: [PATCH 4/4] arm64: dts: apple: t8142-j704: enable apple,sleep-late-notice on SMC With #3736 merged, use the standard apple,sleep-late-notice DT property on J704's SMC node and drop the temporary apple,j704 machine checks from sleep.c and macsmc.c. Signed-off-by: WJW --- arch/arm64/boot/dts/apple/t8142-j704-peripherals.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/apple/t8142-j704-peripherals.dtsi b/arch/arm64/boot/dts/apple/t8142-j704-peripherals.dtsi index f61cf008c2877..1a13c5e833af7 100644 --- a/arch/arm64/boot/dts/apple/t8142-j704-peripherals.dtsi +++ b/arch/arm64/boot/dts/apple/t8142-j704-peripherals.dtsi @@ -176,6 +176,11 @@ reg = <3 0x8c600000 0 0x4000>, <3 0x8de00000 0 0x120000>; reg-names = "smc", "sram"; mboxes = <&smc_mbox>; + /* + * Told of a deep sleep after the other coprocessors stopped: ANS + * fails its IDLE handshake when the SMC hears first. + */ + apple,sleep-late-notice; smc_hwmon: hwmon { compatible = "apple,smc-hwmon";