#!/bin/sh

[ -e /lib/firmware/$FIRMWARE ] && exit 0

. /lib/functions/caldata.sh

board=$(board_name)

case "$FIRMWARE" in
"ath11k/IPQ6018/hw1.0/cal-ahb-c000000.wifi.bin")
	case "$board" in
	8devices,mango-dvk)
		caldata_extract "0:ART" 0x1000 0x20000
		;;
	cambiumnetworks,xe3-4)
		caldata_extract "0:ART" 0x1000 0x10000
		;;
	linksys,mr7350)
		caldata_extract "0:art" 0x1000 0x10000
		addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
		ath11k_patch_mac $(macaddr_add $addr 2) 0
		ath11k_patch_mac $(macaddr_add $addr 1) 1
		ath11k_set_macflag
		;;
	netgear,wax214)
		caldata_extract "0:art" 0x1000 0x10000
		;;
	qihoo,360v6)
		caldata_extract "0:art" 0x1000 0x10000
		label_mac=$(mtd_get_mac_ascii factory lanMac)
		ath11k_patch_mac $(macaddr_add $label_mac 3) 0
		ath11k_patch_mac $(macaddr_add $label_mac 2) 1
		ath11k_set_macflag
		;;
	yuncore,fap650)
		caldata_extract "0:art" 0x1000 0x20000
		;;
	esac
	;;
"ath11k/QCN9074/hw1.0/cal-pci-0000:01:00.0.bin")
	case "$board" in
	cambiumnetworks,xe3-4)
		caldata_extract "0:ART" 0x26800 0x20000
		;;
	esac
	;;
*)
	exit 1
	;;
esac
