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

+34
View File
@@ -9,6 +9,40 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
---
## Unreleased — VM-BMS clamp and runtime power policies
- **Kernel fix (patch 0007)**: `pm8916_bms_vm.c` now bounds VADC raw samples
to `8000..16000` (~2.34-4.69 V) with a 3.7 V nominal fallback, covering
the FIFO IRQ, the probe-time FIFO pre-read and both OCV register reads.
An uninitialised `0xffff` sample previously produced `voltage_now=19.2 V`,
`health=Over voltage` and `capacity=100` for the first minutes after a hard
reset. Source-only change; no config, vermagic or struct layout change.
- **Configurable Wi-Fi listen interval**: `wcn36xx` gained a
`listen_interval` module parameter (1-10, default 5, was hardcoded 3).
`/etc/bananarchy-power-policy.conf` (`WIFI_LISTEN_INTERVAL`) drives
`/etc/modprobe.d/10-bananarchy-power.conf` via
`bananarchy-power-policy.sh`. Higher values cut idle RX wakeups at the cost
of inbound packet latency; changes apply at module load.
- **Modem DRX policy**: standard `AT+CPSMS` / `AT+CEDRXS` are unsupported on
this modem firmware, but the Qualcomm `AT$QCDRX` DRX mode (0, 6-9) works.
`MODEM_DRX_MODE` in the policy config is applied at boot and on screen
wake. Default `0` (firmware default) because higher values are
undocumented and can delay paging; `6` is the conservative opt-in.
- **DSDS secondary-SIM policy**: `DSDS_SECONDARY_MODE=eco` parks the
secondary subscription after `DSDS_PARK_DELAY` seconds of a dark panel and
restores it on wake, using QMI provisioning-session
activate/deactivate (not SIM power-off, which loses PIN verification).
Default `active` keeps both SIMs reachable. Hooks in
`sxmo_wm.sh display off/on` cover both idle blank and locker screenoff.
- **New `bananarchy-power-policy.sh`** plus an OpenRC default-runlevel
service and a `doas` rule. `status` reports the effective policy, the
`wcn36xx` parameter, and the current modem DRX mode.
- **Not implementable here**: DDR self-refresh / `mem` suspend (needs PSCI
`SYSTEM_SUSPEND` in lk2nd) and standard LTE PSM/eDRX (not exposed by
`MPSS.JO.3.0.c4`). See `BATTERY-OPTIMIZATION-ANALYSIS.md` §15.
---
## Unreleased — kernel power headroom analysis (no runtime change)
A second live measurement pass on the connected `nokia-argon` (screen off,