bluez5-init: reset bluetooth qualcomm chip before initialization

The power regulator connected to the qca6554 chip is always on, which causes
the Bluetooth part to not work correctly after a software-reset.
This commit asserts momentarily the BT_EN line during the start-up sequence
to reset the Bluetooth controller so that it is in a predictable state after a
reset.

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

Signed-off-by: Isaac Hermida <isaac.hermida@digi.com>
This commit is contained in:
Isaac Hermida 2016-06-23 11:31:24 +02:00
parent 0793dbf75b
commit a6d0a1d139
1 changed files with 9 additions and 0 deletions

View File

@ -26,6 +26,15 @@ SCRIPTNAME="$(basename "${0}")"
bt_init_qca6564() {
MOD_VERSION="$(($(cat /proc/device-tree/digi,hwid,hv 2>/dev/null || true)))"
# Reset the BT_EN line
BT_EN_QCA_GPIO_NR="137"
BT_EN_L="/sys/class/gpio/gpio${BT_EN_QCA_GPIO_NR}"
[ -d "${BT_EN_L}" ] || printf "%s" ${BT_EN_QCA_GPIO_NR} > /sys/class/gpio/export
printf out > ${BT_EN_L}/direction && sleep .1
printf 0 > ${BT_EN_L}/value && sleep .1
printf 1 > ${BT_EN_L}/value && sleep .1
[ -d "${BT_EN_L}" ] && printf "%s" ${BT_EN_QCA_GPIO_NR} > /sys/class/gpio/unexport
# Module version older than revision 4 has swapped TX and RX lines
if [ "${MOD_VERSION}" -lt "4" ]; then
# Workaround to ignore the CTS flow control line