Skip to content

Expose TimeAlarm source and wake signals - #968

Merged
dymk merged 2 commits into
OpenDevicePartnership:mainfrom
dymk:dymk/time-alarm-wake-signal
Nov 2, 2026
Merged

dymk merged 2 commits into
OpenDevicePartnership:mainfrom
dymk:dymk/time-alarm-wake-signal

Conversation

@dymk

@dymk dymk commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Add board-facing methods to select the active AC/DC timer and await changes to the wake-request level. The level remains asserted while either timer has a triggered-wake latch; clear, disable, and reprogram operations update it. Existing callers retain the AC startup default and the nine-command relay format is unchanged.

Source transitions and wake publication are serialized. A stale timer expiry can no longer bypass the remaining policy delay after a source change.

Part of #689. This supplies the library boundary for a CPU retention-wake test; it does not implement power-source hardware detection or prove host resume.

13 host tests pass, including 11 new source/latch/policy cases. Host and Thumb Clippy feature combinations and Thumb no_std builds pass. Stacked AC/DC CPU-retention wake, disconnected/inactive guard cases, clear/rearm, and existing native/Windows RTC regressions now pass through the board and virtual GPIO changes in OpenDevicePartnership/odp-platform-qemu-arm-virt#182.

Comment thread time-alarm-service/src/timer/tests.rs Resolved
Comment thread time-alarm-service/src/lib.rs Resolved
Comment thread time-alarm-service/src/lib.rs Resolved
Comment thread time-alarm-service/src/lib.rs Resolved
Comment thread time-alarm-service/src/lib.rs Resolved
Copilot AI balanced review requested due to automatic review settings October 13, 2026 18:57
@dymk
dymk force-pushed the dymk/time-alarm-wake-signal branch from 3e6aecd to baf1a15 Compare October 13, 2026 18:57

Copilot AI 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.

🟢 Approval recommended

The synchronization model, stale-expiry handling, public API behavior, and tests are consistent and complete.

0 open findings

What changed in this PR

Adds board-facing power-source selection and wake-level signaling while preserving AC as the default. Timer transitions and combined wake publication are serialized, preventing stale expiries from bypassing policy delays.

Changes:

  • Adds synchronous AC/DC source selection.
  • Publishes the combined triggered-wake level.
  • Adds extensive source, latch, policy-delay, and concurrency tests.

Review Guide

  1. Source transitions now update timer activity synchronously.
  2. Expiry processing rejects superseded deadlines and atomically publishes wake state.
  3. Tests cover both sources, coalescing, rearming, and concurrent clears.

Potential Issues

No issues identified.

File Description
time-alarm-service/​src/​lib.rs Exposes source selection and wake signaling with serialized updates.
time-alarm-service/​src/​timer.rs Separates expiry waiting from synchronized expiry processing.
time-alarm-service/​src/​timer/​tests.rs Adds comprehensive behavioral and concurrency coverage.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Allow board code to select AC or DC synchronously and consume the latched wake-request level. Publish level changes when alarms expire or their latches clear, preserving the relay wire contract.

Assisted-by: GitHub Copilot:gpt-6-astra

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dymk
dymk force-pushed the dymk/time-alarm-wake-signal branch from baf1a15 to 54eb80e Compare November 2, 2026 17:30
Move power-source selection and the wake-request level into the
TimeAlarmService trait. Back the level with a Watch so each consumer
gets its own receiver and is notified only when the level changes.

Document why each timer test exists.

Assisted-by: GitHub Copilot:claude-opus-5.5
@dymk
dymk merged commit 3ff41f5 into OpenDevicePartnership:main Nov 2, 2026
16 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.

4 participants