lsmod |grep bt

btusb                  57344  0
btrtl                  20480  1 btusb
btbcm                  16384  1 btusb
btintel                24576  1 btusb
bluetooth             573440  41 btrtl,btintel,btbcm,bnep,btusb,rfcomm
 

通过上面这个mod信息,可以猜测,基本的驱动流程如下

linux 蓝牙驱动_linux

内核路径

net/bluetooth

drivers/bluetooth 

​https://linux-sunxi.org/Bluetooth​

每层协议名称:

These application profiles work on a stack of ​​protocols​​, similar in concept to the networking and USB stacks. For example the Object Push Profile (OPP) uses the OBject EXchange (OBEX) protocol, which uses the Radio Frequency COMMunication (RFCOMM) protocol, which uses the Logical Link Control and Adaptation Protocol (L2CAP), which uses the Host Controller Interface (HCI) protocol, which uses the radio link protocols.

This can rapidly become a complex area, but the user space tools make this all "just work" for users. It is beyond the scope of this page to configure Bluetooth profiles.

host和controler及其通讯组成了HCI

The Host Controller Interface is a lower level protocol in the Bluetooth stack. A host is usually a PC, tablet, SBC, phone, etc. A controller is the chip with the Bluetooth radio. Although some simpler Bluetooth devices, such as a headset, may have the host and controller implemented on a single processor.

The communication layer between host and controller can be over a number of interfaces, for example UART, USB and SPI.

HOST 是PC 、平板等,controller是带有蓝牙射频的芯片。host和controller可以通过uart usb spi等接口进行通讯,如下图所示

linux 蓝牙驱动_linux_02

​https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/bluetooth​​  传输层的驱动

​https://www.amd.e-technik.uni-rostock.de/ma/gol/lectures/wirlec/bluetooth_info/hci.html​