uzbek-plus/b10/b10b3/b10b3-mon.sh
q 58dcb3d121 B10: battery charging — PM8916 LBC supervisor v4 (CHARGE/HOLD, FAULT safe clamp to 4.00 V) and persistent B10B-5 cache
- LBC supervisor v1..v4 (linux/patches/b10b3-lbc-supervisor-v3.patch + b10/b10b3/lbc-v3-to-v4-fault-clamp.diff):
  CHARGING 4.20 V/450 mA -> HOLD 4.05 V after 60 min CV -> battery -> new cycle on USB insert; FAULT = VDD_MAX 4.00 V clamp
- RAM tests C/B/D/D2/D3/D4 (safety timer only ends fast charge), B10B-4 actuator audit (VDD_MAX works, USB_SUSP does not),
  B10B-5 FAULT clamp regression, production run, warm reboot via PON reboot reason
- cache = B10B-5 c3732515 (HW EDL write, readback + full partition verify), class-A persistent validation
- test-only hooks/images are not part of the production kernel; images with the AP PSK are not published
2026-10-04 19:00:27 +03:00

18 lines
1.7 KiB
Bash

#!/bin/sh
# B10B-3 board-side observer (env VMAX = ALERT VBAT uV, EVDD = expected VDD_MAX hex): every P s append one line to /tmp/b10b3-mon.log (survives NCM/USB loss). Reads only.
P=${1:-30}
grep -q " /sys/kernel/debug " /proc/mounts || mount -t debugfs debugfs /sys/kernel/debug
R=/sys/kernel/debug/regmap/0-00/registers; S=/sys/kernel/debug/pm8916_lbc/state
rd() { dd if=$R bs=9 skip=$(($1)) count=$2 2>/dev/null | cut -d' ' -f2 | tr '\n' ' '; }
D=/sys/bus/iio/devices/iio:device0; C=/sys/class/power_supply/pm8916-lbc-chgr
trap '' HUP
i=0
while [ ! -e /tmp/b10b3-mon.stop ]; do
i=$((i + 1)); vb=$(cat $D/in_voltage6_input); pt=$(cat $D/in_temp8_input)
a=""; [ "$vb" -gt ${VMAX:-4220000} ] && a="$a ALERT-VBAT"; [ "$pt" -gt 60000 ] && a="$a ALERT-TEMP"; [ "$(rd 0x1060 1)" != "80 " ] && a="$a ALERT-TIMER"; case "$(rd 0x1040 1)" in ${EVDD:-08}" "|${EVDD2:-xx}" ") ;; *) a="$a ALERT-VDDMAX";; esac; [ "$(rd 0x1044 1)" != "04 " ] && a="$a ALERT-IBAT"
st=$(head -1 $S | tr ' ' '='); cv=$(sed -n 2p $S | sed 's/.*cv_s \([-0-9]*\) nocv \([0-9]*\).*/cv_s=\1 nocv=\2/'); cnt=$(sed -n 3p $S | tr ' ' '='); vdd=$(rd 0x1040 1)
ld=$(pgrep -c yes 2>/dev/null || ps | grep -c "[y]es$")
echo "M $i $(date -u +%T) up=$(cut -d' ' -f1 /proc/uptime) $st $cv $cnt vbat6=$vb vph=$(cat $D/in_voltage7_input) usbin=$(cat $D/in_voltage0_input) fifo=$(rd 0x40c0 4) chgst=$(rd 0x1009 1) crt=$(rd 0x1010 1) brt=$(rd 0x1210 1) urt=$(rd 0x1310 1) usbp=$(rd 0x1308 2) ctrl=$(rd 0x1049 1) vdd=$vdd ibat=$(rd 0x1044 1) tchg=$(rd 0x1060 2) failed=$(rd 0x104a 1) bd=$(rd 0x1642 1) online=$(cat $C/online) psy=$(cat $C/status) pmt=$pt cpu=$(cat /sys/class/thermal/thermal_zone4/temp) load=$ld$a" >> /tmp/b10b3-mon.log
sleep $P
done
echo "MON-END $(date -u +%T)" >> /tmp/b10b3-mon.log