Skip to content

Add the cpufreq driver and frequency caps to omarchy-power-profiles-daemon - #1029

Closed
turbineBMW wants to merge 1 commit into
omacom:masterfrom
turbineBMW:upstream/omarchy-power-profiles-daemon-cpufreq
Closed

turbineBMW wants to merge 1 commit into
omacom:masterfrom
turbineBMW:upstream/omarchy-power-profiles-daemon-cpufreq

Conversation

@turbineBMW

Copy link
Copy Markdown
Contributor

Gives Snapdragon X laptops working power profiles in omarchy-power-profiles-daemon, which today falls back to placeholder profiles on them.

Why

Snapdragon X CPUs run on the scmi cpufreq driver, with no energy-performance preference, and boost is off by default. Neither stock power-profiles-daemon nor the CPPC driver from #897 handles them, so balanced and power-saver change nothing and there is no performance profile for omarchy-powerprofiles-set to pick on AC.

What works is capping each CPU cluster's scaling_max_freq, the way Windows caps maximum processor performance per power mode. On a Surface Pro 11 (X1E-80-100), a sustained all-core job drew 31.5 W uncapped, 19.6 W at the balanced cap and 15.1 W at the power-saver cap: 39% and 50% less energy for the same work, taking 16% and 37% longer. Idle power doesn't change.

What changes

Three patches on top of the existing 0.30 + CPPC build, pkgrel 2:

  • balanced-performance-spelling.patch: upstream !238, merged after 0.30. 0.30 ignores firmware switching to the kernel's balanced-performance profile.
  • cpufreq-boost-driver.patch: upstream !237, merged after 0.30. A generic cpufreq driver, which uses the boost switch on Apple Silicon (apple-cpufreq).
  • cpufreq-caps.patch: upstream !239, open. A second method in that driver for scmi and qcom-cpufreq-hw:
Profile Cap X1E-80-100
power-saver 60% of the highest non-boost frequency 1.92 GHz
balanced 75%, on AC and on battery 2.52 GHz
performance none 3.42 GHz

The CPPC driver is unchanged. The drivers claim different scaling drivers (cppc_cpufreq, apple-cpufreq, and scmi/qcom-cpufreq-hw), so they can't both act on one machine, and x86 is untouched. The caps are lifted when the daemon stops and re-applied after resume. The governor and the boost switch are left alone.

The patches drop out when power-profiles-daemon releases with !237, !238 and !239.

Tested

On a Surface Pro 11 (X1E-80-100), kernel 7.2.8, installed in place of stock power-profiles-daemon:

  • makepkg with check(): 181/181 tests pass, the 137 from Add omarchy-power-profiles-daemon 0.30, with a CPPC driver for ARM laptops #897 plus the upstream cpufreq tests.
  • CpuDriver is cpufreq. Each profile reaches every cluster's scaling_max_freq on AC and on battery, stopping the daemon lifts the caps, and Omarchy's AC/battery switching picks up all three profiles.
  • tests/pinned-sources.sh passes.

…aemon

Backports two changes merged upstream after 0.30: the balanced-performance
spelling fix (!238) and the generic cpufreq driver (!237). On top, caps
each CPU cluster's maximum frequency on Snapdragon X (scmi and
qcom-cpufreq-hw), which has no energy preference and otherwise gets
placeholder profiles: 60% in power-saver, 75% in balanced, none in
performance. The caps are proposed upstream as !239. The CPPC driver is
unchanged; the drivers claim different scaling drivers.

Replaces the Surface Pro 11 package proposed in omacom#829.

Validated on a Surface Pro 11 (X1E-80-100): 181/181 tests in check(),
cpufreq driver picked, 1.92/2.52/3.42 GHz on AC and battery, caps lifted
when the daemon stops.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
turbineBMW added a commit to turbineBMW/omarchy-pkgs that referenced this pull request Oct 13, 2026
omarchy-power-profiles-daemon caps the CPU clusters on every Snapdragon X
laptop now (omacom#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>
turbineBMW added a commit to turbineBMW/omarchy that referenced this pull request Oct 13, 2026
The Surface-specific power-profiles-daemon build and the CPU cap service are
gone: omarchy-power-profiles-daemon caps the CPU clusters on every Snapdragon
X laptop (omacom/omarchy-pkgs#1029).

Validated with test/shell.d/surface-pro-11-hardware-test.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ryanrhughes ryanrhughes added build-approved Maintainer approved this PR to build on the self-hosted pool and removed build-approved Maintainer approved this PR to build on the self-hosted pool labels Oct 14, 2026
@ryanrhughes

Copy link
Copy Markdown
Collaborator

Rebased onto master (after #1047 swapped the CPPC driver for NVIDIA's RTX Spark driver) in #1102, with you kept as the commit author. The rebase touches workflow files, so it couldn't be pushed to your fork. Closing this in favour of #1102. Thanks!

birkskyum pushed a commit to turbineBMW/omarchy that referenced this pull request Oct 17, 2026
The Surface-specific power-profiles-daemon build and the CPU cap service are
gone: omarchy-power-profiles-daemon caps the CPU clusters on every Snapdragon
X laptop (omacom/omarchy-pkgs#1029).

Validated with test/shell.d/surface-pro-11-hardware-test.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
birkskyum pushed a commit to turbineBMW/omarchy that referenced this pull request Oct 17, 2026
The Surface-specific power-profiles-daemon build and the CPU cap service are
gone: omarchy-power-profiles-daemon caps the CPU clusters on every Snapdragon
X laptop (omacom/omarchy-pkgs#1029).

Validated with test/shell.d/surface-pro-11-hardware-test.sh.

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>
turbineBMW added a commit to turbineBMW/omarchy that referenced this pull request Oct 21, 2026
The Surface-specific power-profiles-daemon build and the CPU cap service are
gone: omarchy-power-profiles-daemon caps the CPU clusters on every Snapdragon
X laptop (omacom/omarchy-pkgs#1029).

Validated with test/shell.d/surface-pro-11-hardware-test.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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