power: fix LBC charger FSM, BMS-VM fuel gauge, WCN36xx BMPS, WCD clock gating, and battery UI

This commit is contained in:
Luxferre committed 2026-11-03 12:44:17 +02:00
1 parent ebdb0f8ee2
commit 06d991d4fa
47 files changed
+727 -45

No files matched your search

+25 -6
View File
@@ -1,6 +1,8 @@
#!/bin/sh
# Bananarchy kernel and runtime power management optimizations
chmod 0755 / 2>/dev/null || true
# Disable fbcon cursor blinking (eliminates 5 Hz fb_flashcursor + drm_fb_helper_damage_work wakeups)
if [ -w /sys/class/graphics/fbcon/cursor_blink ]; then
echo 0 > /sys/class/graphics/fbcon/cursor_blink 2>/dev/null || true
@@ -29,16 +31,33 @@ for pm_dev in /sys/devices/platform/soc@0/1c00000.gpu /sys/devices/platform/soc@
fi
done
# Tune CPUFreq schedutil governor for rapid downclocking to 200 MHz at idle
# (qcom-cpufreq reports transition_latency=UINT_MAX, causing schedutil rate_limit_us
# to default to 6442450 us = 6.44s without this override)
# Tune CPUFreq schedutil governor to avoid 22 Hz frequency/RPM voltage thrashing at idle
# while keeping interactive ramp-up responsive. Allow video group (dwm/xlocker) to switch
# scaling_governor to powersave (200 MHz) while the screen is off.
for gov_dir in /sys/devices/system/cpu/cpufreq/schedutil /sys/devices/system/cpu/cpufreq/policy*/schedutil /sys/devices/system/cpu/cpu*/cpufreq/schedutil; do
if [ -d "$gov_dir" ]; then
{ echo 2000 > "$gov_dir/rate_limit_us"; } 2>/dev/null || true
{ echo 20000 > "$gov_dir/up_rate_limit_us"; } 2>/dev/null || true
{ echo 1000 > "$gov_dir/down_rate_limit_us"; } 2>/dev/null || true
{ echo 40000 > "$gov_dir/rate_limit_us"; } 2>/dev/null || true
{ echo 40000 > "$gov_dir/up_rate_limit_us"; } 2>/dev/null || true
{ echo 10000 > "$gov_dir/down_rate_limit_us"; } 2>/dev/null || true
fi
done
for gov_file in /sys/devices/system/cpu/cpufreq/policy*/scaling_governor /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
if [ -e "$gov_file" ]; then
chgrp video "$gov_file" 2>/dev/null || true
chmod 0664 "$gov_file" 2>/dev/null || true
fi
done
# Ensure rootfs pm8916_lbc and pm8916_bms_vm modules are active if initramfs loaded an older build
if [ -r /sys/class/power_supply/pm8916-lbc-chgr/constant_charge_current ]; then
_chg_cur=0
read -r _chg_cur < /sys/class/power_supply/pm8916-lbc-chgr/constant_charge_current 2>/dev/null || _chg_cur=0
if [ "${_chg_cur:-0}" -lt 500000 ] 2>/dev/null; then
modprobe -r pm8916_bms_vm pm8916_lbc 2>/dev/null || true
modprobe pm8916_lbc 2>/dev/null || true
modprobe pm8916_bms_vm 2>/dev/null || true
fi
fi
# Enable IEEE 802.11 power save on WCN3620 wlan0
if command -v iw >/dev/null 2>&1; then