diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.50/ccimx8x/bluetooth-init b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.50/ccimx8x/bluetooth-init index 0a6a70cc4..fb7f0c7b5 100644 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.50/ccimx8x/bluetooth-init +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-5.50/ccimx8x/bluetooth-init @@ -1,7 +1,7 @@ #!/bin/sh #=============================================================================== # -# Copyright (C) 2018 by Digi International Inc. +# Copyright (C) 2018,2019 by Digi International Inc. # All rights reserved. # # This program is free software; you can redistribute it and/or modify it @@ -13,32 +13,6 @@ # #=============================================================================== -# Bluetooth power GPIO -BT_EN_QCA_GPIO_NR="394" - -# set_gpio_value -set_gpio_value() { - local SG_GPIONR="${1}" - local SG_GPIOVAL="${2}" - local SG_GPIOPATH="/sys/class/gpio/gpio${SG_GPIONR}" - - [ -d "${SG_GPIOPATH}" ] || printf "%s" "${SG_GPIONR}" > /sys/class/gpio/export - printf out > "${SG_GPIOPATH}/direction" && sleep .2 - printf "${SG_GPIOVAL}" > "${SG_GPIOPATH}/value" && sleep .2 - [ -d "${SG_GPIOPATH}" ] && printf "%s" "${SG_GPIONR}" > /sys/class/gpio/unexport -} - -# powercycle_gpio -powercycle_gpio() { - set_gpio_value "${1}" 0 - set_gpio_value "${1}" 1 -} - -error() { - echo ${1} - exit 1 -} - bluetooth_init() { # Get MAC address from the device tree. Use a default value if it has not been set. BT_MACADDR="$(hexdump -ve '1/1 "%02X" ":"' /proc/device-tree/bluetooth/mac-address 2>/dev/null | sed 's/:$//g')" @@ -52,10 +26,11 @@ bluetooth_init() { for RETRY in $(seq 1 5) do killproc hciattach - powercycle_gpio "${BT_EN_QCA_GPIO_NR}" + modprobe btdigi if hciattach ttyBt qca ${BT_RATE:-3000000} -t30 ${BT_FLOW:-flow} unused ${BT_MACADDR} >${HCIATTACH_LOG} 2>&1; then return fi + rmmod btdigi sleep 1 done BT_ERROR="FAIL (hciattach)" @@ -76,8 +51,7 @@ case "$1" in if [ -d "/sys/class/bluetooth/hci0" ]; then echo -n "Stopping bluetooth hardware: " killproc hciattach - # Power down bluetooth - set_gpio_value "${BT_EN_QCA_GPIO_NR}" 0 + rmmod btdigi echo "done." fi ;;