Skip to content

SM8550 deep suspend/resume#2954

Open
shuuri-labs wants to merge 5 commits into
ROCKNIX:nextfrom
shuuri-labs:sm8550-suspend-resume-wip
Open

SM8550 deep suspend/resume#2954
shuuri-labs wants to merge 5 commits into
ROCKNIX:nextfrom
shuuri-labs:sm8550-suspend-resume-wip

Conversation

@shuuri-labs

@shuuri-labs shuuri-labs commented Jul 1, 2026

Copy link
Copy Markdown

Summary

This PR enables the deep suspend path (S2RAM) for SM8550, tested on the Retroid Pocket 6.

It is @jaewun's #2952 series, cherry-picked with authorship intact and rebased onto current next (7.1.2). Rebase adjustments, noted in the commit messages:

  • 0204 (ICE iface clock votes) is dropped, it landed upstream verbatim in 7.1.2
  • 0201 has one hunk rebased, ufshcd_intr() gained the active_uic_cmd thread-handoff condition upstream
  • the ICE/inline-crypto set is dropped entirely per the discussion below (not load bearing for suspend), so this PR no longer touches the kernel config

So this is the same suspend content as #2952, in a form that merges cleanly on next today.

Two commits are mine:

  • the IPCC mailbox fix, split back out with its original commit. This is the wake fix the RP6 needs: the ADSP charger firmware pushes an unsolicited BATTMGR_NOTIFICATION (opcode 0x7) about 0.5s after suspend entry, and with IRQF_NO_SUSPEND the mailbox irq is never masked, so the device wakes itself every few minutes. Lifted from ROCKNIX's SM8750 patch, which shares the battmgr/pmic_glink charger model.
  • broaden the TSENS uplow-wake skip from ayn,thor to qcom,sm8550. The RP6's compatible list has no ayn,thor entry, so the Thor-only check silently does nothing there and the TSENS threshold IRQs keep waking the device. The SoC-level compatible covers every SM8550 board, Thor included. Critical thermal wake stays enabled.

s2idle stays disabled (mem_sleep_default=deep plus SuspendState pinned to mem): a failed deep attempt that falls through to s2idle has wedged SM8550 devices in testing, so a failed deep should no-op instead.

Compared to the previous revision of this PR: the old patch lineage is replaced by the #2952 versions (which add the mphy hibern8-park and RX LineCfg fixes), and the rsinput MCU suspend/resume and geni UART patches are dropped to match #2952. Given the controller irq-storm behaviour jaewun describes in the comments, those three are the likely re-add candidates once we have his notes and an RP6 repro; keeping them out for now so the fix can be evidence-based.

Testing

Built and tested on the Retroid Pocket 6: repeated RTC-woken deep suspend/resume cycles, including longer unattended runs. Wake sources checked via /sys/power/pm_wakeup_irq (with PM_SLEEP_DEBUG enabled in my local builds) and /sys/kernel/debug/wakeup_sources, real time-in-suspend confirmed via CLOCK_BOOTTIME vs CLOCK_MONOTONIC drift.

Note: that testing was against the previous revision of this branch. The kernel patches here are byte-identical to what I build daily against stock 7.1.2, but a full rebuild and retest of this exact set on the RP6 is still to come, including the buttons-during-suspend controller repro. I'll report back here.

Thor coverage is jaewun's testing in #2952.

Test results

Deep suspend resumes reliably on the tested RP6 setup with no self-wakes. Before the IPCC fix the device could not stay asleep past 5 to 10 minutes; with it, clean ~14 minute RTC-bounded suspends with matching boottime drift. UFS recovers cleanly after resume. One UFS host reset per deep resume is expected on this platform because system suspend uses LINK_OFF.

Additional context

This PR and #2952 are the same series. The difference is the rebase onto current next, the ICE drop, and the two RP6-facing commits. Happy to fold this into #2952 instead if that's preferred.

AI Usage

Did you use AI tools to help write this code? Yes.

AI tools were used during the investigation and packaging: correlating wakeup-source and suspend-stat logs to pin the wake to the opcode 0x7 IPCC push, comparing candidate patches across the SM8550 and SM8650 trees, and assembling this branch. The IPCC fix itself is lifted verbatim from ROCKNIX's SM8750 patch, and the final selection was validated by hardware testing on the RP6.

@dcu

dcu commented Jul 8, 2026

Copy link
Copy Markdown

awesome! I can help testing if you provide steps to test
do you have a pre built kernel somewhere?

@loki666

loki666 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

also can you guys align
what's the difference with @jaewun #2952 PR ?

@Cyfarw9dd

Copy link
Copy Markdown

Thanks for your work! Already testing on an Odin2 portal — the suspend patch works so far, going to run a few more tests (repeated suspend/resume, wake stability etc).

@dcu

dcu commented Jul 11, 2026

Copy link
Copy Markdown

Works really well for me as well RP6.

just once after resuming the device did not recognize the input but after sleeping and resuming again it worked. I haven't been able to reproduce it ever since.

EDIT: I lost input recognition again, after suspending and resuming again it's restored. there must be some kind of race condition

@dcu

dcu commented Jul 13, 2026

Copy link
Copy Markdown

@shuuri-labs can you rebase your branch on origin/next?

@shuuri-labs
shuuri-labs force-pushed the sm8550-suspend-resume-wip branch from 7921026 to 68626b6 Compare July 13, 2026 15:57
@shuuri-labs
shuuri-labs marked this pull request as ready for review July 13, 2026 16:06
@shuuri-labs
shuuri-labs force-pushed the sm8550-suspend-resume-wip branch 5 times, most recently from aa0946e to 8752710 Compare July 15, 2026 11:21
@jaewun

jaewun commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

I'm pretty sure we can drop the ICE patches to simplify things here, they were introduced early on in testing as a correctness patch but in retrospect they dont appear load bearing.

I also ran into the controller issues mentioned above and it seems like the controller continues sending interrupts, and storms a whole lot of interupts during wake and the irq eventually gets disabled as "nobody cared". Might be able to replicate by pressing buttons during suspend/wake? Will dig up my old notes on that when I get home next week.

@shuuri-labs shuuri-labs changed the title WIP: SM8550 deep suspend/resume SM8550 deep suspend/resume Jul 15, 2026
jaewun and others added 4 commits July 15, 2026 15:34
Add the UFS core, qcom host, and QMP PHY patches needed for reliable
suspend/resume relink on the SM8550 UFS host.

The set covers non-MCQ PM completion draining, host-reset IRQ depth
balance, hibern8 error propagation, auto-hibern8 versus clk-gating
policy, no-retention PHY handling, and RX LineCfg control around link
startup.

[shuuri-labs: rebased 0201 hunk 9 for 7.1.2, ufshcd_intr() gained the
active_uic_cmd thread-handoff condition upstream]
Add the TSENS patch used by the SM8550 suspend path.

The TSENS patch leaves AYN Thor uplow threshold IRQs as non-wakeup.
Critical thermal wake remains enabled.

[shuuri-labs: split the IPCC patch into its own commit to restore its
original authorship; it was first added in an earlier revision of this
PR]
The ADSP charger firmware pushes an unsolicited BATTMGR_NOTIFICATION
(opcode 0x7) about 0.5s after suspend entry. It rings the IPCC mailbox
irq, which upstream is IRQF_NO_SUSPEND, so it is never masked and wakes
the device every few minutes. Drop IRQF_NO_SUSPEND so the mailbox irq is
masked across system suspend. Lifted from ROCKNIX SM8750 (AYN Odin 3),
which shares the battmgr/pmic_glink charger model and sleeps cleanly.
Default SM8550 devices to mem suspend and wire power, suspend, and lid
handling through logind.

Also set the UFS command timeout and deep sleep default on the SM8550
kernel command line.
@shuuri-labs
shuuri-labs force-pushed the sm8550-suspend-resume-wip branch from 8752710 to af78668 Compare July 15, 2026 13:38
@shuuri-labs

shuuri-labs commented Jul 15, 2026

Copy link
Copy Markdown
Author

@jaewun sweet, thanks for letting me know. I've dropped the ICE set from the branch (the crypto configs went with it, so this PR no longer touches the kernel config at all).

As for the controller - I originally carried your MCU suspend/resume + geni UART mask patches and that's mostly what I've tested, so it makes sense that I haven't really seen this issue yet. I removed them when rebasing off your clean set, so at some point I can run the buttons-during-suspend repro on the RP6 and report what pm_wakeup_irq and the irq counters show with the new set. Depending on the results, we can either re-add your older patches or something more targeted (from your your notes)

EDIT: actually, since @dcu reported facing the controller issue before my rebase, the now dropped patches probably didn't help. I'll do my investigation anyway, but probably we'll just wait for your notes for a fix :)

@dcu

dcu commented Jul 15, 2026

Copy link
Copy Markdown

EDIT: actually, since @dcu reported facing the controller issue before my rebase, the now dropped patches probably didn't help. I'll do my investigation anyway, but probably we'll just wait for your notes for a fix :)

I have not seen those issues again though, not sure what changed or it is just pure luck
I've also tested pressing buttons during the suspend/resume phases and everything's ok, I have not seen those "nobody care" messages in dmesg
wifi speed is also good after waking up

jaewun's patch scoped the of_machine_is_compatible() check to
ayn,thor. RP6's root compatible is "retroidpocket,rp6",
"qcom,qcs8550", "qcom,sm8550" with no ayn,thor entry, so the fix
silently did nothing there. Broaden the check to the SoC-level
compatible so it covers every SM8550 board.
@shuuri-labs
shuuri-labs force-pushed the sm8550-suspend-resume-wip branch from af78668 to c0a0434 Compare July 16, 2026 21:44
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.

5 participants