Fix deep-sleep battery drainers, enable MD1 mem suspend, and update docs

This commit is contained in:
Luxferre committed 2026-11-28 10:38:56 +02:00
1 parent 180d0a91e6
commit 29314ca9e6
20 files changed
+996 -75

No files matched your search

+54 -3
View File
@@ -673,9 +673,12 @@ def main():
os.path.join(overlay_dir, "etc", "modprobe.d", "geminux.conf"): (
"blacklist stk3310",
"softdep cpufreq_dt pre: clk_mt6797_mcusys",
"options mt6797_spm_sleep sodi_idle=0 pmic_modes=0 timer_sec=600",
"options mt6797_spm_sleep sodi_idle=0 pmic_modes=1 allow_md1=1 timer_sec=600",
"options mt6797_wlan power_save=0",
),
os.path.join(overlay_dir, "etc", "init.d", "geminux-powerd"): (
"after modules geminux-hwinit geminux-ccci",
),
os.path.join(overlay_dir, "etc", "X11", "xorg.conf.d", "10-geminux-gpu.conf"): (
'Option "TearFree" "true"',
'Option "ShadowFB" "true"',
@@ -684,6 +687,7 @@ def main():
"0009-mt6797-wlan-drop-free-stability.patch",
"0012-gemini-lid-wake-and-fg-taper-fix.patch",
"0013-gemini-pmic-wake-and-spm-safety.patch",
"0014-gemini-deep-sleep-power-drainers.patch",
),
os.path.join(overlay_dir, "etc", "profile.d", "10-geminux-env.sh"): (
"export NO_AT_BRIDGE=1",
@@ -730,18 +734,33 @@ def main():
powerd_dpms_src = handle.read()
for needle in (
"wake_x11_display_dpms",
"blank_x11_display_dpms",
"DPMSForceLevel",
"DPMSModeOn",
"DPMSModeOff",
"bl_power",
"standby_retry_ms",
"XResetScreenSaver",
"poll(&pf, 1, 1800)",
):
if needle not in powerd_dpms_src:
raise AssertionError(f"geminux-powerd.c missing expected DPMS/lock sync token: {needle}")
pc_start = powerd_dpms_src.find("static void prepare_consys_for_suspend")
pc_end = powerd_dpms_src.find("\nstatic ", pc_start + 1)
pc_src = powerd_dpms_src[pc_start:pc_end]
if "reap_radio_worker(ctx, true)" not in pc_src:
raise AssertionError("prepare_consys_for_suspend must reap radio_worker_pid before suspend")
tb_start = powerd_dpms_src.find("static void toggle_backlight")
tb_end = powerd_dpms_src.find("\nstatic ", tb_start + 1)
tb_src = powerd_dpms_src[tb_start:tb_end]
if "wake_x11_display_dpms()" not in tb_src:
raise AssertionError("toggle_backlight must invoke wake_x11_display_dpms() when waking display")
if "wake_x11_display_dpms()" not in tb_src or "blank_x11_display_dpms()" not in tb_src:
raise AssertionError("toggle_backlight must invoke DPMS wake/blank helpers")
with open(os.path.join(DAEMON_DIR, "geminux-modem-ctl.c"), "r", encoding="utf-8") as handle:
modem_ctl_src = handle.read()
for needle in ("epoll_wait(ctx.epfd, events, 8, -1)", "inotify_init1"):
if needle not in modem_ctl_src:
raise AssertionError(f"geminux-modem-ctl.c missing zero-poll token: {needle}")
lock_path = os.path.join(APPS_DIR, "geminux-lock.c")
with open(lock_path, "r", encoding="utf-8") as handle:
@@ -766,6 +785,38 @@ def main():
if "XPeekEvent(" not in gemui_src:
raise AssertionError("gemui.c must coalesce consecutive MotionNotify events with XPeekEvent")
patch_0014_path = os.path.join(
BASE_DIR, "patches", "kernel", "0014-gemini-deep-sleep-power-drainers.patch"
)
with open(patch_0014_path, "r", encoding="utf-8") as handle:
p14_src = handle.read()
for needle in (
"allow_md1",
"last_wake_r12",
"WAKE_CLDMA",
"WAKE_CCIF0",
"WAKE_MD1_WDT",
"CLDMA_AP_SO_START_CMD",
"MT6351_LDO_MODE_CTRL_BIT",
):
if needle not in p14_src:
raise AssertionError(f"0014 patch missing expected MD1 mem-sleep token: {needle}")
for needle in (
"read_spm_allow_md1",
"read_spm_last_wake_r12",
"modem_wake ? 3500 : 300",
"arm_timer_ms(ctx->tmr_fd, 1000)",
):
if needle not in powerd_dpms_src:
raise AssertionError(f"geminux-powerd.c missing expected MD1 mem-sleep token: {needle}")
with open(os.path.join(DAEMON_DIR, "geminux-power-audit.c"), "r", encoding="utf-8") as handle:
audit_src = handle.read()
for needle in ("spm_allow_md1", "spm_last_wake_r12"):
if needle not in audit_src:
raise AssertionError(f"geminux-power-audit.c missing expected telemetry token: {needle}")
print("[PASS] Zero-poll daemon loops, power/lid policy, and touch gestures verified")
return 0