aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
diff options
context:
space:
mode:
authorJohn Crispin <john@phrozen.org>2018-02-21 20:40:50 +0100
committerMathias Kresin <dev@kresin.me>2018-03-14 19:04:50 +0100
commit54b275c8ed3ad20c447fd46deec83384822ac79d (patch)
tree4198c9f77e467b316940cb78297d3030e67d67ea /target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
parentb7f115f22a9d79bd45bfe27cfb8d491dac49feb4 (diff)
downloadupstream-54b275c8ed3ad20c447fd46deec83384822ac79d.tar.gz
upstream-54b275c8ed3ad20c447fd46deec83384822ac79d.tar.bz2
upstream-54b275c8ed3ad20c447fd46deec83384822ac79d.zip
ipq40xx: add target
Signed-off-by: Christian Lamparter <chunkeey@gmail.com> Signed-off-by: Mathias Kresin <dev@kresin.me> Signed-off-by: John Crispin <john@phrozen.org>
Diffstat (limited to 'target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata')
-rw-r--r--target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata62
1 files changed, 62 insertions, 0 deletions
diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
new file mode 100644
index 0000000000..33ea9b426c
--- /dev/null
+++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+ath10kcal_die() {
+ echo "ath10cal: " "$*"
+ exit 1
+}
+
+ath10kcal_extract() {
+ local part=$1
+ local offset=$2
+ local count=$3
+ local mtd
+
+ mtd=$(find_mtd_chardev $part)
+ [ -n "$mtd" ] || \
+ ath10kcal_die "no mtd device found for partition $part"
+
+ dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
+ ath10kcal_die "failed to extract calibration data from $mtd"
+}
+
+[ -e /lib/firmware/$FIRMWARE ] && exit 0
+
+. /lib/functions.sh
+. /lib/functions/system.sh
+
+board=$(board_name)
+
+
+case "$FIRMWARE" in
+"ath10k/pre-cal-ahb-a000000.wifi.bin")
+ case "$board" in
+ avm,fritzbox-4040)
+ /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
+ ;;
+ glinet,gl-b1300 |\
+ qcom,ap-dk01.1-c1)
+ ath10kcal_extract "ART" 4096 12064
+ ;;
+ openmesh,a42)
+ ath10kcal_extract "0:ART" 4096 12064
+ ;;
+ esac
+ ;;
+"ath10k/pre-cal-ahb-a800000.wifi.bin")
+ case "$board" in
+ avm,fritzbox-4040)
+ /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
+ ;;
+ glinet,gl-b1300 |\
+ qcom,ap-dk01.1-c1)
+ ath10kcal_extract "ART" 20480 12064
+ ;;
+ openmesh,a42)
+ ath10kcal_extract "0:ART" 20480 12064
+ ;;
+ esac
+ ;;
+*)
+ exit 1
+ ;;
+esac