Skip to content

PCI: dwc: gs201-cp: turn the sleep guard on for zumapro - #258

Merged
derekross merged 1 commit into
derekross:omamobilefrom
W4HO-ham:zumapro-sleep-guard
Nov 15, 2026
Merged

derekross merged 1 commit into
derekross:omamobilefrom
W4HO-ham:zumapro-sleep-guard

Conversation

@W4HO-ham

Copy link
Copy Markdown
Contributor

The follow-up to #232 that @ikegam and I agreed on there: its sleep handling is behind sleep_guard, which only gs201 sets, and this sets it for zumapro (Pixel 9a), with the comments that named gs201 alone updated. One line of code.

Without it a sleep with the modem's link down loses the 9a's modem until a reboot (root port D3hot and inaccessible, Can't set D0, CPIF reading 0xffff).

Tested on the palmtop, both forms of the series, numbers in the commit message and in my comments on #232:

Tonight the palmtop runs a night off the charger on that second build with the modem registered; I'll add the standby current here in the morning.

The one open point, also in the commit message: an awake hang at a link power-up, once, in the first build's 1,549th power-up of a boot; none in over 15,000 since. It isn't on the sleep path, and this line doesn't touch the power-up.

scripts/checkpatch.pl --strict: clean.

The system sleep handling for the modem's link (the refusal while the
link is up, before the freeze and again at noirq; the root port and the
endpoint kept out of the PCI core's sleep path) is behind sleep_guard,
and only gs201 sets it. zumapro has the same link driver and CPIF and
fails the same way without it: a system sleep with the modem's link
down puts the root port in D3hot with the device inaccessible, the
resume waits for a link that isn't coming, and CPIF reads 0xffff from
the modem's command register until a reboot.

Set sleep_guard for zumapro, and say so where the comments name gs201
alone.

Tested on a Pixel 9a (tegu) with the modem registered on LTE with IMS
voice and SMS, Wi-Fi connected and the cellular data service running:

- with the series as it was under review plus the maintainer's two
  review patches (the second a ring trace, left out of the merge): 300
  sleep requests of 60 s in one boot, 299 entered and woke (239 on the
  RTC alarm, 60 on cp2ap_wakeup) and 1 refused before the freeze with
  the link up; after every one the CP was ONLINE and the phone service
  answered. Calls and texts sent to the sleeping palmtop woke it on
  cp2ap_wakeup, and rang or arrived;
- with the series as merged: 10 sleeps entered, none refused or failed,
  in a boot of 954 link power-ups.

In those boots there was no "Unable to change power state", "Link
Active not set", "Can't set D0", "BME" or UFS error handler line, and
the shutdowns stopped the modem cleanly. Without the guard the same
phone lost the modem at the first sleep with the link down.

One open point from the same testing, not on the sleep path: a boot of
the first build hung once at a link power-up while awake, before the
PHY's external PLL lock was reported (the 1,549th power-up of that
boot); none in over 15,000 power-ups since, on either build.

Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
@W4HO-ham

Copy link
Copy Markdown
Contributor Author

A night on the palmtop with this in, for the record: the test kernel 7.3.0-rc6-omamobile-push1-g716f6d8ef355 (#232 as merged, this line, and #247), the modem up for the whole boot, the shell's auto-sleep doing the sleeping, cable out.

  • 10.8 h off the charger, asleep 99 % of it (38,771 of 38,939 s), 37 sleep requests and every one woke: 24 on cp2ap_wakeup, 11 on the PMIC (the alarm), and the two the owner made in the morning. No hang, no UFS line, no oops.
  • After it, CPIF still had the modem: omamobile-sit read CP ONLINE, IMS registered, voice and SMS yes, no poll failures or watchdog timeouts.
  • But a ping over rmnet0 got 0 of 5 back, with 27 Reserve doorbell interrupt lines in the boot. I can't pin that on the sleeps: rmnet0 had received 3 packets in the whole 20 h boot and I didn't ping it before the cable came out, so I don't know it carried data that evening. On the daily kernel after a fresh boot this morning it passed 5 of 5 with 6 to 8 of those same doorbell lines already in the log, so the line alone isn't a sign of lost data on the 9a.
  • The battery went from 89 % to 29 %, 288 mA on average, high for a palmtop that was asleep 99 % of the time.

So on the 9a the guard keeps the sleeps safe with the modem up, and the open questions are the same two as on the 7 Pro (#799): whether data survives the wakes, and the current. I'll run the night again with a data check before the cable comes out and after each wake.

@derekross

Copy link
Copy Markdown
Owner

Thank you, and thank you for splitting it out as ikegam asked. I ran the gate on it merged onto today's omamobile: it merges cleanly, checkpatch is clean, the W=1 build is fine and the sign-off is in place. The tested driver file is this head's file too, since fef165e7496f's copy is the one that merged.

I read it for what it changes. Only zumapro's match data moves, so the 7 Pro is unchanged. On the 9a the guard runs only for a sleep that gets past the modem's inhibitor, which the release keeps. That's exactly the sleep that loses the whole modem without it, so this makes the 9a safer and turns nothing on. It also makes omamobile-modem-sleep-policy's kernel check honest on the 9a: today that check finds the early refusal's strings in the module on every SoC, even where the guard is off.

One thing you should know from my 7 Pro. On kernel-2026.11.15, with this same guard code, twenty auto-sleeps with the modem up all entered and woke, but mobile data stopped answering from the first timer wake and stayed down with the phone awake. CPIF logged "Reserve doorbell interrupt: PCI not powered on" while the link came up again and again, and the bearer was still reported up. Wi-Fi was unloaded around each sleep, so mobile data was the only route. I've turned the 7 Pro's modem-up sleep back off. The guard is needed, but it isn't enough yet, and the data path across a wake is now the open question on both phones. I've written on omarchy-mobile#758 what I'd like the 9a to check there.

On the night you planned off the charger with the modem registered: please keep modem tests on the charger, and keep sleeps with the modem up to attended runs on the charger that end in a reboot, as AGENTS says. I've written more about that on #758 too.

I'll merge this.

@derekross
derekross merged commit d49d68c into derekross:omamobile Nov 15, 2026
1 check passed
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