Fix 2720 Flip cover init, shared backlight and flip lock

This commit is contained in:
Luxferre committed 2026-11-10 23:20:13 +02:00
1 parent c939687138
commit b389120328
24 files changed
+494 -217

No files matched your search

@@ -3,17 +3,23 @@
# /home/user/.config/bananarchy/cover-display.conf and are applied by
# the xcover DWM plugin at session start.
# kernel = the default: the kernel panel-mipi-dbi-spi driver drives whichever
# GC9305 is behind the gpio13 bus switch, using CS0 and its own gpio110 D/C.
# While the flip is closed the daemon switches the mux to the cover, forces a
# DPMS re-init so the kernel replays its init sequence there, and renders the
# cover UI into /dev/fb0; the main backlight and keypad stay dark. On open the
# mux returns to the internal panel and the kernel re-initialises it.
# auto = /dev/fb1 when the opt-in two-panel DT is present, otherwise spidev;
# fb/spidev force those legacy paths, none keeps the bus untouched (rollback).
# kernel = the default shipping path. The KaiOS 3.10 DTS shows that both
# GC9305s share CS0, gpio110 D/C and one PMIC PWM backlight; gpio13 selects
# the panel, gpio23 is the external reset, and gpio21 is TE. While the flip is
# closed the daemon claims gpio13/gpio23, pulses reset, replays the stock
# 240x240 init through the kernel driver's debugfs command hook, enables the
# shared backlight and flushes a 240x240 /dev/fb0 damage rect. The keypad
# stays dark. Opening the flip releases the bus and re-initialises the main
# panel. auto = /dev/fb1 with the opt-in two-panel DT, otherwise spidev;
# fb/spidev force those legacy paths; none keeps the bus untouched.
backend = kernel
main_fb_device = /dev/fb0
kernel_dpms_helper = /usr/bin/bananarchy-cover-dpms.sh
kernel_command_path = /sys/kernel/debug/dri/0/command
kernel_backlight_path = /sys/class/backlight/backlight/brightness
kernel_backlight_marker = /run/bananarchy/cover-backlight
# The main and cover panels share this backlight; 14 is the normal UI level.
kernel_backlight_level = 14
fb_device = /dev/fb1
spidev_device = /dev/spidev0.1
gpiochip_device = /dev/gpiochip0
@@ -25,39 +31,33 @@ input_dir = /dev/input
# GPIO offsets on MSM8909 TLMM (from the KaiOS downstream DTS)
mux_gpio = 13
reset_gpio = 23
# gpio110 (the internal panel's DC line) is claimed exclusively by
# panel-mipi-dbi-spi, so the daemon cannot request it through gpiochip0.
# The gpio13 switch routes the shared DC/CS lines; -1 lets the spidev
# backend open without fighting the kernel driver. Set this back to 110
# only when the spi-mux kernel modules own both panels instead.
# gpio110 is the shared D/C line owned by panel-mipi-dbi-spi; the daemon
# cannot request it through gpiochip0. -1 lets the legacy spidev backend open
# without fighting the kernel driver. Set it back to 110 only with a DT where
# spi-mux owns both panels.
dc_gpio = -1
# Closed-flip userspace GC9305 backend. gpio13 is held low by the boot chain
# while the main panel is active, so low = internal, high = cover. The 240x240
# panel has its own D/C (gpio21) and reset (gpio23) lines. All polarities are
# config knobs for the physical sign-off: change them here, restart the
# service, and use bananarchy-coverctl TEST bars with LID CLOSED.
# Closed-flip kernel path. gpio13 is low while the main panel is active, so
# high is assumed to select the cover. If the outer panel stays dark, run
# bananarchy-coverctl SET mux_closed_level 0 while closed and press a button;
# the runtime knob forces a fresh reset/init cycle.
mux_open_level = 0
mux_closed_level = 1
reset_assert_level = 0
reset_idle_level = 1
# Legacy userspace spidev rollback. gpio21 is TE in the stock DTS, not D/C;
# these polarity/word-width knobs and PROBE are retained only for sign-off.
spi_device = /dev/spidev0.1
spi_mux_gpio = 13
spi_dc_gpio = 21
spi_reset_gpio = 23
mux_open_level = 0
mux_closed_level = 1
dc_command_level = 0
dc_data_level = 1
reset_assert_level = 0
reset_idle_level = 1
# Keep the verified internal-panel clock on the shared bus.
spi_speed_hz = 25000000
# Legacy userspace spidev backend, retained as a rollback path. The KaiOS
# downstream DTS labels gpio21 "TE" and Qualcomm MDSS SPI sends D/C as the
# ninth bit, so the cover panel may be 8-bit (D/C on gpio21) or
# 9-bit MIPI DBI (D/C in bit 8, no DC GPIO). 8 keeps the current wiring;
# 9 releases gpio21 and sends every byte as a 9-bit word. Until the physical
# sign-off is done, use "bananarchy-coverctl PROBE" repeatedly while the flip
# is closed: it draws TEST bars and walks the polarity/word-bit/speed cases,
# reporting the active one in STATUS as probe=case N/12. 9-bit is the default
# because the vendor DTS has no external D/C GPIO; set 8 for the old wiring.
# 9-bit MIPI DBI puts D/C in bit 8; 8-bit uses gpio21 as D/C. PROBE walks
# twelve polarity/clock/word-width cases and switches the backend to spidev.
spi_word_bits = 9
# Privacy defaults: no caller name, no notification body, no text in logs.
@@ -70,6 +70,6 @@ brightness = 160
# Follow Config -> Screen blank (~/.config/sxmo/idle_blank_timeout, default
# 300 s, 0 = never). A numeric value here overrides it for the cover panel.
blank_timeout = auto
# Optional sysfs node for the external panel backlight. Empty: the daemon
# writes an all-black frame and sends GC9305 display-off (0x28) instead.
# Optional sysfs node for a separate legacy cover backlight. Empty on the
# shipping image: the kernel backend uses kernel_backlight_path above.
backlight_path =