wens recently spent some time figuring out Bluetooth support within the kernel using device tree and serdev for various Allwinner SoC based SBCs using AMPAK modules. These modules are based on chips from Broadcom’s Wireless IoT division, now Cypress. Previously we could already enable Bluetooth using a combination of userspace utilities and sysfs GPIO toggling. However this was quite fragile, depending on other devices (WiFi) enabling the required clocks and regulators. Having Bluetooth enabled with kernel drivers handling power sequencing and firmware would simplify userspace by not having every user hunt down the required “magical” scripts.
This is now achievable using the new serdev (Serial Device) subsystem, which allows us to describe and bind slave devices to UARTs. A Bluetooth device node is attached to the UART device node, describing clocks, regulators, and GPIO lines. The kernel driver would do all the power sequencing and also take care of uploading the firmware and registering the Bluetooth HCI device.
The patch series was developed and tested on Cubietech and Bananapi SBCs, with AP6210, AP6212, and AP6330 modules.