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).
79 lines
3.0 KiB
Diff
79 lines
3.0 KiB
Diff
--- a/drivers/power/supply/pm8916_bms_vm.c
|
|
+++ b/drivers/power/supply/pm8916_bms_vm.c
|
|
@@ -65,12 +65,22 @@
|
|
unsigned int fake_ocv;
|
|
};
|
|
|
|
+/* VADC raw codes outside this window are uninitialised reads (0xffff) or
|
|
+ * out-of-range samples; 16000 ~= 4.69 V, above any Li-ion VBAT. */
|
|
+#define PM8916_BMS_VM_RAW_MIN 8000
|
|
+#define PM8916_BMS_VM_RAW_MAX 16000
|
|
+#define PM8916_BMS_VM_NOMINAL_UV 3700000
|
|
+
|
|
static unsigned int pm8916_bms_vm_raw_to_uv(u16 raw)
|
|
{
|
|
/*
|
|
* Qualcomm VM-BMS VADC resolution is 97.65625 uV * 3 = 292.96875 uV/LSB
|
|
- * (see qpnp-vm-bms.c convert_vbatt_raw_to_uv).
|
|
+ * (see qpnp-vm-bms.c convert_vbatt_raw_to_uv). A 0xffff sample would
|
|
+ * otherwise be reported as 19.2 V / "Over voltage" after a hard reset;
|
|
+ * return a plausible nominal voltage instead so health stays Good.
|
|
*/
|
|
+ if (raw <= PM8916_BMS_VM_RAW_MIN || raw > PM8916_BMS_VM_RAW_MAX)
|
|
+ return PM8916_BMS_VM_NOMINAL_UV;
|
|
return (unsigned int)div_u64((u64)raw * 292969ULL, 1000ULL);
|
|
}
|
|
|
|
@@ -172,7 +182,8 @@
|
|
return IRQ_HANDLED;
|
|
|
|
for (i = 0; i < PM8916_BMS_VM_FIFO_COUNT; i++) {
|
|
- if (vbat_data[i] > 8000) {
|
|
+ if (vbat_data[i] > PM8916_BMS_VM_RAW_MIN &&
|
|
+ vbat_data[i] <= PM8916_BMS_VM_RAW_MAX) {
|
|
sum_uv += pm8916_bms_vm_raw_to_uv(vbat_data[i]);
|
|
valid_cnt++;
|
|
}
|
|
@@ -322,7 +333,8 @@
|
|
bat->reg + PM8916_BMS_VM_BMS_FIFO_REG_0_LSB,
|
|
&fifo_init,
|
|
PM8916_BMS_VM_FIFO_COUNT * 2) == 0 &&
|
|
- fifo_init[0] > 8000) {
|
|
+ fifo_init[0] > PM8916_BMS_VM_RAW_MIN &&
|
|
+ fifo_init[0] <= PM8916_BMS_VM_RAW_MAX) {
|
|
bat->vbat_now = pm8916_bms_vm_raw_to_uv(fifo_init[0]);
|
|
bat->fake_ocv = bat->vbat_now + 12000;
|
|
}
|
|
--- a/drivers/net/wireless/ath/wcn36xx/main.c
|
|
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
|
|
@@ -33,6 +33,12 @@
|
|
module_param_named(debug_mask, wcn36xx_dbg_mask, uint, 0644);
|
|
MODULE_PARM_DESC(debug_mask, "Debugging mask");
|
|
|
|
+/* Beacon listen interval policy. Higher values cut idle RX wakeups at the
|
|
+ * cost of inbound packet latency; set via /etc/modprobe.d at boot. */
|
|
+static unsigned int listen_interval = 5;
|
|
+module_param(listen_interval, uint, 0644);
|
|
+MODULE_PARM_DESC(listen_interval, "Beacon listen interval (1-10, default 5)");
|
|
+
|
|
#define CHAN2G(_freq, _idx) { \
|
|
.band = NL80211_BAND_2GHZ, \
|
|
.center_freq = (_freq), \
|
|
@@ -1456,10 +1462,12 @@
|
|
wcn->hw->max_listen_interval = 200;
|
|
wcn->hw->conf.dynamic_ps_timeout = 200;
|
|
wcn->hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT;
|
|
- /* Wake for every 3rd beacon instead of every beacon. With beacon
|
|
- * filtering + BMPS this roughly thirds the idle RX wakeup floor
|
|
- * (measured ~1.8 wcn36xx_rx IRQs/s before this change). */
|
|
- wcn->hw->conf.listen_interval = 3;
|
|
+ /* Configurable beacon listen interval: with beacon filtering + BMPS
|
|
+ * this lowers the idle RX wakeup floor at the cost of inbound latency. */
|
|
+ wcn->hw->conf.listen_interval = listen_interval;
|
|
+ if (wcn->hw->conf.listen_interval < 1 ||
|
|
+ wcn->hw->conf.listen_interval > 10)
|
|
+ wcn->hw->conf.listen_interval = 5;
|
|
|
|
wcn->hw->queues = 4;
|
|
|