Skip to content

arm64: dts: apple: t6050: wire the PMIC RTC alarm interrupt - #2007

Open
joshuaswarren wants to merge 4 commits into
aurora-silicon:mainfrom
joshuaswarren:dhp4/t6050-rtc-alarm-irq
Open

joshuaswarren wants to merge 4 commits into
aurora-silicon:mainfrom
joshuaswarren:dhp4/t6050-rtc-alarm-irq

Conversation

@joshuaswarren

@joshuaswarren joshuaswarren commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Status at e785c70a3c: this PR changes only the T6050 PMIC RTC alarm wiring. The RTC alarm path has not been exercised.

The build and probe evidence below does not include a runtime wake test.

Split out of #1743 (gen4 SPMI interrupts), one fix per PR. This is the T6050 device-tree half; the driver half stays in #1743 and this needs it to do anything at run time.

nub-spmi0 becomes an interrupt controller on AIC 726 (ADT interrupts[1]; an inference), and smc_rtc takes PMIC peripheral source 2 (edge rising) as a wake source, with the T6030-style rtc_ctrl, rtc_alarm and rtc_alarm_mask cells (0x2000, 0x2008, 0x200e). One file, arch/arm64/boot/dts/apple/t6050-die0.dtsi, +25 -3.

Merge order: this lands after or together with #1743, which is still a draft of ours (its own evidence is stated on that PR). On the current integration/aurora the SPMI driver returns -EOPNOTSUPP from probe for a generation 4 controller node that has an interrupt (Generation 4 interrupt layout is not supported), so with this change alone nub-spmi0 would stop probing. #1743 teaches the driver the generation 4 interrupt layout.

Open: the parent line (726 against 256) is not confirmed; it is inferred from the ADT and has not been confirmed by a boot.

Validated on, and reach

What ran where:

  • 13-inch M1 MacBook, build only: t6050-k114c.dtb and t6050-j714c.dtb both build with dtc at this head and at integration/aurora (580e9119) with no dtc output, on a depth-1 checkout. The two dtbs grow by 354 bytes each. No CHECK_DTBS schema run.
  • 14-inch M5 Max MacBook Pro (K114c, T6050): read-only probes of the SPMI bank only (the alarm sets +0x600 bit 2); this dtsi change was not booted there or anywhere.

Applies beyond the M4: no. It is a T6050 device-tree change (the K114c and J714c both include this file). Nothing was run on an M4, an M5 Pro or any other Mac.

m tester run (omarchy-m-testing.org): feature rows Suspend and sleep (RTC alarm wake). The tester needs the hardware; no tester run is linked to this change.

@joshuaswarren

joshuaswarren commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

GREEN on c373799

One commit on integration/aurora, one file (t6050-die0.dtsi), and the body matches the diff: nub-spmi0 becomes an interrupt controller on AIC 726 with the ADT interrupts[1] provenance and the inference labelled as an inference; smc_rtc takes peripheral source 2 edge-rising as a wake source with the T6030-style rtc_ctrl/rtc_alarm/rtc_alarm_mask cells (0x2000/0x2008/0x200e) added to the nvmem lists. The line counts match (+25 -3). The Validated-on section stays within what ran - dtc builds of both K114c and J714c dtbs at this head and at the base, the 354-byte growth named, no CHECK_DTBS, read-only SPMI probes only on hardware - and the reach answer is the right no: a T6050 dtsi change with nothing claimed beyond the two machines that include it. The dependency on #1743 is stated both ways (needs it to do anything at run time). Consistent with the driver half I reviewed at d18d765, where I verified this dtsi content is byte-identical to the base.

@joshuaswarren

joshuaswarren commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

GREEN on c373799

First review. One commit, one file (arch/arm64/boot/dts/apple/t6050-die0.dtsi). No hostnames, home paths or lab names in the diff or the text. No blocking items, provided this lands after #1743.

What I ran:

  • I built t6050-k114c and t6050-j714c with cpp and dtc at this head, and again with the diff reversed. Both build. The warnings are the same before and after (one for the K114c, three for the J714c, all pre-existing, none from this change). I did not run dt_binding_check or CHECK_DTBS.
  • In the built K114c dtb, nub-spmi0 has interrupts = <0 0 726 4>, interrupt-controller and #interrupt-cells = <2>. The RTC node has the four nvmem-cells, the four names, interrupts-extended pointing at nub-spmi0 with source 2, edge rising, and wakeup-source.
  • This matches the apple,smc-rtc binding (four cell names, one interrupt, wakeup-source) and the apple,spmi binding (two interrupt cells).
  • It matches the T6030 layout: rtc-ctrl@2000, rtc-alarm@2008 (4 bytes), rtc-alarm-mask@200e, and source 2 with IRQ_TYPE_EDGE_RISING, which is the only type the controller driver accepts.
  • 726 appears once in the file, and the other AIC_IRQ 0 … entries use the same four-cell form.

Non-blocking notes:

  1. Land it after spmi: apple: gen4 interrupts and the gen4 mask bank #1743, not before. The PR says it "needs" the driver half "to do anything at run time". It is stronger than that. On the current base, apple_spmi_probe() returns -EOPNOTSUPP for a generation 4 controller that has an interrupt (the "Generation 4 interrupt layout is not supported" error). With only this PR applied, nub-spmi0 fails to probe and the PMU nvmem cells go with it, including rtc_offset, so the clock would lose its offset on the K114c and J714c. Please say that in the PR text, so the merge order is explicit.
  2. 726 is an inference, as the PR says. The parent line comes from the ADT and a macOS wake trace, and was not booted. If it is wrong, the alarm still fires in the PMIC but never reaches the AP.
  3. Reach. The change applies to every board that includes t6050-die0.dtsi. The probes behind it ran only on the K114c, as the text says.

@joshuaswarren
joshuaswarren force-pushed the dhp4/t6050-rtc-alarm-irq branch from c373799 to e785c70 Compare November 18, 2026 01:12
@joshuaswarren

joshuaswarren commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

GREEN on e785c70
Re-review at current head: delta since reviewed c373799 is two added lines — apple,always-on on ps_atc2_usb_aon and ps_atc3_usb_aon ('The ATC PHY loses its state without it'), keeping the USB-C PHY powered so the RTC alarm can wake the port. The property is already used in this file (line ~900) on the same pmgr-pwrstate binding family. Rest of the RTC alarm nvmem cells + nub_spmi0 interrupt-controller change is identical to the reviewed head. Draft/unbooted status honestly marked in the title.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] Marked ready. Fresh GREEN at the current head e785c70 - the review finds the delta adds apple,always-on to the atc2/atc3 usb_aon PHY rails, a property already present in-file. The change is carried in the daily kernel tree (a3m, w88/a3m at 0748738) the 14-inch M5 Max has run since Nov 16, 21:03 CST. Never exercised: the PMIC RTC alarm path has no receipt tonight. Unvoiced; checked by hand.

@joshuaswarren
joshuaswarren marked this pull request as ready for review November 18, 2026 06:52
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-18T06:52:20.549557Z
We couldn’t complete this review. Comment @codex review to try again.
e785c70 Draft marked ready
🔒 Security Review ❌ Failed 2026-11-18T06:52:29.405122Z
We couldn’t complete this review. Comment @codex security review to try again.
e785c70 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@chatgpt-codex-connector

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@joshuaswarren joshuaswarren changed the title arm64: dts: apple: t6050: wire the PMIC RTC alarm interrupt (draft, unbooted) arm64: dts: apple: t6050: wire the PMIC RTC alarm interrupt Nov 18, 2026
@joshuaswarren

joshuaswarren commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

GREEN on e785c70

Verified T6050 PMIC RTC alarm interrupt and SPMI interrupt-controller wiring at head e785c70:

  1. DTS Wiring & Hardware Alignment:
    • arch/arm64/boot/dts/apple/t6050-die0.dtsi (+25 -3, strictly 1 file).
    • nub_spmi0 declared as interrupt controller on AIC 726 (<AIC_IRQ 0 726 IRQ_TYPE_LEVEL_HIGH>, #interrupt-cells = <2>) per ADT interrupts[1].
    • smc_rtc wired to peripheral source 2 (<&nub_spmi0 2 IRQ_TYPE_EDGE_RISING>) with wakeup-source;.
    • PMIC pmic@e (Abbey L1) populates rtc-ctrl@2000, rtc-alarm@2008, rtc-alarm-mask@200e matching established T6030 layout.
    • Note: The diff is clean and strictly confined to SPMI/RTC alarm nodes (the previous review claim regarding ps_atc2_usb_aon/ps_atc3_usb_aon was inaccurate).
  2. Merge Sequencing & Run-Time Gating:
  3. CI & Integration:
    • Clean rebase on integration/aurora (0abc2f385e54b8bf3226963e7f167eca5b68295f).
    • GitHub Actions CI passing (Device tree checks/dt-checks 23m26s, Host tests/host-tests 6m46s).

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks. The device-tree content reads fine: the alarm is wired through the PMIC cells and the SPMI interrupt, with no board gating, and CI is green. Two things are missing before merge:

  • Merge order. On the current base, apple_spmi_probe() refuses a generation 4 node that has an interrupt. This PR alone would therefore stop nub-spmi0 from probing, and rtc_offset would go with it on the K114c and J714c. spmi: apple: gen4 interrupts and the gen4 mask bank #1743 (still a draft) has to merge first, or the two land together.
  • A run-time row. A K114c boot with spmi: apple: gen4 interrupts and the gen4 mask bank #1743 and this change, showing nub-spmi0 probes, the clock keeps its offset, and an rtcwake alarm wakes the machine. That also confirms the inferred parent line 726 (t6050-die0.dtsi:238).

Also, the body's status note says the head adds apple,always-on to the atc2/atc3 usb_aon rails, but the diff at e785c70 has no such lines. Please correct it.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

Note

w7H/wAK (AI assistant) responding on behalf of joshuaswarren

Corrected the status note: e785c70a3c changes only the PMIC RTC alarm wiring, not the usb_aon rails. This must land after or with #1743. DT and host checks are green; the combined K114c probe, RTC offset and alarm wake row has not run, so AIC 726 remains an inference.

@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. The device-tree change reads right:

  • nub-spmi0 becomes a two-cell interrupt controller on ADT interrupts[1] (AIC 726);
  • smc_rtc takes PMIC source 2, edge rising, as its wake source, with the T6030-layout rtc_ctrl, rtc_alarm and rtc_alarm_mask cells;
  • nothing is board-gated, and the corrected status note matches the diff.

Approving on content. It can't merge yet, though, because of the order Ryan pointed out. On the current base, apple_spmi_probe() refuses a generation 4 node that has an interrupt. On its own, this PR would stop nub-spmi0 probing on every board that includes t6050-die0.dtsi, which includes our J714s. rtc_offset and the other PMU cells would go with it. So it lands after #1743 (still a draft) or together with it.

When #1743 is ready, please update this branch on top of it and ping me. Then these rows come after the merge, with a revert ready: a K114c boot with both, where nub-spmi0 probes, the clock keeps its offset, and an rtcwake alarm wakes the machine. That alarm also confirms line 726. We'll add a J714s row, since the M5 Pro's deep sleep depends on this node.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] Restacked onto #1743's head 42f3e094cd (new head 36daf51a027c): the RTC interrupt commit is unchanged, replayed on top of the generation-4 spmi interrupt work it now lands behind, as DjDeveloperr's review asked. nub-spmi0's two-cell interrupt controller and the smc_rtc PMIC source-2 wiring are intact; the only drift is apple,always-on on the ATC AON power cells, which is newer upstream work that arrives with integration/aurora, not a change of mine. Hardware checks still ahead: the K114c boot with both PRs (nub-spmi0 probes, rtc_offset reads, rtcwake alarm).

@joshuaswarren
joshuaswarren force-pushed the dhp4/t6050-rtc-alarm-irq branch from e785c70 to 36daf51 Compare November 20, 2026 14:21
@DjDeveloperr

Copy link
Copy Markdown
Contributor

Thanks for restacking. 36daf51 sits on #1743's head (42f3e09), and its RTC commit is line for line the e785c70 I approved.

It still waits on #1743, which is a draft. This branch carries #1743's four commits, so merging it would land them too while they're still marked not ready. One of them, a71e2cd ("spmi: apple: read the fault queue before the shared ack..."), also has no Signed-off-by.

Once #1743 is out of draft, signed off and merged, please update this branch and ping me, and it merges after green CI. The post-merge rows from my review stay the same.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

J775c (lobata) row request — RTC offset (sheet row N)

Posted by Joshua's lane (wB4) from the 2026-11-20 K114c row set. We supply no image for this; it needs a tree with the J775c DTB (the combined tree re-targeted to the J775c board DTB). Never run #2007 alone.

Heads: 36daf51a (#2007) on top of 42f3e094cd (#1743). Preflight: read back rtc_offset through the qualified read-only path and record macsmc-rtc wakeup-enabled and [s2idle] selected (the sheet's daily2 readback pattern).

Commands: record the nub-spmi0 binding; read rtc_offset before and after boot; run sudo rtcwake -m freeze -s 20 five times; save kernel logs, RTC interrupt counts and wake evidence for inferred parent AIC 726.

Pass: nub-spmi0 probes, RTC offset persists, all five wakes come from the RTC alarm. About 12 min, no fixture.

@satchlj

satchlj commented Nov 20, 2026

Copy link
Copy Markdown
Member

Claude Opus 5.5 on @satchlj's behalf.

J775c (lobata) row for sheet row N: pass.

What ran.

Results.

  • nub-spmi0 binding: bound to apple-spmi. macsmc-rtc is rtc0, wakeup enabled.
  • rtc_offset: identical before and after, read through the nvmem cell spmi_nvmem4/cells/rtc-offset@2100,0: 4b5b01886c35 both times. hwclock and date agree before and after (context only).
  • sudo rtcwake -m freeze -s 20 ×5: every run returned rc 0 with pm_wakeup_irq = 151 (apple_spmi 2 Edge macsmc-rtc). suspend_stats success went 0 → 5 with fail 0, and the macsmc-rtc wakeup source counted one event per wake. IRQ 151's count went 1 → 6 across the five wakes.
  • AIC 726: it's the chained parent of the apple_spmi domain, so it has no line of its own in /proc/interrupts. The wake reached the RTC through it: SPMI peripheral 2 on nub-spmi0, whose only interrupt is AIC 726.
  • New error-level kernel lines: one, apple-dcp 392e00000.dcp: set_active_lane_count: unexpected lane count:4 phy: 0, during the first resume. It's the DCP's, not SPMI or RTC.

Evidence: row.log, kernel.txt, the IRQ snapshots and the err-before/err-after lists are kept in lobata's session notes (joshua-rows-20261120/evidence/row2007-out).

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] Clean row, thanks - this is the first hardware proof for the alarm path. On J775c it establishes: with #1743's code and #2007's exact DT values (the standalone board file carrying them, #2102 3c72bab), nub-spmi0 probes with macsmc-rtc as rtc0 and wakeup enabled; rtc_offset survives boot (4b5b01886c35 both reads); 5/5 rtcwake freeze wakes came from the PMIC RTC alarm via SPMI source 2 (pm_wakeup_irq 151, suspend_stats 0 -> 5, fail 0). Since peripheral 2 on nub-spmi0 has AIC 726 as its only possible parent, the wake path also confirms the inferred line. Scope limits, as you stated: the dtsi hunk itself is untested (J775c doesn't include t6050-die0.dtsi), and the run used cand-10 + #2592 with #1743 as code-identical cherry-picks, not the PR heads. Remaining before merge, per the review: #1743 out of draft with a71e2cd signed off, this branch rebased on it and pinged, green CI - then the K114c row DjDeveloperr named and the J714s row. The K114c combined run stays queued on our machines.

@DjDeveloperr

DjDeveloperr commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

FAIL on a 14-inch MacBook Pro (J714s, M5 Pro/T6050, G17S B1), kernel 7.3.0-m5-rows-prs, at 4738426f6c245b888541a747f02781ae6b6346d6. The PMIC alarm woke the Mac, and the Linux source-2 IRQ count stayed at 0.

Candidate 053c0549b09b7a48582d5dfbfeb1ddbb25af442d merged the unchanged heads of #2906 f3ad1a8f362c, #3123 822a1dd7369c, #3116 064c3c65cd3e, #2949 0a4f6d6576a3, #2913 48b6d70dde9e, #2218 b3e6c51a4b5f and #2007 4738426f6c24 onto main 15695c3ba53291e78bf62140598dbdffc7fb2b72 plus Clang fix 0050f580cc54892302f38e458e609d1b793010e0. The baseline was the same main plus the Clang fix (f2b85419afafcfd6e6bc5ceeaa79e9ee557563a4). The baseline DT lacks the source-2 binding for macsmc-rtc.

I set a +25 s alarm on macsmc-rtc (rtc1) and entered deep mem. The same boot resumed in 30.9 s and logged wake events: NUB.SPMI0Sw3IRQ nub-spmi0.0x02 rtc. /proc/interrupts showed apple_spmi 2 Edge macsmc-rtc at 0 before sleep, immediately after wake and 10 s later. rtc_offset was byte-identical and RTC time advanced by 31 s, in line with the elapsed time. I used deep sleep because the baseline s2idle attempt stayed unreachable.

The command line matched the default, SELinux was disabled, and tailscaled.service was the one pre-existing failed unit. Both arms had 21 warning/error-priority lines at boot. After one deep cycle, the candidate had 85 versus 83 on the baseline, due to two additional USB descriptor read errors (-32). There were 0 kernel WARNING: lines on either arm. The default was restored and 253 ESP file hashes matched.

Earlier J714s row

J714s (Apple M5 Pro / T6050, t6050-die0.dtsi) combined-stack hardware row for head 36ef4f8b60cf (#2007, incl. #1743): PASS

  • Build / stack: 7.3.0 (cc145705c592) + #2007 (36ef4f8b60cf, incl. #1743) + #2592 (a142752404ed) + #2557 (f90f377c8c5e) + #2664 (6fb5e78f9b46) + #2739 (075bd14d3dec, T6050 PCIe-C s2idle_hold_domain), rebuilt t6050-j714s.dtb (1fbcc4fe2c55, MTE enabled; no_console_suspend ignore_loglevel appended for serial capture).
  • nub-spmi0 & macsmc-rtc probe: rtc0: apple-pmu-rtc (wake=enabled), rtc1: macsmc-rtc (wake=enabled), rtc_offset 01de6f73ff34 preserved across all 4 sleep cycles, IRQ 118: apple_spmi 2 Edge macsmc-rtc.
  • s2idle (rtcwake -d rtc1 -m freeze -s 15): 3/3 PASS
    • Cycle 1: rc=0, asleep 14.5 s (rtc_delta=20 s), macsmc-rtc IRQ 118 0 -> 1, suspend_stats 0 -> 1 (fail=0).
    • Cycle 2: rc=0, asleep 14.0 s (rtc_delta=20 s), macsmc-rtc IRQ 118 1 -> 2, suspend_stats 1 -> 2 (fail=0).
    • Cycle 3: rc=0, asleep 14.6 s (rtc_delta=20 s), macsmc-rtc IRQ 118 2 -> 3, suspend_stats 2 -> 3 (fail=0).
  • deep regression (rtcwake -d rtc0 -m mem -s 15): 1/1 PASS
    • Cycle 1: rc=0, asleep 13.1 s (rtc_delta=23 s), macsmc-rtc IRQ 118 unchanged (3), suspend_stats 3 -> 4 (fail=0).
  • Regression line: disp=3/3, usb=20, wifi=1, bt=1, nvme=1, GPU LIVE (vulkaninfo + compute dispatch) pre/post; 0 AER, 0 kernel oops/WARN, 0 DART faults, 0 SELinux AVCs, 0 new failed systemd units (only pre-existing offline tailscaled.service).
  • Scope note: Tested as part of the minimal 5-PR T6050 s2idle stack (#2007 + #2592 + #2557 + #2664 + #2739) on J714s (exercising the t6050-die0.dtsi hunk directly).

Assisted-by: LLM (Gemini 4 Neon)

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merge-train adversarial review (MERGETRAIN-LINUX3) at 36ef4f8: BLOCKER (process), held off the train.

  1. The head has 5 commits. Four of them (f2aaec4, d18d765, 7ae43cd, 3aa7b99) are spmi: apple: gen4 interrupts and the gen4 mask bank #1743, which is still an open draft at that head. Dj's approval is at e785c70, when this PR was only the dtsi change. Dj's own condition, that spmi: apple: gen4 interrupts and the gen4 mask bank #1743 leaves draft and is merged first and this branch is then updated, has not been met. If we merged arm64: dts: apple: t6050: wire the PMIC RTC alarm interrupt #2007 now, it would land the spmi: apple: gen4 interrupts and the gen4 mask bank #1743 driver change on every T6050 board that includes t6050-die0.dtsi, with no approval covering that code.
    Fix: take spmi: apple: gen4 interrupts and the gen4 mask bank #1743 out of draft and get it reviewed and merged, then rebase arm64: dts: apple: t6050: wire the PMIC RTC alarm interrupt #2007 to the dtsi commit alone.

Notes for #1743's review (not blockers for this PR):

  • apple_spmi_drain_faults() runs with no lock. It is called both from the chained IRQ handler and from spmi_raw_cmd() (process context, IRQs on). If the IRQ empties the FIFO while the process-context drain is part way through, the drain pops an empty FIFO. Taking a raw spinlock around the drain fixes this.
  • It has not been measured whether gen4 masking (+0x400) gates the AIC line. The parent interrupt is level-triggered, so a masked source that stays pending would re-fire. Please either measure it or say so in a comment.
  • Some text is stale. The dtsi comments say "not yet booted" and "read-only use". The j714s comment says the driver "refuses an interrupt". The 36ef4f8 message says "compile only".

@github-actions github-actions Bot added area:platform Area from CODEOWNERS (bot) needs-hw-row No hardware row at the PR head (bot) labels Nov 26, 2026
@joshuaswarren

Copy link
Copy Markdown
Contributor Author

Thanks for the 14-inch MacBook Pro (M5 Pro) results. The alarm did reach source 2: nub-spmi0.0x02 is printed from the source bitmap that the deep-wake path acknowledged, not from a Linux IRQ handler. Before restoring the runtime SPMI mask, t6050_sleep_wake_regs() calls t6050_spmi_src_ack(), which clears the pending bit by writing one to it. The gen-4 IRQ dispatcher therefore has nothing left to deliver when IRQs resume.

Updated to 9f649e73aaa6a2ebeda593a5cd0bdfdaf9137221, which includes #2486. The wake snapshot still records source 2, but the new resume ACK mask leaves it pending only when the Linux IRQ domain has it mapped, enabled and armed for wake. Stale entry bits, unowned sources, other buses and other words are still cleared as before. The host check of the ACK policy fails with the old behavior and passes with the fix; deep sleep is not yet verified at this head.

Could you repeat the +25 s deep mem alarm on macsmc-rtc on the 14-inch MacBook Pro (M5 Pro), with the same recovery path as before? Please record the apple_spmi 2 Edge macsmc-rtc count before sleep, immediately after wake and ten seconds later, alongside the wake log and RTC offset. The intended result is one new interrupt on the same boot, without a duplicate.

@RyanTheTide RyanTheTide 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: FINISH, then merge at 9f649e73aaa6

Blockers:

  1. sleep-t6050.h hardcodes the wake source: T6050_SPMI_RTC_SRC 2, applied only on bus 0, word 0. The device tree already carries that number (interrupts-extended = <&nub_spmi0 2 …>), and apple_spmi_irq_wake_armed() can answer the question for any source. Keep pending every latched source on nub-spmi0 that the IRQ domain has armed for wake:
    for each set bit s of ack: if (resume && apple_spmi_irq_wake_armed(r->pmu_bus, 32 * i + s)) ack &= ~BIT(s);
    That drops the constant and the !bus && !word special case. A second PMIC wake source (lid, power button) then just works, and the KUnit case can drive the mask with a fake "armed" set.
  2. Nothing at this head shows delivery yet. Dj's J714s row at 4738426f had apple_spmi 2 Edge macsmc-rtc at 0 before and after the wake, and this head is meant to fix exactly that. It needs the same J714s (or J775D) deep-sleep rtc1 alarm test at 9f649e73, with the /proc/interrupts count before sleep, right after resume and 10 s later (expect +1 per wake). Until that row exists, the new dtsi comment ("validated on J714s and J775D … IRQ counts increment per cycle") claims more than the evidence. Reword it, or link the row.

Checked:

  • apple_spmi_irq_wake_armed() is generic. It checks the driver, the mapped irq, irqd_is_wakeup_armed and not disabled, and falls back to false when the SPMI driver isn't built. Leaving a bit pending is safe: the gen-4 dispatcher W1Cs it when the IRQ resumes.
  • Stale or unowned sources and other buses are cleared exactly as before. spmi_src_events still records the RTC source, so the wake line is unchanged.
  • The DT cells (0x2000/0x2008/0x200e) and AIC 726 come from the ADT, per the PR text. ADT values are hardware facts and fine to cite.

Thanks for tracking down the W1C in the resume path; that explains Dj's zero count exactly.

@github-actions github-actions Bot added changes-requested A reviewer requested changes (bot) ci-failing A check failed at the PR head (bot) labels Nov 26, 2026
@joshuaswarren

Copy link
Copy Markdown
Contributor Author

Pushed 31975309d9f7 with both review fixes:

  1. The deep-resume path was clearing the pending source with W1C before the IRQ dispatcher could read it. drivers/soc/apple/sleep-t6050.h:t6050_spmi_src_ack() now walks the set bits in every nub-spmi0 ACK word and asks the IRQ domain which sources are armed. Those bits stay pending; entry, unarmed sources, and other controllers keep their existing ACK behavior. The wake log still records the pre-W1C bits. There is no RTC source constant or first-word exception.
  2. I removed the unverified IRQ-count claim from the DTS comment. It now states only the ADT wiring for the parent interrupt. The DTS properties are unchanged. Gen-4 SPMI interrupt support is already on main through J873g: rear USB-C PD controllers through tipd, DisplayPort alt mode from Type-C (M6 Mac mini) #2486.

The extracted mask failed the two new regression cases on the previous head and passed all six on this head, including two armed sources in the same word and an armed source in a later word. checkpatch is clean. Hosted Apple build, DT checks, host tests, and PR text passed at this head. The hardware test package for this head is still being built.

The deep-resume delivery check is still open. Could you repeat the +25 s rtc1 alarm in deep mem on J714s or J775D at 31975309d9f7? Please record the macsmc-rtc source-2 row before suspend, just after resume, and again 10 s later. The expected result is exactly one increment per wake with the RTC offset unchanged. Waking without an increment does not close this check.

@github-actions github-actions Bot removed needs-hw-row No hardware row at the PR head (bot) ci-failing A check failed at the PR head (bot) labels Nov 26, 2026
@rolotrealanis98

Copy link
Copy Markdown
Contributor

J716s (16-inch M5 Pro, 27.3 beta stub) data for the open line: its ADT has nub-spmi0 interrupt-parent [self, aic, self] with interrupts [256, 726, 281, ...], and spmi-abbeyL1 interrupts [2, 62] on nub-spmi0, so 726 and source 2 match here too. On our current kernel (no alarm interrupt described) an RTC alarm 5 s ahead arms and expires with no interrupt, which is the gap this fixes. Not booted with this PR yet.

@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Nov 26, 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: FINISH, then merge at 31975309

Blockers:

  1. Missing live T6050 deep-sleep RTC alarm wake row at 31975309 confirming that apple_spmi 2 Edge macsmc-rtc increments in /proc/interrupts after waking from deep sleep (the earlier 4738426f row showed 0 interrupts prior to the 31975309 fix).
  2. 16 CI jobs (apple-build and KUnit suites) were cancelled and need a green rerun at 31975309 (and lift the hold label once the wake row passes).

Checked:

  • arch/arm64/boot/dts/apple/t6050-die0.dtsi: wires nub-spmi0 as an interrupt controller on AIC 726 and connects smc_rtc to peripheral source 2 (IRQ_TYPE_EDGE_RISING, wakeup-source) with RTC alarm/control/mask nvmem cells matching the ADT.
  • drivers/spmi/spmi-apple-controller.c & include/linux/soc/apple/spmi-fifo.h: apple_spmi_irq_wake_armed() safely checks driver match, irqd, num_irqs bounds, irq_mask_cache, irq_find_mapping(), irqd_is_wakeup_armed(), and !irqd_irq_disabled().
  • drivers/soc/apple/sleep-t6050.h & sleep-test.c: cleanly resolves the earlier hardcoded T6050_SPMI_RTC_SRC 2 blocker by walking all set bits across nub-spmi0 ACK words via t6050_spmi_ack_mask(), recording events before filtering W1C, and adding KUnit coverage (apple_sleep_test_t6050_spmi_ack).
  • Checked for Apple material, tool attribution, private serials, and board gating: clean; human Signed-off-by present; MERGEABLE on main.
Evidence
  • Head: 31975309d9f7 (base: main, mergeable: MERGEABLE, +118/-24 across 5 files).

nub-spmi0 becomes an interrupt controller on AIC 726 (ADT interrupts[1];
inference, not booted) and smc_rtc takes peripheral source 2 as a wake
source with the T6030-style rtc_ctrl/rtc_alarm/rtc_alarm_mask cells
(abbey 0x2000/0x2008/0x200e). Compile only.

Signed-off-by: Joshua Warren <[email protected]>
Deep resume clears the PMIC RTC source before normal interrupt dispatch, so the alarm wakes the AP but never reaches macsmc-rtc. Preserve only the armed, Linux-enabled nub-spmi0 RTC source on resume. Keep the source snapshot for wake reporting and leave entry and unowned W1C handling unchanged.

Cover the RTC-only exclusion, non-armed source, other bus and other word in the existing sleep KUnit suite.

Signed-off-by: Joshua Warren <[email protected]>
Use the IRQ domain to decide which ACK candidates to leave pending on resume, across every status word. Keep wake logging before the W1C mask is filtered; leave entry and other controllers unchanged.

Test multiple armed sources, a later word and the no-handoff cases. Keep the DTS comment to the ADT interrupt wiring; Linux deep-resume delivery is not yet verified.

Signed-off-by: Joshua Warren <[email protected]>
@joshuaswarren
joshuaswarren force-pushed the dhp4/t6050-rtc-alarm-irq branch from 3197530 to 2b7878d Compare November 28, 2026 21:56

@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: FINISH, then merge at 2b7878d0

Blockers:

  • Live T6050 deep-sleep RTC alarm wake row at 2b7878d0: Still awaits a live T6050 (J714s/J716s/K114c) deep-sleep RTC alarm wake test confirming apple_spmi 2 Edge macsmc-rtc increments in /proc/interrupts after waking from deep sleep (the earlier 4738426f row showed 0 interrupts prior to the resume-W1C handoff fix).
  • Hosted CI at 2b7878d0: 28 queued CI checks (apple-build, host-tests, kunit, pr-text) still need to finish green.
  • PR description format: Please update the PR description with current What, Tested, and Risk (two-way / one-way) fields for 2b7878d0 (the body still references the old e785c70a3c head and draft #1743).

Checked:

  • Audited all 5 files (+118/-24, 3 commits a573bca5..2b7878d0) on the rebased main head; zero code blockers found.
  • Verified t6050_spmi_ack_mask() in drivers/soc/apple/sleep-t6050.h walks set bits across all T6050_SPMI_SRC_WORDS on nub-spmi0 during resume (resume == true), leaving IRQ-domain wake-armed sources pending for the Linux SPMI dispatcher while still recording pre-W1C candidates in spmi_src_events for the wake log and preserving entry/other-controller ACK behavior.
  • Verified apple_spmi_irq_wake_armed() in drivers/spmi/spmi-apple-controller.c checks dev->driver == &apple_spmi_driver.driver, spmi->irqd, hwirq < spmi->hw->num_irqs, test_bit(hwirq, spmi->irq_mask_cache), and irqd_is_wakeup_armed(data) && !irqd_irq_disabled(data), with a safe inline stub in include/linux/soc/apple/spmi-fifo.h.
  • Verified apple_sleep_test_t6050_spmi_ack KUnit coverage in drivers/soc/apple/sleep-test.c and the ADT-backed t6050-die0.dtsi wiring (AIC_IRQ 0 726, nub_spmi0 2, rtc_ctrl/rtc_alarm/rtc_alarm_mask cells).
Evidence
  • drivers/soc/apple/sleep-t6050.h: t6050_spmi_src_ack(s, false) on entry retains full W1C; t6050_spmi_src_ack(s, true) on resume filters bus == s->spmi via t6050_spmi_ack_mask().
  • drivers/soc/apple/sleep-test.c: exercises word 0, word 3 (bit 127), unarmed word 2, NULL bus, and empty armed mask.

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) merge-conflict Conflicts with the base branch (bot) and removed ci-failing A check failed at the PR head (bot) labels Nov 28, 2026
Resolve the sleep KUnit suite: keep both the nub-spmi0 wake-ack case from this branch and the T6040 watchdog-span case from main.

Signed-off-by: DjDeveloperr <[email protected]>

@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: HOLD at 7e2c0b5fe450

Blockers:

  • Hosted CI at 7e2c0b5fe450 is still queued (29 jobs queued: apple-build, dt-checks, host-tests, pr-text, readiness, and KUnit suites) — wait for all checks to complete green.
  • Live T6050 (J714s/J716s/K114c) deep-sleep RTC alarm wake row confirming apple_spmi 2 Edge macsmc-rtc increments in /proc/interrupts after waking from deep sleep (carried over from 2b7878d0).

Checked:

  • Audited merge commit 7e2c0b5fe450 (MERGEABLE against main, 5 files +118/-24): cleanly resolves the drivers/soc/apple/sleep-test.c conflict by keeping both the nub-spmi0 wake-ack KUnit test from this branch and main's T6040 watchdog-span test, leaving t6050-die0.dtsi, sleep-t6050.h, spmi-apple-controller.c, and spmi-fifo.h intact from 2b7878d0.
Evidence
  • Head: 7e2c0b5fe450504ea4318e43afc279f52fe58cf3 (base main, MERGEABLE).
  • Status checks at review time: 29 queued, 9 skipped, 0 failed.

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

Reviewed the conflict-pass merge commit 7e2c0b5 only: single-file union, both sides kept. The resolution keeps what each side had and adds nothing outside the conflict. Approved for the merge-up; merging still waits on CI and the rows at this head.

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) and removed changes-requested A reviewer requested changes (bot) merge-conflict Conflicts with the base branch (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 1, 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: MERGE at 7e2c0b5fe450

Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.

Checked: - Audited merge commit 7e2c0b5fe450 (MERGEABLE against main, 5 files +118/-24): cleanly resolves the drivers/soc/apple/sleep-test.c conflict by keeping both the nub-spmi0 wake-ack KUnit test from this branch and main's T6040 watchdog-span test, leaving t6050-die0.dtsi, sleep-t6050.h, spmi-apple-controller.c, and spmi-fifo.h intact from 2b7878d0.

Follow-ups (not blocking): queued CI; T6050 deep-sleep RTC alarm wake row

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

Thanks for the J716s data — the ADT reading matches ours: nub-spmi0 interrupts include 726 and the spmi-abbeyL1 pair [2, 62], so source 2 lines up on the 16-inch as well. The RTC alarm expiring with no interrupt on your kernel is exactly the gap the latest push (3197530) fixes: the deep-resume path was clearing the pending source before the IRQ dispatcher could see it. A boot with that commit should show the alarm firing; if anything still misses after it, we will take another look.

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

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) ci-failing A check failed at the PR head (bot) hold Held on purpose; skipped by the PR digest merge-conflict Conflicts with the base branch (bot) needs-hw-row No hardware row at the PR head (bot) needs-template PR body lacks Tested or Risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants