#!/bin/sh

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

. /lib/functions/caldata.sh

board=$(board_name)

case "$FIRMWARE" in
"ath10k/pre-cal-pci-0000:00:00.0.bin")
	case $board in
	dlink,dir-842-c1|\
	dlink,dir-842-c2|\
	dlink,dir-842-c3)
		caldata_extract "art" 0x5000 0x2f20
		caldata_valid "202f" || caldata_extract "reserved" 0x15000 0x2f20
		ath10k_patch_mac $(mtd_get_mac_ascii devdata wlan5mac)
		ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
			/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
		;;
	esac
	;;
*)
	exit 1
	;;
esac
