Fix 2720 Flip cover init, shared backlight and flip lock
This commit is contained in:
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 =
|
||||
Binary file not shown.
@@ -1,41 +1,30 @@
|
||||
# Nokia 2720 Flip (nokia-beatles) 1.3-inch 240x240 external GC9305 panel.
|
||||
#
|
||||
# Derived from the KaiOS 3.10 downstream DTS in the archived postmarketOS
|
||||
# linux-nokia-beatles package (0004-dts-adaptations.patch):
|
||||
# spi_gc9305_v2_qvga_ext_cmd, qcom,mdss-spi-on-command:
|
||||
# fe, ef, 3a 05, 35 00, 2a 00 00 00 ef, 2b 00 00 00 ef, 2c,
|
||||
# delay 120, 11, 29, 2c
|
||||
# Exact qcom,mdss-spi-on-command stream from the KaiOS 3.10 downstream DTS
|
||||
# (spi_gc9305_v2_qvga_ext_cmd) in pmaports' 0004-dts-adaptations.patch:
|
||||
# fe, ef, 3a 05, 35 00, 2a 00 00 00 ef, 2b 00 00 00 ef, 2c,
|
||||
# delay 120, 11, 29, 2c
|
||||
# qcom,mdss-spi-panel-width = 240, height = 240, bpp = 16.
|
||||
#
|
||||
# The register/gamma block below is the one already proven on this device's
|
||||
# internal GC9305 panel (nokia,beatles-gc9305-panel.txt); the two column/page
|
||||
# windows are set to 0..239 for the square cover panel. The blob is consumed
|
||||
# by panel-mipi-dbi-spi (kernel) or by bananarchy-coverd's spidev backend.
|
||||
# The stock panel node uses qcom,platform-spi-dc-gpio = gpio110 (the same
|
||||
# D/C line as the internal panel), qcom,platform-te-gpio = gpio21,
|
||||
# qcom,platform-reset-gpio = gpio23 and qcom,platform-spi-switch-gpio =
|
||||
# gpio13. gpio21 is TE, not D/C. Both panels share PMIC MPP2 PWM backlight.
|
||||
#
|
||||
# This init sequence is derived from vendor sources but has NOT yet been
|
||||
# verified on 2720 Flip hardware; see NOKIA-2720-FLIP.md.
|
||||
|
||||
# This MIPI DBI firmware is replayed by the shipping kernel backend through
|
||||
# /sys/kernel/debug/dri/0/command after gpio23 is pulsed and the gpio13 bus
|
||||
# switch is set to the cover. The obsolete userspace spidev rollback also
|
||||
# parses this file.
|
||||
#
|
||||
# MIPI DBI firmware records below (command, parameter count, parameters):
|
||||
command 0xfe
|
||||
command 0xef
|
||||
command 0x36 0x00 # MADCTL
|
||||
command 0x3a 0x55 # 65K 16-bit RGB565
|
||||
command 0x3a 0x05 # 16-bit RGB565
|
||||
command 0x35 0x00 # TE v-blanking
|
||||
command 0xb2 0x0c 0x0c 0x00 0x33 0x33 # porch setting
|
||||
command 0xb7 0x75 # gate control VGH/VGL
|
||||
command 0xbb 0x34 # Vcoms
|
||||
command 0xc0 0x2c # LCM control
|
||||
command 0xc2 0x01 # VDV/VRH enable
|
||||
command 0xc3 0x0d # VRH set
|
||||
command 0xc4 0x20 # VDV set
|
||||
command 0xc6 0xef # frame rate
|
||||
command 0x44 0x00 0x00 # tearing scan line
|
||||
command 0xd0 0xa4 0xa1 # power control 1
|
||||
command 0xe0 0xd0 0x02 0x09 0x0d 0x0e 0x19 0x30 0x51 0x43 0x09 0x14 0x13 0x18 0x21
|
||||
command 0xe1 0xd0 0x02 0x09 0x0d 0x0d 0x18 0x32 0x46 0x42 0x09 0x13 0x13 0x17 0x21
|
||||
command 0x2a 0x00 0x00 0x00 0xef # column address 0..239
|
||||
command 0x2b 0x00 0x00 0x00 0xef # page address 0..239
|
||||
command 0x2c # memory write
|
||||
command 0x11 # sleep out
|
||||
delay 120
|
||||
command 0x11 # sleep out
|
||||
command 0x29 # display on
|
||||
command 0x2c
|
||||
command 0x2c # memory write
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
# Report the live state of the 2720 Flip external panel (closed-flip backend).
|
||||
# Intended for the physical gpio13/reset/DC sign-off: it never changes state.
|
||||
# Read-only: it never changes the mux, backlight, DPMS or panel state.
|
||||
set -u
|
||||
|
||||
FB=/dev/fb1
|
||||
@@ -8,6 +8,9 @@ SYSFS=/sys/class/graphics/fb1
|
||||
SPI=/dev/spidev0.1
|
||||
GPIOCHIP=/dev/gpiochip0
|
||||
FW=/lib/firmware/nokia,beatles-gc9305-ext-panel.bin
|
||||
CMD=/sys/kernel/debug/dri/0/command
|
||||
BL=/sys/class/backlight/backlight/brightness
|
||||
MARKER=/run/bananarchy/cover-backlight
|
||||
CONF=/etc/bananarchy/cover-display.conf
|
||||
COVERCTL=/usr/bin/bananarchy-coverctl
|
||||
|
||||
@@ -39,8 +42,15 @@ if [ -e "$GPIOCHIP" ]; then
|
||||
else
|
||||
printf 'gpiochip : %s MISSING\n' "$GPIOCHIP"
|
||||
fi
|
||||
if [ -w "$CMD" ]; then
|
||||
printf 'kernel command hook : %s writable\n' "$CMD"
|
||||
else
|
||||
printf 'kernel command hook : %s MISSING\n' "$CMD"
|
||||
fi
|
||||
printf 'DRM cards : %s\n' "$(ls /dev/dri/card* 2>/dev/null | tr '\n' ' ')"
|
||||
printf 'main panel dpms : %s\n' "$(cat /sys/class/drm/card0-SPI-1/dpms 2>/dev/null || printf 'unknown')"
|
||||
printf 'shared backlight : %s\n' "$(cat "$BL" 2>/dev/null || printf 'unknown')"
|
||||
printf 'cover backlight marker: %s\n' "$([ -f "$MARKER" ] && printf 'present' || printf 'absent')"
|
||||
printf 'main fbdev : %s\n' "$(cat /sys/class/graphics/fb0/virtual_size 2>/dev/null || printf 'absent')"
|
||||
printf 'fbdev nodes : %s\n' "$(ls /dev/fb* 2>/dev/null | tr '\n' ' ')"
|
||||
for mod in mux_core mux_gpio spi_mux panel_mipi_dbi spidev; do
|
||||
@@ -62,7 +72,7 @@ if [ -r /sys/kernel/debug/gpio ]; then
|
||||
fi
|
||||
if [ -r "$CONF" ]; then
|
||||
printf 'backend config :\n'
|
||||
grep -E '^(backend|main_fb_device|kernel_dpms_helper|spi_device|spi_mux_gpio|spi_dc_gpio|spi_reset_gpio|mux_open_level|mux_closed_level|dc_command_level|dc_data_level|reset_assert_level|reset_idle_level|spi_speed_hz|spi_word_bits) ' "$CONF" | sed 's/^/ /'
|
||||
grep -E '^(backend|main_fb_device|kernel_dpms_helper|kernel_command_path|kernel_backlight_path|kernel_backlight_marker|kernel_backlight_level|spi_device|spi_mux_gpio|spi_dc_gpio|spi_reset_gpio|mux_open_level|mux_closed_level|dc_command_level|dc_data_level|reset_assert_level|reset_idle_level|spi_speed_hz|spi_word_bits) ' "$CONF" | sed 's/^/ /'
|
||||
fi
|
||||
if [ -x "$COVERCTL" ]; then
|
||||
printf 'daemon : %s\n' "$("$COVERCTL" STATUS 2>/dev/null || printf 'not answering')"
|
||||
@@ -72,10 +82,8 @@ fi
|
||||
if command -v rc-service >/dev/null 2>&1; then
|
||||
rc-service bananarchy-cover-display status 2>&1 | sed 's/^/service : /'
|
||||
fi
|
||||
printf 'sign-off : bananarchy-cover-probe.sh (12 cases)\n'
|
||||
printf ' watch the cover, note STATUS probe=case N/12\n'
|
||||
printf ' bananarchy-coverctl SET mux_closed_level 0|1\n'
|
||||
printf ' bananarchy-coverctl SET reset_assert_level 0|1\n'
|
||||
printf ' bananarchy-coverctl SET dc_command_level 0|1\n'
|
||||
printf ' rollback: bananarchy-coverctl SET backend none\n'
|
||||
printf 'sign-off : close the flip, press an outer button\n'
|
||||
printf ' if the cover stays dark: SET mux_closed_level 0\n'
|
||||
printf ' legacy: bananarchy-cover-probe.sh (12 cases)\n'
|
||||
printf ' rollback: SET backend none\n'
|
||||
exit 0
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
# Replay the kernel panel-mipi-dbi-spi init sequence onto whichever GC9305 is
|
||||
# currently behind the gpio13 bus switch. A DPMS off/on cycle makes
|
||||
# mipi_dbi_enable() rerun the firmware command stack with CS0 and gpio110 D/C;
|
||||
# with the mux on the cover that initialises the 240x240 external panel.
|
||||
# Switch DRM DPMS for whichever GC9305 is behind the gpio13 bus switch.
|
||||
# The cover daemon sends the stock external init separately through the
|
||||
# panel-mipi-dbi-spi debugfs command hook; this helper only stops/restarts
|
||||
# Xorg's framebuffer flushes and the shared backlight power state.
|
||||
set -u
|
||||
export DISPLAY="${DISPLAY:-:0}"
|
||||
case "${1:-}" in
|
||||
@@ -18,8 +18,6 @@ case "${1:-}" in
|
||||
xset dpms force off >/dev/null 2>&1 || true
|
||||
;;
|
||||
*)
|
||||
printf 'Usage: %s [reinit|on|off]\n' "${0##*/}" >&2
|
||||
exit 1
|
||||
;;
|
||||
printf 'Usage: %s [reinit|on|off]\n' "${0##*/}" >&2; exit 1 ;;
|
||||
esac
|
||||
exit 0
|
||||
Binary file not shown.
@@ -4,7 +4,10 @@
|
||||
# (via doas). Every blank path writes brightness=0; every wake path restores it.
|
||||
|
||||
BR_PATH=/sys/class/backlight/backlight/brightness
|
||||
KBD_PATH=/sys/class/leds/white:kbd_backlight/brightness
|
||||
RL_PATH=/sys/devices/system/cpu/cpufreq/schedutil/rate_limit_us
|
||||
COVER_MARKER=/run/bananarchy/cover-backlight
|
||||
LID_STATE=/run/bananarchy/lid-state
|
||||
|
||||
DPMS_PATH=
|
||||
for _dpms in /sys/class/drm/card*-*/dpms; do
|
||||
@@ -18,11 +21,21 @@ case "$br" in ''|*[!0-9]*) br=1 ;; esac
|
||||
cur=On
|
||||
[ -r "$DPMS_PATH" ] && { read -r cur < "$DPMS_PATH" 2>/dev/null || cur=On; }
|
||||
|
||||
# The main and cover panels share one PWM backlight. While the cover owns the
|
||||
# bus, its daemon publishes this marker before raising brightness; the closed
|
||||
# lid gate must not turn that shared backlight back off.
|
||||
if [ -f "$COVER_MARKER" ] &&
|
||||
[ "$(cat "$LID_STATE" 2>/dev/null)" = "closed" ]; then
|
||||
printf '0\n' > "$KBD_PATH" 2>/dev/null || true
|
||||
[ "$cur" = "On" ] || DISPLAY=:0 xset dpms force on >/dev/null 2>&1 || true
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Hard gate: while the flip is closed no path may relight the main panel or
|
||||
# the keypad backlight. This also enforces DPMS-off, which is the condition
|
||||
# the cover daemon needs before it takes the shared QUP5 SPI bus.
|
||||
if ! "${BANANARCHY_LID_GATE:-/usr/bin/bananarchy-lid-gate.sh}"; then
|
||||
printf '0\n' > /sys/class/leds/white:kbd_backlight/brightness 2>/dev/null || true
|
||||
printf '0\n' > "$KBD_PATH" 2>/dev/null || true
|
||||
[ "$br" -eq 0 ] || printf '0\n' > "$BR_PATH" 2>/dev/null || true
|
||||
[ "$cur" = "Off" ] || DISPLAY=:0 xset dpms force off >/dev/null 2>&1 || true
|
||||
exit 0
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user