Bluetooth: btrtl: add support for retrieving the UART settings
authorMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Thu, 2 Aug 2018 14:57:15 +0000 (16:57 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 3 Aug 2018 11:27:46 +0000 (13:27 +0200)
commitb85b0ee1001b112a3dd4c4718d80b0c40551a2bb
tree64fc92fdc2415b371df1b1da1ee5361ae98c7e69
parenta5c76e67ca82f12b6ba6d2cbc0d3ff5dc89c45af
Bluetooth: btrtl: add support for retrieving the UART settings

The UART settings are embedded in the config blob. This has to be parsed
to successfully initialize the Bluetooth part of the RTL8723BS (which is
an SDIO chip, but the Bluetooth part is connected via UART).

The Realtek "rtl8723bs_bt" and "rtl8723ds_bt" userspace Bluetooth UART
initialization tools (rtk_hciattach) use the following sequence:
- send H5 sync pattern (already supported by hci_h5)
- get LMP version (already supported by btrtl)
- get ROM version (already supported by btrtl)
- load the firmware and config for the current chipset (already
  supported by btrtl)
- read UART settings from the config blob (part of this patch)
- send UART settings via a vendor command to the device (which changes
  the baudrate of the device and enables or disables flow control
  depending on the config)
- change the baudrate and flow control settings on the host
- send the firmware and config blob to the device (already supported by
  btrtl)

Sending the last firmware and config blob download command
(rtl_download_cmd) fails if the UART settings are not updated
beforehand. This is presumably because the device applies the config
right after the firmware and config blob download - which means that at
this point the host is using different UART settings than the device
(which will obviously result in non-working communication).

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jeremy Cline <jeremy@jcline.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/btrtl.c
drivers/bluetooth/btrtl.h