kernel-module-qualcomm: add support to override the region code

The region code is programmed in the OTP bits. We want to allow to be able to
override this behavior by setting the new value as a property in the device
tree called "regulatory-domain".
This can be done by setting the variable "regdomain=<code>" in uboot or well
by defining that entry in the device tree.

https://jira.digi.com/browse/DEL-2799

Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
This commit is contained in:
Isaac Hermida 2016-07-21 10:22:49 +02:00
parent cd253b370b
commit 46c7508ee3
1 changed files with 13 additions and 2 deletions

View File

@ -50,14 +50,25 @@ if ! cmp -s ${TMP_MACFILE} ${MACFILE}; then
fi
rm -f ${TMP_MACFILE}
REGION_CODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null)"
OTP_REGION_CODE="$(cat /proc/device-tree/digi,hwid,cert 2>/dev/null)"
DTB_REGION_CODE="$(cat /proc/device-tree/wireless/regulatory-domain 2>/dev/null)"
US_CODE="0x0"
WW_CODE="0x1"
JP_CODE="0x2"
# Check if the DTB_REGION_CODE is in the list of valid codes,
# if not use the OTP programmed value.
case "${DTB_REGION_CODE}" in
${US_CODE}|${WW_CODE}|${JP_CODE})
REGULATORY_DOMAIN=${DTB_REGION_CODE};;
*)
logger -t qca6564 "[ERROR] Invalid region code in device tree, using OTP value"
REGULATORY_DOMAIN=${OTP_REGION_CODE};;
esac
BDATA_LINK="${FIRMWARE_DIR}/bdwlan30.bin"
# Create a symbolic link to the FW file for the specific country region.
BDATA_SOURCE="${FIRMWARE_DIR}/bdwlan30_US.bin"
case "${REGION_CODE}" in
case "${REGULATORY_DOMAIN}" in
${US_CODE})
logger -t qca6564 "Setting US wireless region";;
${WW_CODE}|${JP_CODE})