Skip to content

t600x: PMU RTC wake alarm (SPMI notify index, latch clear + DT) - #1284

Closed
RyanTheTide wants to merge 3 commits into
integration/aurorafrom
rtc/t600x-pmu-alarm-int3
Closed

RyanTheTide wants to merge 3 commits into
integration/aurorafrom
rtc/t600x-pmu-alarm-int3

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Supersedes #1225 with the Maverick event-latch fix added. This remains a draft until the J316s awake and s2idle checks below pass.

Before this series, the M1 Pro has only rtc0 (macsmc-rtc, no wakealarm), so rtcwake, scheduled wake, and suspend-then-wake cannot use the retained-power PMU alarm.

Interrupt route

The alarm route is direct SPMI, not an SMC notification:

Maverick RTC comparator
  -> PMU peripheral interrupt 2
  -> nub-spmi0 interrupt controller
  -> AIC 636
  -> apple-spmi child IRQ
  -> apple-pmu-rtc

The t6000 SPMI controller's RX-reply notification is controller event 192. That event is separate from the RTC's PMU peripheral interrupt 2.

Commits

  1. spmi: apple: take the interrupt count from the SoC. The controller driver previously hard-coded the RX FIFO notification at 256. T6000 has 192 peripheral interrupts and uses notification 192; other supported SoCs retain 256.
  2. arm64: dts: apple: t600x: describe the PMU RTC alarm. The nub SPMI controller is routed through AIC 636. The Maverick PMU gets an RTC child on SPMI peripheral interrupt 2, using the existing RTC-offset cell and wakeup-source.
  3. rtc: apple-pmu: clear Maverick control event latch. Maverick has a second fired-event latch in control bit 1 in addition to the separate W1C event register. A stale control value of 0x03 was preserved during arm, producing 0x43; after the comparator matched, ARM cleared but no new event edge could latch. The driver now clears the Maverick control-event bit on every control write, so it arms as 0x41.

The new control-event field is zero for T8112/Stowe, and the host model retains exact Stowe control-value checks, so the working M2 path is unchanged.

Checks

  • checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks.

  • Buildbox arm64 focused build with LLVM=1 W=1: rtc-apple-pmu.o and spmi-apple-controller.o compiled with no diagnostics.

  • Buildbox arm64 Image modules dtbs build with LLVM=1 W=1: completed successfully.

  • Host model:

    PMU RTC: Baku, Abbey, Stowe and Maverick arithmetic, W1C transactions and fault injection passed
    
  • The model starts Maverick with control 0x03 and separate event clear, proves that the stale control latch suppresses a new edge, then proves the driver clears bit 1 and arms as exactly 0x41.

  • All nine mutation controls are detected, including the new control-event-clear negative control.

J316s hardware gate

No target hardware was used for this update. The owner lane should:

  1. Run an awake rtcwake twice and require the RTC IRQ count to increase by exactly one each time. Immediately after each arm, require control 0x41 (bit 1 clear), separate event clear, and the alarm unmasked; after each interrupt, require both event latches clear.
  2. Only after both awake alarms pass, run one guarded short s2idle wake. Require the RTC IRQ count to increase, the wakealarm to clear, and no new SPMI, PM, warning, or failed-unit class.

The earlier J316s trial already established that notification 192 makes the interrupt-driven SPMI FIFO work and that rtc1 probes. The missing alarm edge was the stale Maverick control latch addressed by commit 3.

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 an additional fired-event latch in control bit 1. If that latch is stale when the alarm is armed, the next comparator match does not produce a new event edge. Clear it on every control write so the normal armed value is 0x41 instead of 0x43.

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

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Superseded by #1312 (same three patches rebased onto integration f4b6890, with hardware results).

@RyanTheTide RyanTheTide closed this Nov 9, 2026
@RyanTheTide
RyanTheTide deleted the rtc/t600x-pmu-alarm-int3 branch November 27, 2026 13:22
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