bluez5-init: add Bluetooth init script for CCMP1x platforms
The HCI_UART Bluetooth driver does not support suspend-to-RAM operation, so the driver must be loaded and unloaded manually. This commit adds support for the Bluetooth initialization script used across Digi platforms, specifically for ConnectCore MP13 and MP15. https://onedigi.atlassian.net/browse/DEL-9650 Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
This commit is contained in:
parent
ac69566ecd
commit
a20aadbeec
|
|
@ -146,9 +146,6 @@ HAS_WIFI_VIRTWLANS = "true"
|
|||
# Set this platform without graphical support
|
||||
IS_HEADLESS = "true"
|
||||
|
||||
# Remove additional bluetooth packages
|
||||
MACHINE_BLUETOOTH_EXTRA_INSTALL = ""
|
||||
|
||||
# XBee
|
||||
XBEE_RESET_N_GPIO ?= "GPIOG@15"
|
||||
XBEE_TTY ?= "ttySTM2"
|
||||
|
|
|
|||
|
|
@ -159,9 +159,6 @@ MKUBIFS_ARGS ?= "-m 2048 -e 126976 -c 8191"
|
|||
# Wireless external module
|
||||
HAS_WIFI_VIRTWLANS = "true"
|
||||
|
||||
# Remove additional bluetooth packages
|
||||
MACHINE_BLUETOOTH_EXTRA_INSTALL = ""
|
||||
|
||||
# XBee
|
||||
XBEE_RESET_N_GPIO ?= "GPIOZ@2"
|
||||
XBEE_TTY ?= "ttySTM2"
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@ do_compile:append:stm32mpcommon() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Blacklist hci_uart module. It will be managed by the bluetooth-init script
|
||||
KERNEL_MODULE_PROBECONF:ccmp1 += "hci_uart"
|
||||
module_conf_hci_uart:ccmp1 = "blacklist hci_uart"
|
||||
|
||||
do_install:append:stm32mpcommon() {
|
||||
if ${@bb.utils.contains('MACHINE_FEATURES','gpu','true','false',d)}; then
|
||||
# when ACCEPT_EULA are filled
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (C) 2022-2024, Digi International Inc.
|
||||
# Copyright (C) 2022-2025, Digi International Inc.
|
||||
|
||||
SUMMARY = "Bluetooth init scripts"
|
||||
LICENSE = "GPL-2.0-only"
|
||||
|
|
@ -60,7 +60,9 @@ RDEPENDS:${PN} = "initscripts-functions"
|
|||
|
||||
# IW61x Bluetooth support requires the WiFi FW support
|
||||
RDEPENDS:${PN}:append:ccimx9 = " firmware-nxp-wifi-nxpiw612-sdio"
|
||||
RDEPENDS:${PN}:append:ccmp25 = " firmware-murata-infineon"
|
||||
# Murata - Infineon combo chip requires both WiFi and Bluetooth firmware
|
||||
RDEPENDS:${PN}:append:ccmp1 = " firmware-murata-infineon"
|
||||
RDEPENDS:${PN}:append:ccmp2 = " firmware-murata-infineon"
|
||||
|
||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul|ccimx8m|ccimx8x|ccimx9|ccmp25)"
|
||||
COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul|ccimx8m|ccimx8x|ccimx9|ccmp1|ccmp2)"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,93 @@
|
|||
#!/bin/sh
|
||||
#===============================================================================
|
||||
#
|
||||
# Copyright (C) 2025 by Digi International Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
#
|
||||
# !Description: Initialize Bluetooth interface
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
SCRIPTNAME="$(basename ${0})"
|
||||
RETRIES=3
|
||||
HCI_IFACE="hci0"
|
||||
MODULE_NAME="hci_uart"
|
||||
|
||||
if grep -qs '\<digi,ccmp13\>' /proc/device-tree/compatible; then
|
||||
# CCMP13 - BT_REG_EN - GPIO PD13
|
||||
GPIO_CHIP="GPIOD"
|
||||
GPIO_NUMBER="13"
|
||||
else
|
||||
# CCMP15 - BT_REG_EN - GPIO PZ6
|
||||
GPIO_CHIP="GPIOZ"
|
||||
GPIO_NUMBER="6"
|
||||
fi
|
||||
|
||||
log() {
|
||||
if type "systemd-cat" >/dev/null 2>/dev/null; then
|
||||
systemd-cat -p "${1}" -t "${SCRIPTNAME}" printf "%s" "${2}"
|
||||
else
|
||||
logger -p "${1}" -t "${SCRIPTNAME}" "${2}"
|
||||
fi
|
||||
}
|
||||
|
||||
bt_power() {
|
||||
gpioset "${GPIO_CHIP}" "${GPIO_NUMBER}"="${1}"
|
||||
}
|
||||
|
||||
is_kernel_module_loaded() {
|
||||
lsmod | grep -qs -w "^${MODULE_NAME}"
|
||||
}
|
||||
|
||||
bt_init() {
|
||||
# If module is already loaded, skip
|
||||
is_kernel_module_loaded && log info "kernel module already present, skipping" && return 1
|
||||
|
||||
for i in $(seq ${RETRIES}); do
|
||||
# Perform a power cycle
|
||||
bt_power 0
|
||||
sleep 0.5
|
||||
bt_power 1
|
||||
|
||||
# Load manually the kernel module
|
||||
modprobe "${MODULE_NAME}"
|
||||
sleep 1
|
||||
is_kernel_module_loaded && log info "Bluetooth activated" && return 0
|
||||
|
||||
log err "Cannot initialize Bluetooth, retrying..."
|
||||
done
|
||||
|
||||
log err "Failed to initialize Bluetooth interface"
|
||||
return 1
|
||||
}
|
||||
|
||||
bt_stop() {
|
||||
hciconfig ${HCI_IFACE} down
|
||||
# Unload HCI driver instance
|
||||
rmmod hci_uart
|
||||
rmmod btbcm
|
||||
# Disable Bluetooth chip
|
||||
bt_power 0 && log info "Bluetooth disabled" && return 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
bt_init
|
||||
;;
|
||||
stop)
|
||||
bt_stop
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Loading…
Reference in New Issue