- Streamline README, INSTALL, MANUAL, ARCHITECTURE, and POWER-OPTIMIZATION docs - Add release ZIP packager (package-image.sh, scripts/package-release-zip.py, rebuild-image.sh --package) with sanitized rootfs, SHA256SUMS, and FLASH-INSTRUCTIONS.txt - Add automatic offline MT6797 firmware ext4 injection in flash-mtk.py and scripts/extract-vendor-fw.py - Backport X11 DPMS wake + XResetScreenSaver in geminux-powerd and _GEMINUX_LOCK_READY + grab-first sync in geminux-lock, rebuild aarch64 prebuilts, and expand tests
7.3 KiB
Power optimization
Battery endurance and reliable deep-sleep recovery span kernel configuration, suspend/wake IRQ handling, zero-poll daemons, CPU cluster gating, audio, radios, and storage in Geminux.
Kernel-level optimizations
Built into 7.3.5-geminux via kernel/configs/geminux-mt6797x.config:
CONFIG_HZ_100=y&CONFIG_RCU_LAZY=y: Cuts timer interrupt overhead vs. 250/1000 Hz kernels and batches idle RCU callbacks for deeper CPU C-state residency.CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL=y: EnablesschedutilDVFS viaclk-mt6797-mcusys+cpufreq-dtloaded by geminux-hwinit (GEMINUX_ENABLE_CPUFREQ="yes"in conf.d/geminux-hwinit), scalingpolicy0(221..897 MHz) andpolicy4(325..1209 MHz) independently of Cortex-A72 bring-up (GEMINUX_ENABLE_A72="no").mt6797-gate-unused: Gates ~25 unused bootloader leaf clocks (SPI,UART,PWM,IRTX,ICUSB,ANC_MD32, etc.) left on byclk_ignore_unused.- Sensor IR LED gating: Blacklists
stk3310in modprobe.d/geminux.conf (GEMINUX_ENABLE_SENSORS="no") to stop unconsumed ALS/proximity IR polling. CONFIG_ZRAM_DEF_COMP_LZ4=y&CONFIG_CRYPTO_AES_ARM64_CE_BLK=y:2 GiBLZ4zram(vm.swappiness=100) avoids eMMC flash swap writes; ARMv8 AES-CE accelerates optional LUKS2 (--allow-discards).
Deep sleep (mem) and wakeup reliability
CONFIG_SUSPEND=y drives Suspend-to-RAM (mem) through mt6797-spm-sleep (sodi_idle=0 pmic_modes=0 timer_sec=600 in modprobe.d/geminux.conf):
pmic_modes=0: PreventsMT6351from droppingVCOREto0.600 Vwhile CPU0 remains inWFI.- SPM & wake IRQ hardening (
0008): Boundsspm_enter()PCM timer rollovers without.suspend_again, clearsmtk-eintdebounce on edge wakeups (SW_LID/EINT5), and firespm_wakeup_event()frommtk-pmic-keys. - Hall lid filtering & debounce (
0011): Applies1 msHall EINT /10 mskeypad debounce, synchronously filtering spurious inputs and inhibiting keypad + touch when closed. - Lid resume & fuel gauge (
0012): Reconcilesgemini-lidstate viaPM_POST_SUSPEND+ raw-GPIO rechecks (preventing stuckBL_CORE_SUSPENDED/input lockouts), and improvesmt6351-fuel-gauge+bq25890zero-current boot OCV, CV-taper validation,+1%step caps, and180 mVADC21sag tolerance. - PMIC wake IRQ order & SPM backstops (
0013): Movesmt6397_irq_suspend/mt6397_irq_resumefromPM_SUSPEND_PREPAREintoLATE_SYSTEM_SLEEP_PM_OPSso childenable_irq_wake()settings arm cleanly before deep sleep, and addsWAKE_PCM_WDT,pcm_wdt,im_wait(1000 us), and a5000 mscntpphysical timer backstop (100 msons.sodi) onmt6797-spm-sleeps.sleepto prevent unrecoverable overnight hangs.
Zero-poll userspace daemons
geminux-powerd
Sleeps in epoll_wait() over /dev/input/event* (SW_LID, KEY_POWER, mtk-pmic-keys KEY_ESC), filtered KOBJECT_UEVENT netlink (input, power_supply, drm), /run/geminux/powerd.sock, and a lazy timerfd:
- USB/AC policy (
inhibit_ac_lid): Locks/blanks without unloading CONSYS or invoking/sys/power/state, keepingbq25890's40 swatchdog fed without-EBUSYsuspend thrash. - Battery
memvs.low_power_standby: Unloadsmt6797_consys(+ dependents) and offlinescpu1..9beforememsleep; if 4GMD1blocksmem, holds zero-thrashlow_power_standby(cpu0 @ 221 MHzpowersave, neverfreeze/s2idle). - Wakeup filtering & quiet open-lid re-suspend: Polls post-resume events (
90 ms) even with the lid open so onlyclosed -> openlid events, genuineEV_KEY/EV_REL/EV_ABSactivity, or USB/AC attach wake the session; internal timer wakes during open-lidIDLE_STAGE_LOCKED_BLANKre-suspend quietly (quiet_timer_resleep) without reloading CONSYS or waking the backlight. - X11 DPMS wake & lock sync: Unblanking runs
DPMSForceLevel(..., DPMSModeOn)+XResetScreenSaver()in a privilege-dropped child so X11/HDMI outputs never stay blanked across S3 or lid events; pre-suspend locking waits up to1800 msforgeminux-lockto draw, grab input, and publish_GEMINUX_LOCK_READY. - Persisted state & caching: Persists Airplane Mode (
/var/lib/geminux/airplane-mode) and caches CPUfreq/profile writes.
Supporting daemons & X11 efficiency
geminux-statusd:epoll(signalfd, netlink, filtered uevents,inotify, minute-alignedtimerfd); deduplicatesWM_NAMEupdates with zero shell forks.- Display &
st:ShadowFB+TearFree(AccelMethod "none"in 10-geminux-gpu.conf) eliminates Glamor spin-waits;ststops cursor blink timers when unfocused. - Input, Audio, Modem, LEDs & Lock:
geminux-touchd,geminux-ccci-daemon,geminux-modem-ctl,geminux-imsd(20 ms RTPtimerfdarmed only mid-call),geminux-bt-obex,geminux-leds(AW9120 strip0 mAidle/100%,rgb:indicator-6while charging), andgeminux-lock(15 srefresh, diff-checked).
Cluster gating and profiles
Managed via geminux-power-ctl / geminux-control (geminux-power-policy.c):
| Profile | Governor | A72 (cpu8..9) |
A53 LL (policy0) / L (policy4) max freq |
Battery idle (dim -> suspend) | AC idle (lock+blank) |
|---|---|---|---|---|---|
eco |
schedutil |
Offline (0) |
715 MHz / 962 MHz |
60 s -> 180 s |
180 s |
balanced |
schedutil |
Online (1, 2002 MHz) |
897 / 1209 MHz (bat), 1547 / 1846 MHz (AC) |
120 s -> 300 s |
300 s |
performance |
performance |
Online (1, 2600 MHz) |
1547 MHz / 1846 MHz (clamped to DT max) |
180 s (lock+blank only) |
600 s |
Idle timers count strictly from the last user input (CLOCK_MONOTONIC), ignoring periodic battery uevents. Lid close (SW_LID = 1) on battery suspends unless inhibited by AC (inhibit_ac_lid), an active call, a manual inhibitor, or HDMI (SiI9024).
Audio, radios, and storage defaults
- Audio: PipeWire
min-quantum = 1024,quantum = 2048(10-geminux-power.conf); WirePlumber suspends idle nodes after3 s. - Bluetooth:
AutoEnable = false,FastConnectable = false(etc/bluetooth/main.conf); soft-blocked at boot. - Wi-Fi & NTP:
wifi.powersave = 2prevents associated CONSYS key/DNS stalls; Chrony usesmaxsources 2,minpoll 10 maxpoll 14(10-geminux.sources) + offline dispatch (30-geminux-chrony). - Toolkits & Storage:
NO_AT_BRIDGE=1(10-geminux-env.sh) avoids idle AT-SPI daemons;noatime,commit=60anddirty_writeback_centisecs=1500cut eMMC wakes;/media/sdcardmountsnoatimepurely viaeudevhotplug.
Auditing on device
geminux-power-audit
geminux-power-audit --json
Reports live profile, battery stats, online CPUs, governors, frequency caps, Bluetooth rfkill state, ZRAM algorithm, and /sys/power/mem_sleep. Actual idle current draw and overnight endurance must be measured on physical hardware.