Eliminate dual-target idle wakeups and stage upcoming a1114 (carbonara) build

- Replace continuous polling in bananarchy-lid and bananarchy-volume-keys with /dev/input inotify watching and IRQ-driven poll(..., -1) steady state, and sync CPU/schedutil/GPU power knobs on flip transitions

- Grant video-group write permissions to Adreno 304 devfreq governor, sync GPU powersave/simple_ondemand across bananarchy-display-power-sync and locker.so, and restore schedutil rate_limit_us on forced transitions

- Trim per-minute statusbar clock forks, skip unchanged ext4 brightness rewrites and no-op sxmo_autosuspend spawns on blanking, and make bananarchy-bt-obex fully event-driven via inotify and blocking select

- Register upcoming build a1114 (carbonara) in version.sh, check-rebuild.sh, CHANGELOG.md, AGENTS.md, and BATTERY-OPTIMIZATION-ANALYSIS.md while keeping a1111 (lennon) as the current public release
This commit is contained in:
Luxferre committed 2026-11-12 12:09:46 +02:00
1 parent ed04da3e23
commit e42024e90d
22 files changed
+416 -75

No files matched your search

+74
View File
@@ -1133,3 +1133,77 @@ domains, and the remaining periodic work is either event-driven or spaced
policy, DDR self-refresh via lk2nd PSCI `SYSTEM_SUSPEND`, or a real
battery-powered discharge measurement; they cannot come from more idle
timer/sysctl trimming without hurting latency or connectivity.
---
## 19. Dual-target idle audit for upcoming build `a1114` / `carbonara` (`nokia-argon` and `nokia-beatles`)
After the Nokia 2720 Flip (`nokia-beatles`) lid/cover stack, Bluetooth HOGP/OBEX
gamepad bridge, and minute-fresh dark statusbar clock landed in `a1108`--`a1111`,
a fresh cross-target battery audit inspected every daemon, hook, DTB, kernel
module, and sysfs power knob across both active devices for upcoming build
`a1114` (codename `carbonara`).
### 19.1 Verified parity and clean subsystems
- **DTB and boot image parity**: `qcom-msm8905-nokia-beatles.dts` already matches
`qcom-msm8905-nokia-argon.dts` on `cpu-opp-table` `clock-latency-ns`
(`100000` ns), `spc` `cpu-idle-states`, peripheral `sleep` pinctrl states,
`wakeup-source` `gpio-keys`, and identical `vmlinuz` plus patched
`pm8916_bms_vm`, `pm8916_lbc`, and `wcn36xx` kernel modules.
- **Target isolation**: `apply-bananarchy-overlay.sh` writes `slider` vs `flip`
to `/usr/share/bananarchy/lid-profile` and disables all flip services, udev
rules, and mux modules on `nokia-argon`.
- **Desktop and drivers**: `dwm`, `dmenu`, preloaded `dwm` plugins,
`dsds-daemon`, PipeWire/WirePlumber, `sshd-debug`, `unudhcpd`, `msm8905-cam`,
and `leds-msm8905-torch` all rest at `0` wakeups/s when dark.
### 19.2 Six zero-regression optimizations implemented
1. **Event-driven steady state in `bananarchy-lid` (`nokia-beatles`)**:
`bananarchy-lid.c` previously ran `poll(..., 20)` (`50 Hz` = 3,000
wakeups/min), read `/sys/kernel/debug/gpio` to EOF at `10 Hz` (600 full SoC
GPIO register dumps/min), and every `2 s` globbed `/dev/input/event*`,
rewrote `/run/bananarchy/lid-state`, ran `sync_sw_lid()`, and sent
`CLOSED`/`OPEN` to `/run/bananarchy/cover.sock` (waking
`bananarchy-cover-idle` every 2 s). Because `hall-lid-open` (`gpio36`) and
`hall-lid-closed` (`gpio92`) are hardware-IRQ `gpio-keys` with
`wakeup-source`, `bananarchy-lid` now watches `/dev/input` via `inotify`,
retains the `20 ms` (`LID_LOOP_MS` / `LID_DEBOUNCE_MS` / `HALL_EDGE_MS`)
settle window on `EV_SW` edges plus one `+2 s` post-transition confirmation
broadcast, and then blocks in `poll(..., -1)` at `0` steady-state wakeups/s.
Flip-open and flip-close transitions also synchronize CPU `scaling_governor`,
`schedutil/rate_limit_us` (`40000`), and Adreno 304 `governor` directly in C.
2. **Event-driven `bananarchy-volume-keys` (`nokia-beatles`)**:
`bananarchy-volume-keys.c` replaced its `1,000 ms` `poll()` loop and `2,000 ms`
`/dev/input/event*` `glob()` with an `inotify` watch on `/dev/input` plus
`poll(..., -1)`, eliminating ~90 wakeups/min while keeping `BANANARCHY_INPUT_GLOB`
FIFO polling for host tests.
3. **Adreno 304 `devfreq` `powersave` permissions and `schedutil` `rate_limit_us`
restoration (both targets)**: `10-power-save.start` previously granted
`video`-group write permissions (`0664`) to CPU `scaling_governor` only, so
`sxmo_wm.sh`'s `[ -w /sys/class/devfreq/1c00000.gpu/governor ]` check failed
silently and left the GPU in `simple_ondemand` while dark. `10-power-save.start`
now applies `chgrp video` and `chmod 0664` to `1c00000.gpu/governor`,
`locker_plugin.cpp` toggles `1c00000.gpu/governor` on lockscreen idle-blank
and wake, and `bananarchy-display-power-sync` synchronizes `1c00000.gpu/governor`
and restores `schedutil/rate_limit_us = 40000` on both forced (`FORCE=1`) and
normal (`FORCE=0`) transitions.
4. **Lightweight per-minute clock maintenance (both targets)**:
`sxmo_hook_statusbar.sh` skips sourcing the 257-line `sxmo_hook_icons.sh`
table on `time` ticks and updates `099-time` directly in-shell when the
`sxmo_status` runtime directory already exists (avoiding spawning
`sxmo_status.sh` and two `mkdir -p` calls every minute while dark), and
`sxmo_status.sh` guards `mkdir -p "$ROOT"` with `[ -d "$ROOT" ]`.
5. **Avoid redundant ext4 eMMC write and no-op `sxmo_autosuspend.sh` fork on
blanking (both targets)**: `sxmo_wm.sh display off` now writes
`~/.config/sxmo/brightness` on ext4 only when brightness actually changed
(avoiding dirty-page eMMC writeback wakeups 60 s after blanking), and
`sxmo_hook_screenoff.sh` skips spawning `sxmo_autosuspend.sh` when
`/etc/bananarchy-no-deep-standby` is present.
6. **Event-driven `bananarchy-bt-obex` when Bluetooth is enabled (both
targets)**: replaced the `1.0 s` D-Bus/RFCOMM poll timeout and the `1.5--2.0 s`
`/dev/input` gamepad polling loop with a signal self-pipe, `ctypes` `inotify`
on `/dev/input`, and blocking `select.select(..., None)`, dropping Bluetooth
daemon idle wakeups from ~100/min to `0`/min and reducing gamepad hotplug
latency from `2 s` to `<5 ms`.