Skip to content

feat(mock): Drive battery _PSR from power policy - #58

Open
tullom wants to merge 1 commit into
OpenDevicePartnership:mainfrom
tullom:battery/mock-power-policy-psr
Open

tullom wants to merge 1 commit into
OpenDevicePartnership:mainfrom
tullom:battery/mock-power-policy-psr

Conversation

@tullom

@tullom tullom commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Add a mock power policy so battery _PSR follows a mock wall adapter, plugged in and out by GPIO2 on dev-qemu. Bump QEMU to latest qemu-builder hash for GPIO2 and let qemu-ec.sh set it up for time-alarm-power-input builds.

Assisted-by: GitHub Copilot:claude-opus-5.5

Add a mock power policy so battery _PSR follows a mock wall adapter,
plugged in and out by GPIO2 on dev-qemu. Bump QEMU to latest qemu-builder hash for
GPIO2 and let qemu-ec.sh set it up for time-alarm-power-input builds.

Assisted-by: GitHub Copilot:claude-opus-5.5
@tullom tullom self-assigned this Nov 12, 2026
@tullom
tullom requested a review from a team as a code owner November 12, 2026 23:59
@tullom tullom added the enhancement New feature or request label Nov 12, 2026
@tullom
tullom requested review from RobertZ2011, dymk, maxperga-msft and rogurr and a balanced review from Copilot November 12, 2026 23:59

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

End-to-end QEMU validation is needed for cold AC/DC starts and GPIO2 transitions through power policy to host-visible _PSR, which the default-build integration script does not query.

No open issues 🎉

What changed in this PR

This PR connects the shared mock battery service to a mock power policy so battery _PSR follows the wall-adapter state controlled by GPIO2 on dev-qemu.

Changes:

  • Add a mock PSU and route power-policy notifications to the battery service.
  • Connect GPIO2 AC/DC changes to both TimeAlarm and the mock adapter.
  • Update the QEMU runner, pinned image, runtime dependencies, and documentation for power-input builds.
File Description
platform/​platform-common/​src/​mock/​time_alarm.rs Update mock adapter attachment when the power input changes.
platform/​platform-common/​src/​mock/​power_policy.rs Add the mock PSU, adapter control, and power-policy task.
platform/​platform-common/​src/​mock/​mod.rs Initialize power policy and expose the PSU control handle.
platform/​platform-common/​src/​mock/​battery.rs Process power-policy events through a shared battery service.
platform/​platform-common/​Cargo.toml Add power-policy dependencies.
platform/​platform-common/​Cargo.lock Lock the shared library’s power-policy dependencies.
platform/​dev-qemu/​src/​main.rs Pass PSU control to the GPIO2 monitoring task.
platform/​dev-qemu/​README.md Document runtime power switching and QEMU requirements.
platform/​dev-qemu/​qemu-ec.sh Configure GPIO2, update QEMU, and cache binaries per image tag.
platform/​dev-qemu/​Cargo.lock Include power-policy dependencies for QEMU.
platform/​dev-qemu/​build.rs Mark power-input binaries for runner detection.
platform/​dev-npcx/​Cargo.lock Include the new shared power-policy dependencies.
platform/​dev-mec/​Cargo.lock Include the new shared power-policy dependencies.
platform/​dev-mcxa/​Cargo.lock Include the new shared power-policy dependencies.
platform/​dev-imxrt/​Cargo.lock Include the new shared power-policy dependencies.
.github/​workflows/​check.yml Update the QEMU image and install required runtime libraries.

Review effort: Balanced

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

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants