Skip to content

omamobile-device-tegu 0.2.5: keep the CPUs out of core power-down while the palmtop sleeps, so sleeps last - #255

Closed
W4HO-ham wants to merge 3 commits into
derekross:mainfrom
W4HO-ham:device-tegu-sleep-wfi
Closed

W4HO-ham wants to merge 3 commits into
derekross:mainfrom
W4HO-ham:device-tegu-sleep-wfi

Conversation

@W4HO-ham

@W4HO-ham W4HO-ham commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

On the Pixel 9a, every s2idle sleep ended about a second in. This makes them last until their wake.

What was happening. With the CPUs allowed into core power-down (their only deeper cpuidle state, cpu-*-sleep, PSCI core power-down), the S2MPG14 raised an event that hadn't happened about a second after PM: suspend entry, and that woke the palmtop. A bring-up module read the PMIC's INT1-INT5 in suspend_noirq and resume_noirq (reads only):

Alarm set INT1-5 at sleep INT1-5 at wake Wake IRQ
30 s 00 09 00 00 00 00 0c 00 00 00 56 (PMIC)
120 s 00 09 00 00 00 00 0d 00 00 00 56 (PMIC)
none 00 08 00 00 00 02 09 00 00 00 59 (power key)

With an alarm set, alarm 0 latched within 60 ms whether it was due in 30 or 120 s; awake, the same alarm fires on time. With none set, a power-key release nobody made did the same. With core power-down disabled on all eight CPUs (WFI only), a 30 s sleep lasted until its alarm. Our idle states match stock's (the same c2 states and arm,psci-suspend-param = <0x10000>); stock also has Samsung's exynos-cpupm cluster power-down and SICD, coordinated with the APM, which mainline doesn't have. That the false events come from there is my inference, not a measurement. Details are in SLEEP-PLAN S1 (#244).

The change. A sleep hook, omamobile-tegu-cpuidle, disables every *-sleep cpuidle state before the sleep and puts each back as it was afterwards (a state already off by hand stays off). test/cpuidle-hook checks this in a scratch root, and test/all runs it.

Tested on the palmtop (7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty, this branch built and installed with tools/phone-install-package): ten systemctl suspend cycles with a 60 s RTC alarm, the hook doing the switch:

  • Nine slept 55-61 s (PM: suspend entry to exit) and woke on IRQ 56, the alarm.
  • The seventh's resume took longer than the 8 s the script waits, so its length wasn't captured. It woke, and the hook restored the states afterwards.
  • suspend_stats went from 6 to 15 successes with 0 failures.
  • No UFS errors, no ACPM timeouts, and all states were back on after the run.

Before the hook, every sleep in the same setup lasted 0.6-1.6 s.

What this doesn't settle: the screen stays lit through a sleep started with systemctl suspend (the shell blanks it on its own sleep path), so there's no drain figure yet. The rare hang on wake (one in 21 before) also needs a longer run now that sleeps really last. This branch sits on #238 (0.2.4), so it's 0.2.5. tools/pr-check and the package tests pass.

With the zumapro PCIe channel-1 host and the Wi-Fi node in the device tree, the graphics start loads pcie_zumapro, waits for the BCM4383 on the link, then loads brcmfmac and waits for its interface, as hang-safe steps after NFC.
… a Wi-Fi hang keeps the display off too

Review of derekross#238: the graphics start's one marker covers every step, so a hang in the Wi-Fi step leaves the GPU and the display off on the next boot as well.
…le the palmtop sleeps

With PSCI core power-down allowed in s2idle, the S2MPG14 raised an event that hadn't happened about a second in and ended every sleep; with WFI only, a sleep lasts until its alarm. A sleep hook disables the cpuidle sleep states for the sleep and restores them after.
@W4HO-ham

W4HO-ham commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Withdrawn: the finding behind it was my measurement error. I took each sleep's length from PM: suspend entry to PM: suspend exit in dmesg, but the kernel log's clock doesn't advance while the SoC is suspended, so those deltas left out the sleep itself. The RTC shows it plainly. In the 120 s test, since_epoch read 1793545398 right after the wake, with the alarm at 1793545394, so the palmtop slept the full 120 s and woke on its alarm. The "power key release" wake in the no-alarm test was the owner pressing the key, minutes later. The journal's wall-clock times for the 10-31 S1 cycles show 28-30 s sleeps too.

With core power-down disabled, the dmesg deltas grew to the alarm time because with WFI only the s2idle loop doesn't freeze the tick, so timekeeping keeps running. That makes the sleep shallower, not fixed. So this hook would cost power for nothing, and I'm closing it. The SLEEP-PLAN paragraphs that claimed one-second sleeps (merged with #244) get a correction in #256, and the AGENTS correction you asked for isn't needed. Sorry for the noise.

@W4HO-ham W4HO-ham closed this Nov 1, 2026
W4HO-ham added a commit to W4HO-ham/omarchy-mobile that referenced this pull request Nov 1, 2026
The one-second sleeps were dmesg deltas, and the kernel log's clock stops while the SoC is suspended. The RTC shows full-length sleeps, so the core power-down hook (derekross#255) is withdrawn, and S1's wake counts stand.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant