uzbek-plus/b10/b10b0/b10b0-cal.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

19 lines
1.4 KiB
Bash

#!/bin/sh
# B10B-0 VBAT calibration series: N samples, P s apart. Reads IIO (VADC) + BMS FIFO/charger status via regmap debugfs (reads only).
# Shows the sample number on the display (tty1) so the operator can note the DMM value (BAT+ - BAT-) for each sample.
N=${1:-12}; P=${2:-20}
grep -q " /sys/kernel/debug " /proc/mounts || mount -t debugfs debugfs /sys/kernel/debug
R=/sys/kernel/debug/regmap/0-00/registers
rd() { dd if=$R bs=9 skip=$(($1)) count=$2 2>/dev/null | cut -d' ' -f2 | tr '\n' ' '; }
D=$(for d in /sys/bus/iio/devices/iio:device*; do [ "$(cat $d/name 2>/dev/null)" = "adc@3100" ] && echo $d; done | head -1)
[ -z "$D" ] && D=$(ls -d /sys/bus/iio/devices/iio:device* | head -1)
echo "CAL-START dev=$D name=$(cat $D/name) files: $(cd $D && ls | grep -E '^in_' | tr '\n' ' ')"
i=1
while [ $i -le $N ]; do
printf '\033[2J\033[H\n\n B10B-0 CAL\n\n SAMPLE %d / %d\n\n read DMM now\n' $i $N > /dev/tty1
v=""; for f in $D/in_voltage6_*raw $D/in_voltage6_*input $D/in_voltage7_*raw $D/in_voltage7_*input; do [ -e "$f" ] && v="$v ${f##*/}=$(cat $f)"; done
echo "S $i $(date -u +%T) up=$(cut -d' ' -f1 /proc/uptime)$v fifo=$(rd 0x40c0 10) st1009=$(rd 0x1009 1) usb1308=$(rd 0x1308 1) rt1010=$(rd 0x1010 1) tz=$(for t in /sys/class/thermal/thermal_zone*; do printf "%s:%s," $(cat $t/type) $(cat $t/temp); done)"
i=$((i + 1)); [ $i -le $N ] && sleep $P
done
printf '\033[2J\033[H\n\n B10B-0 CAL\n\n DONE\n' > /dev/tty1
echo CAL-END