Skip to content

power: add charge-aware auto sleep mode for Pocket EVO - #273

Open
jesherman wants to merge 1 commit into
armada-os:mainfrom
jesherman:codex/pocket-evo-auto-sleep
Open

power: add charge-aware auto sleep mode for Pocket EVO#273
jesherman wants to merge 1 commit into
armada-os:mainfrom
jesherman:codex/pocket-evo-auto-sleep

Conversation

@jesherman

Copy link
Copy Markdown
Contributor

Summary

Adds an "Auto adjust" sleep-mode option to armada-control that resolves per suspend: s2idle when a charger is present, deep sleep otherwise.

Why

Deep sleep powers down the ADSP on the Pocket EVO, which kills the PD contract and the battery-manager firmware:

  • a plugged-in EVO in deep sleep drains instead of charging (0 W in, ~1.5 A out)
  • the UCSI firmware can come back in source mode on wake (2 of 3 wakes in testing), requiring an ADSP restart to recover
  • charging is uninterrupted in s2idle (ADSP stays alive; ~15–20 W through sleep, clean wake, charging resumes immediately)

"Auto adjust" picks per-suspend so the charge state can't be misconfigured: plugged → s2idle (charging continues), unplugged → deep (battery savings).

Design

The choice is resolved at suspend time, not stored as a kernel mode:

  • device-env — accepts auto in /etc/armada/sleep.conf and resolves it to s2idle/deep from the qcom-battmgr USB supply (online=1 → s2idle, else deep). Every existing consumer (suspend-dispatch, device-quirks) sees only a concrete mode — no change to the suspend path.
  • armada-control — advertises the new option in available_sleep_modes(); select_mem_sleep() deliberately skips writing /sys/power/mem_sleep for it (it is a resolution layer, not a kernel mode).
  • decky system.py — adds the "Auto adjust" entry to the sleep-mode menu.

No kernel changes; no behavior change when the option is not selected (existing modes unchanged).

Verification (on-device, hybrid 7.2.0-rc7)

  • Plugged s2idle: ~15–20 W held through sleep, PD contract survives, battery charging on wake, policy re-establishes 28 W in ~90 s
  • Unplugged deep: no charging (battery preserved)
  • Charger attached during deep sleep: clean wake, PD renegotiates to PPS, charging resumes — no wedge
  • 11-check automated harness (resolution, parsing, explicit-mode precedence) all passing

Closes the sleep-charging gap for Pocket EVO owners without forcing a single sleep mode on everyone.

Deep sleep powers down the ADSP, killing the PD contract and the
battery-manager firmware: a plugged-in EVO drains instead of charging
(0 W in, ~1.5 A out) and the UCSI firmware can come back in source
mode on wake. s2idle keeps the ADSP alive, so charging continues
through sleep with a clean wake.

Add an 'auto adjust' sleep mode that resolves per suspend: s2idle
when a charger is present, deep otherwise. device-env resolves the
choice from the qcom-battmgr USB supply so every consumer
(suspend-dispatch, device-quirks) sees only a concrete mode; the
armada-control backend and decky menu advertise the new option.

Verified on-device (Pocket EVO, hybrid 7.2.0-rc7): plugged s2idle
holds ~15-20 W through sleep with charging continuing and a clean
wake; unplugged deep preserves the battery; attaching a charger
during deep sleep no longer wedges the device.
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.

1 participant