Drive the 2720 Flip cover panel from userspace while closed

The shipping single-panel DTB left the external GC9305 unused because
bananarchy-cover-idle only knew /dev/fb1. The compiled daemon now owns the
shared QUP5 bus while the flip is closed: it claims gpio13/21/23 through
the gpiochip ABI, replays the external firmware over /dev/spidev0.1 at the
verified 25 MHz and pushes 240x240 RGB565 frames. LID OPEN restores the mux
and releases the panel lines; activation also requires the main panel to be
DPMS-off. Polarities are config keys and live SET knobs, with
SET backend none as a rollback. /dev/fb1 keeps precedence and the two-panel
spi-mux DT stays opt-in.

Rebuilt the a1108/dejavu nokia-beatles image and pinned the verified hash
ccc8c44517a6a3b78e16e45e9dddbf89f6f04a35ee4c52246d38d89970bd13ac in
check-rebuild.sh. e2fsck -fn passes on both partitions, debugfs confirms
the four updated rootfs files byte-for-byte, and the bootfs sync, boot image
check, artifact sync, host tests and rebuild preflight all pass.

This is an intermediate checkpoint: eyes-on confirmation that the cover
lights up and several more polarity/CS fixes are still required.
This commit is contained in:
Luxferre committed 2026-11-10 19:41:57 +02:00
1 parent d402a53221
commit 40a840b49b
12 files changed
+1085 -72

No files matched your search

+10 -1
View File
@@ -13,6 +13,15 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
Work since `a1108` has focused on reliable 2720 Flip hardware support and a reproducible boot/flash path. Earlier incremental and superseded diagnostic entries are consolidated here.
### Closed-flip external panel on the shipping 2720 Flip image
- **Problem**: both GC9305 panels share one BLSP1 QUP5 SPI bus through a gpio13 mux. The shipping image registers only the 240x320 internal panel, so `bananarchy-cover-idle` had no `/dev/fb1` and reported `backend=none`: the cover screen was never driven in the closed flip state. Registering both panels in the DT (`devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts`) does produce `/dev/fb1`, but an earlier live test darkened the main panel, so that layout is deliberately opt-in.
- **Switch**: `src/bananarchy-daemons/bananarchy-cover-idle.c` now owns the external GC9305 from userspace while the flip is **closed only**. It claims gpio13 (mux), gpio21 (D/C) and gpio23 (reset) through the gpiochip v1 ABI, drives the mux to the cover panel, pulses reset, replays `/lib/firmware/nokia,beatles-gc9305-ext-panel.bin` over `/dev/spidev0.1` at the verified 25 MHz, and writes 240x240 RGB565 frames with proper D/C and CS framing. On `LID OPEN` it sends GC9305 display-off, restores the mux to the internal panel, releases the D/C and reset lines and stops all SPI traffic, so Xorg's `card0` cannot lose the bus. Activation additionally requires the main panel to be DPMS-off (`card0-SPI-1/dpms`), which is the real closed-flip condition and rejects the transient lid-state flap observed when `bananarchy-lid` restarts. While open the daemon holds no panel handles and issues no transfers; the mux line stays claimed for the daemon's lifetime so it is always explicitly driven back to the internal panel. `/dev/fb1` still takes precedence when the opt-in two-panel DT is installed (`backend = auto`), `backend = fb|spidev|none` forces a path, and `FBIOBLANK` blanking of the fbdev is unchanged.
- **Hardware measurements**: on the live `nokia-beatles` target over root SSH, `/sys/kernel/debug/gpio` showed gpio13 `out low` with the main panel active (low = internal, high = cover), gpio21/gpio23 free inputs, gpio25 (`reset`) and gpio110 (`dc`) claimed by `panel-mipi-dbi-spi`, and `l17`/`l6` panel rails enabled. gpio13 therefore stays an output-low mux select and the daemon never requests gpio110. Polarities were *not* confirmed with eyes on the cover panel, so they remain config keys and runtime `bananarchy-coverctl SET` knobs, with `SET backend none` as a one-command rollback.
- **Live verification**: the rebuilt ARM daemon, config, service and diagnostics were deployed to the phone. With the flip open, `STATUS` reports `backend=idle spi=1 mux=free` and gpio13 stays low. After `LID CLOSED` + `BUTTON` (lid broadcaster stopped, main panel DPMS-off to emulate a closed flip), `STATUS` reports `backend=spidev visible=1 mux=closed`, gpio13 goes high, the daemon holds `/dev/gpiochip0`, two `gpio-linehandle` fds and `/dev/spidev0.1`, and every init/frame ioctl succeeds. `BLANK` sends display-off; `LID OPEN` restores gpio13 low and `mux=open`. Xorg, dwm, `card0-SPI-1 dpms=On` and backlight 14 were restored afterwards, the lid service was restarted, and stopping the cover service leaves gpio13 output-low. Physical illumination of the cover still needs eyes-on sign-off.
- **Guards and docs**: `scripts/test-cover-spidev.py` compiles the daemon in SPI simulation mode and verifies the open-flip bus silence, the DPMS-On gate, mux-first ordering, firmware replay, RGB565 frame size, display-off on blank, handover on open, polarity knobs, `SET backend none` rollback and `/dev/fb1` precedence. `scripts/check-rebuild.sh` guards the new source/config tokens and both compiled ARM copies. `bananarchy-cover-diagnose.sh` reports the spidev node, TLMM lines and polarity config. README, MANUAL and `AGENTS.md` describe the closed-flip-only ownership; the shipping DTB stays single-panel and the two-panel DT stays opt-in. `prebuilt/bananarchy-daemons/usr/bin/bananarchy-cover-idle` and its overlay mirror were rebuilt with `scripts/build-bananarchy-daemons.sh`.
- **Image persistence**: rebuilt `images/bananarchy-nokia-beatles.img` at `a1108` / `dejavu` with the closed-flip external-panel backend; the verified raw hash is `ccc8c44517a6a3b78e16e45e9dddbf89f6f04a35ee4c52246d38d89970bd13ac`, pinned by `scripts/check-rebuild.sh`. `debugfs` confirms the image rootfs carries the rebuilt `bananarchy-cover-idle` and the new config, service and diagnostics byte-for-byte; `e2fsck -fn` passed on both `pmOS_boot` and `pmOS_root`; `sync-beatles-bootfs.py --check`, `check-beatles-bootimg.py`, artifact sync and `check-rebuild.sh` pass. The standalone `boot-bananarchy-nokia-beatles.img` hash is unchanged. Eyes-on confirmation that the cover panel lights up is still pending, so this is an intermediate build.
### Power menu label
- Shortened the Power menu item **Reboot to bootloader** to **Reboot to loader** in `dmenu.so`, `sxmo_appmenu.sh` and the context-menu hook so the full label fits the 240x320 screen. Rebuilt `dmenu.so`, updated the prebuilt and overlay artifacts and guards, and kept the `sxmo_power.sh bootloader` action unchanged.
@@ -23,7 +32,7 @@ Work since `a1108` has focused on reliable 2720 Flip hardware support and a repr
- **Connection path**: `overlay/rootfs/etc/bluetooth/main.conf` now uses `ControllerMode = dual`, preserving classic A2DP/HSP/HFP profiles while allowing LE HOGP. `input.conf` keeps `UserspaceHID=true`, `LEAutoSecurity=true` and `ClassicBondedOnly=false`. `bananarchy-bt-obex` powers the adapter on, calls the narrow `bananarchy-bt-le-enable.sh` helper, sets `PreferredBearer = le` for devices exposing HID service `00001812-...`, and automatically pairs unbonded peripherals selected through **Connect Device**.
- **Daemon lifecycle**: `bananarchy-bt-obex stop` no longer calls `pkill`, which is absent from the BusyBox-based target rootfs; it now terminates the PID-file daemon and scans `/proc` directly for stale daemon command lines.
- **Guards and live verification**: `scripts/test-bluetooth-hid.py` and `check-rebuild.sh` guard the dual-mode config, HOGP settings, pair/connect preflight, LE bearer selection and auto-pair logic. On the live phone, `bluetoothd -d` showed `Loading hog plugin` with no `System does not support hog plugin` rejection after the change, and `btmgmt info` showed `le` in the controller's current settings immediately after `bluetoothctl power on`.
- **Image persistence**: rebuilt `images/bananarchy-nokia-beatles.img` at `a1108` / `dejavu` after the Bluetooth HID and Power menu label fixes; the verified raw hash is `16cc68cbfa9908dd42a36e1e4dd18149f9d8e43f7c5af30839695a89a5e60783`, pinned by `check-rebuild.sh`. `debugfs` confirms the image rootfs has `ControllerMode = dual`, the corrected `0755` `bananarchy-bt-obex` helper, the explicit Bluetooth packages and a `dmenu.so` containing only the compact `Reboot to loader` label; `e2fsck -fn` passed. This supersedes the previous image hash `c5dc3e2b...`.
- **Image persistence**: rebuilt `images/bananarchy-nokia-beatles.img` at `a1108` / `dejavu` after the Bluetooth HID and Power menu label fixes; the verified raw hash at that point was `16cc68cbfa9908dd42a36e1e4dd18149f9d8e43f7c5af30839695a89a5e60783` (superseded by the closed-flip cover rebuild below). `debugfs` confirms the image rootfs has `ControllerMode = dual`, the corrected `0755` `bananarchy-bt-obex` helper, the explicit Bluetooth packages and a `dmenu.so` containing only the compact `Reboot to loader` label; `e2fsck -fn` passed. This supersedes the previous image hash `c5dc3e2b...`.
### Live Bluetooth peripheral discovery