Skip to content

omamobile-modem: a start refused before any driver loads releases the sleep block - #424

Merged
derekross merged 3 commits into
derekross:mainfrom
robotosaith:omamobile-modem-inhibit-release
Nov 10, 2026
Merged

derekross merged 3 commits into
derekross:mainfrom
robotosaith:omamobile-modem-inhibit-release

Conversation

@robotosaith

Copy link
Copy Markdown
Contributor

What and why

Part of #390. omamobile-modem-inhibit blocks sleep from before the modem's drivers load until the reboot. A start that refuses before any driver loads (a stale modem-up marker after a forced restart, the bring-up latch) left that block in place for the whole boot, so the phone never slept although no modem was up, and systemctl suspend needed -i.

refuse() now kills the inhibitor (it refuses a manual stop) when it's running and none of pcie_gs201_cp, shm_ipc and cpif is loaded. Once a driver has loaded, nothing changes. An unprovisioned phone skips the inhibitor by its own conditions, so nothing is released there. test/all covers all three cases (no driver: released; cpif loaded: kept; inhibitor not running: left alone).

Device and build

Checks (no phone needed)

  • tools/pr-check origin/main passes
  • tests/all passes: one check, "published files are world-readable and not executable", fails on this laptop on an untouched main too, so it's this machine's setup; CI runs it
  • tests/packages passes (or the packages I touched: omamobile-modem)
  • Each changed package has its version bumped, and the new version is in the commit subject (left for the merge, see above)
  • Commits have area prefixes and bodies that say why; any AI help is a Co-Authored-By: or Assisted-by: trailer, never a Signed-off-by:

On the phone

tools/phone-smoke report

phone-smoke: raven

Kernel 7.3.0-rc6-omamobile-push1-ge1e6adb69bbf, tools at d1c9d044, 2026-11-04T08:48Z.

Check Result Detail
boot (required) ok kernel 7.3.0-rc6-omamobile-push1-ge1e6adb69bbf, slot b, up 195s
storage guard (required) ok 49 partitions; only userdata and slot B's boot images writable
root (required) ok ext4 on userdata, 96G free
kernel health (required) ok no oops or BUG; 0 WARN, 261 error lines in dmesg (56 known, of them ASoC no backend DAIs (PipeWire probe) x1, 205 new)
new dmesg errors not ok wc-mbox N: Try increasing MBOX_TX_QUEUE_LEN x117; cpif: mif_gpio_get_value: GET GPIO N is not valid x24; cpif: rx_demux: PCIE: ERR! N is not opened x15
systemd units ok none failed
USB gadget (required) ok bound to 11110000.usb
display ok card2-DSI-1 connected, 1440x3120
GPU ok render node on panfrost
session (required) ok Hyprland and the Omarchy shell running
lock ok PAM file present, the shell can lock (passwordPam true, locked true)
touch ok s6sy761
buttons ok gpio-keys
Wi-Fi ok wlp1s0 on brcmfmac, link up
Bluetooth ok hci0, powered true
battery ok 95% Discharging, 22 °C
sound cards ok googleaocsndcar
sensors ok Accelerometer AmbientLight Proximity
cameras skip no libcamera tools
thermal ok hottest zone 42 °C

Packages: hyprland 0.57.0-3.1, libcamera 0.7.2-4.22, mesa 1:26.2.4-1.4, omacam 0.3.3-1, omamessages 0.2.1-1, omamobile-apps 0.2.2-1, omamobile-audio 0.5.15-1, omamobile-device-raven 0.1.32-1, omamobile-firstboot 0.1.3-1, omamobile-gnss 0.2.7-1, omamobile-keyring 20261026-1, omamobile-mirror 0.1.1-1, omamobile-mmd 0.1.2-1, omamobile-modem 0.1.17-1, omamobile-modem-sit 0.3.30-1, omamobile-omarchy 0.1.31-1, omamobile-owl-widgets 0.1.2-1, omamobile-sensors 0.2.1-1, omamobile-shell 0.2.94-1, omamobile-voice 0.1.0-1, omaphone 0.2.2-1, omarchy 4.0.6-1, omatel-agent 0.2.4-2, quickshell 0.3.2.r7.g2b4501a-1

The smoke report was taken after the modem was started again. Its flags are the unpublished kernel's CPIF lines and the AoC mailbox burst at card start, as in #389 and #401.

🤖 Generated with Claude Code

@derekross

Copy link
Copy Markdown
Owner

Thank you for this. It's a clean fix for the half of #390 that bites most often: after a forced restart or a latch, the phone sat awake all day for a modem that never started. I read every path into refuse(). The ones before the drivers (unprovisioned, the latch, the stale marker, no sleep lock) now release the block, and the two that can come after a driver loads (allow_hw and the profile check) keep it. All three modules are =m in the shared config, so the /sys/module check means what it says. A process exit isn't a stop, so Requires= doesn't take anything down with it, and your raven run shows the inhibitor coming back with systemctl start omamobile-modem. I also ran the package tests on this branch merged with #389 (both edit test/all), and broke the driver check once to make sure the new test catches it. It does.

Since #398 this script starts the modem on every Pixel 7 Pro, and refusals there will now let the phone sleep. That's the same reason and the same state the 7 Pro's suspend tests ran in, so I'm happy with it, but I'll run it on mine before merging: a latch, a reboot, the release, then the modem back by hand. I'll do that together with #389's boot.

Two small things, fine in one push:

  • The unit comment lists "no CPIF" among the refusals that release the block. A missing or failing module actually leaves through set -e at the first modprobe, not through refuse(), so the block stays there. Either drop it from the comment, or send that modprobe's failure through refuse. Your /sys/module check would then keep the block if the module loaded and failed in probe, and release it if it never loaded.
  • cheetah's MODEM-PLAN (around line 2712, "so it lasts until the reboot … the phone never sleeps") and the header of omamobile-modem.service ("which stays until the reboot") could each get a dated line about the release.

On the version: as you say, 0.1.17 is taken twice already. I'll set the next free number in the file and the title at merge.

robotosaith and others added 2 commits November 10, 2026 07:32
… sleep block

omamobile-modem-inhibit holds a block on sleep from before the modem's
drivers load until the reboot, since suspend with the modem up isn't
qualified. But a start that refuses before any driver loads (a stale
modem-up marker after a forced restart, the bring-up latch) left that
block in place for the whole boot, so the phone never slept although no
modem was up, and systemctl suspend needed -i (derekross#390).

refuse() now kills the inhibitor (it refuses a manual stop) when it is
running and none of pcie_gs201_cp, shm_ipc and cpif is loaded. Once a
driver has loaded, nothing changes: the block stays until the reboot.
An unprovisioned phone skips the inhibitor by its own conditions, so
nothing is released there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of derekross#424: a modprobe that failed left through set -e, not
refuse(), so the sleep block stayed although the unit comment said
"no CPIF" released it. Each modprobe now refuses with its module's
name for the tile ("Off: cpif didn't load"). refuse() then releases
the block only when none of the modem's drivers is loaded, and that
list now takes the device's link stack from link.conf (derekross#568) as well
as pcie_gs201_cp, shm_ipc and cpif: a module that loaded and failed in
probe keeps the block, one that never loaded releases it. The latch
stays either way, as it did.

test_link.py runs the real starter through both cases (the first link
module fails: the block goes; the second fails with the first loaded,
a module named only in link.conf: it stays), with a fake systemctl so
the tests never ask the host's. The inhibitor's and the modem unit's
headers and cheetah's MODEM-PLAN M4.6 get the dated release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@robotosaith
robotosaith force-pushed the omamobile-modem-inhibit-release branch from d1c9d04 to b50995e Compare November 10, 2026 07:37
@robotosaith

Copy link
Copy Markdown
Contributor Author

Thanks for reading every path. Both points are in b50995e, rebased onto today's main:

  • I took the second option. Each modprobe now goes through refuse with its module's name ("Off: cpif didn't load"). Since omamobile-modem: allow a device-provided ordered link stack #568 the link stack can come from the device's link.conf, so the /sys/module check now covers those modules by name as well as pcie_gs201_cp, shm_ipc and cpif. A module that loaded and then failed in probe keeps the block; one that never loaded releases it. The latch stays in both cases, as it did with set -e.
  • There are dated lines in cheetah's MODEM-PLAN M4.6, in the header of omamobile-modem.service, and in the inhibitor's comment (which no longer says "no CPIF").

test_link.py runs the real starter through both cases. If the first link module fails, the block goes. If the second fails while the first is loaded (a name that only appears in link.conf), the block stays. I checked that the second test fails when the link.conf names are dropped from the check. The runner also gets a fake systemctl, so a refusal there no longer queries the host. Package tests and pr-check pass. I couldn't run anything on hardware this time.

@derekross

Copy link
Copy Markdown
Owner

Thanks, both points are in, and the second went the better way: a module that doesn't load is now a refusal with a reason on the tile, and the /sys/module check decides whether the block stays. Covering the link.conf names was a good catch after #568. I read the starter end to end, ran the package tests on today's main with #389 merged in, and broke both new cases on purpose (the link.conf names dropped, and the release removed from refuse): each of your two new tests fails as it should.

Nothing more needed from you. What's left is my run on the Pixel 7 Pro: a latch, a clean reboot, the release, then the modem back by hand, in the same session as #389's boot. I'll post the result here and merge after it, with the version set then.

One thing for later, not for this PR: the refusals that come before link.conf is read only know the three default module names, as your comment says. No phone ships a link.conf yet, so it can wait for the first one that does.

@derekross

Copy link
Copy Markdown
Owner

The 7 Pro run is done, 2026-11-10, 7.3.0-rc6-omamobile-push1-gc7fb37460f84, built from today's main with this PR and #389 merged in and installed as packages.

Step Result
A normal boot modem ONLINE, the sleep block held, a call and a text each way worked
A bring-up marker placed by hand, then systemctl reboot the stop logged, modem-up removed
The next boot "never reached ONLINE; skipping the modem", then "no modem driver loaded: sleep is no longer blocked this boot"; no omamobile-modem line in systemd-inhibit --list; none of pcie_gs201_cp, shm_ipc, cpif loaded; the tile's reason "Off: last bring-up hung"; omamobile-modem-inhibit reads inactive, not failed
rm the marker, systemctl start omamobile-modem CP ONLINE, the sleep block back, the tile's reason gone

No UFS error-handler pass and no I/O error on either boot. So a refused start no longer keeps the phone awake, and a successful one is unchanged. Thank you for your patience with this one; it has waited on my phone since 11-05.

It will merge as omamobile-modem 0.1.20: main moved to 0.1.19 today (#634), and this branch bumps none, so I'll add the number on top of your branch and merge.

Main moved to omamobile-modem 0.1.19 (derekross#634) and this branch bumped no
version, so the squash would have shipped new contents under a published
number. Tested on a Pixel 7 Pro on 2026-11-10 as this tree plus derekross#389.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@derekross
derekross merged commit 84f4d2a into derekross:main Nov 10, 2026
2 checks passed
@robotosaith
robotosaith deleted the omamobile-modem-inhibit-release branch November 12, 2026 17:18
robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
…ses the sleep block (derekross#424)

A modem start that is refused before any link driver loads (a stale marker, the bring-up latch, a phone that isn't provisioned) kept the "don't sleep with the modem up" block for the whole boot, although no modem was up. It now releases the block, so the phone can sleep that boot. A link module that fails to load is a refusal with a reason for the Mobile data tile, where the script used to leave through set -e with modprobe's status. A successful start is unchanged.

Tested by the contributor on a Pixel 6 Pro. Tested on a Pixel 7 Pro on 2026-11-10 (7.3.0-rc6-omamobile-push1-gc7fb37460f84, this change with derekross#389): with a bring-up marker placed by hand the next boot refused, logged "no modem driver loaded: sleep is no longer blocked this boot", held no inhibitor and loaded no link module; removing the marker and starting the unit brought the CP ONLINE with the block back. A normal boot before it: ONLINE, a call and a text each way.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants