# Power optimization Battery endurance and deep idle efficiency are first-class design requirements across the kernel, daemons, radios, display, audio, and storage stack in Geminux. ## Kernel-level optimizations Configured in [kernel/configs/geminux-mt6797x.config](file:///home/lux/proj/geminux/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 Hz / 1000 Hz kernels while remaining responsive for interactive X11 workloads. - **`CONFIG_RCU_LAZY=y`**: Batches RCU callbacks during idle periods to extend CPU C-state residency. - **`CONFIG_SUSPEND=y`**: Enables deep Suspend-to-RAM (`mem` / `deep`) triggered on Gemini PDA lid close (`SW_LID`) or power button press. - **`CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL=y`**: Uses scheduler utilization feedback (`schedutil`) across the MT6797X tri-cluster (Cortex-A53 + Cortex-A72) topology instead of static `performance` governors. - **`CONFIG_ZRAM_DEF_COMP_LZ4=y`** with `2 GiB` LZ4 `zram` swap (`etc/conf.d/zram-init`) and `vm.swappiness=100` (`etc/sysctl.d/99-geminux-power.conf`): avoids slow, power-hungry flash swap I/O on eMMC and pairs with `commit=60,noatime` mount options (`etc/fstab`). - **`CONFIG_CRYPTO_AES_ARM64_CE_BLK=y`** paired with `--allow-discards` in initramfs: runs optional LUKS2 `dm-crypt` (`aes-xts-plain64`) encryption using ARMv8 hardware AES Cryptography Extensions with negligible battery overhead. ## Zero-poll userspace daemons All background system services avoid wake-up timers and polling loops: - **`geminux-powerd`**: Sleeps indefinitely in `epoll_wait()` over `/dev/input/event*` (`SW_LID`, `KEY_POWER`, keyboard/touch/pointer activity), `KOBJECT_UEVENT` netlink (AC charger/HDMI hotplug), `/run/geminux/powerd.sock`, and a lazy-rearming `timerfd`; implements two-stage screensaver dimming and auto-lock/blank or suspend strictly timed from the last active user input (`dim_timeout_s` / `suspend_timeout_s`). - **`geminux-statusd`**: Uses `signalfd` (`SIGUSR1`), `RTMGRP_LINK` netlink, `inotify`, and a minute-aligned `timerfd` so the DWM status bar wakes only on actual network/power/modem changes or minute boundaries with zero child shell forks. - **`geminux-touchd`**: Event-driven XInput 2.2 multi-touch gesture recognizer with zero polling loops. - **`geminux-ccci-daemon` & `geminux-modem-ctl`**: Event-driven `epoll_wait()` over `/dev/ccci_*`, AT port, and netlink; enter completely idle sleep when no modem activity is pending. - **`geminux-bt-obex` & `geminux-leds`**: Event-driven GLib/GDBus and `epoll_wait()` + `KOBJECT_UEVENT` control without periodic polling. `geminux-leds` keeps the back AW9120 cover strip (`rgb:indicator-1..5`) off (`0 mA`) when idle or at 100% charge, lighting only `rgb:indicator-6` during active battery charging unless manually overridden. ## Cluster gating and profiles `geminux-power-ctl` (and `geminux-control`) switches between three profiles managed in [src/geminux-daemons/geminux-power-policy.c](file:///home/lux/proj/geminux/src/geminux-daemons/geminux-power-policy.c): | Profile | Governor | A72 big cores (`cpu8..9`) | A53 max freq | Battery idle (dim -> lock+suspend) | AC idle (lock+blank screensaver) | | --- | --- | --- | --- | --- | --- | | `eco` | `schedutil` | Offline (`0`) | `1391 MHz` | `60 s` -> `180 s` | `180 s` | | `balanced` | `schedutil` | Online (`1`) | `1547 MHz` | `120 s` -> `300 s` | `300 s` | | `performance` | `schedutil` | Online (`1`) | `1846 MHz` | `180 s` (lock+blank, no suspend) | `600 s` | All idle thresholds above are measured from the last active keyboard, touchscreen, pointer, or lid-open event (`CLOCK_MONOTONIC`) and are not reset by periodic battery `power_supply` uevents. Closing the Gemini PDA clamshell (`SW_LID = 1`) suspends immediately to RAM (`mem`), unless inhibited by an active voice call (`inhibit add call`), an explicit inhibitor, or a connected external HDMI monitor (`SiI9024`). ## Audio, radios, and storage defaults - **Audio**: PipeWire uses `default.clock.min-quantum = 1024` and `quantum = 2048` (`10-geminux-power.conf`); WirePlumber suspends idle ALSA and BlueZ nodes after `3` seconds (`50-geminux-suspend.conf`) so audio DSP clocks gate quickly. - **Bluetooth**: `bluetooth` OpenRC service is disabled from default boot (`AutoEnable=false` in `etc/bluetooth/main.conf`); users toggle Bluetooth on demand via `geminux-net`. - **Wi-Fi**: NetworkManager configures `wifi.powersave = 2` (`10-geminux-power.conf`) to keep CONSYS Wi-Fi awake while associated so GTK rekeys, ARP, and DNS never stall; the radio still powers down cleanly on Wi-Fi toggle-off or system S3 suspend. - **Storage**: `noatime,commit=60` in `etc/fstab` alongside `vm.dirty_writeback_centisecs=1500` reduces eMMC write amplification and wakes. ## Auditing on device Run the bundled C11 audit utility at any time: ```sh geminux-power-audit geminux-power-audit --json ``` It prints the live power profile, battery capacity/voltage/current, online CPU count (including A72 cluster gating status), CPUfreq governor, ZRAM compression algorithm, and supported `/sys/power/mem_sleep` modes. Live idle current draw and multi-hour standby battery endurance benchmarks must be measured on physical Gemini PDA (x27) hardware after flashing.