From e3a12fae2ecaa3fde97e747df4f3f3e12a0711aa Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 21:31:01 -0647 Subject: [PATCH 1/6] 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.md | 69 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 device/tegu/SLEEP-PLAN.md diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md new file mode 100644 index 000000000..a2b1ef1bb --- /dev/null +++ b/device/tegu/SLEEP-PLAN.md @@ -0,0 +1,69 @@ + +# Pixel 9a sleep: why s2idle drains so much + +Status (2026-10-29): s2idle works (RTC and power-key wakes; NFC and Wi-Fi +have their own notes in NOTES and AGENTS), but the drain in sleep is high. +This plan is an audit from the code, stock's device tree and a read-only +snapshot of the palmtop, with candidates ranked by how much they likely +cost, and a measurement runbook. Nothing here has been changed on the +palmtop yet. + +Kernel: `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty` (the +integration tree), the palmtop's bring-up DTB. + +## What the earlier numbers do and don't say + +The 10-28 measurements (434-445 mA as it runs, 374-389 mA with MIF capped +at 421 MHz) were taken with the screen on, so they measure the awake +system, not sleep. They do say that MIF's rate matters. The sleep number +still has to be measured, with the screen off and the cable out (runbook +below). + +## Candidates + +1. **No cluster or system idle states.** The CPUs have only WFI and the + per-core `c2` state (PSCI `0x10000`, as in Google's `zumapro-cpu.dtsi`). + Google adds cluster power-down for all three clusters (`cpd_cl0`-`cpd_cl2`) + and a system state (`sicd`, idle clock-down), each with a 10 ms target + residency, through Samsung's own `exynos-cpupm` driver and PMU wakeup + masks, not through PSCI domain states. Mainline has neither, so in s2idle + all three clusters stay powered and the SoC's clocks keep running. This is + likely the largest share. The work is a cluster/SICD path for zumapro + (PSCI OS-initiated domains if the firmware supports them, otherwise the + PMU sequence `exynos-cpupm` uses), and it needs its own plan. +2. **GNSS rails always on.** LDO9S-11S (`gnss-core` 1.2 V, `gnss-rf` 1.8 V, + `gnss-aux` 1.8 V) are `regulator-always-on` in the bring-up DTB, so the + S5300's GNSS RF and core supplies stay up through sleep, with the modem + off too. In stock's DT they carry `channel-mux-selection` (subsys GPS): + the GNSS core switches them itself. Off unless the modem's GNSS runs. +3. **Fingerprint rail always on.** `udfps-3v3` (LDO15S) is also + `regulator-always-on` in the bring-up DTB. The sensor only needs it while + an operation runs. +4. **MIF and the interconnect.** The awake numbers moved by about 55 mA with + MIF capped at 421 MHz. Whether MIF drops in s2idle, and to what, is + unread. +5. **Smaller and unmeasured:** the eUSB2 repeater rails (`eusb-vdd`, + `eusb-vdda12`), touch (on for touch wake), the AoC and its sensors (on by + design), the NFC clock pad (always enabled while NFC is bound), and the + modem when it has been started (no suspend is allowed then, by the + inhibitor). + +## Runbook (attended for the cable) + +**S1. Baseline (risk low).** Screen off, Wi-Fi as it runs, modem not +started, cable out, `tools/power-ab` style detached logging of the fuel +gauge's `current_avg` and `capacity` every 30 s for 30 minutes of +`systemctl suspend` with RTC wakes every 5 minutes. Expect a number in mA. +Stop: the palmtop doesn't come back on the cable within 5 minutes of the +end (power key). + +**S2. Rails (risk low).** Same as S1 with the three GNSS rails and +`udfps-3v3` not always-on (a DTB round, through `push`, slot B marked first). +Expect: S1 minus their share. + +**S3. Clusters (risk medium-high).** After a cluster/SICD plan exists. + +## Not known yet + +- The real sleep drain (S1). +- Whether the firmware's PSCI supports OS-initiated cluster states on zumapro. From 5b4e507035b15b2dd7011da15a70c1cc706bfa02 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 21:31:46 -0647 Subject: [PATCH 2/6] 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.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index a2b1ef1bb..7dd715310 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -66,4 +66,11 @@ Expect: S1 minus their share. ## Not known yet - The real sleep drain (S1). -- Whether the firmware's PSCI supports OS-initiated cluster states on zumapro. +- Whether the firmware takes a cluster state at all. Its PSCI is v1.1 with + **no OS-initiated mode** and the original StateID format + (`/sys/kernel/debug/psci`, 2026-10-29), so cluster states would be + platform-coordinated: a deeper `arm,psci-suspend-param` in each CPU's + list (power level 1, power-down: `0x1010000`), which the firmware may + refuse or ignore without the PMU setup `exynos-cpupm` does first. The + core state works today: cpu0's `c2` was entered about a million times, + 1304 rejected (EINVAL); cpu4 1148 of 46339, cpu7 576 of 33173. From 25ec63625b4fdbb16c667462ce9cb17f88d440a5 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 21:33:19 -0647 Subject: [PATCH 3/6] 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.md | 97 +++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 50 deletions(-) diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index 7dd715310..82aa52e88 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -3,74 +3,71 @@ Status (2026-10-29): s2idle works (RTC and power-key wakes; NFC and Wi-Fi have their own notes in NOTES and AGENTS), but the drain in sleep is high. -This plan is an audit from the code, stock's device tree and a read-only -snapshot of the palmtop, with candidates ranked by how much they likely -cost, and a measurement runbook. Nothing here has been changed on the -palmtop yet. +This plan gathers what's measured, an audit from stock's device tree and +a read-only snapshot of the palmtop, the candidates ranked, and a +measurement runbook. Kernel: `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty` (the integration tree), the palmtop's bring-up DTB. -## What the earlier numbers do and don't say +## What's measured -The 10-28 measurements (434-445 mA as it runs, 374-389 mA with MIF capped -at 421 MHz) were taken with the screen on, so they measure the awake -system, not sleep. They do say that MIF's rate matters. The sleep number -still has to be measured, with the screen off and the cable out (runbook -below). +- **s2idle with the cable out: about 140 mA** (59 minutes, 2026-10-27). +- **MIF in sleep** (cable in, buck off, Bluetooth blocked, 600 s RTC-woken + freezes): 371-373 mA at MIF 2028 MHz, 314 mA at 421 MHz, so lowering MIF + for sleep saves about 57 mA. With the cable in, the USB link keeps the + SoC busy, so this can't reproduce the cable-out figure. A PM-notifier + module (`tegu-mif-sleep`: 421 MHz at suspend-prepare, the old rate after + resume) is the policy to measure with the cable out. +- **Cluster power-down was tried** (2026-10-28) through the hint Google's + `exynos-cpupm` writes on each idle entry (`CPU_INFORM`, PMU 0x860 + 4 x + cpu; 1 = C2, 2 = cluster power-down). The C2 hint was stable but saved + nothing measurable. Cluster power-down on all three clusters stopped + ACPM's DVFS channel within a second, then I2C and UFS stalled and the + watchdog reset the palmtop (Google never powers down cluster 0: + `cpd_cl0` has no `entry-allowed`). Clusters 1 and 2 alone were stable, + but no saving was measurable, screen on or off. Dropped. ## Candidates -1. **No cluster or system idle states.** The CPUs have only WFI and the - per-core `c2` state (PSCI `0x10000`, as in Google's `zumapro-cpu.dtsi`). - Google adds cluster power-down for all three clusters (`cpd_cl0`-`cpd_cl2`) - and a system state (`sicd`, idle clock-down), each with a 10 ms target - residency, through Samsung's own `exynos-cpupm` driver and PMU wakeup - masks, not through PSCI domain states. Mainline has neither, so in s2idle - all three clusters stay powered and the SoC's clocks keep running. This is - likely the largest share. The work is a cluster/SICD path for zumapro - (PSCI OS-initiated domains if the firmware supports them, otherwise the - PMU sequence `exynos-cpupm` uses), and it needs its own plan. +1. **MIF in sleep: about 57 mA**, measured with the cable in. Next is the + cable-out measurement with `tegu-mif-sleep`. 2. **GNSS rails always on.** LDO9S-11S (`gnss-core` 1.2 V, `gnss-rf` 1.8 V, `gnss-aux` 1.8 V) are `regulator-always-on` in the bring-up DTB, so the - S5300's GNSS RF and core supplies stay up through sleep, with the modem - off too. In stock's DT they carry `channel-mux-selection` (subsys GPS): - the GNSS core switches them itself. Off unless the modem's GNSS runs. + S5300's GNSS supplies stay up through sleep, with the modem off too. In + stock's DT they carry `channel-mux-selection` (subsys GPS): the GNSS + core switches them itself. Off unless the modem's GNSS runs. 3. **Fingerprint rail always on.** `udfps-3v3` (LDO15S) is also - `regulator-always-on` in the bring-up DTB. The sensor only needs it while - an operation runs. -4. **MIF and the interconnect.** The awake numbers moved by about 55 mA with - MIF capped at 421 MHz. Whether MIF drops in s2idle, and to what, is - unread. + `regulator-always-on` in the bring-up DTB. The sensor only needs it + while an operation runs. +4. **The system idle state (SICD).** Google's `cpupm` has a system state + (`sicd`, idle clock-down, 10 ms target residency) beside the cluster + ones. It hasn't been tried, and it would need the same PMU sequence. + Given the cluster results, it's lower than 1-3. 5. **Smaller and unmeasured:** the eUSB2 repeater rails (`eusb-vdd`, - `eusb-vdda12`), touch (on for touch wake), the AoC and its sensors (on by - design), the NFC clock pad (always enabled while NFC is bound), and the - modem when it has been started (no suspend is allowed then, by the + `eusb-vdda12`), touch (on for touch wake), the AoC and its sensors (on + by design), the NFC clock pad (always enabled while NFC is bound), and + the modem when it has been started (no suspend is allowed then, by the inhibitor). +The CPUs' own idle state works: cpu0's `c2` was entered about a million +times by 2026-10-29, with 1304 rejected (EINVAL); cpu4 1148 of 46339, cpu7 +576 of 33173. The firmware's PSCI is v1.1 with no OS-initiated mode. + ## Runbook (attended for the cable) -**S1. Baseline (risk low).** Screen off, Wi-Fi as it runs, modem not -started, cable out, `tools/power-ab` style detached logging of the fuel -gauge's `current_avg` and `capacity` every 30 s for 30 minutes of -`systemctl suspend` with RTC wakes every 5 minutes. Expect a number in mA. -Stop: the palmtop doesn't come back on the cable within 5 minutes of the -end (power key). +**S1. Baseline, then MIF (risk low; attended for the cable).** Screen off, +Wi-Fi as it runs, modem not started, cable out, detached logging of the fuel +gauge's charge counter and `capacity` every 30 s across 30 minutes of +`systemctl suspend` with RTC wakes every 5 minutes. Repeat with +`tegu-mif-sleep` loaded. Expect about 140 mA, then less. Stop: the palmtop +doesn't come back on the cable within 5 minutes of the end (power key). -**S2. Rails (risk low).** Same as S1 with the three GNSS rails and -`udfps-3v3` not always-on (a DTB round, through `push`, slot B marked first). +**S2. Rails (risk low).** As S1 with the three GNSS rails and `udfps-3v3` +not always-on (a DTB round through `push`, with slot B marked first). Expect: S1 minus their share. -**S3. Clusters (risk medium-high).** After a cluster/SICD plan exists. - ## Not known yet -- The real sleep drain (S1). -- Whether the firmware takes a cluster state at all. Its PSCI is v1.1 with - **no OS-initiated mode** and the original StateID format - (`/sys/kernel/debug/psci`, 2026-10-29), so cluster states would be - platform-coordinated: a deeper `arm,psci-suspend-param` in each CPU's - list (power level 1, power-down: `0x1010000`), which the firmware may - refuse or ignore without the PMU setup `exynos-cpupm` does first. The - core state works today: cpu0's `c2` was entered about a million times, - 1304 rejected (EINVAL); cpu4 1148 of 46339, cpu7 576 of 33173. +- What the GNSS and fingerprint rails cost in sleep (S2). +- What MIF in sleep saves with the cable out (S1). From 79b919e35ced0af8fd5ff63df8dec56a36076b11 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Wed, 28 Oct 2026 21:36:41 -0647 Subject: [PATCH 4/6] device/tegu SLEEP-PLAN: S2's image, its expectation and rollback --- device/tegu/SLEEP-PLAN.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index 82aa52e88..d78e779fb 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -64,8 +64,13 @@ gauge's charge counter and `capacity` every 30 s across 30 minutes of doesn't come back on the cable within 5 minutes of the end (power key). **S2. Rails (risk low).** As S1 with the three GNSS rails and `udfps-3v3` -not always-on (a DTB round through `push`, with slot B marked first). -Expect: S1 minus their share. +not always-on: the running DTB with `regulator-always-on` removed from +LDO9S-11S and LDO15S, nothing else (a `push` of `vendor_kernel_boot` only, +with slot B marked first; the image is built and checked to differ from the +running one in that image alone). Expect: the four rails read disabled +about 30 s after boot (the regulator core's unused-rail cleanup), then S1 +minus their share. GPS and fingerprint don't work in this round. Rollback: +push the running DTB's image back. ## Not known yet From 5e8368bde110537d09fa15b536a94a700ecc18c5 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 10:14:16 -0647 Subject: [PATCH 5/6] 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.md | 102 ++++++++++++++++++++++++++++++++++---- 1 file changed, 92 insertions(+), 10 deletions(-) diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index d78e779fb..3c4a0770e 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -8,17 +8,30 @@ a read-only snapshot of the palmtop, the candidates ranked, and a measurement runbook. Kernel: `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty` (the -integration tree), the palmtop's bring-up DTB. +integration tree), the palmtop's bring-up DTB. The code the runbook boots +is on the bring-up branch `tegu-sleep-bringup` of the kernel fork (not for +merge): + +- the MIF module, `tegu-mif-sleep`: + ; +- the bring-up DT as it runs (the dtsi included at the end of + `zumapro-tegu.dts` in the integration tree): + ; +- S2's change, the four rails no longer always-on: + . ## What's measured +The figures are from the 2026-10-27 and 10-28 NOTES entries +(). + - **s2idle with the cable out: about 140 mA** (59 minutes, 2026-10-27). - **MIF in sleep** (cable in, buck off, Bluetooth blocked, 600 s RTC-woken freezes): 371-373 mA at MIF 2028 MHz, 314 mA at 421 MHz, so lowering MIF for sleep saves about 57 mA. With the cable in, the USB link keeps the SoC busy, so this can't reproduce the cable-out figure. A PM-notifier module (`tegu-mif-sleep`: 421 MHz at suspend-prepare, the old rate after - resume) is the policy to measure with the cable out. + resume; the commit above) is the policy to measure with the cable out. - **Cluster power-down was tried** (2026-10-28) through the hint Google's `exynos-cpupm` writes on each idle entry (`CPU_INFORM`, PMU 0x860 + 4 x cpu; 1 = C2, 2 = cluster power-down). The C2 hint was stable but saved @@ -27,6 +40,14 @@ integration tree), the palmtop's bring-up DTB. watchdog reset the palmtop (Google never powers down cluster 0: `cpd_cl0` has no `entry-allowed`). Clusters 1 and 2 alone were stable, but no saving was measurable, screen on or off. Dropped. + For the record, what wrote the hints: a bring-up kernel module, + `tegu-cpuinform` (a `cpu_pm` notifier, out of tree, on the laptop only; + it was dropped with the result and isn't published), writing each + core's `CPU_INFORM` word with the PMU register-write SMC (function + 0x82000504, the call the kernel's `gs101-pmu` regmap write uses) from + the notifier, not through the `exynos-pmu` regmap and not from + userspace. If SICD ever becomes a step, its PMU sequence goes through the + kernel's `exynos-pmu` regmap. ## Candidates @@ -54,23 +75,84 @@ The CPUs' own idle state works: cpu0's `c2` was entered about a million times by 2026-10-29, with 1304 rejected (EINVAL); cpu4 1148 of 46339, cpu7 576 of 33173. The firmware's PSCI is v1.1 with no OS-initiated mode. +### Stock's consumers of the four rails (checked 2026-10-29) + +Before S2 turns LDO9S, LDO10S, LDO11S and LDO15S off, the question was +whether anything else on stock draws from them. Checked in stock's base +DT (the DTB in stock's `vendor_kernel_boot`, decompiled) and in all ten +board overlays of stock's `dtbo`: none of the four nodes carries a +`phandle`, so no node names any of them as a supply (a consumer would +force one; LDO12S, `L12S_CAMIO`, has one, from the cameras), and no +overlay fixup names them either. The three GNSS rails are `subsys-name +"GPS"` with `channel-mux-selection` 0x29-0x2b, so stock's GNSS core +switches them through the PMIC's channel mux; LDO15S is `L15S_SPARE`, +`regulator-always-on` on stock, subsys Spare, with no consumer in the DT +(the fingerprint sensor node has no supply; FINGERPRINT-PLAN). So the +four feed GNSS and the fingerprint sensor only, by stock's DT. + ## Runbook (attended for the cable) +Preconditions for the whole runbook: + +- **Slot B.** Stop if slot B isn't marked successful; this runbook doesn't + mark it (on the 9a marking is a `devinfo` write, under the rules settled + on ). An unmarked + B burns an ABL retry on every boot, and a cycle that resets the palmtop + counts as one. +- **NFC.** S1 and S2 run `systemctl suspend` cycles, and on the 9a a + suspend with neard polling reset the palmtop (2026-10-27; AGENTS, + "Suspend and modem"). Before the first cycle: the stop-poll sleep hook + (`omamobile-tegu-nfc` on the palmtop, not in the repository yet) is + installed and its unit active, or polling is stopped by hand. The + palmtop's current kernel carries the nxp-nci change of + (its + `core.c` is in the running tree, blob 77fc35b61da5), which turns the + ST54L's NFC mode on after init; it doesn't lift the rule. NFC still + loses its NCI state across s2idle + (, + ), so NFC must not + poll through these cycles. +- **If a cycle doesn't come back** (no wake within 5 minutes, no answer on + the cable): Power held about 30 s, then Power. Then, before anything + else, read `/sys/fs/pstore` (systemd-pstore moves it to + `/var/lib/systemd/pstore` at boot) and quote the end of the console log + in this plan. + **S1. Baseline, then MIF (risk low; attended for the cable).** Screen off, Wi-Fi as it runs, modem not started, cable out, detached logging of the fuel gauge's charge counter and `capacity` every 30 s across 30 minutes of `systemctl suspend` with RTC wakes every 5 minutes. Repeat with -`tegu-mif-sleep` loaded. Expect about 140 mA, then less. Stop: the palmtop -doesn't come back on the cable within 5 minutes of the end (power key). +`tegu-mif-sleep` loaded (the module commit above, built against the running +kernel). Expect about 140 mA, then less. Stop: the palmtop doesn't come +back on the cable within 5 minutes of the end (power key). Rollback: +`rmmod tegu-mif-sleep` (the module changes nothing while awake: it sets the +rate at suspend-prepare and puts the old one back at resume), or a reboot. **S2. Rails (risk low).** As S1 with the three GNSS rails and `udfps-3v3` not always-on: the running DTB with `regulator-always-on` removed from -LDO9S-11S and LDO15S, nothing else (a `push` of `vendor_kernel_boot` only, -with slot B marked first; the image is built and checked to differ from the -running one in that image alone). Expect: the four rails read disabled -about 30 s after boot (the regulator core's unused-rail cleanup), then S1 -minus their share. GPS and fingerprint don't work in this round. Rollback: -push the running DTB's image back. +LDO9S-11S and LDO15S, nothing else (the S2 commit above). Not in or around +a G3 (GNSS) session: GNSS is off for this boot. Steps: + +1. **Before (read-only).** On the running DTB, 60 s or more after boot, + save `/sys/kernel/debug/regulator/regulator_summary` to + `logs/tegu-sleep-s2/summary-before.txt`. +2. **The image.** Build the images from the S2 commit. `bin/omamobile + push` writes every image in `BOOT_IMAGES`; check first that only + `vendor_kernel_boot.img` differs from the running set (sha256 of each + image against the running kit), so the push changes the DTB and + nothing else. Stop if any other image differs. +3. **Push and boot.** Don't start the modem in this boot: the S5300's + GNSS supplies are off. Fingerprint doesn't work either. +4. **After (read-only).** 60 s or more after boot, save the summary again + and diff it against the before file. Expect: LDO9S, LDO10S, LDO11S and + LDO15S read disabled (the regulator core's unused-rail cleanup about + 30 s after late init), and nothing else changed. Stop if anything other + than those four changed: push the running DTB's image back before any + suspend. +5. **Measure.** S1's cycles. Expect S1 minus the four rails' share. + +Rollback: push the running DTB's image back (the before/after check of +step 2 in reverse). ## Not known yet From d5f1c26e973cbf9bae0e764fa27c25a9b5c4f0c5 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 12:25:29 -0647 Subject: [PATCH 6/6] 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. --- device/tegu/SLEEP-PLAN.md | 79 ++++++++++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 13 deletions(-) diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index 3c4a0770e..148b32977 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -90,20 +90,41 @@ switches them through the PMIC's channel mux; LDO15S is `L15S_SPARE`, (the fingerprint sensor node has no supply; FINGERPRINT-PLAN). So the four feed GNSS and the fingerprint sensor only, by stock's DT. +A phandle finds every DT supply reference, but the regulator core also +looks a supply up by `regulator-name` when a driver asks for one the DT +doesn't give it, so stock's kernel source was grepped for the four names +too (`L15S_SPARE`, `L9S_GNSS_CORE`, `L10S_GNSS_RF`, `L11S_GNSS_AUX`, and +`S2MPG15_LDO9`-`11`/`15`): `devices/google/tegu`, `devices/google/zuma*` +and `google-modules`. They appear only in device tree sources +(`zumapro-pmic.dtsi`, `zuma-pmic.dtsi`, the GNSS board dtsi files, and +tegu's udfps dtsi, which makes LDO15S always-on at 3.3 V) and in the +S2MPG15 register header. No vendor module asks for any of them by name: +the GNSS module uses no regulator at all, and the fingerprint tree's +`regulator_get` by name is in the FPC driver, not tegu's Goodix one. The +gap is closed. + ## Runbook (attended for the cable) Preconditions for the whole runbook: - **Slot B.** Stop if slot B isn't marked successful; this runbook doesn't - mark it (on the 9a marking is a `devinfo` write, under the rules settled - on ). An unmarked + mark it (on the 9a marking is a `devinfo` write, under the rules being + settled on ). An unmarked B burns an ABL retry on every boot, and a cycle that resets the palmtop counts as one. - **NFC.** S1 and S2 run `systemctl suspend` cycles, and on the 9a a suspend with neard polling reset the palmtop (2026-10-27; AGENTS, "Suspend and modem"). Before the first cycle: the stop-poll sleep hook (`omamobile-tegu-nfc` on the palmtop, not in the repository yet) is - installed and its unit active, or polling is stopped by hand. The + installed and its unit active, or polling is stopped by hand. Either + way, read neard's `Polling` property before each run (a neard restart + starts polling again): + + ```sh + tools/phone-ssh 'busctl get-property org.neard /org/neard/nfc0 org.neard.Adapter Polling' + ``` + + It must read `b false`. The palmtop's current kernel carries the nxp-nci change of (its `core.c` is in the running tree, blob 77fc35b61da5), which turns the @@ -119,9 +140,22 @@ Preconditions for the whole runbook: in this plan. **S1. Baseline, then MIF (risk low; attended for the cable).** Screen off, -Wi-Fi as it runs, modem not started, cable out, detached logging of the fuel -gauge's charge counter and `capacity` every 30 s across 30 minutes of -`systemctl suspend` with RTC wakes every 5 minutes. Repeat with +Wi-Fi as it runs, modem not started, cable out. The run is `tools/power-ab` +with the systemd suspend mode of +, so S1 waits for +#157 to merge: + +```sh +tools/phone-ssh 'power-ab --detach --unplug 180 --phase 1800 --rounds 2 --suspend systemd s2idle' +``` + +`--suspend systemd` arms the RTC with `rtcwake -m no` and runs `systemctl +suspend`, so the NFC sleep hook runs (a freeze written to +`/sys/power/state` would skip it). Phase A is awake with the screen off, +phase B is the 30-minute sleep, two rounds. The 9a's gauge has no +`charge_counter`, so the figure is the `charge_now` column of the CSV +(column 7, `charge_now_uah`): the gauge's model-corrected remaining +charge, coarser than a coulomb counter, hence the long phases. Repeat with `tegu-mif-sleep` loaded (the module commit above, built against the running kernel). Expect about 140 mA, then less. Stop: the palmtop doesn't come back on the cable within 5 minutes of the end (power key). Rollback: @@ -131,7 +165,14 @@ rate at suspend-prepare and puts the old one back at resume), or a reboot. **S2. Rails (risk low).** As S1 with the three GNSS rails and `udfps-3v3` not always-on: the running DTB with `regulator-always-on` removed from LDO9S-11S and LDO15S, nothing else (the S2 commit above). Not in or around -a G3 (GNSS) session: GNSS is off for this boot. Steps: +a G3 (GNSS) session: GNSS is off for this boot. + +S2 turns LDO15S off on purpose, for this one boot, although +FINGERPRINT-PLAN's Risks table says our S2MPG15 description must not +switch it off as unused: the sensor is unpowered for the boot, and that +is the point of the measurement. FINGERPRINT-PLAN (on +'s branch) gets the +matching note as a follow-up once it is on main. Steps: 1. **Before (read-only).** On the running DTB, 60 s or more after boot, save `/sys/kernel/debug/regulator/regulator_summary` to @@ -141,14 +182,26 @@ a G3 (GNSS) session: GNSS is off for this boot. Steps: `vendor_kernel_boot.img` differs from the running set (sha256 of each image against the running kit), so the push changes the DTB and nothing else. Stop if any other image differs. -3. **Push and boot.** Don't start the modem in this boot: the S5300's - GNSS supplies are off. Fingerprint doesn't work either. +3. **Push and boot.** Precondition, before the push: the fingerprint + stack stays stopped in that boot. `omamobile-fp.service` and anything + that starts the trusted app or `storageproxyd` (the `omamobile-fp-stage` + transient unit, `omamobile-fp-chroot start …` by hand, fprintd) are + disabled or masked before the push and put back after the rollback. + F6c is still writing secure objects, and nothing in Trusty should meet + a sensor with no power while the calibration question is open. Check + after the boot: `systemctl list-units 'omamobile-fp*'` empty, no + `storageproxyd` process. Don't start the modem in this boot: the + S5300's GNSS supplies are off. Nothing on the palmtop starts the modem + at boot (it is started by hand with `omamobile-tegu-modem-up`, + MODEM-PLAN), so there is nothing to mask; just don't run it. 4. **After (read-only).** 60 s or more after boot, save the summary again and diff it against the before file. Expect: LDO9S, LDO10S, LDO11S and - LDO15S read disabled (the regulator core's unused-rail cleanup about - 30 s after late init), and nothing else changed. Stop if anything other - than those four changed: push the running DTB's image back before any - suspend. + LDO15S read disabled, and nothing else changed. All four are off at + hand-off and without `regulator-always-on` nothing turns them on, so + they read disabled whether or not the regulator core's 30 s unused-rail + cleanup has run (which matters if the S2MPG15 regulators ever register + after it). Stop if anything other than those four changed: push the + running DTB's image back before any suspend. 5. **Measure.** S1's cycles. Expect S1 minus the four rails' share. Rollback: push the running DTB's image back (the before/after check of