Files
pmaports-rtwo/device/testing/device-motorola-rtwo/rtwo-panel-revive.sh
T
snlavaiseandClaude Opus 5.5 c028f63183 device-motorola-rtwo: initramfs debug shell, panel revive, power key
- deviceinfo / modules-initfs: boot through the U-Boot chainload, modules
  needed in the initramfs for the display, USB and the DSPs.
- initfs hooks: dropbear/telnet debug shell over USB networking.
- rtwo-panel-revive.service: blank/unblank the NT37705 if it comes up
  dead from the ABL handoff.
- logind-power-key.conf: ignore the power key (handled by the dashboard).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DnHwDU5yL8L6qgPEN5CV5m
2026-09-26 20:02:56 -03:00

59 lines
1.5 KiB
Bash

#!/bin/sh
# Panel NT37705: el ABL deja el subsistema de display encendido (mdss_gdsc on)
# y a veces el primer encendido de msm sobre ese estado no arranca el panel
# (lecturas DCS -61, pantalla negra). Lo unico que lo revive es apagar
# mdss_gdsc, cosa que pasa con un blank/unblank del framebuffer.
#
# El initfs-hook hace lo mismo, pero msm suele enganchar el display recien
# despues del switch_root (no hay fb0 en el initramfs), asi que aca se
# repite desde el rootfs. Solo actua si el panel esta muerto: con el panel
# vivo actual_brightness devuelve el valor; muerto, falla con ENODATA (la
# lectura DCS del driver da -61).
#
# Tiene que correr antes que cualquier cliente DRM (cage): con un DRM
# master activo el blank de fbdev no hace nada.
BL=/sys/class/backlight/ae94000.dsi.0
FB=/sys/class/graphics/fb0
log() {
echo "rtwo-panel: $*" > /dev/kmsg
}
panel_alive() {
cat "$BL/actual_brightness" > /dev/null 2>&1
}
i=0
while [ ! -e "$BL/actual_brightness" ] || [ ! -e "$FB/blank" ]; do
i=$((i + 1))
if [ "$i" -gt 60 ]; then
log "sin backlight/fb0 tras 30 s, nada que hacer"
exit 0
fi
sleep 0.5
done
# Dar tiempo al primer prepare/enable del panel.
sleep 1
if panel_alive; then
log "panel vivo, sin cambios"
exit 0
fi
for try in 1 2 3; do
log "panel muerto, blank/unblank (intento $try)"
echo 1 > "$FB/blank"
sleep 1
echo 0 > "$FB/blank"
sleep 1
if panel_alive; then
log "panel revivido en el intento $try"
exit 0
fi
done
log "el panel sigue muerto tras 3 intentos"
exit 1