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
@@ -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