ipq806x: Initial TP-Link and ASUS OnHub support
[openwrt/openwrt.git] / target / linux / ipq806x / base-files / etc / hotplug.d / firmware / 11-ath10k-caldata
index 398ddf9a290a3606385a37d93ff1fc81e8211113..a0e2e9d1237bdfaa5d00e7a07aa7d98cacf8efe7 100644 (file)
@@ -6,9 +6,32 @@
 
 board=$(board_name)
 
+dt_base64_extract() {
+       local target_dir="/sys$DEVPATH"
+       local source="$target_dir/../../of_node/qcom,ath10k-calibration-data-base64"
+
+       [ -e "$source" ] || caldata_die "cannot find base64 calibration data: $source"
+       [ -d "$target_dir" ] || \
+               caldata_die "no sysfs dir to write: $target"
+
+       echo 1 > "$target_dir/loading"
+       base64decode.uc "$source" > "$target_dir/data"
+       if [ $? != 0 ]; then
+               echo 1 > "$target_dir/loading"
+               caldata_die \
+                       "failed to write calibration data to $target_dir/data"
+       else
+               echo 0 > "$target_dir/loading"
+       fi
+}
+
 case "$FIRMWARE" in
 "ath10k/cal-pci-0000:01:00.0.bin")
        case "$board" in
+       asus,onhub |\
+       tplink,onhub)
+               dt_base64_extract
+               ;;
        meraki,mr52)
                CI_UBIPART=art
                caldata_extract_ubi "ART" 0x1000 0x844
@@ -35,6 +58,14 @@ case "$FIRMWARE" in
                ;;
        esac
        ;;
+"ath10k/cal-pci-0001:01:00.0.bin")
+       case "$board" in
+       asus,onhub |\
+       tplink,onhub)
+               dt_base64_extract
+               ;;
+       esac
+       ;;
 "ath10k/pre-cal-pci-0001:01:00.0.bin")
        case $board in
        asrock,g10)
@@ -61,6 +92,10 @@ case "$FIRMWARE" in
        ;;
 "ath10k/cal-pci-0002:01:00.0.bin")
        case "$board" in
+       asus,onhub |\
+       tplink,onhub)
+               dt_base64_extract
+               ;;
        meraki,mr42)
                CI_UBIPART=art
                caldata_extract_ubi "ART" 0x9000 0x844