Implement deep-standby RPM interconnect, Wi-Fi, USB, DSDS, and panel power savings for a1114

- Enable MSM8909 SMD RPM interconnect scaling (BIMC, PCNOC, SNOC) with 19.2 MHz active floor, zero sleep-set vote clearing clk_smd_rpm_handoff, and CPU OPP bandwidth tables across all six MSM8905/MSM8909 device trees while preserving module vermagic

- Sync wcn36xx conf.listen_interval and expose live screen_off_offload (ARP, IPv6 NS, GTK, ignore_dtim, 40 ms dynamic PS) toggled by bananarchy-display-power-sync without wlan_host_suspend_ind

- Add runtime PM clock gating to ci_hdrc_msm when USB is unplugged while skipping viewport ULPI_SYNC_STATE polling under CI_HDRC_OVERRIDE_PHY_CONTROL

- Default MODEM_DRX_MODE=6 across all /dev/wwan0at* channels with flock serialization, post-probe boot retry, and modem-ready registration hooks, and quiesce dsds-daemon polling whenever the screen is dark

- Issue MIPI DCS DISPLAY_OFF and SLEEP_IN in panel-mipi-dbi on DPMS off while preserving the 2720 Flip closed-only kernel cover backend, and update pinned a1114 (carbonara) hashes and docs
This commit is contained in:
Luxferre committed 2026-11-12 19:06:28 +02:00
1 parent e42024e90d
commit c95a84c69c
44 files changed
+106915 -105453

No files matched your search

+96 -1
View File
@@ -1,6 +1,6 @@
# Bananarchy battery-usage optimization analysis (measurement-corrected)
**Status:** analysis plus implemented changes (sections 15-18).
**Status:** analysis plus implemented changes (sections 15-20).
**Project:** `/home/lux/proj/bananarchy`, current release `a1111` / `lennon`.
**Device:** Nokia 8110 4G (`nokia-argon`, MSM8905), connected over USB RNDIS at `172.16.42.1`,
`Linux nokia-argon 6.12.1-msm8916 #6 SMP PREEMPT Sat May 30 08:38:37 UTC 2026 armv7l`,
@@ -1207,3 +1207,98 @@ module, and sysfs power knob across both active devices for upcoming build
on `/dev/input`, and blocking `select.select(..., None)`, dropping Bluetooth
daemon idle wakeups from ~100/min to `0`/min and reducing gamepad hotplug
latency from `2 s` to `<5 ms`.
---
## 20. Hardware, kernel, and firmware deep-standby fixes after the 4-hour DSDS + Wi-Fi standby test (`a1114` / `carbonara`)
### 20.1 Real-world discharge measurement and root-cause decomposition
On-battery standby testing on `a1114` (`carbonara`) with the screen off, DSDS
active, and Wi-Fi connected measured **20% battery drain over 4 hours**
(`5.0%/h`, or **~75 mA** continuous average on the `1,500 mAh` battery). Because
section 19 had already reduced userspace idle wakeups to near zero and CPU cores
were spending ~98% of uptime in standalone power collapse (SPC), auditing the
`6.12.1-msm8916` kernel source, `.config`, DTBs, and radio policy uncovered five
hardware/firmware power floors keeping SoC buses, clocks, RF receivers, and the
display controller active continuously without `CONFIG_SUSPEND`:
1. **RPM bus clocks (`BIMC`, `PCNOC`, `SNOC`) pinned at `INT_MAX` (~533 MHz DDR
/ ~133 MHz NoC)**: `# CONFIG_INTERCONNECT_QCOM_MSM8909 is not set` and all
six MSM8905/MSM8909 DTS files lacked `interconnect@400000` (`bimc`),
`interconnect@500000` (`pcnoc`), and `interconnect@580000` (`snoc`) nodes.
Without an interconnect provider reaching `icc_sync_state`, `clk-smd-rpm.c`'s
`clk_smd_rpm_handoff()` voted `INT_MAX` in both `QCOM_SMD_RPM_ACTIVE_STATE`
and `QCOM_SMD_RPM_SLEEP_STATE` at boot and never released it (~22--30 mA).
In addition, `qnoc_probe()` in `drivers/interconnect/qcom/icc-rpm.c`
zero-initialized `qp->bus_clk_rate[]`, so `sleep_rate == 0` matched the
cached `0` and skipped sending a `0` sleep-set vote to RPM.
2. **WCN3620 Wi-Fi firmware lacking screen-off ARP/NS/GTK/DTIM offloads and
`conf.listen_interval` mismatch**: `wcn36xx/main.c` only enabled
`wcn36xx_smd_arp_offload()`, `wcn36xx_smd_ipv6_ns_offload()`,
`wcn36xx_smd_gtk_offload()`, and `wcn36xx_smd_set_power_params(ignore_dtim=true)`
inside `wcn36xx_suspend()`, which never runs with `CONFIG_SUSPEND=n`. In
addition, `0007` set `hw->max_listen_interval` without setting
`hw->conf.listen_interval`, leaving `conf.listen_interval` at `1` (~12--18 mA).
3. **ChipIdea USB controller (`ci_hdrc_msm` at `78d9000.usb`) missing runtime
PM**: `ci_hdrc_msm.c` had no `RUNTIME_PM_OPS` and omitted
`CI_HDRC_SUPPORTS_RUNTIME_PM`, leaving `usb_hs_ahb_clk` (`100 MHz`) and
`usb_hs_system_clk` (`80 MHz`) ungated whenever unplugged on battery (~4--6 mA).
4. **DSDS modem paging at default short DRX (`MODEM_DRX_MODE=0`) and single-port
`AT$QCDRX` application**: `bananarchy-power-policy.conf` shipped
`MODEM_DRX_MODE=0`, `msm-modem-uim-selection at auto` exited after the first
`/dev/wwan0at*` port without configuring the second DSDS AT channel, and
`dsds-daemon` checked only `/tmp/bananarchy_screen_locked` rather than raw
backlight state (~10--15 mA).
5. **GC9305 / ST7789V SPI panel controller left in active 60 Hz GRAM scan during
DPMS off**: `drivers/gpu/drm/tiny/panel-mipi-dbi.c` omitted a `.disable`
callback on `panel_mipi_dbi_pipe_funcs`, so `xset dpms force off` turned off
the PWM backlight without issuing `MIPI_DCS_SET_DISPLAY_OFF` (`0x28`) and
`MIPI_DCS_ENTER_SLEEP_MODE` (`0x10`) before disabling `vdd`/`io` (~3--6 mA on
boards with always-on or shared panel rails).
### 20.2 Five hardware, kernel, and firmware fixes implemented (`0008`)
1. **MSM8909 RPM interconnect scaling (`CONFIG_INTERCONNECT_QCOM_MSM8909=y`)**:
enabled `CONFIG_INTERCONNECT_QCOM=y`, `CONFIG_INTERCONNECT_QCOM_MSM8909=y`,
and `CONFIG_INTERCONNECT_QCOM_SMD_RPM=y` (built-in, preserving module
`vermagic` across all 580 `.ko.zst` modules), added `.keep_alive = true` on
`msm8909_bimc`, `msm8909_pcnoc`, and `msm8909_snoc` (`19.2 MHz` active floor,
`0` in `SLEEP_STATE`), initialized `qp->bus_clk_rate[*]` to `U32_MAX` in
`qnoc_probe()` so `icc_sync_state` clears the `INT_MAX` sleep handoff vote in
RPM, and wired `bimc`/`pcnoc`/`snoc` plus `cpus` `interconnects` and
`cpu-opp-table` `opp-peak-kBps` across all six MSM8905/MSM8909 DTS files.
2. **Live WCN3620 screen-off firmware offloads without freezing host RX**:
`wcn36xx` now initializes both `hw->max_listen_interval` and
`hw->conf.listen_interval` from `listen_interval` (clamped `1..10`, default
`5`) before `ieee80211_register_hw()`, and exposes
`/sys/module/wcn36xx/parameters/screen_off_offload` (toggled by
`bananarchy-display-power-sync`). When `1`, `wcn36xx` programs hardware
ARP offload (when a single IPv4 address is assigned, preserving DHCP), IPv6
NS offload, GTK rekey offload, `ignore_dtim = true`, and
`dynamic_ps_timeout = 40 ms` while keeping `rx_irq`/`tx_irq` enabled and
never sending `wlan_host_suspend_ind`, so inbound SSH/TCP/IM unicast packets
still wake the host immediately.
3. **ChipIdea USB runtime PM while unplugged**: `ci_hdrc_msm.c` enables
`CI_HDRC_SUPPORTS_RUNTIME_PM`, wraps `ci_hdrc_msm_por_reset()` in
`pm_runtime_resume_and_get()`/`pm_runtime_put()`, gates `iface_clk` and
`core_clk` in `RUNTIME_PM_OPS` when `vbus_extcon` is unplugged, and skips
`ci_ulpi_resume()`'s `ULPI_SYNC_STATE` viewport poll when
`CI_HDRC_OVERRIDE_PHY_CONTROL` is set so cable hotplug resumes cleanly before
`CI_HDRC_CONTROLLER_RESET_EVENT` powers the ULPI PHY.
4. **Default dual-port `MODEM_DRX_MODE=6` and dark-screen `dsds-daemon` sleep**:
`bananarchy-power-policy.conf` defaults to `MODEM_DRX_MODE=6` while keeping
`DSDS_SECONDARY_MODE=active` so both SIMs stay reachable;
`msm-modem-uim-selection` adds `at all` multi-port support and `screen_is_idle()`
in `dsds-daemon` (`poll_timeout = None` whenever locked, cover-lit, or
backlight off); and `bananarchy-power-policy.sh` serializes AT port access
with `flock`, waits past `ModemManager`'s startup port probe at boot, and
re-applies `AT$QCDRX=6` across all `/dev/wwan0at*` ports on `modem-ready`
(`sxmo_hook_modem.sh` `registered`/`connected` and post-PIN/switch
registration) with per-port devtmpfs inode caching in
`/run/bananarchy-power-policy/drx.<port>`.
5. **MIPI DCS `DISPOFF` + `SLPIN` on `panel-mipi-dbi` DPMS off**:
`panel_mipi_dbi_disable()` sends `0x28` (`msleep(20)`) and `0x10`
(`msleep(50)`) under `drm_dev_enter()` after `backlight_disable()`, halting
the panel boost converter and 60 Hz GRAM scan while leaving the 2720 Flip
`backend = kernel` cover path (`DPMS On` during closed cover wake) intact.