Skip to content

Select TimeAlarm source from emulated GPIO2 - #51

Open
dymk wants to merge 2 commits into
OpenDevicePartnership:mainfrom
dymk:dymk/time-alarm-power-input
Open

dymk wants to merge 2 commits into
OpenDevicePartnership:mainfrom
dymk:dymk/time-alarm-power-input

Conversation

@dymk

@dymk dymk commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Add an opt-in time-alarm-power-input mode. It checks GPIO2 initialization before starting TimeAlarm, selects AC for high and DC for low, and updates the service when the input changes. GPIO1 remains the wake output; GPIO0 remains HID. Default builds and explicit construction-time AC/DC fixtures remain unchanged.

This is QEMU-emulated external power, not physical hardware detection or Windows power-policy notification. Uninitialized input fails startup rather than silently selecting DC.

Depends on #50 and OpenDevicePartnership/odp-qemu-builder#12. This is the single commit after #50, now on upstream's HID TimeAlarm (#53) and using #50's init_with_time_alarm_configure. The temporary HAL fork pin keeps the I2C transaction-boundary fix and adds the generated input-validity register and typed accessor.

Default, wake-fixture, and power-input release builds, strict Clippy, fmt, and cargo vet pass. Real FF-A/SP/EC source-switch qualification passes for both cold AC and DC starts in OpenDevicePartnership/odp-platform-qemu-arm-virt#183, including INSTANTLY versus NEVER after acknowledged source changes; the four retention wake cases also pass with this EC.

Part of OpenDevicePartnership/embedded-services#689. Windows-managed S4 work is separate.

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Cargo Vet Audit Passed

cargo vet has passed in this PR. No new unvetted dependencies were found.

felipebalbi and others added 2 commits October 13, 2026 19:02
Configure an explicit AC or DC source before starting the timer runner
and drive its latched wake level on GPIO1. Disable initial fixture alarms
to keep startup idle-low and leave ordinary initialization unchanged.

Preserve upstream's shared HID TimeAlarm and MCTP services and the
one-argument initializer. Pin the rebased library wake changes and retain
the HAL's zero-gap I2C transaction-boundary fix.

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

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Require an initialized input before starting the runner and track source changes with GPIO level interrupts. Preserve default builds and the construction-time wake fixtures.

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-power-input branch from f12cf11 to f27725d Compare October 16, 2026 22:32
@dymk
dymk marked this pull request as ready for review October 19, 2026 20:00
@dymk
dymk requested a review from a team as a code owner October 19, 2026 20:00
@dymk
dymk requested review from kat-perez, maxperga-msft, rogurr and williampMSFT and a balanced review from Copilot October 19, 2026 20:00

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

🔵 Needs a closer look

Coordinated HAL, QEMU, and service dependencies require final human integration review of interrupt and wake behavior.

No open issues 🎉

What changed in this PR

Adds opt-in GPIO2-based AC/DC selection to QEMU’s shared TimeAlarm service, preserving default initialization and explicit wake fixtures.

Changes:

  • Validates and selects the initial power source before TimeAlarm starts, then tracks GPIO2 changes.
  • Keeps GPIO1 as the wake output and GPIO0 as the HID interrupt.
  • Adds feature flags, dependency updates, and fixture documentation.
File Description
platform/​platform-common/​src/​mock/​time_alarm.rs Adds configuration before the service runner starts.
platform/​platform-common/​src/​mock/​mod.rs Exposes configurable TimeAlarm initialization.
platform/​dev-qemu/​src/​main.rs Implements source selection, monitoring, and wake output.
platform/​dev-qemu/​src/​board.rs Configures GPIO1 output and asynchronous GPIO2 input.
platform/​dev-qemu/​README.md Documents wake fixtures and emulated power input.
platform/​dev-qemu/​Cargo.toml Adds opt-in features and pins the temporary HAL fork.
platform/​dev-qemu/​Cargo.lock Updates HAL and service dependency revisions.

Review effort: Balanced

@dymk
dymk enabled auto-merge (squash) October 19, 2026 23:01

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants