Implement 0012 72h standby battery optimizations and initramfs depmod hook

- Add patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch, rebuild affected kernel/module artifacts and all six device DTS/DTB files (msm8916-wcd-analog s2/bias gating, wcn36xx offload_sync_work and healthy-RSSI screen_off_offload scan short-circuit, pm8916_bms_vm screen_off FORCE_S3 OCV mode, panel-mipi-dbi dc/reset low on blank, spi-qup runtime PM sleep pinctrl, PM8909 l1/l4 LDO seeding, and sdhci-msm vmmc/vqmmc set_load with regulator-allow-set-load on l8/l12), and switch msm8905-cam from direct APSS SPMI LDO6/LDO17 writes to RPM regulator consumer voting.

- Update standby power policy and compiled C daemons (WIFI_LISTEN_INTERVAL=8, WIFI_STANDBY_RAT=gsm with CS verification and fallback, 10-bananarchy-dpm.sh wifi-up/unpark-rat dispatch, 25 s boot QRTR wait and QMI DMS online recovery, pm8916_bms_vm screen_off sync, bananarchy-run-aligned dark-screen skip, bananarchy-dsds --sig-hysteresis, bananarchy-cover-idle wake_blank_timeout = 8, and scripts/test-standby-power-policy.py).

- Add overlay/rootfs/etc/boot-deploy/hooks/10-initramfs-depmod.sh to run depmod -b per staged initramfs cpio archive and eliminate Stage 2 udevd missing-module boot console errors, enforce .ko.zst-only module installs in apply-bananarchy-overlay.sh, stage Alpine 3.24 /usr/lib/{libz,libcrypto}.so* in rebuild-image.sh chroot with failure cleanup, and add initramfs cpio guards plus verified image hashes in scripts/check-rebuild.sh.

- Document all changes under Unreleased in CHANGELOG.md and synchronize AGENTS.md, MANUAL.md, and BATTERY-OPTIMIZATION-ANALYSIS.md.
This commit is contained in:
Luxferre committed 2026-11-15 14:46:50 +02:00
1 parent 9700949b28
commit fc5c4282f5
67 files changed
+67482 -65598

No files matched your search

+42 -6
View File
@@ -611,6 +611,8 @@ struct state {
long long last_input_ms;
long long closed_since_ms;
long long blank_ms;
long long wake_blank_ms;
int wake_capped;
char blank_cfg[32];
char backlight_path[128];
int backlight_level;
@@ -1946,7 +1948,6 @@ static const char *cover_kernel_draw(struct cover_hw *hw,
return "kernel";
}
cover_kernel_backlight(hw, 0);
cover_x11_show_black(hw);
if(hw->kernel_lit > 0)
cover_kernel_display_off(hw, 1, 120);
cover_kernel_display_off(hw, 0, 120);
@@ -2095,6 +2096,19 @@ static void refresh_blank_timeout(struct state *state)
state->blank_ms = blank_timeout_ms(state->blank_cfg);
}
static long long effective_blank_ms(const struct state *state)
{
const char *noidle = getenv("BANANARCHY_COVER_NOIDLE_PATH");
if(!noidle || !noidle[0])
noidle = MAIN_NOIDLE_PATH;
if(state->wake_capped && state->wake_blank_ms > 0 &&
access(noidle, F_OK) != 0 &&
(state->blank_ms == 0 || state->blank_ms > state->wake_blank_ms)) {
return state->wake_blank_ms;
}
return state->blank_ms;
}
static int config_level(const char *value, int fallback)
{
long v = strtol(value, NULL, 10);
@@ -2206,6 +2220,8 @@ static void read_config(const char *path, char *socket_path, size_t splen,
safe_copy(socket_path, splen, DEFAULT_SOCKET);
safe_copy(fb_path, fblen, DEFAULT_FB);
safe_copy(state->blank_cfg, sizeof(state->blank_cfg), "auto");
state->wake_blank_ms = 0;
state->wake_capped = 0;
state->backlight_path[0] = '\0';
state->backlight_level = 160;
if(!handle) {
@@ -2240,7 +2256,12 @@ static void read_config(const char *path, char *socket_path, size_t splen,
state->backlight_level = (int)v;
} else if(strcmp(key, "blank_timeout") == 0)
safe_copy(state->blank_cfg, sizeof(state->blank_cfg), value);
else if(strcmp(key, "backend") == 0)
else if(strcmp(key, "wake_blank_timeout") == 0) {
char *end = NULL;
v = strtol(value, &end, 10);
if(end != value && v >= 0 && v <= 86400)
state->wake_blank_ms = (long long)v * 1000LL;
} else if(strcmp(key, "backend") == 0)
safe_copy(hw->backend, sizeof(hw->backend), value);
else if(strcmp(key, "spi_device") == 0)
safe_copy(hw->spi_path, sizeof(hw->spi_path), value);
@@ -2373,6 +2394,7 @@ static void cover_wake(struct state *state, int *redraw)
refresh_blank_timeout(state);
if(strcmp(state->lid, "closed") == 0 && state->enabled && !state->test) {
state->visible = 1;
state->wake_capped = 1;
state->last_input_ms = now_ms();
*redraw = 1;
}
@@ -2430,6 +2452,7 @@ static void handle_command(char *buffer, struct state *state,
long long now = now_ms();
refresh_blank_timeout(state);
state->visible = 0;
state->wake_capped = 0;
state->last_input_ms = now;
state->closed_since_ms = new_closed ? now : 0;
*redraw = 1;
@@ -2615,6 +2638,13 @@ static void handle_command(char *buffer, struct state *state,
refresh_blank_timeout(state);
return;
}
if(strcmp(key, "wake_blank_timeout") == 0) {
char *end = NULL;
long wv = strtol(value, &end, 10);
if(end != value && wv >= 0 && wv <= 86400)
state->wake_blank_ms = (long long)wv * 1000LL;
return;
}
/* Runtime polarity knobs and a one-command rollback for the physical
* sign-off. Releasing forces the next draw to re-init the panel. */
if(strcmp(key, "backend") == 0) {
@@ -2691,6 +2721,7 @@ static void handle_command(char *buffer, struct state *state,
cover_bus_release(hw);
state->test = 2;
state->visible = 1;
state->wake_capped = 0;
state->last_input_ms = now_ms();
*redraw = 1;
} else if(strcmp(command, "TEST") == 0) {
@@ -2701,11 +2732,13 @@ static void handle_command(char *buffer, struct state *state,
*redraw = 1;
} else if(strcmp(command, "BLANK") == 0) {
state->visible = 0;
state->wake_capped = 0;
*redraw = 1;
} else if(strcmp(command, "UNBLANK") == 0) {
refresh_blank_timeout(state);
if(strcmp(state->lid, "closed") == 0) {
state->visible = 1;
state->wake_capped = 0;
state->last_input_ms = now_ms();
}
*redraw = 1;
@@ -2846,12 +2879,14 @@ int main(int argc, char **argv)
refresh_blank_timeout(&state);
if(next < 1)
next = 1;
long long eff_blank = effective_blank_ms(&state);
if(cover_hold_awake(&state)) {
state.last_input_ms = now;
} else if(state.blank_ms > 0) {
long long remaining = state.blank_ms - (now - state.last_input_ms);
} else if(eff_blank > 0) {
long long remaining = eff_blank - (now - state.last_input_ms);
if(remaining <= 0) {
state.visible = 0;
state.wake_capped = 0;
redraw = 1;
} else if(remaining < next) {
next = remaining;
@@ -2877,10 +2912,11 @@ int main(int argc, char **argv)
long long interval = strcmp(hw.backend, "kernel") == 0 ?
KERNEL_REDRAW_MS : CLOCK_REDRAW_MS;
long long next = interval;
long long eff_blank = effective_blank_ms(&state);
if(cover_hold_awake(&state)) {
state.last_input_ms = now;
} else if(state.blank_ms > 0) {
long long remaining = state.blank_ms - (now - state.last_input_ms);
} else if(eff_blank > 0) {
long long remaining = eff_blank - (now - state.last_input_ms);
if(remaining < 1)
remaining = 1;
if(remaining < next)