Skip to content

soc: apple: sleep: T6050: a sleep with no RTC alarm armed is not refused - #2698

Merged
DjDeveloperr merged 1 commit into
aurora-silicon:integration/aurorafrom
axboe:k116s-sleep-no-alarm
Nov 21, 2026
Merged

DjDeveloperr merged 1 commit into
aurora-silicon:integration/aurorafrom
axboe:k116s-sleep-no-alarm

Conversation

@axboe

@axboe axboe commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Split out of #2201 at Isaac's request (#2201 (comment), his J714s row): it is the one commit a J714s needs from that series for a lid close to deep-sleep, and it depends on nothing else there.

Problem. The T6050 entry refuses a sleep unless the PMU's RTC alarm is armed and unmasked:

PM: suspend entry (deep)
apple-sleep 280600000.sleep-controller: refused at .enter: SoC check: -16
PM: suspend exit

So rtcwake -m mem sleeps and a lid close does not; logind retries about every 30 s while the lid stays shut. The alarm is one wake source among several: the SMC wakes the machine for the lid and the keys without it.

Fix. t6050_sleep_check_alarm() returns 0 with no alarm armed, and t6050_sleep_final_check() then has nothing to hold against the sleep timer. The rearm after the commit is already skipped without a valid alarm. With an alarm armed nothing changes. One commit, 5 lines added.

Tested

Not tested: an RTC-alarm sleep on the J714s with the commit (Isaac ran those without it); any other T6050 board.

#2201 drops its copy when this is in.

The T6050 entry refuses a sleep unless the PMU's RTC alarm is armed and
unmasked ("SoC check: -16"), so a lid close with no alarm set never
sleeps. The alarm is one wake source among several: the SMC wakes the
machine for the lid and the keyboard without it.

Accept a sleep with no alarm armed. The alarm is then not held against
the sleep timer in the final check and not rearmed after the commit.
With an alarm armed nothing changes.

Tested on a K116s: deep sleep with no alarm, woken by the lid.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Looks right. Requiring an armed RTC alarm was stricter than the wake sources need, since the SMC wakes for the lid and keys without it, and with an alarm armed the path is unchanged. The commit rearm is already skipped without a valid alarm, so a lid-only sleep has nothing left to rearm. The J714s 67 s and 2 h 28 min lid sleeps, plus the K116s history, cover the case this enables. The remaining gap you list, an RTC-alarm sleep on the J714s with this commit, is worth one run before merge, since that's the path a scheduled wake (and the lab's dead-man) depends on.

Assisted-by: LLM (Claude:Opus 5.5)

@axboe

axboe commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

Ryan, for the alarm path with the commit, the K116s side from today: one 30 s RTC-alarm deep sleep on integration/aurora a84637d plus my stack (this commit in it), woken by the alarm (wake events: NUB.SPMI0Sw3IRQ nub-spmi0.0x02 rtc), resumed on the same boot. Four sleep entries with no alarm armed on that boot as well. The J714s alarm run is Isaac's.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

J714s (M5 Pro, T6050) Hardware Row — 26bf5f527f1e

Tested clean cherry-pick of 26bf5f527f1e67bb6807fbc2490d0b0a6b8fc0b7 (drivers/soc/apple/sleep-t6050.h, +5/-1, 0-byte patch diff vs PR) on J714s (M5 Pro, T6050), MTE enabled (arm64.nomte absent), SEP writes enabled, mem_sleep = [deep].

  • 3/3 clean RTC-alarm deep sleeps (rtcwake -m mem -s 15):
    • Cycle 1: rc=0, asleep=14.8 s, refusal=0, 14 coprocessors up and stopped, wake events: NUB.SPMI0Sw3IRQ nub-spmi0.0x02 rtc, MBSE 0x10650, MBSW 00 00 00 00 00 00 00 00, boot object resumes 0 -> 1, AOP restarted (6/6 endpoints).
    • Cycle 2: rc=0, asleep=14.7 s, refusal=0, pure RTC wake (MBSE 0x10650, MBSW 00..00).
    • Cycle 3: rc=0, asleep=15.4 s, refusal=0, pure RTC wake (MBSE 0x10650, MBSW 00..00).
  • Subsystem & regression checks (boot + after all 3 wakes): 3/3 displays, 20/20 USB devices (TB5 dock), Wi-Fi (apple_centauri_t6050), Bluetooth, NVMe, AOP/sensors/audio, and GPU Vulkan (vulkaninfo + compute dispatch) all healthy; 0 DART faults, 0 oops/WARN, 0 SELinux AVCs, 0 new failed units (only pre-existing tailscaled.service on baseline).

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

Reviewed head 26bf5f527f1e67bb6807fbc2490d0b0a6b8fc0b7 against pre-pr-checklist.md.

Verdict: Approve (no blockers)

Code & correctness (drivers/soc/apple/sleep-t6050.h, +5/-1)

  • t6050_sleep_check_alarm() clears r->alarm_valid = false on entry, still fails closed on any SPMI/PMU read error, and returns 0 when the RTC alarm is neither armed nor unmasked (!(control & T6050_RTC_CTL_ARMED) || (mask & BIT(0))), leaving r->alarm_valid = false.
  • t6050_sleep_final_check() re-runs t6050_sleep_check_alarm() before the irreversible enclave/commit boundary and returns 0 when !r->alarm_valid, avoiding stale alarm_compare checks if an alarm is disarmed between .check and .final_check.
  • Armed-alarm sleeps preserve the full T6050_RTC_COMPARE / T6050_RTC_COUNTER proximity check (-ETIME) and post-timer rearm path unchanged.
  • Non-T6050 SoCs are untouched, and there is no semantic conflict with current integration/aurora (t6050_sleep_pmu_wake does not depend on alarm_valid).

Non-blocking nit

  • drivers/soc/apple/sleep-t6050.h:692-695 (t6050_sleep_post_timer): if (!r->alarm_valid || !r->alarm_rearm_valid) { r->pmu_errors++; return; } still increments r->pmu_errors when no alarm is armed. Since r->pmu_errors is only reported in dev_dbg() in t6050_sleep_finish(), this has no functional effect, but a clean no-alarm sleep will log PMU 1/0 under dynamic debug; returning early on !r->alarm_valid without bumping pmu_errors would be cleaner in a follow-up.

Checklist & evidence

  • No model/board/firmware gating, default cmdline, safety, clean-room: Pass. Gates purely on PMU RTC register state.
  • Attribution: Pass. Single commit 26bf5f527f1e carries human identity and Signed-off-by: Jens Axboe <axboe@kernel.dk> only (no agent trailers).
  • CI: 7/7 checks green (host-tests, source, rust-build, kunit, and all three DWC3/ATC builds); mergeable/clean.
  • Hardware evidence: Both paths are covered across two T6050 boards:
    • J714s (M5 Pro, T6050): exact-head 3/3 RTC-alarm deep sleeps PASS with full subsystem and regression check (0 DART faults, 0 oops/WARN, 0 SELinux AVCs, 0 new failed units) in #issuecomment-7068612666, plus 2/2 no-alarm lid-close deep sleeps PASS (67 s and 2 h 28 min, vs pre-patch SoC check: -16 refusal) in #2201#issuecomment-7046639840.
    • K116s (T6050): 4 no-alarm lid sleeps and 1 RTC-alarm 30 s deep sleep on the same boot (#issuecomment-7066031200).
    • (Note: #issuecomment-7068612666 verified the RTC-alarm regression path on exact head 26bf5f527f1e; the J714s no-alarm lid-close proof is carried from Isaac's 2/2 row on the same 5-line commit in #2201.)

Assisted-by: LLM (Google:Gemini 4 Neon)

@DjDeveloperr
DjDeveloperr merged commit 97868a7 into aurora-silicon:integration/aurora Nov 21, 2026
7 checks passed
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.

3 participants