Skip to content

soc: apple: enable T6030 suspend-to-RAM on J516s - #3818

Closed
DjDeveloperr wants to merge 14 commits into
mainfrom
feat/t6030-sleep-provider
Closed

DjDeveloperr wants to merge 14 commits into
mainfrom
feat/t6030-sleep-provider

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

What: Enable firmware suspend-to-RAM for J516s (16-inch M3 Pro). The T6030 provider sequences the SMC and PMU handshakes and restores CPU, cache, power-domain and GP PCIe state. J514s keeps the provider disabled.

  • Preserve the AP pin snapshot and skip bitmap across deep sleep. Restore the AP pin state when GPIO is powered, before GP PCIe retraining, with a fallback after the early wake sequence.
  • Dynamically lower active group == 0 OFF-target t336_all[] PMGR domains in child-before-parent order at commit and restore them parent-before-child on undo so unbound DT consumers holding sync_state() (AES, ISP_SYS, SCODEC) do not block firmware sleep entry.
  • Preserve the PMP DART snapshot and keep firmware RX held when its power words time out on wake, so a later firmware wake can retry.
  • Select the SMC radio GPIO template from device tree and retain masked T6030 SPMI interrupts for wake. Carry the cleaned Mesa prepare hook with its J516s DT node disabled.
  • Keep the functional PMU handshake and disable T6030 PMU scratch notes. Use the stock command line.

Tested:

  • J516s (T6030, M3 Pro) exact-head 2-cycle zero-flag production qualification (pr3818-qual-03, head e9ce12c1c2381a20e24ea1ed3ebf19a02ae7f24f, 7.3.0-t6030s2r #64, boot=e8c203da-da14-410c-9946-25636a7b8481): PASS
    • Zero-flag production boot: stock RW command line (rw, s2idle [deep] default, zero bring-up flags), all 5 removed bring-up module parameters absent, SEP profile=T6030, sleep_only=1, keystore=closed, xart_writes=0.
    • Cycle 1 (rtcwake -m mem -s 90, force-discharge): resumes 0 -> 1, sleep=90.06s, awake=1.76s, power_now_uw: -3951000 -> -243000 (0.243 W post-wake draw), 0 ON and 0 AUTO words failed readback, 10 coprocessors up and stopped, 179 of 224 AP pins changed and all put back, PMP wake 0x4d0 6us / 0x4c8 8us, RTC proof ap_before=00000000 ap_after=80000000 spmi_before=00000000 spmi_after=00000004 other_armed=00000000, MBSE 0x10650, wake source: NUB.SPMI0.SW3, apple-dcp 28ec00000.dcp V27 wake plain-on 0@86, apple_sep enclave back, aurora-g16 firmware back in 4737 us, hci_bcm4377 hardware reset recovery + calibration/PTB reload + BD_ADDR 60:3e:5f:4a:e8:c8 restored.
    • Cycle 2 (consecutive same-boot rtcwake -m mem -s 60): resumes 1 -> 2, sleep=59.31s, awake=1.75s, 0 ON and 0 AUTO words failed readback, 10 coprocessors up and stopped, 179 of 224 AP pins changed and all put back, PMP wake 0x4d0 6us / 0x4c8 8us, RTC proof ap_before=80000000 ap_after=80000000 spmi_before=00000000 spmi_after=00000004 other_armed=00000000, MBSE 0x10650, wake source: NUB.SPMI0.SW3, apple-dcp 28ec00000.dcp V27 wake plain-on 0@85, apple_sep enclave back, aurora-g16 firmware back in 4904 us, hci_bcm4377 recovered cleanly.
    • PMU scratch & error hygiene: all 5 watched PMU scratch regions (note, g16, t12, T16, mesa) byte-identical to stock boot across both cycles; zero suspend/resume priority 0–3 kernel errors.
    • Full post-wake parity (after 2 consecutive cycles): eDP-1 connected/enabled + backlight bounce (25 -> 61 -> 37); 16 MiB pre-sleep RW NVMe SHA-256 OK + 16 MiB post-wake fsync write OK; aurora-g16 health: failed 0 errno 0 degraded 0, render: count 282, live vulkaninfo Apple M3 Pro (G15S B1); Wi-Fi wld0 connected 5220 MHz (-52 dBm, 780/866.7 MBit/s); Bluetooth hci0 powered (60:3E:5F:4A:E8:C8); AppleJ516 Primary+Secondary PCMs + speakerguardd-v2 active (running) (supervising, 12 V/I switches).
    • Clean stock handback: verified back on stock 7.3.0 (boot=428632eb-f34e-427f-8014-cd7167d9cea1, both ESPs restored to stock efab68fa..., empty grubenv, 0 failed units).
  • Build & static checks at e9ce12c1c2381a20e24ea1ed3ebf19a02ae7f24f: Clang AArch64 (LLVM=1) built full kernel Image, modules, and both T6030 board DTBs (t6030-j516s.dtb, t6030-j514s.dtb); strict checkpatch.pl reported 0 errors, 0 warnings, 0 checks on e9ce12c1c238; prior static/host checks at f4811a22d68b (dt-doc-validate, T6030 sleep DTB validation, 45/45 focused host tests) all passed.
  • Open merge gates: non-T6030 shared-driver peer hardware rows (tracked on the prerequisite PRs) and independent review.

Risk: two-way door · T6030 (J516s) plus small shared hooks in SMC, GPIO, SPMI, Mesa, DART, and PMP. J514s keeps t6030_sleep disabled and J516s Mesa node stays disabled; shared-driver peer rows and independent review are required before merge.

Stack

The comparison base (feat/t6030-s2r-prerequisites, 77cfce585fda74ecc0cad6e448caf5b33574fd78) aggregates the current M3 Pro prerequisites over Linux main fe7d114c7a08 (including merged #3829) plus updated #3808 (ef31630de2bd) and #3763 (c8dcfe3b2d15). Retarget to main once the prerequisite series lands.

Prerequisites: #3768, #3769, #3805, #3806, #3807, #3808, #3809, #3810, #3812, #3813, #3814, #3815, #3763. Companion userspace PR: aurora-silicon/alarm-aurora#512.

@DjDeveloperr
DjDeveloperr requested review from a team as code owners December 1, 2026 17:16
@DjDeveloperr DjDeveloperr added the blast:all Macs affected, from Merge risk (bot) label Dec 1, 2026
@DjDeveloperr
DjDeveloperr requested a review from a team as a code owner December 1, 2026 17:16
@DjDeveloperr DjDeveloperr added the blast:all Macs affected, from Merge risk (bot) label Dec 1, 2026
@DjDeveloperr
DjDeveloperr requested a review from malik-na December 1, 2026 17:16
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Qualification head f4811a22d68b5a5ae8269c05baf3357d53b199e0 includes the SEP diagnostic fixture fix from #3814. The four provider commits and kernel and DT sources are byte-identical to the local verification head above. The SEP policy and sensor suite also passed 4/4 on this stack head.

@github-actions github-actions Bot added area:platform Area from CODEOWNERS (bot) area:power Area from CODEOWNERS (bot) ci-failing A check failed 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) and removed blast:all Macs affected, from Merge risk (bot) labels Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Merge readiness at f9ab6cbb: not ready yet

Check Detail
CI at head running running: apple-build, dt-checks, host-tests, source, KUnit plan, DWC3/ATC
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head no no line with the head SHA f9ab6cbb, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text ok Risk: two-way · T6030 (J516s) plus small shared hooks in SMC, GPIO, SPMI, Mesa, DART, and PMP. J514s keeps t6030sleep disabled and J516s Mesa node stays disabled; shared-driver peer rows and independent review are required before merge.

Areas: area:gpu, area:platform, area:power, area:usb

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:m3 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) ci-failing A check failed at the PR head (bot) and removed needs-template PR body lacks Tested or Risk (bot) ci-failing A check failed at the PR head (bot) labels Dec 1, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Exact-head J516s (T6030, M3 Pro) hardware qualification PASS at e9ce12c1c2381a20e24ea1ed3ebf19a02ae7f24f (pr3818-qual-03, 7.3.0-t6030s2r #64, boot=e8c203da-da14-410c-9946-25636a7b8481):

  • Zero-flag production boot: stock RW command line (s2idle [deep] default, zero bring-up flags), all 5 removed bring-up module parameters absent, SEP profile=T6030, sleep_only=1, keystore=closed, xart_writes=0.
  • Cycle 1 (rtcwake -m mem -s 90, force-discharge): resumes 0 -> 1, sleep=90.06s, awake=1.76s, power_now_uw: -3951000 -> -243000 (0.243 W post-wake instantaneous draw), 0 ON and 0 AUTO words failed readback, 10 coprocessors up and stopped, 179 of 224 AP pins changed and all put back, PMP wake 0x4d0 6us / 0x4c8 8us, RTC proof ap_before=00000000 ap_after=80000000 spmi_before=00000000 spmi_after=00000004 other_armed=00000000, MBSE 0x10650, wake source: NUB.SPMI0.SW3, 28ec00000.dcp V27 wake plain-on 0@86, apple_sep enclave back, aurora-g16 firmware back in 4737 us, hci_bcm4377 hardware reset recovery + calibration/PTB + BD_ADDR 60:3e:5f:4a:e8:c8 restored.
  • Cycle 2 (consecutive same-boot rtcwake -m mem -s 60): resumes 1 -> 2, sleep=59.31s, awake=1.75s, 0 ON and 0 AUTO words failed readback, 10 coprocessors up and stopped, 179 of 224 AP pins changed and all put back, PMP wake 0x4d0 6us / 0x4c8 8us, RTC proof ap_before=80000000 ap_after=80000000 spmi_before=00000000 spmi_after=00000004 other_armed=00000000, MBSE 0x10650, wake source: NUB.SPMI0.SW3, 28ec00000.dcp V27 wake plain-on 0@85, apple_sep enclave back, aurora-g16 firmware back in 4904 us, hci_bcm4377 recovered cleanly.
  • PMU scratch & error hygiene: all 5 watched PMU scratch regions (note, g16, t12, T16, mesa) byte-identical to stock boot across both cycles; zero suspend/resume priority 0–3 kernel errors.
  • Full post-wake parity after 2 cycles: eDP-1 connected/enabled + backlight bounce (25 -> 61 -> 37); 16 MiB pre-sleep RW NVMe SHA-256 OK + 16 MiB post-wake fsync write OK; aurora-g16 health: failed 0 errno 0 degraded 0, render: count 282, live vulkaninfo Apple M3 Pro (G15S B1); Wi-Fi wld0 (5220 MHz, -52 dBm, 780/866.7 MBit/s); Bluetooth hci0 powered (60:3E:5F:4A:E8:C8); AppleJ516 Primary+Secondary PCMs + speakerguardd-v2 active (running) (supervising, 12 V/I switches).
  • Clean stock handback: verified on stock 7.3.0 (boot=428632eb-f34e-427f-8014-cd7167d9cea1, both ESPs restored to efab68fa..., empty grubenv, 0 failed units).

Non-T6030 shared-driver peer hardware rows (tracked on the prerequisite PRs) and independent review remain open before merge.

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 1, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Refreshed base branch feat/t6030-s2r-prerequisites (77cfce585fda -> 07ca0aef1b8c) and forward-merged cleanly into feat/t6030-sleep-provider (e9ce12c1c238 -> 04f7589e28f0) to pick up main (9d47520eabae), the rebased #3808 (7414365fff12), and the test-only host-fixture updates from #3768 (a57f97381dc5) and #3814 (53c441db6c0d).

  • Provider diff vs feat/t6030-s2r-prerequisites: zero functional/code change relative to e9ce12c1c238 (only t6030.dtsi hunk line-number offsets shifted +45 lines by #3802 opp-microwatt additions on main).
  • Qualification record preserved: Full J516s hardware qualification (pr3818-qual-03: 2-cycle zero-flag 180 s deep S2R + 3-cycle rapid S2R stress, 0 errors, clean stock 7.3.0 handback) remains anchored to first-parent ancestor e9ce12c1c238.
  • Changes absorbed from main since e9ce12c1c238 (083ca15f3935..9d47520eabae): #3280 (tipd hotplug/LDCM/poll revalidation — runtime-relevant for USB-C/PD on J516s), #3802 (t6030.dtsi opp-microwatt — already J516s-verified), #3830 (iomfb_v27 D003 metadata — already J516s-verified), plus non-T6030/CI changes (#3617, #3764, #3776, #3798, #3821, #3832, #3833) and test-only fixture updates (#3768, #3808, #3814).

@github-actions github-actions Bot added the needs-hw-row No hardware row at the PR head (bot) label Dec 1, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Exact-head J516s 10-minute deep-sleep soak & dark-wake finding at 04f7589e28f0

  • Build / Boot: Apple M3 Pro (J516s), 7.3.0-t6030s2r #67 (04f7589e28f0), zero debug flags (mem_sleep=s2idle [deep]), boot_id=b1364c3b-91a0-42a3-88f9-8eb8a1d4f9d5, 0 failed units pre-sleep.
  • Physical deep sleep & peripheral parity (resumes 0 -> 1 -> 2):
    • Cycle 1 (600 s rtcwake -m mem -s 600): Slept physically for 217.933 s until SMC woke the SoC for wifibt alone (MBSE 0x10050, MBSW 00 20 ...: wifibt, dark wake 1). All subsystems resumed cleanly (resumes 0 -> 1, GPU firmware back in 4773 us, sn201202x 1-06/1-0a/1-0c/2-08 S3/SLEEP: 0/S0 in 10–12 ms with typec_diff=0, NVMe 64 MiB direct read PASS, eDP-1 3456x2234 + backlight 25->75->25 + both ext DCPs bound, wld0 866.7 MBit/s + 3/3 ping, hci0 raw 0x1001 status 0x00, PCIe 00:00.0..02:00.0 + mmc0, PMP running: 1, SEP sleep_only=1 sleeps=1 attach=attached unhandled_messages=0, ALSA hw:1,0 PASS, HID/thermal/cpufreq intact).
    • Cycle 2 (15 s clean RTC wake rtcwake -m mem -s 15): rtcwake exit 0, resumes 1 -> 2, GPU firmware back in 4921 us, gpubench-vk render.mdi (GB_VERIFY=1, MESA_SHADER_CACHE_DISABLE=true) PASS (crc 06f8412a, 499.2 µs), 0 GPU faults/recoveries/hang kills.
  • Edge-case bug found during the 10-minute dark-wake re-suspend path:
    1. kernel/power/suspend.c:629 (linux@main, d9b438c4ca41): Inside while (!error && pm_dark_wake()), the dark-wake re-suspend loop calls pm_suspend_clear_flags() and re-enters suspend_devices_and_enter(state) without clearing wakeup state (pm_wakeup_clear(0) / events_check_enabled). Stale wakeup events from the dark wake itself immediately abort dpm_suspend() with -EBUSY (-16, last_failed_step=suspend, PM: Some devices failed to suspend, or early wake event detected).
    2. Interaction with #3813 (drivers/gpu/drm/asahi/g16/sleep.rs): During pm_dark_wake(), aurora-g16 restarted GPU firmware (4.7 ms, unlike apple-dcp/apple-drm which stay off on dark wake), then 1 ms later stopped it again in .prepare (SleepStop::Prepare / asahi_g16_stop_now) right before dpm_suspend() aborted with -EBUSY. sleep_complete() saw !real and hit sleep_hold() ("sleep refused: GPU firmware stays stopped until a real sleep"), returning to userspace with Vulkan/Wayland clients getting EIO until the next real sleep (verified recovered by Cycle 2 above).
    • Recommend follow-up fix: clear stale dark-wake wakeup state before re-entering suspend_devices_and_enter() in kernel/power/suspend.c, and keep aurora-g16 parked across pm_dark_wake() (tracking that a real wake already occurred so an aborted dark-wake re-suspend can still restart GPU firmware cleanly).
  • Stock return verified: J516s rebooted back to clean stock 7.3.0 (boot_id=62cd3bc4-fbfc-40f7-8aa8-484ec69047c2, ESP efab68fa0457a177220d75ba50aa92bc6d93bbd757a0e42ff8c2332ec92f9fe7, no /boot/grub/custom.cfg, empty grubenv, 0 failed units).

@github-actions github-actions Bot removed the needs-hw-row No hardware row at the PR head (bot) label Dec 1, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Updated stack to 098d2b244e078adb3b5b9c23f220ef84fb76ab0a incorporating:

Building and running final exact-head hardware verification on J516s next.

@github-actions github-actions Bot added the needs-hw-row No hardware row at the PR head (bot) label Dec 1, 2026
@github-actions github-actions Bot added area:bringup Area from CODEOWNERS (bot) area:release Area from CODEOWNERS (bot) merge-conflict Conflicts with the base branch (bot) needs-hw-row No hardware row at the PR head (bot) and removed area:usb Area from CODEOWNERS (bot) labels Dec 3, 2026
@DjDeveloperr
DjDeveloperr changed the base branch from feat/t6030-s2r-prerequisites to main December 3, 2026 02:27
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) area:power Area from CODEOWNERS (bot) area:usb Area from CODEOWNERS (bot) and removed area:bringup Area from CODEOWNERS (bot) area:release Area from CODEOWNERS (bot) merge-conflict Conflicts with the base branch (bot) labels Dec 3, 2026

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: REQUEST CHANGES at 121af2b

Failure: drivers/soc/apple/sleep-t6030.h still embeds an Apple tuning table in t6030_boot_replay(). The I2C6 replay identifies those literal entries as ADT tunables and writes the hard-coded values directly. Remove the embedded tuning data from the public change. The table values are omitted here.

Checked: The prior board-name PMGR and AMCC gates are gone. The provider uses named DT resources and validates the supplied operation spans. Both changed binding documents pass dt-doc-validate with their dependencies. The exact quiesce check reports all 13 slots mapped uniquely.

Add the Apple T6030 (M3 Pro) deep suspend-to-RAM provider for
apple-sleep with full SEP stop, DT-driven entry/wake register
sequences (with explicit slc-off and clear64-way opcodes), PTD/CPM/SLC
handshakes, GP PCIe PHY/clock park and wake recovery, PMU RTC alarm
re-arming and sleep/wake stage byte updates (writing 0xfe to PMU
register 0xf801 on wake, matching the 0x50 stage byte written at sleep
entry), and KUnit coverage.

Signed-off-by: Diljit Singh <hey@djdev.me>
Add the apple,t6030-sleep controller node with its register windows,
phandle links, wake sources, SMC policy, and explicit entry/wake
register sequences in t6030.dtsi, add the PCIe sleep register windows,
and enable deep sleep on J516s.

Signed-off-by: Diljit Singh <hey@djdev.me>
@DjDeveloperr
DjDeveloperr force-pushed the feat/t6030-sleep-provider branch from 121af2b to ada9382 Compare December 3, 2026 02:48

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: REQUEST CHANGES at ada9382

Failure: t6030_boot_replay() in drivers/soc/apple/sleep-t6030.h still programs the embedded I2C6 table that the source identifies as Apple ADT tunables. The watchdog revision leaves this part of the public patch in place. Remove the embedded vendor tuning data from the public change.

Checked: The new watchdog path selects WD1, extends its deadline after wake, and uses the existing suspend-end restore of the saved watchdog settings. Both DT binding documents are byte-identical to the validated revision. The exact quiesce test passes all 13 slots and rejects the existing misindexed-DART control.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Update on J516s qualification and head ada93827a977:

  • 01:50Z refuse_late=1 hang on prior v2 head (782d79cde553 / e5868968158a): t6030_sleep_display_off() ran destructive t6030_quiesce_at_display_off() (PCIe port 0/1, DISP DARTs, pinctrl) before refuse_late / commit with no undo in t6030_sleep_undo_regs(), hanging early resume before sn201202x_resume() / cd321x_complete() could wake hpm0 and restore SSPS to S0.
  • Fixes pushed at ada93827a977 (base retargeted to main; W=1 clean, t6030-sleep-qblk 2/2 PASS):
    1. Moved t6030_quiesce_at_display_off() out of t6030_sleep_display_off() into post-commit t6030_sleep_prepare_regs() (6869179b1a6f, previously dd10b5d11b39).
    2. Removed the stray spi-cpol; on &mesa in t6030-j516s.dts so spi1.0 uses SPI mode 2 matching t6030-j514s.dts (fixes 0x3352 << 1 = 0x66a4 unknown Mesa identifier).
    3. Replaced .no_wd2 = true with .wdt_wd1 = true in t6030_sleep_soc and added apple_sleep_set_wd2(s, WDT_SUSPEND_SECS) in t6030_sleep_wake() (6869179b1a6f). Hardware WDT_WD1 (120 s) is now armed in apple_sleep_begin() before device .prepare() / the first hpm0 SSPS write, re-armed in apple_sleep_prepare_late() and on wake, and restored in apple_sleep_end().
  • WD1 counter across deep sleep: t6030_sleep_after_ans() zeroes WDT_WD1_COUNT while WDT_WD1_BITE stays at WDT_SUSPEND_SECS (120 s). The SoC WDT clock stops while the SoC is powered off in deep sleep (as on T8103/T8112), so sleeps longer than 120 s must not reset; to prove that directly on hardware, the first qualification run on ada93827a977 will run one refuse_late=1 dry-run first, then two 15 s deep sleeps, one dark wake, and one >=180 s deep sleep.

@satchlj

satchlj commented Dec 3, 2026

Copy link
Copy Markdown
Member

Cross-checked ada93827a977 against our T8122 27.2 deep-sleep fixes in #4037 (73eddd32ebd7):

Already clean vs. #4037 failure modes

  • .coproc_slp_ddr / MTP adoption: t6030_sleep_soc leaves .coproc_slp_ddr unset (false), matching #4037 (9ccc8a20bfed) so adopted MTP does not latch WAKE_SLP_DDR and keeps DRAM-off deep sleep.
  • SIO_CPU ordering: t6030_sleep_soc does not place SIO_CPU in .stray; t6030_sleep_after_early() lowers T6030_PS_SIO_CPU after apple_sleep_coprocs_stop(s, false) pass 1 stops SIO (avoiding the T8122 race fixed in 9812715f0854).
  • t6030_quiesce_at_display_off() moved to t6030_sleep_prepare_regs() + .wdt_wd1 = true: cleanly resolves the refuse_late=1 destructive-quiesce abort path.

Two items worth checking before the ada93827a977 Cycle 1 run

  1. t6030_sleep_post_timer() (drivers/soc/apple/sleep-t6030.h:2460,2482) writes mask instead of s->soc->spmi_notify_sleep:
    • t6030_sleep_after_ans() (:2187) sets SPMI_NOTIFY_ENABLE to s->soc->spmi_notify_sleep (0x2000001).
    • Every other t6030_pmu_xfer() caller (t6030_last_pmu_boot, t6030_last_pmu_reads, t6030_alarm_snapshot, t6030_last_alarm_disarm, t6030_sleep_pmu_wake) masks out T6030_SPMI_DONE (BIT(0)) during the transfer and restores the full unmasked register afterward.
    • t6030_sleep_post_timer() restores mask (0x2000000, leaving BIT(0) clear) when t6030.alarm_valid is true. Worth verifying against the macOS trace whether SPMI_NOTIFY_ENABLE needs s->soc->spmi_notify_sleep (0x2000001) restored there.
  2. RTC device selection on the 00:22Z no-wake (rtcwake -d /dev/rtc0 -m mem -s 15):
    • t6030_alarm_snapshot() reads T6030_RTC_CTL / T6030_RTC_COMPARE on the SPMI PMU (usid 0xb). On J613 (27.2), macsmc-rtc takes /dev/rtc0 and the SPMI PMU RTC (pmic@e:rtc) is /dev/rtc1; arming /dev/rtc0 leaves the PMU RTC unarmed (t6030.alarm_valid == false), so t6030_sleep_post_timer() skips re-arming the PMU alarm and the machine sleeps without an RTC wake. Worth checking /sys/class/rtc/rtc*/name on J516s so the 15 s / 180 s qualification cycles target the SPMI PMU RTC.
  3. Future fw-27 dcpext note: on internal-only default J516s, dcpext0/dcpext1 stay off (skip_disp + !sleep_ps_on()). Once external display support is enabled on 27.2 J516s, apple_dcp_hw_t6030_dcpext will want the same firmware-27 s2r_ext stop/wake wiring from #4037 (2d2d619a28c6) so t6030_gate_coprocs[] (DISPEXT0_CPU / DISPEXT1_CPU, must_stop = true) sees them stopped cleanly.

Replace the apple,pmp-mbox phandle with an optional 34th reg and
reg-names entry named pmp-mbox so the sleep controller does not depend
on a static mbox@350c08000 node when APPLE_USE_PMP is unset.

Signed-off-by: Diljit Singh <hey@djdev.me>
Move pmp_mbox back inside #ifdef APPLE_USE_PMP in t6030.dtsi so
default (non-APPLE_USE_PMP) T6030 device trees carry no static PMP
nodes, matching t6030-pmp-dt-tests. Map the PMP ASC mailbox from the
sleep controller pmp-mbox reg entry via t6030_map_node_name() instead
of a phandle to pmp_mbox.

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

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: REQUEST CHANGES at 6b79a80

Failure: drivers/soc/apple/sleep-t6030.h still embeds the unchanged Apple ADT I2C6 tuning table. The resume code writes those literals directly to the controller. Remove the embedded Apple-derived data from the public series.

Checked: Both DT binding documents pass dt-doc-validate. The existing PMP DT check passes the default and static PMP profiles on both covered boards. The quiesce mapping check passes all 13 slots and rejects its misindexed-DART negative control.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Updated head to 6b79a80c413d and cross-checked the pre-qualification items:

1. Head 6b79a80c413d (t6030-pmp-dt-tests fix)

  • Previously t6030.dtsi had mbox@350c08000 outside #ifdef APPLE_USE_PMP, which failed t6030-pmp-dt-tests (when fdtget is present).
  • 69123db56d12 + 6b79a80c413d move "pmp-mbox" into t6030_sleep's own reg table (mapped via t6030_map_node_name(s, np, "pmp-mbox")) and restore pmp_mbox inside #ifdef APPLE_USE_PMP.
  • Verification at 6b79a80c413d:
    • drivers/soc/apple/sleep.o compiles cleanly with W=1 (CONFIG_APPLE_SOC_SLEEP=y).
    • scripts/checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks on both new commits.
    • tools/asahi/run-host-tests.py --only t6030 (with fdtget on PATH): 14/14 PASS (0 skips), including t6030-pmp-dt-tests.

2. Answers to @satchlj's two pre-Cycle-1 checks

  1. t6030_sleep_post_timer() writing mask (0x2000000) instead of s->soc->spmi_notify_sleep (0x2000001): Intentional, matching sleep-t6050.h (spmi_post_timer writes spmi_notify_sleep & ~SPMI_IRQ_DONE). Leaving BIT(0) (T6030_SPMI_DONE) masked while keeping BIT(25) enabled prevents completed post-timer PMU transfers from latching a spurious SPMI_DONE wake while keeping the PMU RTC alarm wake armed.
  2. J516s RTC device (/dev/rtc0): On J516s, /sys/class/rtc/rtc0 (macsmc-rtc) is the only RTC device. Unlike T8122 (where smc_rtc only exposes rtc_offset and a separate pmic@e:rtc is /dev/rtc1), t6030.dtsi wires macsmc-rtc directly to the Chapel PMIC (pmic@b, USID 0xb) nvmem cells rtc_ctrl@2000, rtc_alarm@2008, and rtc_alarm_mask@200e with interrupts-extended = <&nub_spmi 2 IRQ_TYPE_EDGE_RISING>; wakeup-source;. macsmc_rtc_program_alarm() writes those exact registers and bits (BIT(6)|BIT(0) on 0x2000, 0 on 0x200e, 4-byte compare on 0x2008) that t6030_alarm_snapshot() and t6030_sleep_post_timer() read and re-arm, so /dev/rtc0 is already the SPMI PMU RTC on J516s.

3. WD1 across SoC power-off (source check)

  • Software does not stop WD1 before SoC power-off: apple,seq-prepare clears only WDT_WD0_CTL (+0x0c), t6030_sleep_after_ans() only zeroes WDT_WD0_COUNT/WDT_WD1_COUNT, and notice/pre_commit/commit/post_timer do not touch WDT (matching T8103/T8112).
  • If hardware does not pause WD1 while the SoC is powered off, sleep would be bounded by WDT_SUSPEND_SECS (120 s; 32-bit 24 MHz ceiling 178.95 s). Qualification therefore includes a >=180 s committed deep sleep to verify directly that hardware stops WD1 during power-off.

4. Status of #4037 lessons across #3818 / #3809 / #3763

  • In #3818 (6b79a80c413d) or already on main:
    • Firmware-27 internal DCP stop: already on main (apple_dcp_hw_t6030 sets .v27_early_stop = true and .s2r_layout = &dcp_s2r_t6030, gated on DT sleep arguments and display power words).
    • disp-off ordering & watchdog: in #3818 (6869179b1a6f: t6030_quiesce_at_display_off() moved out of display_off into post-commit t6030_sleep_prepare_regs(), plus .wdt_wd1 = true).
    • Stray domains / SIO_CPU / .coproc_slp_ddr: clean in #3818 (.coproc_slp_ddr stays false so adopted MTP does not force DRAM-on sleep, and SIO_CPU is not in .stray and is lowered in t6030_sleep_after_early() after pass-1 stops SIO).
    • PCIe port DARTs & Bluetooth ROM resume: covered by companion PRs #3809 (173d1f2d1b58: restore T6030 port DARTs before noirq retraining) and #3763 (c5949ba1ab2d: hci_bcm4377 boot-ROM check, MSI block, and pending-recovery wait across sleep).
  • Carried by #4037 / tracked as follow-up:
    • PMP no-ack / soc-device-record lookup: provided by #4037 (1eb248cd05cf / 90897fed439e), which #3818 qualification stacks on top of.
    • Firmware-27 dcpext s2r_ext handoff: not yet wired on apple_dcp_hw_t6030_dcpext because default J516s keeps dcpext0/dcpext1 powered off (skip_disp + !sleep_ps_on()); tracked as a follow-up once external display is enabled on T6030 27.2.

Drop the hardcoded I2C6 register values from t6030_boot_replay() and map
the I2C6 window once at probe. Snapshot the I2C6 power word and registers
before powering I2C6 down in t6030_sleep_after_ans(), unstage PS_I2C6 on
wake so sleep_ps_rewake_rest() restores its pre-sleep power state, and
write the saved register values back once PS_I2C6 is active again.

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

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: REQUEST CHANGES at f9ab6cb

Failure: The I2C6 table is gone from the tip, but the exact ancestry check confirms that the earlier commit containing it is still in this series. The repository’s ordinary merge would carry that commit into main. Please land a clean successor series on a new branch with the old table omitted from its history.

Checked: The revised code passed local checks for active snapshot and restore, one-time replay, an inactive domain at entry or wake, and an absent controller mapping. The 13-slot quiesce check passed. The DT bindings are unchanged from the validated revision.

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Superseded by #4067 (feat/t6030-sleep-provider-v3, head f0273427aece), which carries the identical final tree from f9ab6cbbc1b9 rebased on main (bbb91e2a416d) with clean commit history and no removed I2C6 table in any commit.

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

Labels

area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) area:power Area from CODEOWNERS (bot) area:usb Area from CODEOWNERS (bot) blast:m3 Macs affected, from Merge risk (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