bluetooth-init: scripts updated to use libgpiod tools

https://jira.digi.com/browse/DEL-6424
https://jira.digi.com/browse/DEL-6423

Signed-off-by: Hector Bujanda <hector.bujanda@digi.com>
This commit is contained in:
Hector Bujanda 2020-03-05 13:58:05 +01:00
parent f14d79f5a6
commit 388ef5c388
4 changed files with 17 additions and 45 deletions

View File

@ -14,24 +14,17 @@
#===============================================================================
# Bluetooth power GPIO
BT_EN_QCA_GPIO_NR="137"
BT_EN_QCA_GPIO_NR="gpio5 9"
# set_gpio_value <gpio_nr> <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
gpioset ${1}=${2}
}
# powercycle_gpio <gpio_nr>
powercycle_gpio() {
set_gpio_value "${1}" 0
set_gpio_value "${1}" 1
gpioset ${1}=0
gpioset ${1}=1
}
error() {

View File

@ -14,24 +14,17 @@
#===============================================================================
# Bluetooth power GPIO
BT_EN_QCA_GPIO_NR="244"
BT_EN_QCA_GPIO_NR="da9063-gpio 4"
# set_gpio_value <gpio_nr> <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
gpioset ${1}=${2}
}
# powercycle_gpio <gpio_nr>
powercycle_gpio() {
set_gpio_value "${1}" 0
set_gpio_value "${1}" 1
gpioset ${1}=0
gpioset ${1}=1
}
error() {

View File

@ -14,24 +14,17 @@
#===============================================================================
# Bluetooth power GPIO
BT_PWR_GPIO_NR="244"
BT_PWR_GPIO_NR="da9063-gpio 4"
# set_gpio_value <gpio_nr> <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
gpioset ${1}=${2}
}
# powercycle_gpio <gpio_nr>
powercycle_gpio() {
set_gpio_value "${1}" 0
set_gpio_value "${1}" 1
gpioset ${1}=0
gpioset ${1}=1
}
error() {

View File

@ -14,24 +14,17 @@
#===============================================================================
# Bluetooth power GPIO
BT_EN_QCA_GPIO_NR="137"
BT_EN_QCA_GPIO_NR="gpio5 9"
# set_gpio_value <gpio_nr> <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
gpioset ${1}=${2}
}
# powercycle_gpio <gpio_nr>
powercycle_gpio() {
set_gpio_value "${1}" 0
set_gpio_value "${1}" 1
gpioset ${1}=0
gpioset ${1}=1
}
error() {
@ -50,7 +43,7 @@ bluetooth_init() {
MOD_VERSION="$(($(cat /proc/device-tree/digi,hwid,hv 2>/dev/null | tr -d '\0' || true)))"
if [ "${MOD_VERSION}" -lt "4" ]; then
# Ignore the CTS flow control
BT_CTS_QCA_GPIO_NR="18"
BT_CTS_QCA_GPIO_NR="gpio1 18"
set_gpio_value "${BT_CTS_QCA_GPIO_NR}" 0
# Reduce the rate to avoid the need for HW flow control