Measurement-corrected battery optimization pass (DSDS + Wi-Fi)

Re-analyzed the running nokia-argon (a1105, 43 h uptime, DSDS + Wi-Fi on) and
implemented the corrected kernel/userspace optimization list. No sleep state
existed at all (/sys/power/state was 0 bytes) and cpuinfo_transition_latency
was UINT_MAX, while the CPU cores were already ~98% power-collapsed.

Kernel (K1-K14)
- Enable CONFIG_SUSPEND / SUSPEND_FREEZER / PM_WAKELOCKS / PM_AUTOSLEEP and
  build the zImage from the tuned config; ship it as overlay/rootfs/boot/vmlinuz
  plus config and System.map. Add wakeup-source to the WCNSS pronto remoteproc.
- Add clock-latency-ns to cpu-opp-table in all 5 device trees (fixes
  CPUFREQ_ETERNAL at its source instead of a userspace rate_limit_us override).
- New patch 0006: wcn36xx keep-alive 30s->120s, listen_interval=3, VM-BMS
  sample interval 10s->30s, power_supply_changed() only on real capacity
  changes, GPU devfreq polling_ms 50->100.
- Retune the config for idle (HZ=100, PREEMPT_VOLUNTARY, TEO cpuidle governor,
  no ftrace/perf/kprobes/BPF-JIT-always-on/debug options, no serial console,
  DRM_FBDEV_OVERALLOC=0, lz4 zram, ENERGY_MODEL) and drop earlycon /
  console=ttyMSM0 from every kernel cmdline.
- net.ipv6.conf.default.disable_ipv6=1 to stop ND/MLD multicast on new
  interfaces; keep NETFILTER/IPV6/CGROUPS and FRAMEBUFFER_CONSOLE for
  VPN/tethering, elogind and plymouth.

Userspace (U1-U14)
- Idle blanking without the passcode locker (bananarchy-idle-blank.sh +
  idle_locker resume hook, SXMO_UNLOCK_IDLE_TIME=60, sxmo.noidle opts out).
- Guarded deep standby (bananarchy-suspend.sh / -deep-standby.sh /
  sxmo_autosuspend.sh / sxmo_suspend.sh), AllowSuspend=yes, doas rule, no
  infinite wakelock, no sxmo.nosuspend. Shipped disabled via
  /etc/bananarchy-no-deep-standby until the new kernel is boot-tested; freeze
  is preferred, mem is opt-in.
- statusbar_periodics 60s->300s, no mmcli/nmcli/rfkill polls, xsetroot only on
  change; battery udev rule filtered and no 2 s recheck fork.
- On-demand QMI DPM port, longer DSDS/modemmonitor backoffs, chrony long polls,
  NM wifi.scan-interval=600, bluetooth AutoEnable=false, tmpfs on /tmp,
  zero-log superd, GPU devfreq governor on screen-off, longer SIP/Tox timers.
- Fix the cosmetic wpa_supplicant yesno typo; withdraw the disproven duplicate
  wpa_supplicant and soundmonitor 5 s loop items.

Rebuilt images/bananarchy-nokia-argon.img with --mkinitfs: boot.img contains
the new zImage + DTB byte-for-byte and no serial-console cmdline. Deployed the
userspace overlay to the connected phone and verified shell/Python syntax, the
idle-blank round trip, the statusbar hook and the deep-standby guard.
check-rebuild.sh and sync-prebuilt-overlay.sh --check both pass.

Docs: BATTERY-OPTIMIZATION-ANALYSIS.md (measurement-corrected, with
implementation status), CHANGELOG.md, MANUAL.md, README.md, AGENTS.md.
This commit is contained in:
Bantam committed 2026-11-07 17:03:12 +02:00
1 parent 2ea2db443d
commit ad3461babf
169 files changed
+151574 -333

No files matched your search

+24 -2
View File
@@ -74,6 +74,10 @@ EOF
echo "[2d/5] Applying QDSP6 Internal BT-SCO and btqcomsmd SCO patch..."
patch -p1 < /bananarchy/patches/kernel/0005-msm8909-qdsp6-bt-sco-support.patch
fi
if ! grep -q "WCN36XX_KEEP_ALIVE_TIME_PERIOD 120" drivers/net/wireless/ath/wcn36xx/hal.h 2>/dev/null; then
echo "[2e/5] Applying BMS/WCN36xx/GPU idle-power patch..."
patch -p1 < /bananarchy/patches/kernel/0006-msm8909-battery-wifi-gpu-power.patch
fi
if [ ! -f include/config/auto.conf ] || ! grep -q "CONFIG_NETFILTER_XT_MATCH_OWNER=m" .config 2>/dev/null; then
echo "[3/5] Preparing kernel configuration..."
cp /bananarchy/patches/kernel/config-bananarchy-msm8909.armv7 .config
@@ -100,6 +104,8 @@ EOF
patch -p1 < /bananarchy/patches/kernel/0003-msm8909-adreno-304-gpu-support.patch
patch -p1 < /bananarchy/patches/kernel/0004-msm8909-power-battery-wifi-audio-pm.patch
patch -p1 < /bananarchy/patches/kernel/0005-msm8909-qdsp6-bt-sco-support.patch
echo "[2e/5] Applying BMS/WCN36xx/GPU idle-power patch..."
patch -p1 < /bananarchy/patches/kernel/0006-msm8909-battery-wifi-gpu-power.patch
echo "[3/5] Preparing kernel configuration and Module.symvers..."
cp /bananarchy/patches/kernel/config-bananarchy-msm8909.armv7 .config
@@ -131,7 +137,21 @@ EOF
qcom/qcom-msm8909-nokia-sparkler.dtb \
qcom/qcom-msm8909-nokia-leo.dtb
echo "[5/5] Exporting built modules and DTBs to prebuilt/kernel-6.12.1-msm8916..."
echo "[4b/5] Building the Bananarchy kernel image (zImage) from the tuned config..."
make ARCH=arm CROSS_COMPILE=armv7-alpine-linux-musleabihf- -j"$(nproc)" zImage
# Keep the resolved config as the single source of truth for module builds.
cp -a .config /bananarchy/patches/kernel/config-bananarchy-msm8909.armv7
echo "[5/5] Exporting built modules, DTBs and kernel image to prebuilt/kernel-6.12.1-msm8916..."
mkdir -p /bananarchy/overlay/rootfs/boot
cp -a arch/arm/boot/zImage /bananarchy/prebuilt/kernel-6.12.1-msm8916/vmlinuz
cp -a arch/arm/boot/zImage /bananarchy/overlay/rootfs/boot/vmlinuz
# Unique basename: sync-prebuilt-overlay.sh matches by basename and a
# plain config filename would collide with the fcitx5 config in the overlay.
cp -a .config /bananarchy/prebuilt/kernel-6.12.1-msm8916/kernel-config
cp -a .config /bananarchy/overlay/rootfs/boot/config
cp -a System.map /bananarchy/prebuilt/kernel-6.12.1-msm8916/System.map
cp -a System.map /bananarchy/overlay/rootfs/boot/System.map
mkdir -p /bananarchy/prebuilt/kernel-6.12.1-msm8916/qdsp6 \
/bananarchy/prebuilt/kernel-6.12.1-msm8916/qcom \
/bananarchy/prebuilt/kernel-6.12.1-msm8916/codecs \
@@ -219,7 +239,9 @@ EOF
chown -R "$HOST_UID:$HOST_GID" /bananarchy/prebuilt/kernel-6.12.1-msm8916 \
/bananarchy/overlay/rootfs/lib/modules/6.12.1-msm8916 \
/bananarchy/overlay/rootfs/boot \
/bananarchy/patches/kernel/config-bananarchy-msm8909.armv7 \
/bananarchy/src/leds-msm8905-torch \
/bananarchy/src/msm8905-cam
echo "Kernel audio modules, torch LED module, camera module, and DTBs built successfully."
echo "Kernel image, audio modules, torch LED module, camera module, and DTBs built successfully."
'