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.
84 lines
3.0 KiB
Diff
84 lines
3.0 KiB
Diff
--- a/drivers/power/supply/pm8916_bms_vm.c
|
|
+++ b/drivers/power/supply/pm8916_bms_vm.c
|
|
@@ -39,6 +39,9 @@
|
|
#define PM8916_BMS_ENABLED BIT(7)
|
|
|
|
#define PM8916_BMS_VM_FIFO_LENGTH_CTL 0x47
|
|
+/* Sample the VM-BMS FIFO every 30 s instead of every 10 s. Each FIFO
|
|
+ * interrupt wakes the AP and (previously) emitted an unconditional
|
|
+ * power_supply_changed() uevent. */
|
|
#define PM8916_BMS_VM_S1_SAMPLE_INTERVAL_CTL 0x55
|
|
#define PM8916_BMS_VM_S2_SAMPLE_INTERVAL_CTL 0x56
|
|
#define PM8916_BMS_VM_S3_S7_OCV_DATA0 0x6A
|
|
@@ -47,8 +50,8 @@
|
|
/* Using only 1 fifo is broken in hardware */
|
|
#define PM8916_BMS_VM_FIFO_COUNT 2 /* 2 .. 8 */
|
|
|
|
-#define PM8916_BMS_VM_S1_SAMPLE_INTERVAL 10
|
|
-#define PM8916_BMS_VM_S2_SAMPLE_INTERVAL 10
|
|
+#define PM8916_BMS_VM_S1_SAMPLE_INTERVAL 30
|
|
+#define PM8916_BMS_VM_S2_SAMPLE_INTERVAL 30
|
|
|
|
struct pm8916_bms_vm_battery {
|
|
struct device *dev;
|
|
@@ -224,8 +227,18 @@
|
|
if (bat->fake_ocv > info->voltage_max_design_uv)
|
|
bat->fake_ocv = info->voltage_max_design_uv;
|
|
|
|
- power_supply_changed(bat->battery);
|
|
-
|
|
+ /* Only tell userspace when the reported capacity actually changed.
|
|
+ * The EMA filter moves slowly, so this drops most uevents (and the
|
|
+ * udev -> su -> sxmo_hook_battery.sh shell chain they trigger). */
|
|
+ {
|
|
+ static int last_reported_cap = -1;
|
|
+ int cap = power_supply_batinfo_ocv2cap(info, bat->fake_ocv, 20);
|
|
+
|
|
+ if (cap != last_reported_cap) {
|
|
+ last_reported_cap = cap;
|
|
+ power_supply_changed(bat->battery);
|
|
+ }
|
|
+ }
|
|
return IRQ_HANDLED;
|
|
}
|
|
|
|
--- a/drivers/net/wireless/ath/wcn36xx/hal.h
|
|
+++ b/drivers/net/wireless/ath/wcn36xx/hal.h
|
|
@@ -3572,7 +3572,9 @@
|
|
/* Enable or disable keep alive */
|
|
#define WCN36XX_HAL_KEEP_ALIVE_DISABLE 0
|
|
#define WCN36XX_HAL_KEEP_ALIVE_ENABLE 1
|
|
-#define WCN36XX_KEEP_ALIVE_TIME_PERIOD 30 /* unit: s */
|
|
+/* 120 s keeps the association alive on typical APs while cutting the
|
|
+ * firmware null-data keep-alive TX wakeups by 4x. */
|
|
+#define WCN36XX_KEEP_ALIVE_TIME_PERIOD 120 /* unit: s */
|
|
|
|
/* Keep Alive request. */
|
|
struct wcn36xx_hal_keep_alive_req_msg {
|
|
--- a/drivers/net/wireless/ath/wcn36xx/main.c
|
|
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
|
|
@@ -1456,6 +1456,10 @@
|
|
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;
|
|
|
|
wcn->hw->queues = 4;
|
|
|
|
--- a/drivers/gpu/drm/msm/msm_gpu_devfreq.c
|
|
+++ b/drivers/gpu/drm/msm/msm_gpu_devfreq.c
|
|
@@ -121,7 +121,9 @@
|
|
|
|
static struct devfreq_dev_profile msm_devfreq_profile = {
|
|
.timer = DEVFREQ_TIMER_DELAYED,
|
|
- .polling_ms = 50,
|
|
+ /* 100 ms halves the simple_ondemand sampling wakeups while the GPU
|
|
+ * is active; the device is runtime-suspended when idle anyway. */
|
|
+ .polling_ms = 100,
|
|
.target = msm_devfreq_target,
|
|
.get_dev_status = msm_devfreq_get_dev_status,
|
|
.get_cur_freq = msm_devfreq_get_cur_freq,
|