Repository navigation
tools/power-ab: a systemd suspend mode, and a gauge without charge_counter - #157
Conversation
…unter The s2idle test froze through rtcwake -m freeze, which skips the system-sleep hooks; on the palmtop (Pixel 9a) the NFC hook must run, since polling through s2idle has reset it. --suspend systemd arms the RTC alarm and runs systemctl suspend, waiting for the suspend success count to move. The 9a's gauge has charge_now but no charge_counter, so the test now accepts either; the summary already used charge_now as its cross-check. Tried on the palmtop: one 40 s cycle with the hooks, woken by the RTC, NFC polling again afterwards.
|
Thank you, this is a tidy change and the default is handled well. With no One thing before it merges:
if [[ $suspend == systemd ]]; then
msm=$(systemd-analyze cat-config systemd/sleep.conf 2>/dev/null |
sed -n 's/^MemorySleepMode=//p' | tail -n1)
if [[ -n $msm ]]; then [[ ${msm%% *} == s2idle ]]
else grep -q '\[s2idle\]' /sys/power/mem_sleep; fi ||
{ echo "power-ab: systemctl suspend would not enter s2idle here" >&2; exit 1; }
fiPlease also reject an unknown Not blocking:
The policy check and both CI jobs pass, and the script parses. |
…ects a typo systemctl suspend enters what sleep.conf and mem_sleep resolve to, and deep never wakes on these phones, so the systemd mode checks MemorySleepMode from the merged sleep.conf (or the selected mem_sleep) and refuses otherwise; an unknown --suspend value is an error instead of the rtcwake path. With less than 30 s left in a phase the systemd mode stays awake for the remainder, since the hooks run before the freeze and a short alarm could fire first. The usage names the mode, and the summary says what the reported-charge column is.
…oot, S1's command and column S2 says it turns LDO15S off on purpose for one boot against FINGERPRINT-PLAN's rule (that plan gets the matching note once derekross#138 is on main), and step 3 keeps omamobile-fp, the trusted app and storageproxyd stopped before the push and until the rollback, since F6c still writes secure objects. S1 names its command, power-ab with derekross#157's systemd suspend mode (rtcwake -m no plus systemctl suspend, so the NFC hook runs), reads charge_now, column 7, because the 9a's gauge has no charge_counter, and waits for derekross#157. Also: derekross#125's rules are being settled; the four rails read disabled with or without the unused-rail cleanup; stock's source grepped for the four rail names (DT sources and the register header only, no module asks by name); a Polling read before each run; nothing starts the modem at boot, so nothing to mask.
|
All in at 3dabf3a: the systemd mode now checks MemorySleepMode from the merged sleep.conf, or the selected entry of mem_sleep when there's none, and refuses unless that's s2idle (your snippet, as written); an unknown --suspend value is an error; with less than 30 s left in a phase the systemd mode stays awake for the remainder rather than arm a short alarm under the hooks; the usage names the mode; and the summary says the reported-charge column is the gauge's model-corrected figure, coarser than a coulomb counter. bash -n and pr-check pass. The 9a's board DT has mem_sleep_default=s2idle, so the check passes there, and I'll re-run the short cycle with this version before the cable-out run for #144. |
|
Re-ran the short cycle on the palmtop with 3dabf3a: the s2idle check passed (the 9a's sleep.conf drop-in names s2idle), one 40 s awake / 40 s sleep cycle through systemctl suspend, woken by the RTC, suspend_stats 1 success 0 fail, NFC polling back afterwards. |
* device/tegu: SLEEP-PLAN, an audit of the s2idle drain The 9a sleeps and wakes, but its drain is high. This audits why from stock's device tree and a snapshot of the palmtop: no cluster or SICD idle states, the GNSS and fingerprint rails always on in the bring-up DTB, and MIF, with a measurement runbook. * device/tegu SLEEP-PLAN: the firmware's PSCI has no OS-initiated mode So cluster states on zumapro would be platform-coordinated, with a composite StateID; and the core state's rejection rate, read from cpuidle. * device/tegu SLEEP-PLAN: start from what's measured The cable-out s2idle figure (about 140 mA), MIF in sleep (about 57 mA saved), and the cluster power-down tries of 10-28 (cluster 0 hangs; clusters 1-2 save nothing measurable) were already measured; the candidates are re-ranked on them. * device/tegu SLEEP-PLAN: S2's image, its expectation and rollback * device/tegu SLEEP-PLAN: the review's preconditions, S2's before and after, the code by commit The runbook stops if slot B isn't marked successful and doesn't mark it (a devinfo write on the 9a, #125). S1 needs the NFC stop-poll hook active or polling stopped by hand, with the kernel's #131 state and the rule that stays, a Rollback line and pstore after a cycle that doesn't come back. S2 snapshots regulator_summary before and diffs it after, stops if more than the four rails changed, records stock's consumers of them (none in its DT: no phandle on any of the four, the GNSS three on the PMIC's channel mux, LDO15S a spare), keeps the modem off in that boot and stays away from a G3 session. The push wording says what bin/omamobile push writes and that only vendor_kernel_boot differs. The module, the bring-up DT and the S2 change are linked by commit on the fork's tegu-sleep-bringup branch, and the CPU_INFORM hints of 10-28 are credited to the bring-up module that wrote them over the PMU SMC. The measurements link #100's NOTES entry. * device/tegu SLEEP-PLAN: the fingerprint stack stays stopped in S2's boot, S1's command and column S2 says it turns LDO15S off on purpose for one boot against FINGERPRINT-PLAN's rule (that plan gets the matching note once #138 is on main), and step 3 keeps omamobile-fp, the trusted app and storageproxyd stopped before the push and until the rollback, since F6c still writes secure objects. S1 names its command, power-ab with #157's systemd suspend mode (rtcwake -m no plus systemctl suspend, so the NFC hook runs), reads charge_now, column 7, because the 9a's gauge has no charge_counter, and waits for #157. Also: #125's rules are being settled; the four rails read disabled with or without the unused-rail cleanup; stock's source grepped for the four rail names (DT sources and the register header only, no module asks by name); a Polling read before each run; nothing starts the modem at boot, so nothing to mask.
… rounds L-348 to L-361: shared drivers judged against every int-line user (#150), board pins against every stock user (#151), ownership flags under the consumer's lock (#152), /chosen children and Google's panel constants (#154), same-day notes PRs on one device (#208/#209), merge simulations for DEVICES rows, ours included (#165), stacked PRs that merged main (#115/#117), titles behind renumbered versions, a contributor merge that dropped the PR (#99), smoke package lists as provenance and "owner-authorized" writes (#200), promised fixes and named tags checked on the remote (#153/#157/#158), and file swaps into old packages (#193). C-23 (usbc-deadman's device scope, kernel #107) and C-24 (BNEP in a lynx-only fragment, #98). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…unter (derekross#157) --suspend systemd runs the A/B drain cycles through systemctl suspend, so sleep hooks (the 9a's NFC stop-poll) run; it refuses unless s2idle is the mode that will actually run, and rejects unknown --suspend values, so a phone without mem_sleep_default=s2idle can't enter deep with the cable out. A gauge without charge_counter (the 9a's) is read through charge_now. The default rtcwake mode is unchanged. Co-authored-by: W4HO-ham <87742609+W4HO-ham@users.noreply.github.com>
* device/tegu: SLEEP-PLAN, an audit of the s2idle drain The 9a sleeps and wakes, but its drain is high. This audits why from stock's device tree and a snapshot of the palmtop: no cluster or SICD idle states, the GNSS and fingerprint rails always on in the bring-up DTB, and MIF, with a measurement runbook. * device/tegu SLEEP-PLAN: the firmware's PSCI has no OS-initiated mode So cluster states on zumapro would be platform-coordinated, with a composite StateID; and the core state's rejection rate, read from cpuidle. * device/tegu SLEEP-PLAN: start from what's measured The cable-out s2idle figure (about 140 mA), MIF in sleep (about 57 mA saved), and the cluster power-down tries of 10-28 (cluster 0 hangs; clusters 1-2 save nothing measurable) were already measured; the candidates are re-ranked on them. * device/tegu SLEEP-PLAN: S2's image, its expectation and rollback * device/tegu SLEEP-PLAN: the review's preconditions, S2's before and after, the code by commit The runbook stops if slot B isn't marked successful and doesn't mark it (a devinfo write on the 9a, derekross#125). S1 needs the NFC stop-poll hook active or polling stopped by hand, with the kernel's derekross#131 state and the rule that stays, a Rollback line and pstore after a cycle that doesn't come back. S2 snapshots regulator_summary before and diffs it after, stops if more than the four rails changed, records stock's consumers of them (none in its DT: no phandle on any of the four, the GNSS three on the PMIC's channel mux, LDO15S a spare), keeps the modem off in that boot and stays away from a G3 session. The push wording says what bin/omamobile push writes and that only vendor_kernel_boot differs. The module, the bring-up DT and the S2 change are linked by commit on the fork's tegu-sleep-bringup branch, and the CPU_INFORM hints of 10-28 are credited to the bring-up module that wrote them over the PMU SMC. The measurements link derekross#100's NOTES entry. * device/tegu SLEEP-PLAN: the fingerprint stack stays stopped in S2's boot, S1's command and column S2 says it turns LDO15S off on purpose for one boot against FINGERPRINT-PLAN's rule (that plan gets the matching note once derekross#138 is on main), and step 3 keeps omamobile-fp, the trusted app and storageproxyd stopped before the push and until the rollback, since F6c still writes secure objects. S1 names its command, power-ab with derekross#157's systemd suspend mode (rtcwake -m no plus systemctl suspend, so the NFC hook runs), reads charge_now, column 7, because the 9a's gauge has no charge_counter, and waits for derekross#157. Also: derekross#125's rules are being settled; the four rails read disabled with or without the unused-rail cleanup; stock's source grepped for the four rail names (DT sources and the register header only, no module asks by name); a Polling read before each run; nothing starts the modem at boot, so nothing to mask.
… rounds L-348 to L-361: shared drivers judged against every int-line user (derekross#150), board pins against every stock user (derekross#151), ownership flags under the consumer's lock (derekross#152), /chosen children and Google's panel constants (derekross#154), same-day notes PRs on one device (derekross#208/derekross#209), merge simulations for DEVICES rows, ours included (derekross#165), stacked PRs that merged main (derekross#115/derekross#117), titles behind renumbered versions, a contributor merge that dropped the PR (derekross#99), smoke package lists as provenance and "owner-authorized" writes (derekross#200), promised fixes and named tags checked on the remote (derekross#153/derekross#157/derekross#158), and file swaps into old packages (derekross#193). C-23 (usbc-deadman's device scope, kernel derekross#107) and C-24 (BNEP in a lynx-only fragment, derekross#98). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ekross#221) options clk_acpm zuma_gpu_max_khz=890000, as tegu's zumapro_gpu_max_khz: the cap kernel derekross#157 adds, with OPPs to 890 MHz and a gpu-thermal passive trip at 85 °C. Without derekross#157 the option is ignored.
Two small things the sleep-drain audit on the 9a (#144) needed from this tool:
--suspend systemd: the s2idle phase arms the RTC alarm withrtcwake -m noand runssystemctl suspend, so the system-sleep hooks run (on the 9a the NFC stop-poll hook has to), and waits for/sys/power/suspend_stats/successto move. The default staysrtcwake, the old behaviour, so cheetah's runs don't change.charge_nowbut nocharge_counter(the 9a's max77779) is accepted; the summary already readcharge_nowas its cross-check column, so for such a gauge that is the sleep-phase figure.Tried on the palmtop: a 40 s awake / 40 s sleep cycle through systemd, woken by the RTC, SSH and NFC polling back afterwards; the two-hour run with the cable out is in progress for #144. Nothing else runs on a phone;
tools/pr-checkpasses.