Skip to content

Support for Suspend #29

Open
Open

Description

@qzed

Suspend doesn't seem to work properly. Part of it may be #26, but there may be other remaining issues. This should only be an overall tracking issues, specific problems should be handled in their own issue. The device should at least support S2Idle, hopefully we can also support suspend to ram.

Activity

  1. added
    A: PM
    on Jun 14, 2022
  2. qzed commented on Jul 14, 2022

    @qzed
    MemberAuthor

    Suspend seems to work (mostly?) fine when I boot the system fully to ram and disable PCIe in the device tree. There are a couple of USB related errors/warnings, so that might also cause problems (could be "only" higher power draw when suspended).

    In essence, this looks like PCIe is the main culprit, causing the observed lock-ups and device reboots (maybe caused by an SError).

  3. qzed commented on Aug 5, 2022

    @qzed
    MemberAuthor

    Adapting steev/linux@9ec798b for sc8180x prevents the PCIe suspend problems. There are still some pciehp timeouts and USB PHY power-state warnings as well as an xHC error. Also, the system takes quite a bit to resume. So there are still some kinks to work out.

  4. valpackett commented on Mar 9, 2026

    @valpackett

    prevents the PCIe suspend problems. There are still some pciehp timeouts and USB PHY power-state warnings as well as an xHC error. Also, the system takes quite a bit to resume

    Just sent the first version of the series clk: qcom: sc8180x: PM-related fixes that tackles this stuff. It was PCIe/USB recovery slowing down resume, with both having their register state retained the resume is faster than on Windows :)

    hopefully we can also support suspend to ram

    Not "real" s2ram, that was only introduced on Hamoa (X1E). See this thread.

    S2ram is not the important thing you thought it was, anyway :) What actually saves a ton of power is reaching CXPC (CX rail power collapse) state, which can be reached from s2idle. This series fixes the PCIe root controller being the big culprit preventing CXPC, however NVMe needs a bit more work for some reason. And we do need to make sure the rest of the SoC survives CXPC as well :)

  5. robertijtsma commented on Nov 20, 2026

    @robertijtsma

    Confirming on Surface Pro X SQ2 (7.3.1-1-surface, EL1 boot): with the SC8180X PCIe/USB PWRSTS_RET_ON fixes now in 7.3, s2idle suspend/resume is fast and reliable (~0.9 s suspend, ~1.2 s resume, NVMe PCIe Gen.3 x2 link comes right back up, instant wake via Hall-sensor SW_LID GPIO 121 and pm8941_pwrkey).

    On top of stock 7.3.1-1-surface, a few subsystem PM gaps still needed fixes so all peripherals survive suspend/resume cleanly:

    1. drm/msm DPU & DP AUX (0012-drm-msm-sc8180x-dpu-dp-s2idle-resume.patch): call dp_phy_intf_sel from dpu_runtime_resume() so MDP_DP_PHY_INTF_SEL is restored after MDSS_GDSC collapses, clear REG_DP_AUX_TRANS_CTRL on reset, keep DP_DP_HPD_REFTIMER_ENABLE set, and check aux->enable_xfers for external HPD bridges.
    2. spi-hid touchscreen (spi0.0) (0014-hid-spi-hid-add-s2idle-system-pm-ops.patch): spi-hid-core.c currently has no dev_pm_ops, so the unmasked digitizer IRQ fires before spi0 resumes (Failed to receive header: -108 / -ESHUTDOWN) and kills touch. Adding SIMPLE_DEV_PM_OPS (spi_hid_suspend/spi_hid_resume powering down vreg_ts_5p0, pulsing reset for 100 ms, and clearing stale IRQ pending state via irq_set_irqchip_state) fixes it cleanly.
    3. qcom-venus EL1 TZ PM (if using the SQ2 Iris1/HFI4 Venus decoder stack, 0013-media-qcom-venus-sq2-el1-tz-s2idle-pm.patch): HFI PC_PREP + qcom_pas_set_remote_state(0/1, 0) + AXI halt/reset pulse lets venus_gdsc/vcodec0_gdsc/mmcx collapse and restores 4K H.264/HEVC decode on wake without unloading PAS 9.
    4. Userspace hooks:
      • Stopping hexagonrpcd-sdsp in pre/* (and restarting with --no-block in post/*) prevents SLPI EX:sensor_process:0x1:frpc_dsp faults during userspace freeze.
      • Stopping iptsd in pre/* and restarting it asynchronously after /sys/bus/spi/devices/spi0.0/ready reports ready keeps touch/stylus working across every cycle.
      • Launching ModemManager --test-quick-suspend-resume keeps qcom-soc (qrtr0 / rmnet_ipa0) registered across wake.

    Matches @valpackett's note on power states: in /sys/kernel/debug/qcom_stats/, Hexagon DSPs (modem, cdsp, slpi_island) enter sleep cleanly during s2idle, while cxsd/aosd counters stay at 0 pending the PCIe/NVMe D3cold work.

    Full notes and systemd/system-sleep/ hooks are documented here: docs/S2IDLE_SUSPEND.md (v1.5.0).

  6. valpackett commented on Nov 21, 2026

    @valpackett

    if using the SQ2 Iris1/HFI4 Venus decoder stack

    Oh wtf, there's a 4000+ line slop patch that enables venus now?! I've tried to get it working, barely managed to not make the init stall rpmh but the arm9 wasn't being kicked on. Interesting. Looks like the firmware requires a lot of extra bullshit compared to sm8150 android phones, oof.

    Maybe generic FW would just load in EL2, that'd be a million times better than that nonsense.

    SLPI EX:sensor_process:0x1:frpc_dsp faults during userspace freeze

    WTF… at least on all the devices I have where sensorspd is in ADSP, it never had any issue with userspace freeze.

  7. robertijtsma commented on Nov 21, 2026

    @robertijtsma

    Yeah, fair call — 0010 is a straight port of lhf1a/googlebookos_surface_pro_x's out-of-tree research stack to 7.3 (definitely not upstream material as-is; it carries both the EL1 PAS 9 path, an experimental EL2 sq2_no_tz path, and the Windows HFI4/OMX quirks).

    In case it's useful if you ever revisit SC8180X Venus/Iris1: the main reasons stock qcom-venus fails to kick the ARM9 on SQ2 (hw_ver 0x5010002f, VIDEO.IR.1.2-00042-PROD-1 / 00079-PROD-2) are:

    • MMCX / RPMh stall: probing videocc-sm8150 (0xab00000) concurrently with early display coldplug stalls/resets MMCX; deferring it past display bring-up avoids the stall.
    • ARM9 / CPU CS setup: Iris1 needs venus_iris1_clock_config() + its own venus_sq2_cpu_map() instead of the stock UC_REGION_ADDR/UC_REGION_SIZE write. Under EL1 TZ (PAS 9), the ELF also has to land inside TZ_PIL_GET_MEM_AREA (0x8b700000..0x9ab00000) with qcom_scm_mem_protect_video_var(); under EL2 no-TZ, releasing the ARM9 (base + 0xe3000 BIT(4)) needs the 0xe1020..0xe1084 / 0xe2000..0xe2010 / 0xe304c..0xe308c wrapper sequence programmed first.

    Agreed 100% that loading generic firmware at EL2 would be way cleaner than fighting Windows HFI4 and EL1 PAS 9's one-shot TZ lifecycle — the EL1 TZ PM hook (qcom_pas_set_remote_state) is just there for stock UEFI/EL1 setups.

    On SLPI (EX:sensor_process:0x1:frpc_dsp): that's specifically the Windows qcslpi8180.mbn SLPI (remoteproc@2400000) paired with hexagonrpcd-sdsp (not ADSP sensorspd). Leaving hexagonrpcd-sdsp's FastRPC reverse-RPC session open across systemd-sleep's userspace freeze makes SLPI's sensor_process PD fault and trigger an SSR restart on resume; stopping hexagonrpcd-sdsp right before freeze closes the FastRPC session cleanly and keeps SLPI quiet through s2idle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A: PM

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions