Skip to content

rtc/spmi/dts: t600x PMU RTC wake alarm - #1312

Merged
RyanTheTide merged 3 commits into
integration/aurorafrom
rtc/t600x-pmu-alarm-int4
Nov 9, 2026
Merged

RyanTheTide merged 3 commits into
integration/aurorafrom
rtc/t600x-pmu-alarm-int4

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Adds a wake-capable RTC to the M1 Pro, Max and Ultra (t600x), so rtcwake and timed wake from s2idle work there. It uses the same apple-pmu-rtc driver, DT shape and wake path as the M2 (t8112), M4 Pro (t6041) and J700 (t8140). This replaces #1284 (rebased onto the current integration tip, with the commit message for the third patch rewrapped). The code is unchanged.

Before this series the t600x machines have only rtc0 (macsmc-rtc), which has no wakealarm.

Wake path

Maverick RTC comparator -> PMU interrupt 2 -> nub-spmi0 interrupt controller -> AIC 636 -> apple-pmu-rtc (rtc1, wakeup-source)

This is the same path the other PMU RTCs use: the nub SPMI controller is an interrupt controller on its AIC line, and the PMIC rtc child has interrupts = <2 IRQ_TYPE_EDGE_RISING>, the shared rtc_offset cell and wakeup-source. The RTC core arms the wake interrupt in suspend. On t600x only two things differ:

  1. spmi: apple: take the interrupt count from the SoC. The t6000 controller has 192 peripheral interrupts, so the RX FIFO notification is interrupt 192, not 256. Every other SoC keeps 256 and behaves exactly as before. Without this, every SPMI transfer on an M1 Pro times out once the controller is described as an interrupt controller.
  2. arm64: dts: apple: t600x: describe the PMU RTC alarm. The nub SPMI interrupt controller (AIC 636) and a Maverick rtc child. rtc0 stays on the SMC clock and rtc1 is the alarm.
  3. rtc: apple-pmu: clear Maverick control event latch. Maverick has a second fired-event latch in control bit 1. The driver preserved that bit, so after one fire the alarm was armed as 0x43 and no new edge latched. It now arms as 0x41. On the other PMUs the new field is 0, so their writes don't change.

Tests

  • checkpatch.pl --strict: 0/0/0 on all three patches.
  • Host model tools/asahi/pmu-rtc-tests.py: Baku, Abbey, Stowe and Maverick arithmetic, W1C transactions and fault injection pass. The stale-latch negative control is detected.
  • arm64 Image modules dtbs build with LLVM=1.

Hardware: J316s (16-inch M1 Pro)

Test kernel: this series plus a lab-only watchdog patch that keeps the watchdog counting in suspend (it is not part of this PR). The DTB is the series' t6000-j316s.dtb.

check before with this series
RTCs rtc0 only (no wakealarm) rtc0 + rtc1 apple-pmu-rtc, wakealarm, wakeup enabled
SPMI errors 0 0
armed control byte 0x43 (earlier revision) 0x41
awake rtcwake -m no -s 6, x2 no interrupt interrupt +1 each time, wakealarm cleared
rtcwake -d rtc1 -m freeze -s 15 could not wake woke at 15.46 s; then 5/5 at 15.95-16.01 s, interrupt +1 each, suspend_stats 6/0
after each wake Wi-Fi connected, NVMe live, Bluetooth powered, ANE and GPU present, no kernel errors
regression suite vs the same base without the series s2idle_rtc: n/a s2idle_rtc: success +3 fail +0, all other rows equal (GPU, camera, ANE, AVD, Wi-Fi/BT reconnect, 6+6 pm_test sleeps); 0 AVC, enforcing

With PMP on (base including #1302), the same kernel and DTB give: awake alarms 2/2, real s2idle 5/5 (woke at 15.35-15.96 s), devices back after each wake, and idle power 3.45 W before the sleeps and 3.43 W after.

Hardware: J413 (M2), the existing Stowe path

Same test kernel; the M2's DTB is unchanged. On the base kernel, rtc1 apple-pmu-rtc already raises interrupt 2 for awake alarms (2/2). With this series: SPMI 0 errors, awake alarms 2/2, and real s2idle 15 s 6/6 woke on the RTC interrupt (suspend_stats 6/0). After each wake, Wi-Fi, Thunderbolt, NVMe, display, Bluetooth, ANE and GPU were all ok, with no kernel errors.

The regression suite's back-to-back sleeps also showed magicmouse ...: unable to request touch data (-19). This is a trackpad resume race outside the RTC path, and it is fixed in #1317.

🤖 Generated with Claude Code

The controller numbers its peripheral interrupts first and puts the RX
FIFO notification right after them. On t8103, t8112 and t8140 that is
256 peripheral interrupts with the notification at 256, which the
driver hard-codes. The M1 Pro, Max and Ultra (t6000) controller has 192
peripheral interrupts and raises the notification as interrupt 192, as
the firmware device tree for the nub SPMI bus lists it.

With the nub SPMI controller described as an interrupt controller, the
driver unmasked bit 256 and waited for a completion that never came,
so every transfer on an M1 Pro timed out ("failed to wait for RX FIFO
not empty") and the SMC RTC, the reboot nvmem cells and the PMU RTC all
failed to read.

Add the interrupt count to the per-SoC data, use it for the
notification index, the mask/ack ranges and the domain bounds, and
match apple,t6000-spmi with a 192-interrupt layout. Other SoCs keep 256.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
Make the nub SPMI controller an interrupt controller and add the
Maverick PMU RTC under the PMIC, so rtcwake can wake M1 Pro, Max and
Ultra systems from s2idle. The PMU raises SPMI interrupt 2 for the
alarm.

Keep rtc0 on the SMC clock and give the alarm rtc1 on every t600x
board. The t602x boards share the board files but not this PMU, so
the aliases go in the t600x board files.

Signed-off-by: Ryan Murray <[email protected]>
Assisted-by: LLM
Maverick keeps a second fired-event latch in control bit 1, next to
the event register. The arm path preserved that bit, so after one
alarm had fired (or firmware had left the latch set) the alarm was
armed as 0x43. The comparator still matched and cleared ARM, but no
new event edge latched and the SPMI interrupt never fired.

Clear the control event bit on every control write, so the alarm is
armed as 0x41 and each match raises interrupt 2.

On a J316s (M1 Pro) with this series, two awake alarms each raised
the RTC interrupt once and cleared wakealarm, and six 15 s s2idle
suspends woke on the RTC interrupt after 15.5-16.0 s.

Extend the host model with Maverick's write-zero-to-clear control
latch and its stale-edge suppression. Stowe keeps its exact control
value checks, so the T8112 path is unchanged.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide merged commit 53dba0e into integration/aurora Nov 9, 2026
2 checks passed
@RyanTheTide
RyanTheTide deleted the rtc/t600x-pmu-alarm-int4 branch November 9, 2026 11:00
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.

1 participant