10 KiB
Power optimization
Battery endurance and reliable deep-sleep recovery are designed across the kernel, system daemons, radios, display, audio, and storage stack in Geminux.
Kernel-level optimizations
Configured in kernel/configs/geminux-mt6797x.config and built into 7.3.5-geminux:
CONFIG_HZ_100=y: 100 Hz tick rate cuts periodic timer interrupt overhead compared to 250/1000 Hz kernels while keeping interactive X11 responsiveness high.CONFIG_RCU_LAZY=y: Batches idle RCU callbacks to extend CPU C-state residency.CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL=y: Drives scheduler-guided frequency scaling (schedutil) across the MT6797X tri-cluster CPU. geminux-hwinit loadsclk-mt6797-mcusysandcpufreq-dt(GEMINUX_ENABLE_CPUFREQ="yes"in conf.d/geminux-hwinit) independently of experimental Cortex-A72 enablement (GEMINUX_ENABLE_A72="no"), providingpolicy0(221..897 MHz) andpolicy4(325..1209 MHz) scaling andsoc-thermalthrottling.mt6797-gate-unused: Loaded at the end ofgeminux-hwinit(GEMINUX_GATE_UNUSED_CLOCKS="yes") to gate ~25 unused bootloader peripheral leaf clocks (SPI,UART,PWM,IRTX,ICUSB,ANC_MD32, etc.) left enabled due toclk_ignore_unusedwhile leaving active display/I2C clocks untouched.- Sensor IR LED gating:
stk3310is blacklisted in modprobe.d/geminux.conf (GEMINUX_ENABLE_SENSORS="no") so its ALS/proximity IR LED does not continuously poll without a consumer. CONFIG_ZRAM_DEF_COMP_LZ4=y: Pairs2 GiBLZ4zramswap (etc/conf.d/zram-init) withvm.swappiness=100(etc/sysctl.d/99-geminux-power.conf) andcommit=60,noatimemounts (etc/fstab) to minimize power-hungry eMMC flash swap writes.CONFIG_CRYPTO_AES_ARM64_CE_BLK=y: Accelerates optional LUKS2dm-crypt(aes-xts-plain64) with ARMv8 Cryptography Extensions (--allow-discardsenabled in initramfs) for negligible encryption overhead.
Deep sleep (mem) and wakeup reliability
CONFIG_SUSPEND=y enables Suspend-to-RAM (mem / deep) via mt6797-spm-sleep (sodi_idle=0 pmic_modes=0 timer_sec=600 in modprobe.d/geminux.conf):
pmic_modes=0& clean SPM timers: KeepsMT6351from droppingVCOREto0.600 Vsleep voltage while CPU0 remains inWFI.- Wake IRQ & resume hardening (
0008): Boundsspm_enter()PCM timer rollovers cleanly without.suspend_again, clearsmtk-einthardware debounce when arming edge wakeup pins (SW_LID/EINT5), and callspm_wakeup_event()frommtk-pmic-keys. - Hall lid filtering & debounce (
0011): Tunes Hall EINT debounce to1 msand matrix keypad debounce to10 ms, synchronously filtering spurious keystrokes/touches and inhibiting both keypad and touchscreen whenever the lid magnet closes. - Post-suspend lid reconciliation & fuel-gauge accuracy (
0012): Reconcilesgemini-lidstate onPM_POST_SUSPENDand raw-GPIO rechecks to avoid stuckBL_CORE_SUSPENDED/input lockouts, and pairsmt6351-fuel-gauge+bq25890zero-current boot OCV calibration (POWER_SUPPLY_PROP_CALIBRATE/MT6351_RGS_CHRDET) withwin_ua+reg_uaCV-taper validation,+1%step caps, and180 mVstart-upADC21sag tolerance. - PMIC wake IRQ timing & SPM safety backstops (
0013): Moves MT6397/MT6351 PMIC wake IRQ masking (mt6397_irq_suspend/mt6397_irq_resume) fromPM_SUSPEND_PREPAREintoLATE_SYSTEM_SLEEP_PM_OPSso all child drivers'enable_irq_wake()settings are already armed before deep sleep, and hardensmt6797-spm-sleeps.sleepwithWAKE_PCM_WDT,pcm_wdt,im_wait(1000 us), and a5000 mscntpphysical timer backstop (100 msons.sodi) so CPU0 cannot wedge indefinitely on an overnight suspend.
Zero-poll userspace daemons
All background daemons sleep in event loops with no periodic polling timers:
geminux-powerd
Uses 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-rearming timerfd:
- USB/AC policy (
inhibit_ac_lid): Closing the lid or timing out locks X11 and blanks the backlight without unloading CONSYS or invoking/sys/power/state, keepingbq25890's40 scharger watchdog fed without-EBUSYsuspend thrash. - Battery
memvs.low_power_standby: Beforememsleep, unloadsmt6797_consys(and reverse dependentsbtmt6797,radio_mt6797,gnss_mt6797,mac) soCONN/VCN*rails power down and offlinescpu1..9. When 4GMD1is powered and blocks SPMmemsleep, uses zero-thrashlow_power_standby(cpu1..9offline,cpu0pinned to221 MHzpowersave, CONSYS unloaded, neverfreeze/s2idle). - Wakeup filtering & quiet open-lid re-suspend: Polls post-resume input/lid events (
90 ms) even when the lid is open; only aclosed -> openlid transition, realEV_KEY/EV_REL/EV_ABSactivity, or USB/AC attach triggers a desktop wake. Internal timer wakes in open-lidIDLE_STAGE_LOCKED_BLANKon battery re-suspend quietly (quiet_timer_resleep) without reloading CONSYS or enabling the backlight. - Persisted hardware Airplane Mode:
Fn+F/geminux-power-ctl airplane onpersists/var/lib/geminux/airplane-mode, keeps CONSYS Wi-Fi/BT modules unloaded, and puts MD1 intoAT+CFUN=4while leavingusb0active. - Zero-thrash sysfs caching: Caches applied CPUfreq/profile state to skip redundant sysfs writes, and measures idle timers strictly from the last user input (
CLOCK_MONOTONIC).
Supporting daemons & X11 efficiency
geminux-statusd:epolloversignalfd(SIGUSR1),RTMGRP_LINK/RTMGRP_IPV4_IFADDR,KOBJECT_UEVENT(power_supply,net),inotify, and minute-alignedtimerfd; deduplicates rootWM_NAMEupdates (XStoreName) with zero child shell forks.- Display & terminal: 10-geminux-gpu.conf uses
AccelMethod "none"+ShadowFB "true"+TearFree "true"to eliminate Glamor fence spin-waits, andstdisables its cursor-blink timer while unfocused. geminux-touchd: Event-driven XInput 2.2 gesture engine with zero polling.- Modem & IMS:
geminux-ccci-daemon,geminux-modem-ctl, andgeminux-imsdsleep inepoll_wait(), arminggeminux-imsd's 20 ms RTPtimerfdonly during active voice calls. geminux-bt-obex,geminux-leds&geminux-lock: Pure event-driven GLib/GDBus andepoll+ uevent operation;geminux-ledskeepsrgb:indicator-1..5off (0 mA) when idle or at 100%, lighting onlyrgb:indicator-6while actively charging;geminux-lockuses a15 srefresh once grabbed and redraws only on clock or battery change.
Cluster gating and profiles
geminux-power-ctl and geminux-control switch between three profiles defined in src/geminux-daemons/geminux-power-policy.c:
| Profile | Governor | A72 big cores (cpu8..9) |
A53 LL (policy0) / L (policy4) max freq |
Battery idle (dim -> lock+suspend) | AC idle (lock+blank screensaver) |
|---|---|---|---|---|---|
eco |
schedutil |
Offline (0) |
715 MHz / 962 MHz |
60 s -> 180 s |
180 s |
balanced |
schedutil |
Online (1, 2002 MHz) |
897 MHz / 1209 MHz (bat), 1547 MHz / 1846 MHz (AC) |
120 s -> 300 s |
300 s |
performance |
performance |
Online (1, 2600 MHz) |
1547 MHz / 1846 MHz (clamped to DT cpuinfo_max_freq) |
180 s (lock+blank, no suspend) |
600 s |
All idle thresholds run on CLOCK_MONOTONIC from the last active keyboard, touchscreen, pointer, or lid-open event and are never reset by periodic power_supply uevents. Closing the clamshell (SW_LID = 1) on battery enters RAM sleep (mem or zero-thrash low_power_standby) unless inhibited by USB/AC (inhibit_ac_lid), an active call (inhibit add call), an explicit inhibitor, or connected HDMI (SiI9024).
Audio, radios, and storage defaults
- Audio: PipeWire uses
default.clock.min-quantum = 1024andquantum = 2048(10-geminux-power.conf); WirePlumber suspends idle ALSA/BlueZ nodes after3 s(50-geminux-suspend.conf) so audio DSP clocks gate quickly. - Bluetooth: BlueZ sets
AutoEnable = falseandFastConnectable = falsein etc/bluetooth/main.conf, andgeminux-hwinitsoft-blocks Bluetooth at boot until enabled ingeminux-net. - Wi-Fi & NTP: NetworkManager keeps
wifi.powersave = 2(10-geminux-power.conf) so associated WLAN never drops GTK rekeys or DNS;geminux-powerdpowers down CONSYS across suspend. 10-geminux.sources limits Chrony pools (maxsources 2,minpoll 10 maxpoll 14) with an offline hook in 30-geminux-chrony. - GTK / Qt / Tk / XSETTINGS: 10-geminux-env.sh exports
NO_AT_BRIDGE=1(disabling unused AT-SPI bridges) andQT_QPA_PLATFORMTHEME=qt6ct:gtk3;xsettingsd(SIGHUPreload),gtkTtk(XA_RESOURCE_MANAGERPropertyNotify), and portal-freedconf(ADW_DISABLE_PORTAL=1) operate without polling loops. - Storage:
noatime,commit=60inetc/fstabandvm.dirty_writeback_centisecs=1500cut eMMC wakeups; microSD mounts at/media/sdcardusenoatimeand pureeudevhotplug events (95-geminux-sdcard.rules) with zero idle polling.
Auditing on device
Inspect live power policy and hardware state on the Gemini PDA at any time:
geminux-power-audit
geminux-power-audit --json
Outputs active profile, battery capacity/voltage/current, online CPUs (including A72 cluster state), CPUfreq governor, policy0/policy4 max frequencies, Bluetooth rfkill state, ZRAM algorithm, and /sys/power/mem_sleep modes. Measure actual multi-hour standby battery endurance and idle current draw directly on physical x27 hardware after flashing.