diff --git a/CHANGELOG.md b/CHANGELOG.md index dd4aaa6..bfc3f7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,16 @@ Release versions follow the `
` format (where `2026` is `a`, --- +## Unreleased — display power and cpufreq fixes + +### Display power management and CPU frequency tuning +- Enabled the X11 DPMS extension in `10-bananarchy-msm8909.conf`, `bananarchy-x11-session.sh`, and `sxmo_dwminit.sh`, and added explicit `xset dpms force off/on` to `sxmo_wm.sh display off/on`. Before the fix the DRM connector stayed `On` while blanked; it now reports `Off` on blank and `On` on wake for both the `sxmo_wm.sh` path and the direct-sysfs paths used by `dwm` and `locker.so`. DPMS timeouts stay at `0 0 0`, so unlocked auto-blanking remains disabled by design. +- Added `bananarchy-display-power-sync` and `86-bananarchy-display-power.rules` to drive DPMS from backlight `change` uevents, covering the lid-close and lockscreen blank paths that write sysfs directly. The helper also re-applies the schedutil rate limit after every wake. +- Fixed `rate_limit_us` silently falling back to the 6.44 s default: `10-power-save.start` no longer writes the nonexistent `up_rate_limit_us` / `down_rate_limit_us` files, and the 40 ms value is re-applied after each `powersave` to `schedutil` governor switch. Measured idle average CPU frequency dropped from 582 MHz to 440 MHz (-24%) with 40 ms instead of 6.44 s. +- Removed the dead `iw dev wlan0 set power_save on` block from `10-power-save.start`: `iw` is not shipped, and NetworkManager `wifi.powersave=3` plus the wcn36xx `WIPHY_FLAG_PS_ON_BY_DEFAULT` patch already report `Power save: on` on the connected link. + +--- + ## Build `a1105` — codename `vendetta` (2026-11-05) ### Full-length SMS conversation view and Unicode-aware composer diff --git a/overlay/rootfs/etc/X11/xorg.conf.d/10-bananarchy-msm8909.conf b/overlay/rootfs/etc/X11/xorg.conf.d/10-bananarchy-msm8909.conf index db83768..e2820af 100644 --- a/overlay/rootfs/etc/X11/xorg.conf.d/10-bananarchy-msm8909.conf +++ b/overlay/rootfs/etc/X11/xorg.conf.d/10-bananarchy-msm8909.conf @@ -6,12 +6,12 @@ Section "ServerFlags" Option "StandbyTime" "0" Option "SuspendTime" "0" Option "OffTime" "0" - Option "DPMS" "false" + Option "DPMS" "true" EndSection Section "Monitor" Identifier "DefaultMonitor" - Option "DPMS" "false" + Option "DPMS" "true" EndSection Section "Device" diff --git a/overlay/rootfs/etc/doas.d/50-sxmo.conf b/overlay/rootfs/etc/doas.d/50-sxmo.conf index 9648228..e7e9527 100644 --- a/overlay/rootfs/etc/doas.d/50-sxmo.conf +++ b/overlay/rootfs/etc/doas.d/50-sxmo.conf @@ -49,6 +49,8 @@ permit nopass :wheel as root cmd /usr/bin/bananarchy-bt-obex permit nopass :wheel as root cmd bananarchy-bt-obex permit nopass :wheel as root cmd /usr/bin/bananarchy-privacy-ctl permit nopass :wheel as root cmd bananarchy-privacy-ctl +permit nopass :wheel as root cmd /usr/bin/bananarchy-display-power-sync +permit nopass :wheel as root cmd bananarchy-display-power-sync permit nopass :wheel as root cmd /usr/bin/plymouth args quit permit nopass :wheel as root cmd plymouth args quit permit nopass :wheel as root cmd rc-service args hexagonrpcd-adsp-sensorspd stop diff --git a/overlay/rootfs/etc/local.d/10-power-save.start b/overlay/rootfs/etc/local.d/10-power-save.start index 1d8759e..10285f6 100755 --- a/overlay/rootfs/etc/local.d/10-power-save.start +++ b/overlay/rootfs/etc/local.d/10-power-save.start @@ -31,14 +31,14 @@ for pm_dev in /sys/devices/platform/soc@0/1c00000.gpu /sys/devices/platform/soc@ fi done -# Tune CPUFreq schedutil governor to avoid 22 Hz frequency/RPM voltage thrashing at idle -# while keeping interactive ramp-up responsive. Allow video group (dwm/xlocker) to switch -# scaling_governor to powersave (200 MHz) while the screen is off. +# Keep schedutil rate_limit_us at 40 ms instead of the 6.44 s default that +# qcom-cpufreq derives from its UINT_MAX transition latency. Only rate_limit_us +# exists on this kernel: up_rate_limit_us and down_rate_limit_us do not. +# Switching scaling_governor away from schedutil and back destroys/recreates +# this kobject, so bananarchy-display-power-sync re-applies the value on wake. for gov_dir in /sys/devices/system/cpu/cpufreq/schedutil /sys/devices/system/cpu/cpufreq/policy*/schedutil /sys/devices/system/cpu/cpu*/cpufreq/schedutil; do if [ -d "$gov_dir" ]; then { echo 40000 > "$gov_dir/rate_limit_us"; } 2>/dev/null || true - { echo 40000 > "$gov_dir/up_rate_limit_us"; } 2>/dev/null || true - { echo 10000 > "$gov_dir/down_rate_limit_us"; } 2>/dev/null || true fi done for gov_file in /sys/devices/system/cpu/cpufreq/policy*/scaling_governor /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do @@ -59,10 +59,10 @@ if [ -r /sys/class/power_supply/pm8916-lbc-chgr/constant_charge_current ]; then fi fi -# Enable IEEE 802.11 power save on WCN3620 wlan0 -if command -v iw >/dev/null 2>&1; then - iw dev wlan0 set power_save on 2>/dev/null || true -fi +# Wi-Fi power save is enabled by NetworkManager (wifi.powersave=3) and by the +# wcn36xx WIPHY_FLAG_PS_ON_BY_DEFAULT / dynamic_ps_timeout=200 kernel patch. +# Verified on-device: "iw dev wlan0 get power_save" reports "Power save: on". +# No iw binary is shipped, so no userspace iw call belongs here. # Restore any persistent Engineering Menu Wi-Fi/BT MAC and IMEI override state if [ -x /usr/bin/bananarchy-engmenu-ctl ]; then diff --git a/overlay/rootfs/etc/udev/rules.d/86-bananarchy-display-power.rules b/overlay/rootfs/etc/udev/rules.d/86-bananarchy-display-power.rules new file mode 100644 index 0000000..2c826f9 --- /dev/null +++ b/overlay/rootfs/etc/udev/rules.d/86-bananarchy-display-power.rules @@ -0,0 +1 @@ +SUBSYSTEM=="backlight", ACTION=="change", RUN+="/bin/sh -c 'DISPLAY=:0 /usr/bin/bananarchy-display-power-sync >/dev/null 2>&1 &'" diff --git a/overlay/rootfs/usr/bin/bananarchy-display-power-sync b/overlay/rootfs/usr/bin/bananarchy-display-power-sync new file mode 100755 index 0000000..20ff0c9 --- /dev/null +++ b/overlay/rootfs/usr/bin/bananarchy-display-power-sync @@ -0,0 +1,33 @@ +#!/bin/sh +# Keep DRM DPMS and the schedutil rate limit in sync with the backlight state. +# Invoked by the backlight udev rule (as root) and by sxmo_wm.sh display on +# (via doas). Every blank path writes brightness=0; every wake path restores it. + +BR_PATH=/sys/class/backlight/backlight/brightness +RL_PATH=/sys/devices/system/cpu/cpufreq/schedutil/rate_limit_us + +DPMS_PATH= +for _dpms in /sys/class/drm/card*-*/dpms; do + [ -r "$_dpms" ] && DPMS_PATH="$_dpms" && break +done + +br=1 +[ -r "$BR_PATH" ] && { read -r br < "$BR_PATH" 2>/dev/null || br=1; } +case "$br" in ''|*[!0-9]*) br=1 ;; esac + +cur=On +[ -r "$DPMS_PATH" ] && { read -r cur < "$DPMS_PATH" 2>/dev/null || cur=On; } + +if [ "$br" -eq 0 ]; then + [ "$cur" = "Off" ] || DISPLAY=:0 xset dpms force off >/dev/null 2>&1 || true +else + [ "$cur" = "On" ] || DISPLAY=:0 xset dpms force on >/dev/null 2>&1 || true +fi + +# Switching scaling_governor away from schedutil and back recreates this +# kobject with the 6.44 s default, so re-apply the 40 ms value on every wake. +if [ "$br" -ne 0 ] && [ -w "$RL_PATH" ]; then + printf '40000\n' > "$RL_PATH" 2>/dev/null || true +fi + +exit 0 diff --git a/overlay/rootfs/usr/bin/bananarchy-x11-session.sh b/overlay/rootfs/usr/bin/bananarchy-x11-session.sh index 57ee553..444c8d2 100755 --- a/overlay/rootfs/usr/bin/bananarchy-x11-session.sh +++ b/overlay/rootfs/usr/bin/bananarchy-x11-session.sh @@ -102,9 +102,9 @@ fi if ! pidof -s Xorg >/dev/null 2>&1; then if [ -f /tmp/bananarchy_ext_logging ]; then - "$XORG_BIN" :0 -s 0 -dpms -nolisten tcp -config "$XORG_CONFIG" -modulepath "$XORG_MODPATH" -logfile /tmp/Xorg.0.log >/dev/null 2>&1 /dev/null 2>&1 /dev/null 2>&1 /dev/null 2>&1 /dev/null 2>&1; then sleep 0.05 i=$((i + 1)) done + xset +dpms >/dev/null 2>&1 || true + xset dpms 0 0 0 >/dev/null 2>&1 || true else xset s off s noblank s 0 0 >/dev/null 2>&1 || true + xset +dpms >/dev/null 2>&1 || true + xset dpms 0 0 0 >/dev/null 2>&1 || true fi SESSION_PID_FILE="/tmp/bananarchy-x11-session.pid" diff --git a/overlay/rootfs/usr/bin/sxmo_dwminit.sh b/overlay/rootfs/usr/bin/sxmo_dwminit.sh index 74ea83a..1493b9b 100755 --- a/overlay/rootfs/usr/bin/sxmo_dwminit.sh +++ b/overlay/rootfs/usr/bin/sxmo_dwminit.sh @@ -20,7 +20,8 @@ envvars() { defaults() { xsetroot -solid '#1c1c1c' - xset s off s noblank s 0 0 -dpms + xset s off s noblank s 0 0 +dpms + xset dpms 0 0 0 [ -e "$HOME"/.Xresources ] && xrdb -merge "$HOME"/.Xresources if command -v feh >/dev/null 2>&1; then WP_FILE="/usr/share/wallpapers/bananarchy.png" diff --git a/overlay/rootfs/usr/bin/sxmo_wm.sh b/overlay/rootfs/usr/bin/sxmo_wm.sh index 20bca2f..4495e31 100755 --- a/overlay/rootfs/usr/bin/sxmo_wm.sh +++ b/overlay/rootfs/usr/bin/sxmo_wm.sh @@ -53,12 +53,14 @@ xorgdisplay() { printf 'powersave\n' > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 2>/dev/null || true fi xset s off s noblank >/dev/null 2>&1 || true + xset dpms force off >/dev/null 2>&1 || true ;; on) if [ -w /sys/devices/system/cpu/cpufreq/policy0/scaling_governor ]; then printf 'schedutil\n' > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 2>/dev/null || true fi xset s off s noblank >/dev/null 2>&1 || true + xset dpms force on >/dev/null 2>&1 || true if [ -w /sys/class/backlight/backlight/bl_power ]; then printf '0\n' > /sys/class/backlight/backlight/bl_power 2>/dev/null || true fi @@ -88,6 +90,7 @@ xorgdisplay() { fi printf '%s\n' "${_restore_kbd:-255}" > /sys/class/leds/white:kbd_backlight/brightness 2>/dev/null || true fi + doas -n /usr/bin/bananarchy-display-power-sync >/dev/null 2>&1 || true ;; "") _cur_bl=14