Enable validated deep sleep and charger wake - #1
Conversation
9b4b3ab to
7260963
Compare
|
Post-rebase firmware integration fix The latest armada-packages rebase included upstream commit 63010cc, which gives the RP6 a device-specific ADSP and speaker-firmware path at qcom/sm8550/retroidpocket/rp6. The Armada image still shipped those known-working blobs only at qcom/sm8550/ayn/odin2, so the first combined snapshot could not start the ADSP. On hardware this appeared as zero ALSA cards and battery power-supply attributes returning EAGAIN/0%. Commit 8936883 adds a forward-compatible RP6 firmware alias to the existing Odin 2 firmware directory. A native RP6 firmware directory can replace the alias later without another DTB change. The image build now fails if the ADSP, ADSP DTB, speaker-amplifier, battmgr, or ADSP JSON files are unresolved. All eight ARM64 Fedora tests pass, including the new RP6 firmware layout regression test. |
Summary
ARMADA_MEM_SLEEP_MODEpolicydeepsuspend for Retroid Pocket 6, AYN Odin 2/Mini/Portal, and AYN ThorSuspendState=memuser.sliceremains frozenwakeup_count/power/state-EBUSYracesWhy
Armada's existing real-suspend dispatcher writes
membut does not select or validate the underlying/sys/power/mem_sleepvariant. Devices can therefore enter the kernel default rather than deep suspend, while unsupported devices need to retain fake suspend safely.This PR keeps fake suspend as the global default and opts in only devices covered by the accompanying kernel fixes.
On SM8550, USB-C and battery state are owned by charger firmware on the ADSP and delivered through PMIC GLINK. A real charger attach and unsolicited
BATTMGR_NOTIFICATIONtraffic therefore share the same IPCC/GLINK wake transport. The interrupt handler cannot know the packet semantics before the AP resumes.Android handles this with a continuously running autosuspend policy. Armada uses a one-shot systemd suspend transaction, so without an equivalent policy every background GLINK notification ends suspend and thaws Gamescope. The new system-sleep hook classifies the wake while
user.sliceis still frozen and uses the standard atomicwakeup_countprotocol to re-enter deep sleep when the wake is transport-only.Kernel dependency: gh123man/armada-packages#1
The implementation research and kernel/userspace boundary are documented in
docs/deep-sleep-charger-wake.md.Build-only Justfile changes
The Justfile diff is unrelated to suspend behavior and does not change the installed image. It is a behavior-preserving compatibility adjustment made so the local image build can run with macOS's bundled Bash 3.2:
mapfileand associative-array package validation with an indexed array populated bywhile readand a linear membership checkGITHUB_TOKENsecret directly toBUILD_ARGS, avoiding expansion of an emptySECRET_ARGSarray under Bash 3.2 withset -uArmada's normal modern-Linux build environment does not require these changes. They can be split into a separate PR or dropped without affecting the kernel, deep-sleep policy, or runtime behavior.
Validation
bash -npassed for the dispatcher, wake policy, and test scriptstests/suspend-dispatch-test.shpassed, including fake suspend, successful deep selection, unavailable deep, invalid variants, and direct state fallbacktests/suspend-wake-policy-test.shpassed, including power-key priority, unknown-wake fail-open behavior, charger attach, plugged → unplug → replug tracking, background GLINK resuspend, and transient-EBUSYretrymem+deep; non-opted-in devices remain on fake suspendbootc container lintcheckswake-policy-power-state-0c1f4b81on a Retroid Pocket 6 with Linux 7.0.11-EBUSY; the bounded retry fix kept the device asleep and subsequent suspend accounting remained cleanKnown behavior
A background unplug/GLINK wake can briefly expose the last compositor frame (often the sleep-animation frame) before the policy returns to deep sleep. The kernel must resume the AP and display devices before the PMIC GLINK packet can be decoded, while the policy runs later in the systemd-sleep post hook. Gamescope remains frozen and the device does return to real deep sleep; eliminating the flash safely requires earlier display blanking or a kernel/display coordination change and is intentionally left for follow-up.