Skip to content

linux-omarchy-aarch64: let the Snapdragon X1 laptops reach DDR sleep and CX collapse in suspend - #1315

Merged
ryanrhughes merged 3 commits into
omacom:masterfrom
turbineBMW:upstream/linux-omarchy-aarch64-sp11-sleep
Oct 20, 2026
Merged

ryanrhughes merged 3 commits into
omacom:masterfrom
turbineBMW:upstream/linux-omarchy-aarch64-sp11-sleep

Conversation

@turbineBMW

@turbineBMW turbineBMW commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #975, which this branch includes (and #975 sits on #1030), so until both land this diff shows their commits too. Only the last commit is new here.

On 7.2.8 an X1 in suspend never reaches its deepest state, even with the PDC and idle-state backports from #975: the CX rail never collapses and DDR never goes into self-refresh. On the Surface Pro 11 that is 0.75 W asleep, about 36% of the battery a day. This adds 2170-2179 and takes pkgrel to 18, leaving 17 to #1277 (the Yoga Slim 7x webcam, also on #975); whichever lands second rebases.

What kept it awake, and the fix for each:

  • gcc never reaches sync_state(). The GPU's GMU node has no driver, so fw_devlink keeps gcc waiting for it, and until then genpd keeps every power domain that was on at boot powered, including ones nothing uses. Those hold CX up. 2170-2174 are Akhil P Oommen's "drm/msm: Attach a driver to the GMU" series (RFT; 2174 needed a small port to 7.2.8), and 2178 fixes three things I found reviewing it: the GMU was added to the match list even without a GPU, an empty match list could reach the component framework, and the GMU lock was initialised only after the GPU code could take it.
  • The root ports never enter D3. 7.2.8 keeps every hotplug-capable root port in D0, and the X1 ports report hotplug, so pcie-qcom keeps a 1 kBps PCIe-to-DDR vote through suspend. Mainline 7.3 lets these ports into D3 on all non-x86 platforms (d4c79b63d82d). 2177 backports that limited to Qualcomm PCIe controllers, so the N1x, GB10 and every other controller keep 7.2.8's behaviour. It goes away with 7.3.
  • The Bluetooth UART keeps its clocks and bus vote. 2175 is 7.3's geni force suspend (d0cd9c8d0fd5).
  • The ADSP keeps waking. Windows' power plug-in tells the ADSP the system is entering Modern Standby, and the ADSP then stops its power-limits timer. 2176 sends the same message. 2179 drops an unused include and documents why the send has to block: the ADSP queues no receive buffer on this channel in advance, so glink must ask for one and wait. I tried rpmsg_trysend() first, and it failed with -EBUSY at suspend, leaving the ADSP waking about 45 times a second. New module: QCOM_ADSP_PWR_LMTS.

About 2176: it is Kirill's driver from github.com/justririll/x1e-sleep (0f3f55b), GPL-2.0 by its SPDX header, carried with him as author and the source linked. His repo has no Signed-off-by, so the README lists it with 2154 and 2165 as carried without the author's sign-off. I've asked him for it, and whether he wants to send it upstream himself, in justririll/x1e-sleep#2. Nothing here is going to mainline in the meantime.

Patches 2170-2179 come from github.com/turbineBMW/linux sp11/n1x-7.2.8-sleep, on top of #975's 2169.

Validation, on a Surface Pro 11 (X1E80100, OLED), 2026-10-19, booted from this recipe with the package's own device tree: gcc, the interconnects and the other providers reach sync_state() on their own at boot, the GPU binds with its GMU, and the ADSP takes the standby message on the way into and out of suspend. In a 10.6-minute deep suspend on battery, CX, AOSS and DDR were asleep 99.9% of the time with five exits, and the battery gauge read about 0.25 W; an earlier one-hour run of 2170-2177 measured 0.23 W, against 0.75 W with none of them asleep. Resume by the power key with the display, NVMe, Wi-Fi, Bluetooth and audio back, and no kernel warnings. Not booted on another X1 laptop or an N1x. On the N1x the GMU, geni and ADSP drivers never bind, and the root-port check finds no Qualcomm controller.

To check another X1 laptop (as root): cat /sys/bus/platform/devices/100000.clock-controller/state_synced should read 1, and /sys/kernel/debug/qcom_stats/cxsd should count up across a suspend.

@turbineBMW
turbineBMW force-pushed the upstream/linux-omarchy-aarch64-sp11-sleep branch from 38e4a3e to 37f42b1 Compare October 19, 2026 19:01
@turbineBMW
turbineBMW marked this pull request as ready for review October 19, 2026 19:01
@ryanrhughes
ryanrhughes force-pushed the upstream/linux-omarchy-aarch64-sp11-sleep branch from 37f42b1 to ff7c9fa Compare October 20, 2026 03:00
@ryanrhughes ryanrhughes added the build-approved Maintainer approved this PR to build on the self-hosted pool label Oct 20, 2026
@ryanrhughes
ryanrhughes enabled auto-merge (squash) October 20, 2026 03:31
turbineBMW and others added 3 commits October 20, 2026 00:22
…d go

qcom_battmgr takes the charger supplies' online state from the battery's
status response and never announces it, so UPower kept the charger state it
read at startup. Patch 2002, applied to the power-supply tree as 87fd20da8ca8,
announces the change.

Validated on a Surface Pro 11 with the patched module built against 7.2.8-7:
OnBattery follows plugging in and out with Omarchy's udev rule turned off.
Brings the Microsoft Surface Pro 11 (X1E80100, microsoft,denali-oled) onto
linux-omarchy-aarch64 as patches 2100-2169 from turbineBMW/linux
sp11/n1x-7.2.8, with SPI HID, IMX681 and VD55G0 as modules, so it no longer
needs its own kernel package. Changes that are tested only on the Surface
Pro 11 are gated to microsoft,denali.

Validated on a Surface Pro 11 with this patch set on 7.2.8: keyboard at the
LUKS prompt, touch and pen, Wi-Fi, Bluetooth, speakers, all three cameras and
the privacy LED, and suspend and resume.
…and CX collapse in suspend

On 7.2.8 an X1 in suspend never collapses CX or puts DDR into
self-refresh: gcc never reaches sync_state() because the GPU's GMU has no
driver, the root ports stay in D0 so pcie-qcom keeps a DDR vote, the geni
UART keeps its clocks, and the ADSP wakes about 100 times a second without
the Modern Standby message Windows sends.

Add Akhil P Oommen's GMU driver series with fixes, 7.3's geni UART force
suspend, a Qualcomm-only backport of 7.3's root-port D3 change, and the
ADSP Modern Standby notification from justririll/x1e-sleep.

On a Surface Pro 11, CX, AOSS and DDR are asleep 99.9% of a one-hour
deep suspend, about 0.23 W instead of 0.75 W.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ryanrhughes
ryanrhughes force-pushed the upstream/linux-omarchy-aarch64-sp11-sleep branch from ff7c9fa to 2f67200 Compare October 20, 2026 04:22
@ryanrhughes
ryanrhughes merged commit 402c40c into omacom:master Oct 20, 2026
7 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Publish succeeded → live

Packages: linux-omarchy-aarch64 (aarch64, PR artifact)

  • edge/aarch64: linux-omarchy-7.2.8-19-aarch64, linux-omarchy-headers-7.2.8-19-aarch64

Commit 402c40c · run

turbineBMW added a commit to turbineBMW/omarchy-pkgs that referenced this pull request Oct 21, 2026
The Surface Pro 11 patches, the KIP pairing node and the IMX681 gain
control among them, landed in linux-omarchy with omacom#1315, and
linux-omarchy-n1x is gone. Point the README and the pairing tool at it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ryanrhughes pushed a commit that referenced this pull request Oct 21, 2026
…eyboard pairing and pen resume (#825)

* Add surface-pro-11-support with Wi-Fi board data and audio

The Surface Pro 11's WCN7850 reports generic identifiers that match no
linux-firmware board record, so Wi-Fi cannot load board data. Extract
Qualcomm's reference-design record from linux-firmware-atheros at build
time, unmodified and checked by size and SHA-256, and ship it as
board.bin until the Surface's own board data reaches linux-firmware.
Stripping is disabled because the record is an ELF image.

Build the AudioReach topology from pinned upstream source, checked
against the binary validated on the device, and ship ALSA UCM routing
for the speakers and microphones, derived from alsa-ucm-conf's Surface
Pro 12in profile with its attribution and BSD-3-Clause licence kept.
Hide the monochrome infrared sensor from camera pickers in WirePlumber,
so apps see the front and back cameras only.

The package is aarch64-only, tagged for the Qualcomm platform guard and
published to edge.

Validated with test.sh and a package build whose board data and
topology are byte-identical to a working Surface Pro 11 installation,
where Wi-Fi, speakers and microphones work and PipeWire offers exactly
the front and back cameras.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Restore the Surface Pro 11's charge window after resume

The battery firmware can lose its charge window across suspend while
the kernel driver still reports the thresholds that were set. A sleep
hook now writes those same thresholds back after resume. It never
chooses a limit, leaving that to UPower or Omarchy's power settings,
and does nothing when no limit is set. The kernel driver already
restores the window when the battery-manager service restarts.

Validated with test.sh and on a Surface Pro 11: a 75-80% window is
written back unchanged after suspend and resume.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Cap the Surface Pro 11's CPU frequency per power profile

The Surface's firmware power profile does not limit short CPU loads. A
service now follows power-profiles-daemon and caps every cpufreq policy
at 1.92 GHz in power-saver and 2.52 GHz in balanced, restoring the full
range in performance.

Validated with test.sh and on a Surface Pro 11: each profile sets its
ceiling on all policies.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Restart iptsd across suspend on the Surface Pro 11

The touch controller resets its firmware during resume ("Spontaneous FW
reset!") and a running iptsd never recovers, leaving pen and touch dead
until it is restarted. A sleep hook now stops the active iptsd
instances before sleep and starts them again one second after resume.

Validated with test.sh and on a Surface Pro 11: the pen works after
suspend and resume.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Take the Surface Pro 11's Wi-Fi and Bluetooth addresses from surface-snapdragon-addresses

The WCN7850's Wi-Fi interface gets a per-boot placeholder address and
its Bluetooth controller stays unconfigured until it is given a public
address. surface-snapdragon-addresses sets both from the
MacAddressEmulationAddress UEFI variable, the way Windows does, and the
Surface Laptop 8 shares it, so this package depends on it instead of
carrying its own copy.

Validated with the package's test.sh and a makepkg build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Give stock libcamera the Surface Pro 11 front camera's black level

Ship the IMX681 simple-IPA tuning file where libcamera looks for
per-sensor tuning, in place of the copy built into the patched
libcamera-surface-pro-11. With the linear gain control now in
linux-omarchy-n1x's IMX681 driver, stock libcamera drives the front
camera and the libcamera fork is no longer needed.

Validated on a Surface Pro 11 with Arch's libcamera 0.7.2-4, which loaded
this file and gave the same front camera picture as the patched
libcamera, before and after suspend.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Drop the Surface Pro 11 CPU cap service

omarchy-power-profiles-daemon caps the CPU clusters on every Snapdragon X
laptop now (#1029), so the SP11's own service would only fight it over
scaling_max_freq. The python, python-dbus, python-gobject and
power-profiles-daemon dependencies were only there for it.

Validated with test.sh and a clean makepkg.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Pair the Surface Flex Keyboard over Bluetooth when it is attached

Attaching the keyboard runs surface-pro-11-flex-autopair: with no bond, or a
bond that stopped working because another host re-keyed it, it hands the
keyboard the tablet's address and a fresh key over the connector and pairs
with LE legacy out-of-band pairing, as Windows does. A working bond is left
alone. Detaching runs surface-pro-11-flex-reconnect, which connects the
keyboard over Bluetooth and marks the bond for re-pairing if it never
connects. surface-pro-11-flex-pair pairs by hand.

Pairing turns the adapter pairable for the pair only, since the kernel stores
the keys only while it is bondable and Omarchy leaves Pairable off. It also
stores a 7.5-11.25 ms connection interval for the keyboard, which never asks
for one; at Linux's default its touchpad reports arrive in bursts.

Validated on a Surface Pro 11 with linux-omarchy-n1x 7.2.8-7 (#975's KIP
pairing node and LE legacy OOB pairing): attaching paired a keyboard bonded
to another host, it typed over Bluetooth when detached, reattaching left the
working bond alone, attaching it after a Surface Pro 12 had re-keyed it took
it back in about 25 s, and the touchpad moved smoothly over Bluetooth with
the stored interval. test.sh covers the attach and detach decisions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Arm the Surface Pro 11's lid wake only when the lid is closed

Now that linux-omarchy lets the SoC collapse CX in suspend, the lid line
(gpio2) shows a false edge about 0.3 s after the collapse when the cover
is open. Lid wake is on by default, so every suspend with the cover open
wakes the machine at once.

A sleep hook now arms lid wake before suspend only when logind reports
the lid closed, and turns it off otherwise; an unknown lid state counts
as open. Suspending with the cover closed keeps the default, so opening
the cover still wakes the machine, and the power button wakes it either
way.

Validated with test.sh and on a Surface Pro 11 on linux-omarchy 7.2.8:
with the cover open the machine stays asleep (5 h overnight, CX
collapsed 99.9 %) and wakes on the power button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Name the Surface Pro 11's kernel linux-omarchy in surface-pro-11-support

The Surface Pro 11 patches, the KIP pairing node and the IMX681 gain
control among them, landed in linux-omarchy with #1315, and
linux-omarchy-n1x is gone. Point the README and the pairing tool at it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Drop the channels key from surface-pro-11-support

The release ring replaced channels on master (61ff008) and metadata
validation now refuses the key. The package publishes to edge on merge
like every other package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Drop a stray source clone from surface-pro-11-support

The lid wake commit picked up makepkg's audioreach-topology clone by
mistake. In CI it lands in the build directory, and makepkg refuses it
because it is not a clone of the source URL, so the build fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@n1c0la84

Copy link
Copy Markdown

Thanks for the detailed write-up. One question about the Surface Pro 11 validation (99.9 % CX/AOSS/DDR, ~0.25 W): was Linux running at EL1 under Gunyah, as a stock Omarchy install boots, or at EL2 through slbounce?

I ask because the other X1E reports I can find only reach CXSD/AOSD at EL2: an SP11 owner in dwhinham/archiso-aarch64-sp11#38 measured 1.06 W with no CXSD at EL1 and 0.26 W at EL2, and on linux-arm-msm Michael Burch's XPS 13 at EL1 stays at aosd/cxsd 0 with every APPS vote zeroed. My Galaxy Book4 Edge (NP940XMA) collapses at EL2 but didn't at EL1 when I tried in October. If yours was at EL1, these four fixes are what I'd try next there.

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

Labels

build-approved Maintainer approved this PR to build on the self-hosted pool

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants