Skip to content

device/tegu: SLEEP-PLAN, an audit of the s2idle drain - #144

Merged
derekross merged 6 commits into
derekross:mainfrom
W4HO-ham:tegu-sleep-plan
Oct 29, 2026
Merged

derekross merged 6 commits into
derekross:mainfrom
W4HO-ham:tegu-sleep-plan

Conversation

@W4HO-ham

@W4HO-ham W4HO-ham commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Piece 13's open item: s2idle works on the 9a, but it draws about 140 mA with the cable out (10-27). The plan gathers what's measured: MIF at 421 MHz in sleep saves about 57 mA with the cable in, and the 10-28 cluster power-down tries (cluster 0 hangs; clusters 1 and 2 are stable but save nothing measurable). It adds an audit from Google's zumapro-cpu.dtsi and a read-only snapshot of the palmtop, which shows the bring-up DTB keeps the three GNSS rails and udfps-3v3 always on. The candidates are ranked, with a measurement runbook. S1 needs the cable out and is attended. Docs only.

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.
So cluster states on zumapro would be platform-coordinated, with a composite StateID; and the core state's rejection rate, read from cpuidle.
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.
@derekross

Copy link
Copy Markdown
Owner

Thank you for this. It's exactly the kind of plan the drain needed: what's measured, what was tried and dropped (cluster power-down, with the reason Google never powers down cluster 0), and a ranked list with the cable-in MIF figure kept apart from the cable-out one. Finding the GNSS rails and udfps-3v3 left always-on is a very plausible lead.

A few things before it merges. They're all small text changes, but the first two matter for safety:

  1. S2: "with slot B marked first". On the 9a, marking slot B is a devinfo write. We're still settling the rules for that on AGENTS, device/tegu: a fallback to slot A on the 9a costs the Linux root #125, and it's not part of this test. As written, S2 reads as an instruction to mark. Please use the same precondition as USB-HOST-PLAN: "Stop if slot B isn't marked successful; this runbook doesn't mark it."
  2. NFC across the suspends. S1 and S2 run systemctl suspend cycles. On the 9a, a suspend with neard polling has reset the palmtop (AGENTS, "Suspend and modem"), and the sleep hook that stops polling isn't in the repository yet. Please add a precondition to S1: the stop-poll hook is installed and active (or polling stopped by hand), and say whether the kernel has nfc: nxp-nci: Turn the ST54L's NFC mode on after init linux-omarchy-mobile#131 (see AGENTS: on the 9a, NFC needs the ST54L's NFC mode on (linux-omarchy-mobile#131), not a power-off hook #137).
  3. The code S1 and S2 boot. S1 loads tegu-mif-sleep, and S2 edits the palmtop's bring-up DTB. Neither is in a public tree. Please push both to a bring-up branch on your fork of linux-omarchy-mobile, as you did with docs/review: 34 lessons and 3 corrections from the twenty-fifth and twenty-sixth rounds #127, and link it by commit in the plan, before they run.
  4. S2 needs a Stop line and a "before". The Expect says the four rails read disabled about 30 s after boot. Please snapshot /sys/kernel/debug/regulator/regulator_summary before the change and diff it after, with a Stop if anything other than LDO9S-11S and LDO15S changed. Before turning them off, please also check stock's DT for any other consumer of those four LDOs, since a rail that looks like GNSS-only can feed something else too. Also say "don't start the modem in this boot", since the S5300's GNSS supplies are off.

Not blocking:

  • "A push of vendor_kernel_boot only": bin/omamobile push writes every image in BOOT_IMAGES. What you describe (only vendor_kernel_boot differs) is right, so maybe word it that way.
  • S1 could use a Rollback line (rmmod tegu-mif-sleep, or a reboot) and a note to read /sys/fs/pstore if a cycle doesn't come back.
  • The measurements come from device/tegu, DEVICES, AGENTS: the 9a on 2026-10-27 and 10-28 #100's NOTES, so a link to that entry would help.
  • For the record: which code wrote the CPU_INFORM hints in the 10-28 cluster tries? I assume a kernel change through the PMU regmap, like your C2 commit. If so, a line saying where it lives would help. If SICD ever becomes a step, the PMU sequence must go through the kernel too, never userspace.
  • S2 turns GNSS off for a boot, so it's best kept away from a G3 session.

The policy check and CI pass, and the plan has no identifiers. This one has no textual conflicts with the other open tegu PRs. It reads best after #100, since it quotes that entry's measurements.

…fter, 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.
@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Thanks, all done in 5e8368b.

  1. S2 no longer reads as an instruction to mark. The runbook now has USB-HOST-PLAN's precondition: stop if slot B isn't marked successful; this runbook doesn't mark it (a devinfo write on the 9a, AGENTS, device/tegu: a fallback to slot A on the 9a costs the Linux root #125).
  2. S1 and S2 now need the stop-poll hook active (or polling stopped by hand) before the first cycle. The palmtop's kernel carries linux-omarchy-mobile#131's nxp-nci change, and the plan says it doesn't lift the rule: the 10-27 reset isn't explained by it (Pixel 9a: the ST54L stops answering on I2C when idle without its NFC mode #132, AGENTS: on the 9a, NFC needs the ST54L's NFC mode on (linux-omarchy-mobile#131), not a power-off hook #137), so NFC must not poll through these cycles.
  3. Both are on my fork's tegu-sleep-bringup branch, linked by commit in the plan: the tegu-mif-sleep module (adbca4c88), the bring-up dtsi the palmtop's DTB is built from, as it runs (af56e6307), and the S2 change on top of it, the four rails no longer always-on and nothing else (054ee7808). Bring-up, not for merge; the dtsi is there so the change has something to show against, since no public branch carries the S2MPG15 rails in a DTS yet.
  4. S2 now saves regulator_summary before, builds the image, checks that only vendor_kernel_boot differs, boots without starting the modem, saves the summary again and diffs, with a Stop if anything other than LDO9S-11S and LDO15S changed. I checked stock's DT for other consumers: in the base DTB and all ten board overlays none of the four nodes has a phandle, so nothing names them as a supply (the camera rail LDO12S does, so the method does see consumers). The GNSS three are the PMIC's GPS subsystem rails; LDO15S is L15S_SPARE, always-on on stock, with no consumer. Recorded in the plan.

Not blocking: the push wording now says bin/omamobile push writes every image in BOOT_IMAGES, and the step checks by sha that only vendor_kernel_boot differs; S1 has a Rollback line (rmmod tegu-mif-sleep, or a reboot) and the runbook says to read /sys/fs/pstore first after a cycle that doesn't come back; the measurements link #100's NOTES entry; S2 stays away from a G3 session.

CPU_INFORM: not the exynos-pmu regmap, and not userspace. It was a small bring-up kernel module (a cpu_pm notifier, never published, dropped with the result) that wrote each core's word with the PMU register-write SMC, the same call gs101-pmu's regmap write uses. The plan says so, and that a SICD step would go through the exynos-pmu regmap.

@derekross

Copy link
Copy Markdown
Owner

Thank you for the quick and careful turnaround. I checked 5e8368b point by point, and everything from my last comment is in. The slot B precondition matches USB-HOST-PLAN word for word and no longer tells anyone to mark. The NFC precondition covers both S1 and S2 and says plainly that the nxp-nci change doesn't lift the rule. All three bring-up commits are public on tegu-sleep-bringup, and I read them: the S2 commit removes regulator-always-on from LDO9S-11S and LDO15S and changes nothing else in the DT. S2 now has a before/after regulator_summary diff with a Stop and a check that only vendor_kernel_boot changes. Thanks as well for checking stock's consumers in the base DTB and all ten overlays, and for the CPU_INFORM record. A kernel module calling the PMU write SMC is the right side of the line.

Two small things before it merges. Both come from reading the plan next to the others:

  1. S2 and the fingerprint stack. Your FINGERPRINT-PLAN's Risks table says "LDO15S: always-on on stock; our S2MPG15 description must not switch it off as unused". S2 does that on purpose for one boot, which is fine, but please say so in both plans. More importantly, please add a step 3 precondition: the fingerprint service and anything that starts the trusted app or storageproxyd stay stopped in that boot (disabled or masked before the push, put back after the rollback). F6c is still writing secure objects. I'd rather nothing in Trusty met a sensor with no power while the calibration question is open.
  2. How S1 suspends and what it reads. S1 says "the fuel gauge's charge counter", but your tools/power-ab: a systemd suspend mode, and a gauge without charge_counter #157 says the 9a's max77779 has no charge_counter and the figure comes from charge_now. Please name the command S1 runs (I assume tools/power-ab --suspend systemd s2idle from tools/power-ab: a systemd suspend mode, and a gauge without charge_counter #157) and the column it reports. That also settles how the RTC wakes are armed. AGENTS warns that rtcwake -m mem skips the NFC hook, and tools/power-ab: a systemd suspend mode, and a gauge without charge_counter #157's rtcwake -m no plus systemctl suspend is the way that keeps it. If S1 depends on tools/power-ab: a systemd suspend mode, and a gauge without charge_counter #157, this PR merges after it.

Not blocking:

  • "under the rules settled on AGENTS, device/tegu: a fallback to slot A on the 9a costs the Linux root #125": AGENTS, device/tegu: a fallback to slot A on the 9a costs the Linux root #125 is still open, so "being settled" is more accurate for now.
  • S2 step 4 credits the unused-rail cleanup for turning the four off. Your DT comments say all four are off at hand-off, and without regulator-always-on nothing turns them on, so they should read disabled whether or not the cleanup runs. That's worth knowing if the S2MPG15 regulators ever register after the 30 s cleanup.
  • The "no phandle" method finds every DT supply reference. But the regulator core also falls back to a lookup by regulator-name when a driver asks for a supply that isn't in the DT, and some vendor drivers get rails by name. A quick grep of the stock DT and the vendor modules for the four names (L15S_SPARE and the three GPS ones) would close that gap. Either way S2 is reversible.
  • If polling is stopped by hand rather than by the hook, a neard restart can start it again. A Polling read before each run would catch that.
  • If anything on the palmtop starts the modem at boot, "don't start the modem" needs it masked before the push.

The policy check and both CI jobs pass on this head, it merges cleanly onto today's main, and the plan has no identifiers.

…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.
@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Done in d5f1c26.

  1. S2 now says it turns LDO15S off on purpose for that one boot, against FINGERPRINT-PLAN's rule, and FINGERPRINT-PLAN gets the matching note once device/tegu: fingerprint F6c-F10 (works) and GNSS G3's third and fourth tries #138 is on main. Step 3 has the precondition: omamobile-fp.service and anything that starts the TA or storageproxyd (the fp-stage unit, the chroot by hand, fprintd) disabled or masked before the push and put back after the rollback, with a check after the boot. Agreed on F6c.
  2. S1 names the command: power-ab --detach --unplug 180 --phase 1800 --rounds 2 --suspend systemd s2idle, from tools/power-ab: a systemd suspend mode, and a gauge without charge_counter #157, so the RTC is armed with rtcwake -m no and systemctl suspend runs the NFC hook. The figure is charge_now (column 7), the gauge's model-corrected remaining charge, since the 9a has no charge_counter; the plan says S1 waits for tools/power-ab: a systemd suspend mode, and a gauge without charge_counter #157.

Not blocking, all done: #125 "being settled"; step 4 says the four read disabled whether or not the 30 s cleanup runs; I grepped stock's source for the four names (L15S_SPARE and the three GPS rails, plus S2MPG15_LDO9-11/15) in devices/google/tegu, devices/google/zuma* and google-modules, and they appear only in DT sources and the S2MPG15 register header, no vendor module asks for them by name, recorded in the plan; a busctl Polling read before each run is in the NFC precondition; nothing on the palmtop starts the modem at boot (it's started by hand with omamobile-tegu-modem-up), so there's nothing to mask, and the plan says so.

@derekross
derekross merged commit a6034a5 into derekross:main Oct 29, 2026
2 checks passed
W4HO-ham added a commit to W4HO-ham/omarchy-mobile that referenced this pull request Nov 1, 2026
The 9a's link driver began as a copy of the gs201 controller in kernel derekross#144, so it goes in as a second compatible stacked on that; the section lists what zumapro adds.
W4HO-ham added a commit to W4HO-ham/omarchy-mobile that referenced this pull request Nov 1, 2026
The zumapro compatible of the gs201 modem link driver and its binding, stacked on kernel derekross#144; the DT nodes follow once that stack is on omamobile.
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
* 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.
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.

2 participants