VM-BMS sanity fix and configurable runtime power policies

Kernel (source-only, ABI-preserving, patch 0007):
- pm8916_bms_vm.c: bound VADC raw samples to 8000..16000 (~2.34-4.69 V)
  with a 3.7 V nominal fallback in raw_to_uv(); reject out-of-window FIFO
  samples in the IRQ handler and probe pre-read. Fixes the 19.2 V /
  "Over voltage" / 100% misreport from an uninitialised 0xffff sample after
  a hard reset (also covers the OCV register reads on probe/resume).
- wcn36xx: listen_interval becomes a module parameter (1-10, default 5,
  was hardcoded 3) so the beacon skip is configurable at module load.

Runtime power policy (/etc/bananarchy-power-policy.conf):
- WIFI_LISTEN_INTERVAL drives /etc/modprobe.d/10-bananarchy-power.conf.
- MODEM_DRX_MODE (0 or 6-9) applies Qualcomm AT$QCDRX at boot and on wake.
  Standard AT+CPSMS / AT+CEDRXS are unsupported on this modem firmware.
- DSDS_SECONDARY_MODE=eco parks the secondary GW provisioning session after
  DSDS_PARK_DELAY seconds of a dark panel and restores it on wake, capturing
  the actual slot and AID. Uses QMI provisioning sessions, not SIM power-off
  (which clears PIN verification). Default active keeps both SIMs reachable.
- New bananarchy-power-policy.sh, OpenRC default-runlevel service, doas rule,
  and hooks in sxmo_wm.sh display off/on.

Live-verified on nokia-argon: DRX 6 readback, eco park/unpark round-trip,
Wi-Fi param 5, status output, module vermagic match, both SIMs registered.
Rebuilt image with --mkinitfs: initramfs and rootfs carry the new modules
(SHA-256 match), boot.img keeps the byte-identical known-good zImage + DTB.
Docs updated (BATTERY-OPTIMIZATION-ANALYSIS.md section 15, CHANGELOG,
MANUAL, README, AGENTS).
This commit is contained in:
Luxferre committed 2026-11-07 20:39:06 +02:00
1 parent b5a1e0c5f9
commit bc1c19a483
20 files changed
+470 -2

No files matched your search

+1
View File
@@ -303,6 +303,7 @@ rm -rf \
"$TARGET_ROOTFS/swapfile" \
"$TARGET_ROOTFS/var/log/logbookd.db"*
ln -sf /etc/init.d/kill-plymouth "$TARGET_ROOTFS/etc/runlevels/default/kill-plymouth"
ln -sf /etc/init.d/bananarchy-power-policy "$TARGET_ROOTFS/etc/runlevels/default/bananarchy-power-policy"
mkdir -p "$TARGET_ROOTFS/var/lib/tinydm"
ln -sf /usr/share/xsessions/sxmo.desktop "$TARGET_ROOTFS/var/lib/tinydm/default-session.desktop"
+7
View File
@@ -78,6 +78,10 @@ EOF
echo "[2e/5] Applying BMS/WCN36xx/GPU idle-power patch..."
patch -p1 < /bananarchy/patches/kernel/0006-msm8909-battery-wifi-gpu-power.patch
fi
if ! grep -q "PM8916_BMS_VM_NOMINAL_UV" drivers/power/supply/pm8916_bms_vm.c 2>/dev/null; then
echo "[2f/5] Applying VM-BMS FIFO sanity and Wi-Fi listen-interval policy patch..."
patch -p1 < /bananarchy/patches/kernel/0007-msm8909-bms-fifo-wifi-policy.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
@@ -107,6 +111,9 @@ EOF
echo "[2e/5] Applying BMS/WCN36xx/GPU idle-power patch..."
patch -p1 < /bananarchy/patches/kernel/0006-msm8909-battery-wifi-gpu-power.patch
echo "[2f/5] Applying VM-BMS FIFO sanity and Wi-Fi listen-interval policy patch..."
patch -p1 < /bananarchy/patches/kernel/0007-msm8909-bms-fifo-wifi-policy.patch
echo "[3/5] Preparing kernel configuration and Module.symvers..."
cp /bananarchy/patches/kernel/config-bananarchy-msm8909.armv7 .config
make ARCH=arm CROSS_COMPILE=armv7-alpine-linux-musleabihf- olddefconfig