From fcceab6586d42faa929cd3c596a72e7377f2181a Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 19:35:45 -0647 Subject: [PATCH 01/18] device/tegu: SLEEP-PLAN S1 result, the drain is the SoC floor Record the baseline (311 mA awake with the screen off, 302 mA asleep, cable out), the proof that the CPUs sleep, the radio elimination (nothing), the MIF-in-sleep saving (60-75 mA, module loaded at boot by a hand unit) and the coulomb-counter method. Note that a direct rtcwake freeze failed to wake again, so every sleep test goes through systemctl suspend; add that to the agent gotchas. Retire the 2026-10-27 140 mA figure. --- AGENTS.md | 1 + device/tegu/NOTES.md | 17 +++++++++++++ device/tegu/SLEEP-PLAN.md | 51 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index 7f76d22ce..3344010fc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -172,6 +172,7 @@ Each entry gives the gotcha, then the reason or the fix. Details are in the link ### Suspend and modem - **On the 9a, NFC must not poll through s2idle.** A suspend with neard polling reset the palmtop (2026-10-27); with polling stopped, 35 s2idle cycles with RTC wakes that day all woke. The cause isn't known: nxp-nci has no PM callbacks, but neither does the 7 Pro's st-nci, so the controller's interrupt or the I2C bus during the freeze are the next suspects. A sleep hook on the palmtop, `omamobile-tegu-nfc` (not in the repository yet; it comes with tegu's device package), stops neard's poll loop before a systemd sleep and restarts it after; a sleep written straight to `/sys/power/state` (`rtcwake -m mem`) skips the hook, so stop polling by hand first. [tegu MODEM-PLAN](device/tegu/MODEM-PLAN.md) "Suspend with the modem on" +- **On the 9a, sleep only through `systemctl suspend` (after `rtcwake -m no -s N`), never `rtcwake -m freeze` or a write to `/sys/power/state`.** Two direct freezes out of about six (2026-10-28, 2026-10-29) never woke from their RTC alarm and needed Power + Volume Up; every `systemctl suspend` cycle so far woke (35 on 2026-10-27, 6 on 2026-10-29). The cause isn't known. The systemd path also runs the sleep hooks (NFC poll stop, Wi-Fi). [tegu SLEEP-PLAN](device/tegu/SLEEP-PLAN.md) S1 - **UFS must be at `spm_lvl` 5 in system suspend.** At the core default 3, UFS failed its first hibern8 exit on resume and needed a host reset (it recovered, no I/O errors); at 5 the first real s2idle freeze resumed clean. gs201 now defaults to 5 in the kernel (S3a, `a7e5e1d95`), so a suspend test only checks that `spm_lvl` reads 5; on a kernel without that commit, `echo 5` first. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) S1-S3 - **Only s2idle, never `deep`.** The firmware advertises PSCI SYSTEM_SUSPEND, so mainline offers `deep`, but Linux has no gs201 SoC sleep sequence (SYS_SLEEP), and the phone wouldn't wake. `mem_sleep_default=s2idle` in the bootargs and device-cheetah's `sleep.conf` drop-in keep it on s2idle. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) §1, §5 - **Some unattended RTC cycles wake early on the PMIC interrupt** (2 of 20 in S4, 4 of 31 in S5c, at 13-16 s instead of 30 s). Which PMIC event it is hasn't been read yet; count it, don't treat it as a failed cycle. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) S4, S5c diff --git a/device/tegu/NOTES.md b/device/tegu/NOTES.md index 14d362e25..ce4fd9ba9 100644 --- a/device/tegu/NOTES.md +++ b/device/tegu/NOTES.md @@ -13,6 +13,23 @@ hash/build ID; this dirty release is not a published kernel package. `[V]` marks verified observations; `[I]` marks an inference still to test. Raw captures, recordings, backups and vendor files remain off repository. +## 2026-10-29: the s2idle drain is the SoC floor, not the CPUs or the radios + +- Cable out, screen off: 311 mA awake, 302 mA asleep (two 30-minute + `systemctl suspend` rounds through `power-ab --suspend systemd`). The CPUs + sleep (timekeeping suspended for the whole of a 60 s test, one deep-state + entry per CPU); Bluetooth, NFC and Wi-Fi cost nothing measurable at idle. + What stays on is MIF, the buses and the always-on rails: there is no + system idle state in our kernel. `tegu-mif-sleep.ko` (MIF 421 MHz in + sleep) saves about 60-75 mA and is loaded at boot by a hand unit now. + Details and method in [SLEEP-PLAN](SLEEP-PLAN.md) S1. +- `rtcwake -m freeze` written straight to `/sys/power/state` failed to wake + again (the second time in two days); `systemctl suspend` after + `rtcwake -m no` has woken every time. Use only the systemd path. +- The 2026-10-27 "140 mA asleep" figure doesn't hold up against 2026-10-28 + (434-445 mA cable out, as-is) and tonight; treat about 300 mA cable out + as the baseline. + ## 2026-10-26: audio (speakers, microphones, A2DP) with omamobile-audio 0.5.0 Kernel `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`: the private diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index 148b32977..e2a544498 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -162,6 +162,57 @@ 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. +**S1 result (2026-10-29, `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`, +device-tegu 0.2.0).** The baseline ran as written (cable out, screen off, +Wi-Fi kept, modem not started, two 30-minute `systemctl suspend` rounds +through `power-ab --suspend systemd`), then the pieces were pulled apart +with the cable in. + +- **Cable out: 311 mA awake with the screen off, 302 mA asleep** (phase A + 3434 samples of `current_now`; phase B 302.5 mAh of `charge_now` over + 3604 s, two rounds, both woken by the RTC through the PMIC, `success` 2). + Sleep saves nothing over the awake screen-off state. The 140 mA of + 2026-10-27 is the outlier: a cable-out A/B on 2026-10-28 + (`logs/tegu-morning-20261028/sleep-ab-20261028b.log`) already read 434 + and 445 mA asleep as-is and 374 and 389 mA with MIF at 421 MHz. +- **The CPUs do sleep.** A 60 s `systemctl suspend` with the cable in ran + with `Timekeeping suspended for 60.059 seconds` and each cluster's deep + state entered once in s2idle (`cpuidle/state1/s2idle/usage` +1 per CPU), + so no interrupt keeps the cores up. What stays on is everything below + them: MIF and the buses at full rate, and the always-on rails. Google's + kernel has a system idle state (SICD) for this; ours has none. +- **The radios cost nothing at idle** (cable in, buck off through + `CHG_CNFG_00` 0x00 under a dead-man restore, screen off, 45 s means of + `current_now`): baseline 351 mA, Bluetooth off 355, NFC driver unbound + 356, Wi-Fi link down 360. All within noise. +- **MIF at 421 MHz in sleep saves about 60-75 mA.** Cable in, buck off, + 240 s `systemctl suspend` sleeps measured by the gauge's coulomb counter + (`QH`, register 0x4d of the fuel gauge at 0x36 on bus 24; 2.5 mAh per + count, checked against 60 s of `current_now`): as-is 12 counts, 446 mA; + with `tegu-mif-sleep.ko` 10 counts, 371 mA (one count is 37 mA at this + length). This matches the 2026-10-28 figure (57 mA). The module loads, + unloads and wakes cleanly; the palmtop now loads it at boot from a hand + unit, `/etc/systemd/system/tegu-mif-sleep.service` + (`insmod /var/lib/omamobile-tegu/tegu-mif-sleep.ko`), until the policy + is in the kernel or the device package. Cable-in figures sit about + 140 mA above cable-out ones (the USB link keeps the SoC busy). +- **`rtcwake -m freeze` straight to `/sys/power/state` is not safe on the + 9a.** The one direct freeze of the night (240 s, NFC blocked by rfkill, + polling already stopped) never woke from its RTC alarm; the owner reset + it with Power + Volume Up about 25 minutes later. The 2026-10-28 run lost + one of four the same way, while every `systemctl suspend` cycle so far + (35 on 2026-10-27, 2 x 30 min and 4 short ones tonight) woke. Until the + difference is understood, every sleep test goes through `systemctl + suspend` after `rtcwake -m no -s N`. Nothing in pstore: a held power key + is a pin reset, and the console log of the hung sleep didn't survive it. +- A later note on the method: `power-ab`'s CSV columns are + `voltage_uv,current_ua,current_avg_ua,charge_counter_uah,charge_now_uah`; + the gauge's `current_avg` is a long filter and says little about a + 30-minute window, so read `charge_now` (or `QH`) across the sleep. + +Next: S2 (the four rails), and a cable-out `power-ab` run with the module +loaded to put a cable-out number on the MIF saving. + **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 From 510a4e68db7a3eb403c9fee0eaade422b30dbf72 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Fri, 30 Oct 2026 06:48:35 -0647 Subject: [PATCH 02/18] device/tegu SLEEP-PLAN: the cable-in method as runbook steps, and the rule points at systemd S1 gets the buck-off, dead-man, read-back and coulomb-counter steps with Expect, Stop and Rollback; the 140 mA expectation becomes the S1 figure; the hand unit for tegu-mif-sleep names its commit and rollback; the direct-freeze count reads two of five and says the Wi-Fi hook may be the real difference. AGENTS's NFC clause no longer allows a direct write, and power-ab runs with --suspend systemd on the 9a. --- AGENTS.md | 4 +-- device/tegu/SLEEP-PLAN.md | 57 ++++++++++++++++++++++++++++++++------- 2 files changed, 49 insertions(+), 12 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 554256d7c..f54ade12e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -172,8 +172,8 @@ Each entry gives the gotcha, then the reason or the fix. Details are in the link ### Suspend and modem -- **On the 9a, NFC must not poll through s2idle.** A suspend with neard polling reset the palmtop (2026-10-27); with polling stopped, 35 s2idle cycles with RTC wakes that day all woke (`7.3.0-rc6-omamobile-tegu-s2mpg15-m1`). The cause isn't known: nxp-nci has no PM callbacks, but neither does the 7 Pro's st-nci, so the controller's interrupt or the I2C bus during the freeze are the next suspects. A sleep hook on the palmtop, `omamobile-tegu-nfc` (not in the repository yet; it comes with tegu's device package), stops neard's poll loop before a systemd sleep and restarts it after; a sleep written straight to `/sys/power/state` (`rtcwake -m mem`) skips the hook, so stop polling by hand first. [tegu MODEM-PLAN](device/tegu/MODEM-PLAN.md) "Suspend with the modem on" -- **On the 9a, sleep only through `systemctl suspend` (after `rtcwake -m no -s N`), never `rtcwake -m freeze` or a write to `/sys/power/state`.** Two direct freezes out of about six (2026-10-28, 2026-10-29) never woke from their RTC alarm and needed Power + Volume Up; every `systemctl suspend` cycle so far woke (35 on 2026-10-27, 6 on 2026-10-29). The cause isn't known. The systemd path also runs the sleep hooks (NFC poll stop, Wi-Fi). [tegu SLEEP-PLAN](device/tegu/SLEEP-PLAN.md) S1 +- **On the 9a, NFC must not poll through s2idle.** A suspend with neard polling reset the palmtop (2026-10-27); with polling stopped, 35 s2idle cycles with RTC wakes that day all woke (`7.3.0-rc6-omamobile-tegu-s2mpg15-m1`). The cause isn't known: nxp-nci has no PM callbacks, but neither does the 7 Pro's st-nci, so the controller's interrupt or the I2C bus during the freeze are the next suspects. A sleep hook on the palmtop, `omamobile-tegu-nfc` (not in the repository yet; it comes with tegu's device package), stops neard's poll loop before a systemd sleep and restarts it after; a sleep written straight to `/sys/power/state` (`rtcwake -m mem`) skips the hook, and is ruled out anyway (the next entry: sleep only through `systemctl suspend`). [tegu MODEM-PLAN](device/tegu/MODEM-PLAN.md) "Suspend with the modem on" +- **On the 9a, sleep only through `systemctl suspend` (after `rtcwake -m no -s N`), never `rtcwake -m freeze` or a write to `/sys/power/state`.** Two direct freezes of five (2026-10-28, 2026-10-29) never woke from their RTC alarm and needed Power + Volume Up; every `systemctl suspend` cycle so far woke (35 on 2026-10-27, 6 on 2026-10-29). The cause isn't known. The systemd path also runs the sleep hooks (NFC poll stop, Wi-Fi), so the hang may come from Wi-Fi through the freeze rather than from the entry method; the rule covers both. `tools/power-ab` defaults to `--suspend rtcwake`, a direct freeze: on the 9a pass `--suspend systemd`. [tegu SLEEP-PLAN](device/tegu/SLEEP-PLAN.md) S1 - **UFS must be at `spm_lvl` 5 in system suspend.** At the core default 3, UFS failed its first hibern8 exit on resume and needed a host reset (it recovered, no I/O errors); at 5 the first real s2idle freeze resumed clean. gs201 now defaults to 5 in the kernel (S3a, `a7e5e1d95`), so a suspend test only checks that `spm_lvl` reads 5; on a kernel without that commit, `echo 5` first. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) S1-S3 - **Only s2idle, never `deep`.** The firmware advertises PSCI SYSTEM_SUSPEND, so mainline offers `deep`, but Linux has no gs201 SoC sleep sequence (SYS_SLEEP), and the phone wouldn't wake. `mem_sleep_default=s2idle` in the bootargs and device-cheetah's `sleep.conf` drop-in keep it on s2idle. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) §1, §5 - **Some unattended RTC cycles wake early on the PMIC interrupt** (2 of 20 in S4, 4 of 31 in S5c, at 13-16 s instead of 30 s). Which PMIC event it is hasn't been read yet; count it, don't treat it as a failed cycle. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) S4, S5c diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index ad3867fda..ed3f954c2 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -25,7 +25,9 @@ merge): 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). +- **s2idle with the cable out: about 300 mA** (302 mA over two 30-minute + sleeps on 2026-10-29, S1 below; the 140 mA read on 2026-10-27 didn't + hold up and is retired there). - **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 @@ -151,13 +153,16 @@ tools/phone-ssh 'power-ab --detach --unplug 180 --phase 1800 --rounds 2 --suspen `--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, +`/sys/power/state` would skip it). On the 9a always pass it: `power-ab`'s +default, `--suspend rtcwake`, is a direct freeze, the path that fails to +wake (the S1 result below), and a detached cable-out run is the worst place +for one. 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 +kernel). Expect about 300 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. @@ -193,23 +198,55 @@ with the cable in. length). This matches the 2026-10-28 figure (57 mA). The module loads, unloads and wakes cleanly; the palmtop now loads it at boot from a hand unit, `/etc/systemd/system/tegu-mif-sleep.service` - (`insmod /var/lib/omamobile-tegu/tegu-mif-sleep.ko`), until the policy - is in the kernel or the device package. Cable-in figures sit about + (`insmod /var/lib/omamobile-tegu/tegu-mif-sleep.ko`, the module built + from `adbca4c88a21` above against this release), until the policy is in + the kernel or the device package. Rollback: `systemctl disable --now + tegu-mif-sleep; rmmod tegu_mif_sleep` (nothing changes while awake), and + the module must be rebuilt for every kernel push. Cable-in figures sit about 140 mA above cable-out ones (the USB link keeps the SoC busy). - **`rtcwake -m freeze` straight to `/sys/power/state` is not safe on the 9a.** The one direct freeze of the night (240 s, NFC blocked by rfkill, polling already stopped) never woke from its RTC alarm; the owner reset it with Power + Volume Up about 25 minutes later. The 2026-10-28 run lost - one of four the same way, while every `systemctl suspend` cycle so far - (35 on 2026-10-27, 2 x 30 min and 4 short ones tonight) woke. Until the - difference is understood, every sleep test goes through `systemctl - suspend` after `rtcwake -m no -s N`. Nothing in pstore: a held power key - is a pin reset, and the console log of the hung sleep didn't survive it. + one of four the same way: two direct freezes of five never woke, while + every `systemctl suspend` cycle so far (35 on 2026-10-27, 2 x 30 min and + 4 short ones tonight) woke. Until the difference is understood, every + sleep test goes through `systemctl suspend` after `rtcwake -m no -s N`, + and `power-ab` runs with `--suspend systemd`. The entry method may not be + the cause: the systemd path also runs the sleep hooks, so a direct freeze + goes down with Wi-Fi loaded and un-prepared, and the hang may come from + Wi-Fi through the freeze rather than from the write itself. The rule + covers both. Nothing in pstore: a held power key is a pin reset, and the + console log of the hung sleep didn't survive it. - A later note on the method: `power-ab`'s CSV columns are `voltage_uv,current_ua,current_avg_ua,charge_counter_uah,charge_now_uah`; the gauge's `current_avg` is a long filter and says little about a 30-minute window, so read `charge_now` (or `QH`) across the sleep. +**S1 method, cable in (the steps the measurements above used; S2 reuses +them).** Each goes into the runbook before it runs; the charger write ran +tonight before it was written here, which is not the order the plan asks +for. + +```sh +# 1. Buck off: the palmtop runs on its battery with USB data up (risk low; charger in, battery above 30 %). +# First the dead-man that puts the buck back. For awake measurements a monotonic timer is enough: +tools/phone-ssh 'systemd-run --unit=x-buck-restore --on-active=600 /usr/bin/i2cset -f -y 24 0x69 0xbc 0x05' +# For sleeps, monotonic timers don't run in suspend, so use the wall clock, and have the script restore on EXIT too: +tools/phone-ssh 'systemd-run --unit=x-buck-cal --on-calendar="$(date -d "+25 min" "+%Y-%m-%d %H:%M:%S")" /usr/bin/i2cset -f -y 24 0x69 0xbc 0x05' +tools/phone-ssh 'i2cset -f -y 24 0x69 0xbc 0x00; sleep 3; i2cget -f -y 24 0x69 0xbc; cat /sys/class/power_supply/max77779-battery/current_now' +# Expect: 0x00, current_now negative (discharging, about -350 mA screen off). Stop: current_now stays positive +# (the buck is still on: don't measure), or the dead-man refuses to arm. Rollback: the write of 0x05 below. +# 2. Measure. Awake: 45 s means of current_now. Asleep: the gauge's coulomb counter across the sleep, +tools/phone-ssh 'i2cget -f -y 24 0x36 0x4d w' # QH, 2.5 mAh per count; mA = counts * 2.5 * 3600 / seconds +# (checked 2026-10-29: 3 counts in 60 s at a 357 mA mean of current_now; one count is 37 mA over 240 s). +# The sleep itself: rtcwake -m no -s 240; systemctl suspend. Never rtcwake -m freeze (the result above). +# 3. Buck back on, then the read-back: +tools/phone-ssh 'i2cset -f -y 24 0x69 0xbc 0x05; systemctl stop x-buck-restore.timer x-buck-cal.timer 2>/dev/null; sleep 3; i2cget -f -y 24 0x69 0xbc; cat /sys/class/power_supply/max77779-battery/status' +# Expect: 0x05 and current_now positive again (status reads Unknown on this driver). Stop: 0x05 doesn't read +# back: write it again; if it still doesn't, replug the charger (the chip's power-on default is 0x05). +``` + Next: S2 (the four rails), and a cable-out `power-ab` run with the module loaded to put a cable-out number on the MIF saving. From b265200f464224316b491bfe3486831f5f8952e4 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Fri, 30 Oct 2026 10:06:01 -0647 Subject: [PATCH 03/18] device/tegu SLEEP-PLAN, AGENTS: a systemd sleep failed to wake too, so the rule is attendance, not the entry path The 2026-10-30 cable-out run with tegu-mif-sleep loaded never woke from its 30-minute systemctl suspend. Three no-wakes now, on both entry paths, with and without the module: the plan tallies them, the hand unit is disabled, and the agent rule asks for attended sleeps and no boot-time module until the hang is understood. --- AGENTS.md | 2 +- device/tegu/SLEEP-PLAN.md | 37 +++++++++++++++++++++++-------------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index f54ade12e..ead892c79 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -173,7 +173,7 @@ Each entry gives the gotcha, then the reason or the fix. Details are in the link ### Suspend and modem - **On the 9a, NFC must not poll through s2idle.** A suspend with neard polling reset the palmtop (2026-10-27); with polling stopped, 35 s2idle cycles with RTC wakes that day all woke (`7.3.0-rc6-omamobile-tegu-s2mpg15-m1`). The cause isn't known: nxp-nci has no PM callbacks, but neither does the 7 Pro's st-nci, so the controller's interrupt or the I2C bus during the freeze are the next suspects. A sleep hook on the palmtop, `omamobile-tegu-nfc` (not in the repository yet; it comes with tegu's device package), stops neard's poll loop before a systemd sleep and restarts it after; a sleep written straight to `/sys/power/state` (`rtcwake -m mem`) skips the hook, and is ruled out anyway (the next entry: sleep only through `systemctl suspend`). [tegu MODEM-PLAN](device/tegu/MODEM-PLAN.md) "Suspend with the modem on" -- **On the 9a, sleep only through `systemctl suspend` (after `rtcwake -m no -s N`), never `rtcwake -m freeze` or a write to `/sys/power/state`.** Two direct freezes of five (2026-10-28, 2026-10-29) never woke from their RTC alarm and needed Power + Volume Up; every `systemctl suspend` cycle so far woke (35 on 2026-10-27, 6 on 2026-10-29). The cause isn't known. The systemd path also runs the sleep hooks (NFC poll stop, Wi-Fi), so the hang may come from Wi-Fi through the freeze rather than from the entry method; the rule covers both. `tools/power-ab` defaults to `--suspend rtcwake`, a direct freeze: on the 9a pass `--suspend systemd`. [tegu SLEEP-PLAN](device/tegu/SLEEP-PLAN.md) S1 +- **On the 9a, sleep tests are attended, and the direct freeze path is still not used.** Three sleeps have never woken (not from the RTC alarm, not from the power key; Power + Volume Up to reset, nothing in pstore): two direct `rtcwake -m freeze` runs (2026-10-28, 2026-10-29) and one 30-minute `systemctl suspend` with `tegu-mif-sleep` loaded (2026-10-30, cable out); 35 short and six longer systemd sleeps woke. No single factor explains it, so don't leave the palmtop in an unattended long sleep, keep `power-ab` on `--suspend systemd` (the sleep hooks run that way), and don't load `tegu-mif-sleep` at boot until the hang is understood. [tegu SLEEP-PLAN](device/tegu/SLEEP-PLAN.md) S1 - **UFS must be at `spm_lvl` 5 in system suspend.** At the core default 3, UFS failed its first hibern8 exit on resume and needed a host reset (it recovered, no I/O errors); at 5 the first real s2idle freeze resumed clean. gs201 now defaults to 5 in the kernel (S3a, `a7e5e1d95`), so a suspend test only checks that `spm_lvl` reads 5; on a kernel without that commit, `echo 5` first. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) S1-S3 - **Only s2idle, never `deep`.** The firmware advertises PSCI SYSTEM_SUSPEND, so mainline offers `deep`, but Linux has no gs201 SoC sleep sequence (SYS_SLEEP), and the phone wouldn't wake. `mem_sleep_default=s2idle` in the bootargs and device-cheetah's `sleep.conf` drop-in keep it on s2idle. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) §1, §5 - **Some unattended RTC cycles wake early on the PMIC interrupt** (2 of 20 in S4, 4 of 31 in S5c, at 13-16 s instead of 30 s). Which PMIC event it is hasn't been read yet; count it, don't treat it as a failed cycle. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) S4, S5c diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index ed3f954c2..e9f7ae9d0 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -204,20 +204,29 @@ with the cable in. tegu-mif-sleep; rmmod tegu_mif_sleep` (nothing changes while awake), and the module must be rebuilt for every kernel push. Cable-in figures sit about 140 mA above cable-out ones (the USB link keeps the SoC busy). -- **`rtcwake -m freeze` straight to `/sys/power/state` is not safe on the - 9a.** The one direct freeze of the night (240 s, NFC blocked by rfkill, - polling already stopped) never woke from its RTC alarm; the owner reset - it with Power + Volume Up about 25 minutes later. The 2026-10-28 run lost - one of four the same way: two direct freezes of five never woke, while - every `systemctl suspend` cycle so far (35 on 2026-10-27, 2 x 30 min and - 4 short ones tonight) woke. Until the difference is understood, every - sleep test goes through `systemctl suspend` after `rtcwake -m no -s N`, - and `power-ab` runs with `--suspend systemd`. The entry method may not be - the cause: the systemd path also runs the sleep hooks, so a direct freeze - goes down with Wi-Fi loaded and un-prepared, and the hang may come from - Wi-Fi through the freeze rather than from the write itself. The rule - covers both. Nothing in pstore: a held power key is a pin reset, and the - console log of the hung sleep didn't survive it. +- **Sleeps that never wake, three so far, and no single cause.** Not + woken by the RTC alarm, nor by the power key, and reset by hand with + Power + Volume Up: a direct `rtcwake -m freeze` of 10 min on 2026-10-28 + (MIF as it was, after two 421 MHz sleeps that woke); a direct freeze of + 240 s on the night of 2026-10-29 (NFC blocked, polling already stopped); + and on 2026-10-30 a `systemctl suspend` of 30 min, cable out, through + `power-ab --suspend systemd` with `tegu-mif-sleep` loaded (the A phase + ran at about 300 mA, the B freeze was logged, nothing after; the owner's + 65-minute timer ran out with the palmtop dark). Woke: 35 short systemd + cycles on 2026-10-27, two 30-minute and four 240 s systemd sleeps on + 2026-10-29 (one of the four with the module), two 10-minute direct + freezes with the module on 2026-10-28. So neither the entry method nor + the module alone explains it. Until it is understood: every sleep test + is attended, the cable-out run's sleep phase is kept to what the owner + can watch, `power-ab` still runs with `--suspend systemd` (the sleep + hooks run that way), and the hand unit that loaded `tegu-mif-sleep` at + boot is disabled (2026-10-30). Nothing in pstore for any of the three: a + held power key is a pin reset, and the console log doesn't survive it; + the cable-out S1 figure with the module is therefore still missing. + Next on this: a way to see the hung state (the RTC alarm registers and + the wake sources after a forced reset are gone; a kmsg stream to the + laptop needs the cable, so a cable-in 30-minute systemd sleep with the + module, logged, is the next cheap test). - A later note on the method: `power-ab`'s CSV columns are `voltage_uv,current_ua,current_avg_ua,charge_counter_uah,charge_now_uah`; the gauge's `current_avg` is a long filter and says little about a From 485be762a31e8e47479a758aab5edae86ea8e067 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Fri, 30 Oct 2026 10:45:10 -0647 Subject: [PATCH 04/18] device/tegu SLEEP-PLAN: the cable-in probe woke; the no-wake's common factor is still open --- device/tegu/SLEEP-PLAN.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index e9f7ae9d0..78017324f 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -223,10 +223,13 @@ with the cable in. boot is disabled (2026-10-30). Nothing in pstore for any of the three: a held power key is a pin reset, and the console log doesn't survive it; the cable-out S1 figure with the module is therefore still missing. - Next on this: a way to see the hung state (the RTC alarm registers and - the wake sources after a forced reset are gone; a kmsg stream to the - laptop needs the cable, so a cable-in 30-minute systemd sleep with the - module, logged, is the next cheap test). + The cheap test ran the same morning: a cable-in 30-minute `systemctl + suspend` with the module loaded, the RTC alarm logged as armed before + (`alarm_IRQ: yes`, 1800 s ahead), woke on the alarm to the second + (`PM: Triggering wakeup from IRQ 56`, the PMIC's RTC; `suspend_stats` + success 1). So the module and a 30-minute systemd sleep can wake; what + the three failures share is still open. Next: the same probe with the + cable out (the only difference left to the failed run), attended. - A later note on the method: `power-ab`'s CSV columns are `voltage_uv,current_ua,current_avg_ua,charge_counter_uah,charge_now_uah`; the gauge's `current_avg` is a long filter and says little about a From 97858dace75564339faed0c3bc80da89ddefd8b6 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Fri, 30 Oct 2026 12:33:45 -0647 Subject: [PATCH 05/18] device/tegu SLEEP-PLAN: the cable-out figure with MIF at 421 MHz in sleep, 260 mA The repeated cable-out run with tegu-mif-sleep loaded woke on its alarm: 273 mA awake with the screen off, 260 mA asleep, about 40 mA below the previous day's figure without the module. None of the suspected factors reproduces the no-wake alone. --- device/tegu/SLEEP-PLAN.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index 78017324f..993d127fe 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -221,15 +221,21 @@ with the cable in. can watch, `power-ab` still runs with `--suspend systemd` (the sleep hooks run that way), and the hand unit that loaded `tegu-mif-sleep` at boot is disabled (2026-10-30). Nothing in pstore for any of the three: a - held power key is a pin reset, and the console log doesn't survive it; - the cable-out S1 figure with the module is therefore still missing. + held power key is a pin reset, and the console log doesn't survive it. The cheap test ran the same morning: a cable-in 30-minute `systemctl suspend` with the module loaded, the RTC alarm logged as armed before (`alarm_IRQ: yes`, 1800 s ahead), woke on the alarm to the second (`PM: Triggering wakeup from IRQ 56`, the PMIC's RTC; `suspend_stats` - success 1). So the module and a 30-minute systemd sleep can wake; what - the three failures share is still open. Next: the same probe with the - cable out (the only difference left to the failed run), attended. + success 1). The same afternoon the cable-out run was repeated with the + module loaded by hand (`power-ab --suspend systemd`, one round, the + owner away for an hour) and woke on its alarm: awake with the screen off + 273 mA (1715 samples), asleep 259.7 mA (130.0 mAh of `charge_now` over + 1802 s). Against the previous day's 302 mA asleep without the module + that is about 40 mA saved, in line with the cable-in coulomb-counter + figure given the gauge's coarseness. So neither the module, nor the + 30-minute systemd sleep, nor the cable being out reproduces the no-wake + on its own; the three failures' common factor is still open, and sleeps + stay attended. - A later note on the method: `power-ab`'s CSV columns are `voltage_uv,current_ua,current_avg_ua,charge_counter_uah,charge_now_uah`; the gauge's `current_avg` is a long filter and says little about a From 80e6659bfa084a5ae9364a41bc27292925cd7657 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Fri, 30 Oct 2026 13:16:35 -0647 Subject: [PATCH 06/18] device/tegu SLEEP-PLAN, NOTES, AGENTS: the no-wake correction reaches every spot The NOTES entry no longer says the systemd path has woken every time or that the module loads at boot; a 2026-10-30 bullet carries the cable-out no-wake, the disabled unit, the cable-in wake and the afternoon's 260 mA. The status line names the three no-wakes and attended sleeps, the S1 repeat and Next say attended, the AGENTS count is seven longer systemd wakes, the nightly auto-sleep without the module is said to be fine, and the NFC hook is in the repository since #152. --- AGENTS.md | 4 ++-- device/tegu/NOTES.md | 20 +++++++++++++++++--- device/tegu/SLEEP-PLAN.md | 20 +++++++++++++------- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index ead892c79..4ad41ede9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -172,8 +172,8 @@ Each entry gives the gotcha, then the reason or the fix. Details are in the link ### Suspend and modem -- **On the 9a, NFC must not poll through s2idle.** A suspend with neard polling reset the palmtop (2026-10-27); with polling stopped, 35 s2idle cycles with RTC wakes that day all woke (`7.3.0-rc6-omamobile-tegu-s2mpg15-m1`). The cause isn't known: nxp-nci has no PM callbacks, but neither does the 7 Pro's st-nci, so the controller's interrupt or the I2C bus during the freeze are the next suspects. A sleep hook on the palmtop, `omamobile-tegu-nfc` (not in the repository yet; it comes with tegu's device package), stops neard's poll loop before a systemd sleep and restarts it after; a sleep written straight to `/sys/power/state` (`rtcwake -m mem`) skips the hook, and is ruled out anyway (the next entry: sleep only through `systemctl suspend`). [tegu MODEM-PLAN](device/tegu/MODEM-PLAN.md) "Suspend with the modem on" -- **On the 9a, sleep tests are attended, and the direct freeze path is still not used.** Three sleeps have never woken (not from the RTC alarm, not from the power key; Power + Volume Up to reset, nothing in pstore): two direct `rtcwake -m freeze` runs (2026-10-28, 2026-10-29) and one 30-minute `systemctl suspend` with `tegu-mif-sleep` loaded (2026-10-30, cable out); 35 short and six longer systemd sleeps woke. No single factor explains it, so don't leave the palmtop in an unattended long sleep, keep `power-ab` on `--suspend systemd` (the sleep hooks run that way), and don't load `tegu-mif-sleep` at boot until the hang is understood. [tegu SLEEP-PLAN](device/tegu/SLEEP-PLAN.md) S1 +- **On the 9a, NFC must not poll through s2idle.** A suspend with neard polling reset the palmtop (2026-10-27); with polling stopped, 35 s2idle cycles with RTC wakes that day all woke (`7.3.0-rc6-omamobile-tegu-s2mpg15-m1`). The cause isn't known: nxp-nci has no PM callbacks, but neither does the 7 Pro's st-nci, so the controller's interrupt or the I2C bus during the freeze are the next suspects. A sleep hook on the palmtop, `omamobile-tegu-nfc` (shipped by `omamobile-device-tegu` since #152), stops neard's poll loop before a systemd sleep and restarts it after; a sleep written straight to `/sys/power/state` (`rtcwake -m mem`) skips the hook, and is ruled out anyway (the next entry: sleep only through `systemctl suspend`). [tegu MODEM-PLAN](device/tegu/MODEM-PLAN.md) "Suspend with the modem on" +- **On the 9a, sleep tests are attended, and the direct freeze path is still not used.** Three sleeps have never woken (not from the RTC alarm, not from the power key; Power + Volume Up to reset, nothing in pstore): two direct `rtcwake -m freeze` runs (2026-10-28, 2026-10-29) and one 30-minute `systemctl suspend` with `tegu-mif-sleep` loaded (2026-10-30, cable out); 35 short and seven longer systemd sleeps woke (two 30-minute and four 240 s ones on 2026-10-29, a cable-in 30-minute one with the module on 2026-10-30; the afternoon's cable-out run with the module makes eight). No single factor explains it, so keep sleep tests attended, keep `power-ab` on `--suspend systemd` (the sleep hooks run that way), and don't load `tegu-mif-sleep` at boot until the hang is understood. The shell's nightly auto-sleep (the `omamobile-sleep` toggle, systemd path, no module) has woken every time, and the two no-wakes without the module were both direct freezes, so it goes on unattended. [tegu SLEEP-PLAN](device/tegu/SLEEP-PLAN.md) S1 - **UFS must be at `spm_lvl` 5 in system suspend.** At the core default 3, UFS failed its first hibern8 exit on resume and needed a host reset (it recovered, no I/O errors); at 5 the first real s2idle freeze resumed clean. gs201 now defaults to 5 in the kernel (S3a, `a7e5e1d95`), so a suspend test only checks that `spm_lvl` reads 5; on a kernel without that commit, `echo 5` first. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) S1-S3 - **Only s2idle, never `deep`.** The firmware advertises PSCI SYSTEM_SUSPEND, so mainline offers `deep`, but Linux has no gs201 SoC sleep sequence (SYS_SLEEP), and the phone wouldn't wake. `mem_sleep_default=s2idle` in the bootargs and device-cheetah's `sleep.conf` drop-in keep it on s2idle. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) §1, §5 - **Some unattended RTC cycles wake early on the PMIC interrupt** (2 of 20 in S4, 4 of 31 in S5c, at 13-16 s instead of 30 s). Which PMIC event it is hasn't been read yet; count it, don't treat it as a failed cycle. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) S4, S5c diff --git a/device/tegu/NOTES.md b/device/tegu/NOTES.md index e7d12205b..ff86da141 100644 --- a/device/tegu/NOTES.md +++ b/device/tegu/NOTES.md @@ -43,11 +43,25 @@ with nothing but Bluetooth starting resets again at that time, start here. entry per CPU); Bluetooth, NFC and Wi-Fi cost nothing measurable at idle. What stays on is MIF, the buses and the always-on rails: there is no system idle state in our kernel. `tegu-mif-sleep.ko` (MIF 421 MHz in - sleep) saves about 60-75 mA and is loaded at boot by a hand unit now. + sleep) saves about 60-75 mA by the coulomb counter; a hand unit loaded it + at boot for one night and was disabled the next day (below). Details and method in [SLEEP-PLAN](SLEEP-PLAN.md) S1. - `rtcwake -m freeze` written straight to `/sys/power/state` failed to wake - again (the second time in two days); `systemctl suspend` after - `rtcwake -m no` has woken every time. Use only the systemd path. + again (the second time in two days); every `systemctl suspend` after + `rtcwake -m no` had woken up to then. The next day showed the entry + path isn't the whole story (the 2026-10-30 bullet). +- 2026-10-30: the cable-out `power-ab --suspend systemd` run with the + module loaded never woke from its 30-minute sleep (not from the RTC, not + from the power key; reset by hand), so the hand unit that loaded the + module at boot is disabled. The same day a cable-in 30-minute systemd + sleep with the module, its alarm logged as armed, woke on the alarm to + the second, and the afternoon's repeat of the cable-out run with the + module loaded by hand woke too: 273 mA awake with the screen off, 260 mA + asleep, about 40 mA under the figure without the module. Three sleeps + have never woken (two direct freezes, one systemd sleep with the module) + and no single factor explains them, so sleep tests stay attended and the + module stays off at boot; the shell's nightly auto-sleep (systemd path, + no module) has woken every time and goes on as before. - The 2026-10-27 "140 mA asleep" figure doesn't hold up against 2026-10-28 (434-445 mA cable out, as-is) and tonight; treat about 300 mA cable out as the baseline. diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index 993d127fe..e4e600fbe 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -1,8 +1,13 @@ # 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. +Status (2026-10-30): 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, +and three test sleeps have never woken (two direct freezes and one +30-minute systemd sleep with `tegu-mif-sleep` loaded; S1), so sleep tests +are attended. The shell's nightly auto-sleep, which the palmtop runs with +the `omamobile-sleep` toggle on and without the module, has woken every +time and goes on. 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. @@ -160,9 +165,10 @@ for one. 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 300 mA, then less. Stop: the palmtop doesn't come +charge, coarser than a coulomb counter, hence the long phases. Repeat, +attended, with `tegu-mif-sleep` loaded (the module commit above, built +against the running kernel): that is the configuration that once didn't +wake. Expect about 300 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. @@ -265,8 +271,8 @@ tools/phone-ssh 'i2cset -f -y 24 0x69 0xbc 0x05; systemctl stop x-buck-restore.t # back: write it again; if it still doesn't, replug the charger (the chip's power-on default is 0x05). ``` -Next: S2 (the four rails), and a cable-out `power-ab` run with the module -loaded to put a cable-out number on the MIF saving. +Next: S2 (the four rails), attended. The cable-out number with the module +is in (260 mA, S1 result); any further run with the module is attended too. **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 From c8d10bf8004b65d9c0f09e7c880db008011115db Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Fri, 30 Oct 2026 14:07:03 -0647 Subject: [PATCH 07/18] device/tegu SLEEP-PLAN, AGENTS: the sleep toggle is off on the palmtop since the shell reinstall --- AGENTS.md | 2 +- device/tegu/SLEEP-PLAN.md | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 4ad41ede9..1d0662f2e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -173,7 +173,7 @@ Each entry gives the gotcha, then the reason or the fix. Details are in the link ### Suspend and modem - **On the 9a, NFC must not poll through s2idle.** A suspend with neard polling reset the palmtop (2026-10-27); with polling stopped, 35 s2idle cycles with RTC wakes that day all woke (`7.3.0-rc6-omamobile-tegu-s2mpg15-m1`). The cause isn't known: nxp-nci has no PM callbacks, but neither does the 7 Pro's st-nci, so the controller's interrupt or the I2C bus during the freeze are the next suspects. A sleep hook on the palmtop, `omamobile-tegu-nfc` (shipped by `omamobile-device-tegu` since #152), stops neard's poll loop before a systemd sleep and restarts it after; a sleep written straight to `/sys/power/state` (`rtcwake -m mem`) skips the hook, and is ruled out anyway (the next entry: sleep only through `systemctl suspend`). [tegu MODEM-PLAN](device/tegu/MODEM-PLAN.md) "Suspend with the modem on" -- **On the 9a, sleep tests are attended, and the direct freeze path is still not used.** Three sleeps have never woken (not from the RTC alarm, not from the power key; Power + Volume Up to reset, nothing in pstore): two direct `rtcwake -m freeze` runs (2026-10-28, 2026-10-29) and one 30-minute `systemctl suspend` with `tegu-mif-sleep` loaded (2026-10-30, cable out); 35 short and seven longer systemd sleeps woke (two 30-minute and four 240 s ones on 2026-10-29, a cable-in 30-minute one with the module on 2026-10-30; the afternoon's cable-out run with the module makes eight). No single factor explains it, so keep sleep tests attended, keep `power-ab` on `--suspend systemd` (the sleep hooks run that way), and don't load `tegu-mif-sleep` at boot until the hang is understood. The shell's nightly auto-sleep (the `omamobile-sleep` toggle, systemd path, no module) has woken every time, and the two no-wakes without the module were both direct freezes, so it goes on unattended. [tegu SLEEP-PLAN](device/tegu/SLEEP-PLAN.md) S1 +- **On the 9a, sleep tests are attended, and the direct freeze path is still not used.** Three sleeps have never woken (not from the RTC alarm, not from the power key; Power + Volume Up to reset, nothing in pstore): two direct `rtcwake -m freeze` runs (2026-10-28, 2026-10-29) and one 30-minute `systemctl suspend` with `tegu-mif-sleep` loaded (2026-10-30, cable out); 35 short and seven longer systemd sleeps woke (two 30-minute and four 240 s ones on 2026-10-29, a cable-in 30-minute one with the module on 2026-10-30; the afternoon's cable-out run with the module makes eight). No single factor explains it, so keep sleep tests attended, keep `power-ab` on `--suspend systemd` (the sleep hooks run that way), and don't load `tegu-mif-sleep` at boot until the hang is understood. The shell's the shell's auto-sleep (the `omamobile-sleep` toggle, systemd path, no module) woke every time while it was on, and the two no-wakes without the module were both direct freezes; the toggle is off on the palmtop since the 2026-10-30 shell reinstall (the package ships it off), so turning it on is the owner's call. [tegu SLEEP-PLAN](device/tegu/SLEEP-PLAN.md) S1 - **UFS must be at `spm_lvl` 5 in system suspend.** At the core default 3, UFS failed its first hibern8 exit on resume and needed a host reset (it recovered, no I/O errors); at 5 the first real s2idle freeze resumed clean. gs201 now defaults to 5 in the kernel (S3a, `a7e5e1d95`), so a suspend test only checks that `spm_lvl` reads 5; on a kernel without that commit, `echo 5` first. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) S1-S3 - **Only s2idle, never `deep`.** The firmware advertises PSCI SYSTEM_SUSPEND, so mainline offers `deep`, but Linux has no gs201 SoC sleep sequence (SYS_SLEEP), and the phone wouldn't wake. `mem_sleep_default=s2idle` in the bootargs and device-cheetah's `sleep.conf` drop-in keep it on s2idle. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) §1, §5 - **Some unattended RTC cycles wake early on the PMIC interrupt** (2 of 20 in S4, 4 of 31 in S5c, at 13-16 s instead of 30 s). Which PMIC event it is hasn't been read yet; count it, don't treat it as a failed cycle. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) S4, S5c diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index e4e600fbe..6784fc8f0 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -5,9 +5,11 @@ Status (2026-10-30): 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, and three test sleeps have never woken (two direct freezes and one 30-minute systemd sleep with `tegu-mif-sleep` loaded; S1), so sleep tests -are attended. The shell's nightly auto-sleep, which the palmtop runs with -the `omamobile-sleep` toggle on and without the module, has woken every -time and goes on. +are attended. The shell's auto-sleep (the `omamobile-sleep` toggle) is +off on the palmtop since the 2026-10-30 shell reinstall (the package ships +it off), so it doesn't sleep unattended at present; while it was on, its +systemd-path sleeps without the module all woke, and turning it back on is +the owner's call. 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. From 6a3a489b43680f3f1ea344fd0d6c3a2d10f683c7 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Fri, 30 Oct 2026 14:31:52 -0647 Subject: [PATCH 08/18] device/tegu SLEEP-PLAN: a power-key press didn't wake a sleep with the module loaded --- device/tegu/SLEEP-PLAN.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index 6784fc8f0..ff95aaec4 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -243,7 +243,16 @@ with the cable in. figure given the gauge's coarseness. So neither the module, nor the 30-minute systemd sleep, nor the cable being out reproduces the no-wake on its own; the three failures' common factor is still open, and sleeps - stay attended. + stay attended. One more observation the same afternoon, cable in, module + still loaded from the drain run: during a forced 10-minute systemd sleep + the owner's tap and power-key press did not wake the palmtop; the kernel + came up once at about 112 s (`Timekeeping suspended for 112.557 seconds`) + and went straight back to s2idle until the RTC alarm woke it at 10 + minutes (IRQ 56). The power key woke s2idle on 10-27 without the module, + so the next cheap test is a sleep without the module and a power-key + press, then the same with the module: if the key wakes only without it, + the module is in the no-wake story after all (a key wake that doesn't + register would look exactly like an RTC alarm that doesn't). - A later note on the method: `power-ab`'s CSV columns are `voltage_uv,current_ua,current_avg_ua,charge_counter_uah,charge_now_uah`; the gauge's `current_avg` is a long filter and says little about a From f3047aeccf428e5086da1092c288899247958e90 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Fri, 30 Oct 2026 15:25:13 -0647 Subject: [PATCH 09/18] device/tegu SLEEP-PLAN, AGENTS: UFS failed to resume from an s2idle and the root went read-only The forced 10-minute sleep on 2026-10-30 woke on its alarm but the UFS link never came back (link startup failed, Host init failed, ufshcd_wl_resume failed), every disk read then failed and ext4 went emergency read-only; a sysrq reset recovered it. A palmtop that seems never to wake may have woken with dead storage, so the plan and the agent rules now say to check dmesg for the UFS failure after every sleep and reset from the kernel if it shows. --- AGENTS.md | 1 + device/tegu/SLEEP-PLAN.md | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index 2ddb5b1c8..16de9e8dd 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -176,6 +176,7 @@ Each entry gives the gotcha, then the reason or the fix. Details are in the link - **On the 9a, NFC must not poll through s2idle.** A suspend with neard polling reset the palmtop (2026-10-27); with polling stopped, 35 s2idle cycles with RTC wakes that day all woke (`7.3.0-rc6-omamobile-tegu-s2mpg15-m1`). The cause isn't known: nxp-nci has no PM callbacks, but neither does the 7 Pro's st-nci, so the controller's interrupt or the I2C bus during the freeze are the next suspects. A sleep hook on the palmtop, `omamobile-tegu-nfc` (not in the repository yet; it comes with tegu's device package), stops neard's poll loop before a systemd sleep and restarts it after; a sleep written straight to `/sys/power/state` (`rtcwake -m mem`) skips the hook, so stop polling by hand first. Without [linux-omarchy-mobile#131](https://github.com/derekross/linux-omarchy-mobile/pull/131) the ST54L also doesn't answer on I2C after a wake (`Error -6 on I2C send`, also after the driver's retry), or after about 2-3 s of idle at any time, until neard powers it off and on ([#132](https://github.com/derekross/omarchy-mobile/issues/132)): nxp-nci never turned its NFC mode on, as ST's HAL does after init. With #131 (the results below on `core.c` blob `77fc35b61da5`, #131's first version; the merged version, `c96704ddd480`, re-run for six power-ons and polling at 3 s and 30 s; the release, `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`, is the same as without the fix), NFC polls after 3 s to 3 minutes of idle and polled again after two RTC-woken s2idle cycles (2026-10-29): one with a hook that stops polling and powers the adapter off, and one without that hook, for which it isn't recorded whether polling was stopped, so whether NFC comes back after a wake with the stop-poll hook alone rests on that one cycle and needs a re-run with the hook's log. No power-off hook is needed for NFC; the stop-poll rule above stands on its 35 of 35. [tegu MODEM-PLAN](device/tegu/MODEM-PLAN.md) "Suspend with the modem on" - **On the 9a, sleep tests are attended, and the direct freeze path is still not used.** Three sleeps have never woken (not from the RTC alarm, not from the power key; Power + Volume Up to reset, nothing in pstore): two direct `rtcwake -m freeze` runs (2026-10-28, 2026-10-29) and one 30-minute `systemctl suspend` with `tegu-mif-sleep` loaded (2026-10-30, cable out); 35 short and seven longer systemd sleeps woke (two 30-minute and four 240 s ones on 2026-10-29, a cable-in 30-minute one with the module on 2026-10-30; the afternoon's cable-out run with the module makes eight). No single factor explains it, so keep sleep tests attended, keep `power-ab` on `--suspend systemd` (the sleep hooks run that way), and don't load `tegu-mif-sleep` at boot until the hang is understood. The shell's the shell's auto-sleep (the `omamobile-sleep` toggle, systemd path, no module) woke every time while it was on, and the two no-wakes without the module were both direct freezes; the toggle is off on the palmtop since the 2026-10-30 shell reinstall (the package ships it off), so turning it on is the owner's call. [tegu SLEEP-PLAN](device/tegu/SLEEP-PLAN.md) S1 +- **On the 9a, UFS can fail to come back from s2idle, and then the root filesystem goes read-only.** Seen once on 2026-10-30 (`link startup failed 1`, `Host init failed 1` x5, `ufshcd_wl_resume failed`, then `I/O error, dev sda` and ext4 `emergency_ro`; `spm_lvl` 5). The palmtop woke on its alarm but nothing on disk could be read: `systemctl suspend`/`reboot` did nothing, the power key could not light the screen, SSH kept answering from memory. A dark palmtop that ignores the power key may therefore be awake with dead storage, not asleep. After every s2idle, `dmesg | grep -E "link startup failed|Host init failed|I/O error"` first; if it matches, `echo b > /proc/sysrq-trigger` (binaries won't load), then check the ext4 recovery on the next boot. [tegu SLEEP-PLAN](device/tegu/SLEEP-PLAN.md) S1 - **UFS must be at `spm_lvl` 5 in system suspend.** At the core default 3, UFS failed its first hibern8 exit on resume and needed a host reset (it recovered, no I/O errors); at 5 the first real s2idle freeze resumed clean. gs201 now defaults to 5 in the kernel (S3a, `a7e5e1d95`), so a suspend test only checks that `spm_lvl` reads 5; on a kernel without that commit, `echo 5` first. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) S1-S3 - **Only s2idle, never `deep`.** The firmware advertises PSCI SYSTEM_SUSPEND, so mainline offers `deep`, but Linux has no gs201 SoC sleep sequence (SYS_SLEEP), and the phone wouldn't wake. `mem_sleep_default=s2idle` in the bootargs and device-cheetah's `sleep.conf` drop-in keep it on s2idle. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) §1, §5 - **Some unattended RTC cycles wake early on the PMIC interrupt** (2 of 20 in S4, 4 of 31 in S5c, at 13-16 s instead of 30 s). Which PMIC event it is hasn't been read yet; count it, don't treat it as a failed cycle. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) S4, S5c diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index ff95aaec4..db75f0aa6 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -253,6 +253,33 @@ with the cable in. press, then the same with the module: if the key wakes only without it, the module is in the no-wake story after all (a key wake that doesn't register would look exactly like an RTC alarm that doesn't). +- **Found the same afternoon: UFS failed to come back from an s2idle, and + that is what a "no-wake" looks like from outside.** The forced 10-minute + systemd sleep above (cable in, module loaded) did wake on its RTC alarm + at uptime 10801 s, but the UFS link did not come back: the console in + pstore shows `exynos-ufshc 13200000.ufs: link startup failed 1` and + `ufshcd_host_reset_and_restore: Host init failed 1` five times in a row, + then `ufshcd_wl_resume failed: 1`, `PM: failed to resume async: error 1`, + and from the first write after resume `I/O error, dev sda` with + `hostbyte=0x07`, `EXT4-fs … failed to convert unwritten extents … + potential data loss`, and the root filesystem went `emergency_ro`. The + palmtop answered SSH for a while from what was already in memory, but + nothing on disk could be read: `systemctl suspend` and `systemctl + reboot` did nothing, `coredumpctl` and `df` returned EIO, the power key + reached the kernel (its interrupt count rose) and the shell could not + light the screen. A sysrq `b` reset brought it back with a clean ext4 + journal recovery (`spm_lvl` was 5 throughout, `rpm_lvl` 3). So a + palmtop that "never wakes" and whose power key does nothing may have + woken with its storage dead, which the three no-wake records cannot + distinguish from a missed alarm: none of them had a console. UFS resume + was qualified on 32 of 32 cycles with the reset held in suspend (kernel + #83) and on the S1 sleeps; this is the first failure, 1 of about 50 + systemd-path resumes. Rule until understood: after every s2idle on the + 9a, `dmesg | grep -E "link startup failed|Host init failed|I/O error"` + before anything else, and reboot at once if it matches; unattended + sleep stays off. Next: the UFS resume path with the kmsg stream, and the + question whether the three dark no-wakes left ext4 recovery lines in + their next boot's journal (`journalctl -b -N -k | grep EXT4`). - A later note on the method: `power-ab`'s CSV columns are `voltage_uv,current_ua,current_avg_ua,charge_counter_uah,charge_now_uah`; the gauge's `current_avg` is a long filter and says little about a From 5b060afd4ddb9c46bfa4eb4c5e15f25d3aa2d0d6 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Fri, 30 Oct 2026 21:28:53 -0643 Subject: [PATCH 10/18] device/tegu SLEEP-PLAN: five clean s2idle cycles, then a hang off the USB bus on the sixth --- device/tegu/SLEEP-PLAN.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index db75f0aa6..0fbbadebf 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -280,6 +280,32 @@ with the cable in. sleep stays off. Next: the UFS resume path with the kmsg stream, and the question whether the three dark no-wakes left ext4 recovery lines in their next boot's journal (`journalctl -b -N -k | grep EXT4`). +- **2026-10-30 night, s2idle with the cable in, 20 cycles asked for, 6 + taken, 1 hang.** Attended RTC-woken 30-second cycles on the daily boot + (release `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`, the + modem never loaded in that boot, NFC's sleep hook in place, `spm_lvl` 5, + `rpm_lvl` 3), each checked for `link startup failed`, `Host init failed`, + `I/O error` and `ufshcd_err_handler` before the next one, and for a + writable root. Cycles 1-5: all woke, all four counters zero, one suspend + entry and one exit each, root writable, the wake each time the RTC with + the power key and Wi-Fi's host-wake disarmed again on resume (`wake + disabled for irq 59`, `irq 73`). `/sys/power/suspend_stats` read + `success=5` with every failure counter zero. The sixth cycle of the same + boot did not come back, and this time the palmtop left the USB bus + entirely (no gadget, the laptop's interface gone), so it is not the dead- + storage shape of the 10-30 afternoon (which kept answering SSH from + memory): the SoC itself is hung or down, and nothing can be read until a + forced restart. Waiting on that to read the console from pstore. +- **What the five clean cycles rule out, and what they don't.** Five in a + row with the storage counters at zero says the UFS resume path is not + broken per se; the afternoon failure and this hang are both the sixth or + later sleep of a long-running boot (the afternoon one at uptime 10801 s, + this one after five sleeps), so the next question is whether the failure + follows the number of sleeps in a boot rather than any single sleep. The + three dark no-wakes left no ext4 recovery line in their next boot's + journal (checked tonight across 25 boots: no boot recovered a journal), + so they were not the dead-storage shape either, which fits a hang like + tonight's. - A later note on the method: `power-ab`'s CSV columns are `voltage_uv,current_ua,current_avg_ua,charge_counter_uah,charge_now_uah`; the gauge's `current_avg` is a long filter and says little about a @@ -357,5 +383,9 @@ step 2 in reverse). ## Not known yet +- Why a boot's sixth or later s2idle hangs or loses its storage while the + first five are clean (2026-10-30 night, above). Next: the cycles again + from a fresh boot with the kmsg stream to the laptop, counting sleeps, + and the console from the forced restart of tonight's hang. - What the GNSS and fingerprint rails cost in sleep (S2). - What MIF in sleep saves with the cable out (S1). From eafd4baea4e5f84e9687cffe84718fd297bb5a63 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Fri, 30 Oct 2026 22:05:24 -0643 Subject: [PATCH 11/18] device/tegu SLEEP-PLAN: the failing suspend was the third of its boot, and the ACPM link is withdrawn --- device/tegu/SLEEP-PLAN.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index 0fbbadebf..d3bb4decd 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -296,12 +296,28 @@ with the cable in. storage shape of the 10-30 afternoon (which kept answering SSH from memory): the SoC itself is hung or down, and nothing can be read until a forced restart. Waiting on that to read the console from pstore. +- **Read back from the afternoon's own console (2026-10-30 night, offline): + the failing suspend was the third of its boot, not a late one.** The + console holds nine suspend entries (387.7 s, 4746.9 s, 10798.6 s, then + 14328.9 s onwards once the filesystem was already read-only), and the + third one, at 10798.6 s, is the one whose resume failed at 10799.8 s. The + 25 seconds before it contain nothing but PAM and audit lines from an SSH + login: no ACPM timeout, no thermal error, no UFS warning. (An earlier + note of mine tied that failure to the ACPM timeouts; those are from a + different boot, the 18:31 console of the same day, and the link is + withdrawn. The ACPM slot leak found while reading that path is real and + is linux-omarchy-mobile#152, but it is a separate defect.) So the + afternoon failure was the third sleep of its boot at about 3 hours of + uptime, and tonight's hang the sixth of its boot at about 10 minutes: + neither "the Nth sleep" nor "a long boot" fits both, and what they share + is only that neither was the first sleep of its boot. - **What the five clean cycles rule out, and what they don't.** Five in a row with the storage counters at zero says the UFS resume path is not broken per se; the afternoon failure and this hang are both the sixth or later sleep of a long-running boot (the afternoon one at uptime 10801 s, - this one after five sleeps), so the next question is whether the failure - follows the number of sleeps in a boot rather than any single sleep. The + this one after five sleeps), so the first guess was the number of sleeps + in a boot; the console read below retires that guess, since the afternoon + failure was only the third sleep of its boot. The three dark no-wakes left no ext4 recovery line in their next boot's journal (checked tonight across 25 boots: no boot recovered a journal), so they were not the dead-storage shape either, which fits a hang like From a1a3568ec1b75aa5ac77aa9dd6453288eae22fbd Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Fri, 30 Oct 2026 22:07:53 -0643 Subject: [PATCH 12/18] device/tegu SLEEP-PLAN: the four rails have no consumer, so S2 measures but cannot be the policy --- device/tegu/SLEEP-PLAN.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index d3bb4decd..42fbb27a5 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -67,6 +67,27 @@ The figures are from the 2026-10-27 and 10-28 NOTES entries 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. +2b. **What S2 can and cannot change, now that GNSS works (read from the + running DTB, 2026-10-30 night).** The four rails are declared with + labels (`gnss_core: ldo9s`, `gnss_rf: ldo10s`, `gnss_aux: ldo11s`, + `udfps_3v3: ldo15s`) and **no consumer anywhere in the device tree**: + nothing names them as a supply, which is why they need + `regulator-always-on` to stay up at all. So removing that property does + not move the cost to the user of the rail, it simply lets the regulator + core's unused-rail cleanup turn all four off about 30 s after late init. + That is still a valid one-boot measurement, and it is what S2 asks for, + but it is not a shippable policy: GNSS needs its three rails for a + session (the Kepler RF front end cannot calibrate without them, which is + why they are on as stock has them), and the fingerprint sensor needs + LDO15S for an operation. Now that a GNSS session works end to end, the + policy S2 should lead to is a consumer rather than an absence: the GNSS + path claiming its three rails when a session starts and dropping them + when it ends, and the fingerprint path doing the same around an + operation, so the drain is paid only while something uses the hardware. + That needs a supply property on the consumer's node and driver support + on both paths, neither of which exists upstream yet, so the order is: + measure with S2 to learn the number, then decide whether the number + justifies the driver work. 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. From 402b5ac0a236a49197d29d8670111289e9ff4d5a Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Fri, 30 Oct 2026 22:11:56 -0643 Subject: [PATCH 13/18] device/tegu SLEEP-PLAN: the failing resume never reached the first DME set, so it is link startup --- device/tegu/SLEEP-PLAN.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index 42fbb27a5..75d309d32 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -332,6 +332,34 @@ with the cable in. uptime, and tonight's hang the sixth of its boot at about 10 minutes: neither "the Nth sleep" nor "a long boot" fits both, and what they share is only that neither was the first sleep of its boot. +- **The failing resume compared with the two clean ones in the same + console (2026-10-30 night, offline).** Lined up on their suspend entry, + the three resumes of that boot differ in one step: + + | | clean (387.7 s) | clean (4746.9 s) | failed (10798.6 s) | + | --- | --- | --- | --- | + | `wl resume begins` | +0.754 | +0.741 | +0.717 | + | `dme-set attr-id 0x4021` | +0.803 | +0.800 | never | + | `Power mode changed to FAST series_B G_4 L_2` | +0.859 | +0.866 | never | + | `link startup failed 1` | - | - | +1.198, then +1.655, +2.143, +2.622, +3.058 | + | `reset_and_restore` | 0 | 0 | 1 | + + So the failure is not in the hibern8 exit or in the device's power mode: + it is link startup itself, which never got as far as the first DME set. + Each attempt took about 430-490 ms, the UIC command timeout, and five of + them in a row exhausted `ufshcd_host_reset_and_restore()`. In the clean + resumes the whole link came up in 50 to 90 ms with the DME set and the + power-mode change present. The wake-interrupt disarm of irq 73 (Wi-Fi's + host wake, on the 154e0000 controller) lands either side of the DME set + in the clean runs, so its ordering against the UFS resume is not the + difference. + + What that points at for the next run: the link-startup path on resume, + which at `spm_lvl` 5 is a full re-init, so the PHY power-on and the + release of the device reset line (`HCI_GPIO_OUT`, asserted in + `gs101_ufs_suspend()`) rather than anything in hibern8. Worth reading + next to the one-sample caveat: this is a single failure against two clean + resumes in that boot and five clean cycles tonight. - **What the five clean cycles rule out, and what they don't.** Five in a row with the storage counters at zero says the UFS resume path is not broken per se; the afternoon failure and this hang are both the sixth or From 4a2d4e5ab13c2eecde360414f3626134f417f1f3 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Fri, 30 Oct 2026 22:19:38 -0643 Subject: [PATCH 14/18] device/tegu SLEEP-PLAN: a hypothesis for the failed link startup, and the cheap test for it --- device/tegu/SLEEP-PLAN.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index 75d309d32..16471958a 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -360,6 +360,24 @@ with the cable in. `gs101_ufs_suspend()`) rather than anything in hibern8. Worth reading next to the one-sample caveat: this is a single failure against two clean resumes in that boot and five clean cycles tonight. +- **A hypothesis for that link startup, from comparing the driver with + Google's (offline).** Both drivers pulse the device reset in the + controller-enable notifier before link startup, with the same 5 us, so + that is not the difference. What our gs201 and zumapro descriptions carry + and Google's does not express the same way is idle clock gating: + `EXYNOS_UFS_OPT_CLKSTOP_PRE_CHANGE | EXYNOS_UFS_OPT_UNGATE_POST_CHANGE`, + and the driver's own comment says zumapro's CMU gates really stop the host + clocks, so the clock-stop registers can only be written with the gates + open. A resume at `spm_lvl` 5 is a full re-init: if the core's clock + gating lands anywhere inside it, the DME commands that link startup sends + would time out exactly as the failing console shows, with no first DME + set and no power-mode change. That is a hypothesis, not a finding: the + ordering in `exynos_ufs_setup_clocks()` is meant to prevent it. + The test is cheap and attended: `CLKGATE=0` in + `runners/13-s2idle-counted.sh` turns gating off for the run + (`clkgate_enable` 0) and the cycles run as usual. One failure in about 50 + resumes means a clean run of ten proves nothing by itself, so it is worth + running both ways and counting. - **What the five clean cycles rule out, and what they don't.** Five in a row with the storage counters at zero says the UFS resume path is not broken per se; the afternoon failure and this hang are both the sixth or From bcd35fc09aab20d70430ac06a1671e374273ee81 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Sat, 31 Oct 2026 06:38:37 -0643 Subject: [PATCH 15/18] device/tegu SLEEP-PLAN: the register that names an early RTC cycle's PMIC event --- device/tegu/SLEEP-PLAN.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index 16471958a..bc9d2fad4 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -470,5 +470,18 @@ step 2 in reverse). first five are clean (2026-10-30 night, above). Next: the cycles again from a fresh boot with the kmsg stream to the laptop, counting sleeps, and the console from the forced restart of tonight's hang. +- Which PMIC event ends an early RTC cycle, and now how to read it. The + record says it has never been read; the driver names the register. In + `rtc-s5m.c`, `s5m_check_pending_alarm_interrupt()` reads + `S2MPG14_PMIC_STATUS2` on zumapro (`S2MPG12_PMIC_STATUS2` on gs201) and + takes the alarm from `RTCA0E`, bit 2 (`RTCA1E`, bit 1, is the second + alarm). So after a cycle that woke early, that register says whether the + alarm fired at all, and its other bits name what else the PMIC latched. + Reading PMIC registers from userspace is allowed (the rule that forbids + it is about the PMU), through that chip's regmap in debugfs, and a single + register rather than a whole dump (lesson from the amplifier regmap). + kernel #149 is the same readback for gs101's S2MPG10, which this tree + gets wrong today; zumapro's and gs201's cases are already right, so that + PR doesn't change what the 9a or the 7 Pro report. - What the GNSS and fingerprint rails cost in sleep (S2). - What MIF in sleep saves with the cable out (S1). From 93a9332605122d7f347bcecd4ecae983e8e540b8 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Sat, 31 Oct 2026 08:30:17 -0643 Subject: [PATCH 16/18] device/tegu SLEEP-PLAN: ten clean cycles, and console_suspend=N keeps the log through the freeze --- device/tegu/SLEEP-PLAN.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index bc9d2fad4..e0dd7c749 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -317,6 +317,22 @@ with the cable in. storage shape of the 10-30 afternoon (which kept answering SSH from memory): the SoC itself is hung or down, and nothing can be read until a forced restart. Waiting on that to read the console from pstore. +- **2026-10-31 morning: ten of ten cycles clean, and the console now + survives the freeze.** The reason every earlier hang left no kernel + evidence is that printk suspends the consoles at the freeze ("Suspending + console(s) (use no_console_suspend to debug)"), so nothing reached + ramoops after that line. It does not need a boot argument: + `/sys/module/printk/parameters/console_suspend` is writable, and `echo N` + into it keeps the console alive through s2idle. With that set, ten + 30-second RTC-woken cycles on the daily boot all woke with the storage + counters, the ACPM timeout count and the watchdog count at zero, + `suspend_stats` reading `success=10 fail=0`, and the kernel log streamed + to the laptop for the whole run (10086 lines, + `logs/tegu-review-20261029/runners/13b-20261031-0807-kmsg.txt`, not + committed), with all ten entry and exit pairs in it and each wake showing + the power key and Wi-Fi host-wake disarmed again (irq 59 and irq 73). + So the next hang will leave its last words, which is the one thing the + 10-30 night could not give. - **Read back from the afternoon's own console (2026-10-30 night, offline): the failing suspend was the third of its boot, not a late one.** The console holds nine suspend entries (387.7 s, 4746.9 s, 10798.6 s, then From 86623ed0e658374c98bc111d05e8268321e24fdc Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Sat, 31 Oct 2026 09:10:41 -0643 Subject: [PATCH 17/18] device/tegu SLEEP-PLAN, NOTES, AGENTS: the consistency pass from the review of #166 --- AGENTS.md | 2 +- device/tegu/NOTES.md | 5 ++-- device/tegu/SLEEP-PLAN.md | 53 +++++++++++++++++++++++++++++++-------- 3 files changed, 46 insertions(+), 14 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 17a3c3a1d..e8360dde0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -176,7 +176,7 @@ Each entry gives the gotcha, then the reason or the fix. Details are in the link - **On the 9a, NFC must not poll through s2idle.** A suspend with neard polling reset the palmtop (2026-10-27); with polling stopped, 35 s2idle cycles with RTC wakes that day all woke (`7.3.0-rc6-omamobile-tegu-s2mpg15-m1`). The cause isn't known: nxp-nci has no PM callbacks, but neither does the 7 Pro's st-nci, so the controller's interrupt or the I2C bus during the freeze are the next suspects. A sleep hook on the palmtop, `omamobile-tegu-nfc` (not in the repository yet; it comes with tegu's device package), stops neard's poll loop before a systemd sleep and restarts it after; a sleep written straight to `/sys/power/state` (`rtcwake -m mem`) skips the hook, so stop polling by hand first. Without [linux-omarchy-mobile#131](https://github.com/derekross/linux-omarchy-mobile/pull/131) the ST54L also doesn't answer on I2C after a wake (`Error -6 on I2C send`, also after the driver's retry), or after about 2-3 s of idle at any time, until neard powers it off and on ([#132](https://github.com/derekross/omarchy-mobile/issues/132)): nxp-nci never turned its NFC mode on, as ST's HAL does after init. With #131 (the results below on `core.c` blob `77fc35b61da5`, #131's first version; the merged version, `c96704ddd480`, re-run for six power-ons and polling at 3 s and 30 s; the release, `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`, is the same as without the fix), NFC polls after 3 s to 3 minutes of idle and polled again after two RTC-woken s2idle cycles (2026-10-29): one with a hook that stops polling and powers the adapter off, and one without that hook, for which it isn't recorded whether polling was stopped, so whether NFC comes back after a wake with the stop-poll hook alone rests on that one cycle and needs a re-run with the hook's log. No power-off hook is needed for NFC; the stop-poll rule above stands on its 35 of 35. [tegu MODEM-PLAN](device/tegu/MODEM-PLAN.md) "Suspend with the modem on" - **On the 9a, sleep tests are attended, and the direct freeze path is still not used.** Three sleeps have never woken (not from the RTC alarm, not from the power key; Power + Volume Up to reset, nothing in pstore): two direct `rtcwake -m freeze` runs (2026-10-28, 2026-10-29) and one 30-minute `systemctl suspend` with `tegu-mif-sleep` loaded (2026-10-30, cable out); 35 short and seven longer systemd sleeps woke (two 30-minute and four 240 s ones on 2026-10-29, a cable-in 30-minute one with the module on 2026-10-30; the afternoon's cable-out run with the module makes eight). No single factor explains it, so keep sleep tests attended, keep `power-ab` on `--suspend systemd` (the sleep hooks run that way), and don't load `tegu-mif-sleep` at boot until the hang is understood. The shell's the shell's auto-sleep (the `omamobile-sleep` toggle, systemd path, no module) woke every time while it was on, and the two no-wakes without the module were both direct freezes; the toggle is off on the palmtop since the 2026-10-30 shell reinstall (the package ships it off), so turning it on is the owner's call. [tegu SLEEP-PLAN](device/tegu/SLEEP-PLAN.md) S1 -- **On the 9a, UFS can fail to come back from s2idle, and then the root filesystem goes read-only.** Seen once on 2026-10-30 (`link startup failed 1`, `Host init failed 1` x5, `ufshcd_wl_resume failed`, then `I/O error, dev sda` and ext4 `emergency_ro`; `spm_lvl` 5). The palmtop woke on its alarm but nothing on disk could be read: `systemctl suspend`/`reboot` did nothing, the power key could not light the screen, SSH kept answering from memory. A dark palmtop that ignores the power key may therefore be awake with dead storage, not asleep. After every s2idle, `dmesg | grep -E "link startup failed|Host init failed|I/O error"` first; if it matches, `echo b > /proc/sysrq-trigger` (binaries won't load), then check the ext4 recovery on the next boot. [tegu SLEEP-PLAN](device/tegu/SLEEP-PLAN.md) S1 +- **On the 9a, a sleep can end badly in two ways: UFS fails to come back and the root filesystem goes read-only, or the SoC hangs and leaves the USB bus.** The first seen once on 2026-10-30 (`link startup failed 1`, `Host init failed 1` x5, `ufshcd_wl_resume failed`, then `I/O error, dev sda` and ext4 `emergency_ro`; `spm_lvl` 5). The palmtop woke on its alarm but nothing on disk could be read: `systemctl suspend`/`reboot` did nothing, the power key could not light the screen, SSH kept answering from memory. A dark palmtop that ignores the power key may therefore be awake with dead storage, not asleep. After every s2idle, `dmesg | grep -E "link startup failed|Host init failed|I/O error"` first; if it matches, `echo b > /proc/sysrq-trigger` (binaries won't load), then check the ext4 recovery on the next boot. [tegu SLEEP-PLAN](device/tegu/SLEEP-PLAN.md) S1 - **UFS must be at `spm_lvl` 5 in system suspend.** At the core default 3, UFS failed its first hibern8 exit on resume and needed a host reset (it recovered, no I/O errors); at 5 the first real s2idle freeze resumed clean. gs201 now defaults to 5 in the kernel (S3a, `a7e5e1d95`), so a suspend test only checks that `spm_lvl` reads 5; on a kernel without that commit, `echo 5` first. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) S1-S3 - **Only s2idle, never `deep`.** The firmware advertises PSCI SYSTEM_SUSPEND, so mainline offers `deep`, but Linux has no gs201 SoC sleep sequence (SYS_SLEEP), and the phone wouldn't wake. `mem_sleep_default=s2idle` in the bootargs and device-cheetah's `sleep.conf` drop-in keep it on s2idle. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) §1, §5 - **Some unattended RTC cycles wake early on the PMIC interrupt** (2 of 20 in S4, 4 of 31 in S5c, at 13-16 s instead of 30 s). Which PMIC event it is hasn't been read yet; count it, don't treat it as a failed cycle. [SUSPEND-PLAN](device/cheetah/SUSPEND-PLAN.md) S4, S5c diff --git a/device/tegu/NOTES.md b/device/tegu/NOTES.md index 8e2900b93..8569aa47c 100644 --- a/device/tegu/NOTES.md +++ b/device/tegu/NOTES.md @@ -60,8 +60,9 @@ with nothing but Bluetooth starting resets again at that time, start here. asleep, about 40 mA under the figure without the module. Three sleeps have never woken (two direct freezes, one systemd sleep with the module) and no single factor explains them, so sleep tests stay attended and the - module stays off at boot; the shell's nightly auto-sleep (systemd path, - no module) has woken every time and goes on as before. + module stays off at boot; the shell's auto-sleep toggle is off on the + palmtop since the 2026-10-30 shell reinstall, and unattended sleep stays + off until the hangs below are understood. - The 2026-10-27 "140 mA asleep" figure doesn't hold up against 2026-10-28 (434-445 mA cable out, as-is) and tonight; treat about 300 mA cable out as the baseline. diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index e0dd7c749..00e1f94c9 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -1,11 +1,14 @@ # Pixel 9a sleep: why s2idle drains so much -Status (2026-10-30): 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, -and three test sleeps have never woken (two direct freezes and one -30-minute systemd sleep with `tegu-mif-sleep` loaded; S1), so sleep tests -are attended. The shell's auto-sleep (the `omamobile-sleep` toggle) is +Status (2026-10-31): s2idle usually works (RTC and power-key wakes; ten of +ten 30-second cycles on 10-31 with the console kept through the freeze), +but not always: four sleeps have never woken (two direct freezes, one +30-minute systemd sleep with `tegu-mif-sleep` loaded, and the sixth +30-second cycle of a boot on 10-30, which left the USB bus and needed a +forced restart), and one more woke with UFS dead (`link startup failed` x5, +then I/O errors and `emergency_ro`, 10-30 afternoon). The drain in sleep is +high. Sleep tests are attended and unattended sleep stays off. The shell's auto-sleep (the `omamobile-sleep` toggle) is off on the palmtop since the 2026-10-30 shell reinstall (the package ships it off), so it doesn't sleep unattended at present; while it was on, its systemd-path sleeps without the module all woke, and turning it back on is @@ -317,6 +320,16 @@ with the cable in. storage shape of the 10-30 afternoon (which kept answering SSH from memory): the SoC itself is hung or down, and nothing can be read until a forced restart. Waiting on that to read the console from pstore. +- **What the forced restart left, and how the cycles slept (for the + rule).** After the sixth-cycle hang of 10-30 and the morning's forced + restart, `/sys/fs/pstore` held nothing from the hung boot: the kept + console (`console-1030-205427.txt`) has that boot's bootloader log and + then the next boot's, with no kernel lines from the hang, because printk + had suspended the consoles at the freeze (below). Every 30-second cycle, + that night and this morning, entered sleep the systemd way: `rtcwake -m + no -s 30` to arm the alarm, then `systemctl suspend`, so the sleep hooks + (NFC's poll stop, Wi-Fi's) ran each time; none was a direct write to + `/sys/power/state`. - **2026-10-31 morning: ten of ten cycles clean, and the console now survives the freeze.** The reason every earlier hang left no kernel evidence is that printk suspends the consoles at the freeze ("Suspending @@ -389,11 +402,23 @@ with the cable in. would time out exactly as the failing console shows, with no first DME set and no power-mode change. That is a hypothesis, not a finding: the ordering in `exynos_ufs_setup_clocks()` is meant to prevent it. - The test is cheap and attended: `CLKGATE=0` in - `runners/13-s2idle-counted.sh` turns gating off for the run - (`clkgate_enable` 0) and the cycles run as usual. One failure in about 50 - resumes means a clean run of ten proves nothing by itself, so it is worth - running both ways and counting. + The test, as a runbook step (attended, cable in, modem never loaded in + the boot, console kept through the freeze; risk: low): + + ```sh + # S3. UFS idle clock gating off for a run of cycles + tools/phone-ssh 'echo N > /sys/module/printk/parameters/console_suspend' + tools/phone-ssh 'u=/sys/devices/platform/soc/13200000.ufs; cat $u/clkgate_enable; echo 0 > $u/clkgate_enable; cat $u/clkgate_enable' + # Expect: 1 then 0 + # ten cycles, each: rtcwake -m no -s 30; systemctl suspend; after the wake: + tools/phone-ssh 'dmesg | grep -cE "link startup failed|Host init failed|I/O error|ufshcd_err_handler"; cat /sys/power/suspend_stats/success' + # Expect: 0, and success counting up by one per cycle + # Stop: any count above 0, or no SSH 120 s after the alarm (forced restart, read pstore and the kept console) + # Rollback: echo 1 > clkgate_enable, or a reboot (the setting does not persist) + ``` + + One failure in about 50 resumes means a clean run of ten proves nothing + by itself, so run it both ways and count. - **What the five clean cycles rule out, and what they don't.** Five in a row with the storage counters at zero says the UFS resume path is not broken per se; the afternoon failure and this hang are both the sixth or @@ -495,7 +520,13 @@ step 2 in reverse). alarm fired at all, and its other bits name what else the PMIC latched. Reading PMIC registers from userspace is allowed (the rule that forbids it is about the PMU), through that chip's regmap in debugfs, and a single - register rather than a whole dump (lesson from the amplifier regmap). + register rather than a whole dump (lesson from the amplifier regmap). Is + `STATUS2` cleared on read, so that a userspace read could take the alarm + away from the RTC driver? Not by the driver's own account: in the + S2MPG14 regmap only `INT1` to `INT5` are marked precious ("clear on + read"), and `STATUS2` is listed as volatile ("RTC alarm flag") and not + precious, so it is a level flag that a read does not change, and regmap's + debugfs refuses precious registers anyway. kernel #149 is the same readback for gs101's S2MPG10, which this tree gets wrong today; zumapro's and gs201's cases are already right, so that PR doesn't change what the 9a or the 7 Pro report. From ed02b10dfedd99252d6825218568d44bf1596de4 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Sat, 31 Oct 2026 10:17:25 -0643 Subject: [PATCH 18/18] SLEEP-PLAN: S3, ten clean wakes with UFS clock gating off Ten 30-second s2idle cycles with idle clock gating off all woke with no UFS errors. The run with gating on was also ten of ten, so the hypothesis is neither confirmed nor ruled out yet. --- device/tegu/SLEEP-PLAN.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/device/tegu/SLEEP-PLAN.md b/device/tegu/SLEEP-PLAN.md index 00e1f94c9..0df3ee52d 100644 --- a/device/tegu/SLEEP-PLAN.md +++ b/device/tegu/SLEEP-PLAN.md @@ -419,6 +419,14 @@ with the cable in. One failure in about 50 resumes means a clean run of ten proves nothing by itself, so run it both ways and count. + + **S3 result, 2026-10-31 (`7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`):** + clock gating off (`clkgate_enable` 0), console kept, modem never loaded + that boot, ten 30-second RTC cycles: ten of ten woke, `suspend_stats` + success 10 and fail 0, no UFS error-handler, link-startup or I/O lines, + no ACPM timeouts. With gating on, 10-31's earlier run was also ten of ten, + so this does not yet separate the two; the count both ways goes on until + one side fails. - **What the five clean cycles rule out, and what they don't.** Five in a row with the storage counters at zero says the UFS resume path is not broken per se; the afternoon failure and this hang are both the sixth or