Implement deep-standby RPM interconnect, Wi-Fi, USB, DSDS, and panel power savings for a1114
- Enable MSM8909 SMD RPM interconnect scaling (BIMC, PCNOC, SNOC) with 19.2 MHz active floor, zero sleep-set vote clearing clk_smd_rpm_handoff, and CPU OPP bandwidth tables across all six MSM8905/MSM8909 device trees while preserving module vermagic - Sync wcn36xx conf.listen_interval and expose live screen_off_offload (ARP, IPv6 NS, GTK, ignore_dtim, 40 ms dynamic PS) toggled by bananarchy-display-power-sync without wlan_host_suspend_ind - Add runtime PM clock gating to ci_hdrc_msm when USB is unplugged while skipping viewport ULPI_SYNC_STATE polling under CI_HDRC_OVERRIDE_PHY_CONTROL - Default MODEM_DRX_MODE=6 across all /dev/wwan0at* channels with flock serialization, post-probe boot retry, and modem-ready registration hooks, and quiesce dsds-daemon polling whenever the screen is dark - Issue MIPI DCS DISPLAY_OFF and SLEEP_IN in panel-mipi-dbi on DPMS off while preserving the 2720 Flip closed-only kernel cover backend, and update pinned a1114 (carbonara) hashes and docs
This commit is contained in:
1 parent
e42024e90d
commit
c95a84c69c
44 files changed
+106915
-105453
No files matched your search
@@ -15,6 +15,7 @@ BL_POWER_PATH=/sys/class/backlight/backlight/bl_power
|
||||
KBD_PATH=/sys/class/leds/white:kbd_backlight/brightness
|
||||
RL_PATH=/sys/devices/system/cpu/cpufreq/schedutil/rate_limit_us
|
||||
GPU_GOV_PATH=/sys/class/devfreq/1c00000.gpu/governor
|
||||
WIFI_OFFLOAD_PATH=/sys/module/wcn36xx/parameters/screen_off_offload
|
||||
COVER_MARKER=/run/bananarchy/cover-backlight
|
||||
FORCE_MARKER=/run/bananarchy/cover-bl-force
|
||||
STATE_CACHE=/run/bananarchy/cover-power-state
|
||||
@@ -83,9 +84,11 @@ case "$br" in ''|*[!0-9]*) br=1 ;; esac
|
||||
if [ "$(read_value "$LID_PROFILE")" != "flip" ]; then
|
||||
if [ "$br" -eq 0 ]; then
|
||||
[ -w "$GPU_GOV_PATH" ] && set_if_changed "$GPU_GOV_PATH" "powersave"
|
||||
[ -w "$WIFI_OFFLOAD_PATH" ] && set_if_changed "$WIFI_OFFLOAD_PATH" "Y"
|
||||
force_dpms "Off"
|
||||
else
|
||||
[ -w "$GPU_GOV_PATH" ] && set_if_changed "$GPU_GOV_PATH" "simple_ondemand"
|
||||
[ -w "$WIFI_OFFLOAD_PATH" ] && set_if_changed "$WIFI_OFFLOAD_PATH" "N"
|
||||
force_dpms "On"
|
||||
[ -w "$RL_PATH" ] && set_if_changed "$RL_PATH" "40000"
|
||||
fi
|
||||
@@ -179,8 +182,10 @@ fi
|
||||
[ -n "$DESIRED_KBD" ] && set_if_changed "$KBD_PATH" "$DESIRED_KBD"
|
||||
if [ "$DESIRED_DPMS" = "Off" ] || [ "$marker" = "0" ] || [ "$marker" = "1" ]; then
|
||||
[ -w "$GPU_GOV_PATH" ] && set_if_changed "$GPU_GOV_PATH" "powersave"
|
||||
[ -w "$WIFI_OFFLOAD_PATH" ] && set_if_changed "$WIFI_OFFLOAD_PATH" "Y"
|
||||
else
|
||||
[ -w "$GPU_GOV_PATH" ] && set_if_changed "$GPU_GOV_PATH" "simple_ondemand"
|
||||
[ -w "$WIFI_OFFLOAD_PATH" ] && set_if_changed "$WIFI_OFFLOAD_PATH" "N"
|
||||
fi
|
||||
force_dpms "$DESIRED_DPMS"
|
||||
[ -w "$RL_PATH" ] && set_if_changed "$RL_PATH" "40000"
|
||||
|
||||
@@ -10,6 +10,9 @@ PARKED="$RUNDIR/parked"
|
||||
AIDFILE="$RUNDIR/secondary.aid"
|
||||
SLOTFILE="$RUNDIR/secondary.slot"
|
||||
TOKEN="$RUNDIR/token"
|
||||
BOOTTOKEN="$RUNDIR/boot.token"
|
||||
READYSTAMP="$RUNDIR/modem_ready.stamp"
|
||||
DRXLOCK="$RUNDIR/lock.drx"
|
||||
QMI="timeout 8 qmicli --silent -pd qrtr://0"
|
||||
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
@@ -17,7 +20,7 @@ if [ "$(id -u)" != "0" ]; then
|
||||
fi
|
||||
|
||||
WIFI_LISTEN_INTERVAL=5
|
||||
MODEM_DRX_MODE=0
|
||||
MODEM_DRX_MODE=6
|
||||
DSDS_SECONDARY_MODE=active
|
||||
DSDS_PARK_DELAY=300
|
||||
[ -r "$CONF" ] && . "$CONF"
|
||||
@@ -44,26 +47,58 @@ write_modprobe() {
|
||||
}
|
||||
|
||||
apply_modem_drx() {
|
||||
force_drx="${1:-cached}"
|
||||
case "$MODEM_DRX_MODE" in
|
||||
0) return 0 ;;
|
||||
0)
|
||||
rm -f "$RUNDIR"/drx.wwan* 2>/dev/null || true
|
||||
return 0
|
||||
;;
|
||||
6|7|8|9) ;;
|
||||
*)
|
||||
log "invalid MODEM_DRX_MODE=$MODEM_DRX_MODE (use 0 or 6-9)"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
[ -c /dev/wwan0at0 ] || {
|
||||
log "no modem AT port"
|
||||
return 1
|
||||
}
|
||||
out="$(timeout 6 /usr/libexec/msm-modem-uim-selection at auto "AT\$QCDRX=$MODEM_DRX_MODE" 2>/dev/null || true)"
|
||||
case "$out" in
|
||||
*OK*) return 0 ;;
|
||||
*)
|
||||
log "AT\$QCDRX=$MODEM_DRX_MODE failed: $out"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
(
|
||||
exec 9>"$DRXLOCK"
|
||||
flock -w 10 9 || exit 1
|
||||
if [ "$force_drx" = "force" ]; then
|
||||
rm -f "$RUNDIR"/drx.wwan* 2>/dev/null || true
|
||||
fi
|
||||
found_port=0
|
||||
failed_port=0
|
||||
for dev in /dev/wwan0at*; do
|
||||
[ -c "$dev" ] || continue
|
||||
found_port=1
|
||||
port_name="${dev#/dev/}"
|
||||
dev_id="$(stat -c '%i' "$dev" 2>/dev/null || echo 0)"
|
||||
cache_file="$RUNDIR/drx.$port_name"
|
||||
want_key="$MODEM_DRX_MODE:$dev_id"
|
||||
cur_key=""
|
||||
if [ "$force_drx" != "force" ] && [ -r "$cache_file" ]; then
|
||||
IFS= read -r cur_key < "$cache_file" 2>/dev/null || cur_key=""
|
||||
if [ "$cur_key" = "$want_key" ]; then
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
out="$(timeout 6 /usr/libexec/msm-modem-uim-selection at "$dev" "AT\$QCDRX=$MODEM_DRX_MODE" 2>/dev/null || true)"
|
||||
case "$out" in
|
||||
*OK*)
|
||||
printf '%s\n' "$want_key" > "$cache_file" 2>/dev/null || true
|
||||
;;
|
||||
*)
|
||||
rm -f "$cache_file" 2>/dev/null || true
|
||||
failed_port=1
|
||||
log "AT\$QCDRX=$MODEM_DRX_MODE on $port_name failed: $out"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [ "$found_port" -eq 0 ]; then
|
||||
[ "$force_drx" = "force" ] && log "no modem AT port"
|
||||
exit 1
|
||||
fi
|
||||
[ "$failed_port" -eq 0 ]
|
||||
)
|
||||
}
|
||||
|
||||
secondary_aid() {
|
||||
@@ -115,10 +150,11 @@ unpark() {
|
||||
else
|
||||
log "failed to reactivate secondary GW session"
|
||||
fi
|
||||
rm -f "$PARKED" "$AIDFILE" "$SLOTFILE"
|
||||
rm -f "$PARKED" "$AIDFILE" "$SLOTFILE" "$RUNDIR"/drx.wwan* 2>/dev/null || true
|
||||
}
|
||||
|
||||
screenoff() {
|
||||
apply_modem_drx cached || true
|
||||
[ "$DSDS_SECONDARY_MODE" = "eco" ] || return 0
|
||||
token="$(date +%s)-$$"
|
||||
printf '%s\n' "$token" > "$TOKEN"
|
||||
@@ -134,13 +170,57 @@ screenoff() {
|
||||
screenon() {
|
||||
rm -f "$TOKEN" 2>/dev/null || true
|
||||
unpark
|
||||
apply_modem_drx || true
|
||||
apply_modem_drx cached || true
|
||||
}
|
||||
|
||||
apply_now() {
|
||||
rm -f "$BOOTTOKEN" "$READYSTAMP" "$RUNDIR"/drx.wwan* 2>/dev/null || true
|
||||
write_modprobe || true
|
||||
apply_modem_drx force || true
|
||||
}
|
||||
|
||||
modem_ready() {
|
||||
now_ts=0
|
||||
if [ -r /proc/uptime ]; then
|
||||
IFS='. ' read -r now_ts _ < /proc/uptime 2>/dev/null || now_ts=0
|
||||
fi
|
||||
case "$now_ts" in ''|*[!0-9]*) now_ts=0 ;; esac
|
||||
last_ts=0
|
||||
[ -r "$READYSTAMP" ] && { read -r last_ts < "$READYSTAMP" 2>/dev/null || last_ts=0; }
|
||||
case "$last_ts" in ''|*[!0-9]*) last_ts=0 ;; esac
|
||||
if [ "$last_ts" -gt 0 ] && [ $((now_ts - last_ts)) -ge 0 ] && [ $((now_ts - last_ts)) -lt 5 ]; then
|
||||
return 0
|
||||
fi
|
||||
printf '%s\n' "$now_ts" > "$READYSTAMP" 2>/dev/null || true
|
||||
if apply_modem_drx force >/dev/null 2>&1; then
|
||||
rm -f "$BOOTTOKEN" 2>/dev/null || true
|
||||
fi
|
||||
}
|
||||
|
||||
boot() {
|
||||
rm -f "$TOKEN" "$PARKED" "$AIDFILE" "$SLOTFILE" 2>/dev/null || true
|
||||
rm -f "$TOKEN" "$PARKED" "$AIDFILE" "$SLOTFILE" "$READYSTAMP" "$RUNDIR"/drx.wwan* 2>/dev/null || true
|
||||
write_modprobe || true
|
||||
apply_modem_drx || true
|
||||
btok="$$-$(cat /proc/uptime 2>/dev/null | awk '{print $1}' || echo 0)"
|
||||
printf '%s\n' "$btok" > "$BOOTTOKEN"
|
||||
(
|
||||
# Let ModemManager finish its startup AT port probe (~5 s) so we do not
|
||||
# compete with mm-port-probe on wwan_core's shared RX queue, then retry
|
||||
# until all enumerated AT channels accept AT$QCDRX.
|
||||
sleep 5
|
||||
i=0
|
||||
while [ "$i" -lt 12 ]; do
|
||||
cur=""
|
||||
[ -r "$BOOTTOKEN" ] && { read -r cur < "$BOOTTOKEN" 2>/dev/null || cur=""; }
|
||||
[ "$cur" = "$btok" ] || exit 0
|
||||
if [ -c /dev/wwan0at0 ] && { [ -c /dev/wwan0at1 ] || [ "$i" -ge 2 ]; }; then
|
||||
if apply_modem_drx force >/dev/null 2>&1; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
sleep 3
|
||||
i=$((i + 1))
|
||||
done
|
||||
) >/dev/null 2>&1 &
|
||||
}
|
||||
|
||||
status() {
|
||||
@@ -159,18 +239,26 @@ status() {
|
||||
printf 'modprobe_conf=absent\n'
|
||||
fi
|
||||
printf 'wcn36xx_param=%s\n' "$(cat /sys/module/wcn36xx/parameters/listen_interval 2>/dev/null || echo n/a)"
|
||||
printf 'modem_drx_now=%s\n' "$(timeout 6 /usr/libexec/msm-modem-uim-selection at auto 'AT$QCDRX?' 2>/dev/null | tr -d '\r' | grep -o '\$QCDRX: [0-9]*' | head -n 1)"
|
||||
printf 'wcn36xx_screen_off_offload=%s\n' "$(cat /sys/module/wcn36xx/parameters/screen_off_offload 2>/dev/null || echo n/a)"
|
||||
drx_summary="$(timeout 8 /usr/libexec/msm-modem-uim-selection at all 'AT$QCDRX?' 2>/dev/null | awk '
|
||||
/^\[wwan0at/ { gsub(/[\[\]]/, "", $0); p=$0; next }
|
||||
/\$QCDRX:/ { gsub(/^[[:space:]]+|[[:space:]]+$/, "", $0); if (p != "") out = (out ? out " " : "") p ":" $0 }
|
||||
END { print out }
|
||||
')"
|
||||
printf 'modem_drx_now=%s\n' "${drx_summary:-n/a}"
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
boot|apply) boot ;;
|
||||
boot) boot ;;
|
||||
apply) apply_now ;;
|
||||
modem-ready) modem_ready ;;
|
||||
screenoff) screenoff ;;
|
||||
screenon) screenon ;;
|
||||
_park) park ;;
|
||||
unpark) unpark ;;
|
||||
status) status ;;
|
||||
*)
|
||||
printf 'Usage: %s [boot|apply|screenoff|screenon|unpark|status]\n' "${0##*/}" >&2
|
||||
printf 'Usage: %s [boot|apply|modem-ready|screenoff|screenon|unpark|status]\n' "${0##*/}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in new issue
Block a user