#!/bin/sh [ -e /lib/firmware/$FIRMWARE ] && exit 0 . /lib/functions.sh . /lib/functions/system.sh . /lib/functions/caldata.sh caldata_die() { echo "caldata: " "$*" exit 1 } caldata_extract() { local part=$1 local offset=$(($2)) local count=$(($3)) local mtd mtd=$(find_mtd_chardev $part) [ -n "$mtd" ] || caldata_die "no mtd device found for partition $part" dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \ caldata_die "failed to extract calibration data from $mtd" } board=$(board_name) case "$FIRMWARE" in ath12k/IPQ5332/hw1.0/caldata.bin) case "$board" in cig,wf189w|\ cig,wf189h|\ cig,wf189|\ edgecore,eap105|\ sercomm,ap72tip-v4|\ sercomm,ap72tip) caldata_extract "0:ART" 0x1000 0x20000 ;; sonicfi,rap7110c-341x) caldata_extract_mmc "0:ART" 0x1000 0xF800 ;; sonicfi,rap750e-h|\ sonicfi,rap750w-311a) caldata_extract "0:ART" 0x1000 0xf800 ;; esac ;; ath12k/QCN92XX/hw1.0/cal-pci-0001:01:00.0.bin) case "$board" in cig,wf189|\ edgecore,eap105|\ sercomm,ap72tip-v4|\ sercomm,ap72tip) caldata_extract "0:ART" 0x58800 0x2d000 ;; sonicfi,rap7110c-341x) caldata_extract_mmc "0:ART" 0x58800 0x2d000 ;; esac ;; ath12k/QCN6432/hw1.0/caldata_1.bin) case "$board" in sonicfi,rap750e-h|\ sonicfi,rap750w-311a) caldata_extract "0:ART" 0x12800 0x18800 ;; esac ;; ath12k/QCN6432/hw1.0/cal-ahb-soc@0:wifi1@c0000000.bin) case "$board" in cig,wf189h|\ cig,wf189w) caldata_extract "0:ART" 0x26800 0x20000 ;; esac ;; ath12k/QCN6432/hw1.0/cal-ahb-soc@0:wifi2@c0000000.bin) case "$board" in cig,wf189h|\ cig,wf189w) caldata_extract "0:ART" 0x58800 0x20000 ;; esac ;; *) exit 1 ;; esac