This patch sets up Qualcomm WCN399x to support the Android BQR commands.
Reviewed-by: Miao-chen Chou <[email protected]>
Signed-off-by: Joseph Hwang <[email protected]>
---
Changes in v2:
- Fix the title
drivers/bluetooth/hci_qca.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 53deea2eb7b4..bf576046681d 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -38,6 +38,7 @@
#include "hci_uart.h"
#include "btqca.h"
+#include "btandroid.h"
/* HCI_IBS protocol messages */
#define HCI_IBS_SLEEP_IND 0xFE
@@ -1730,6 +1731,7 @@ static int qca_setup(struct hci_uart *hu)
if (qca_is_wcn399x(soc_type) ||
qca_is_wcn6750(soc_type)) {
set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
+ hdev->set_quality_report = btandroid_set_quality_report;
ret = qca_read_soc_version(hdev, &ver, soc_type);
if (ret)
--
2.33.0.153.gba50c8fa24-goog
Hi Joseph,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on bluetooth-next/master]
[also build test ERROR on next-20210908]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Joseph-Hwang/Bluetooth-btandroid-Support-Android-Bluetooth-Quality-Report/20210908-192118
base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: x86_64-randconfig-s021-20210908 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/0day-ci/linux/commit/0d4d42904b8f0e73fef4d95c76688c57fc7ed7d0
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Joseph-Hwang/Bluetooth-btandroid-Support-Android-Bluetooth-Quality-Report/20210908-192118
git checkout 0d4d42904b8f0e73fef4d95c76688c57fc7ed7d0
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> ERROR: modpost: "btandroid_set_quality_report" [drivers/bluetooth/hci_uart.ko] undefined!
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
Hi Joseph,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on bluetooth-next/master]
[also build test ERROR on next-20210908]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Joseph-Hwang/Bluetooth-btandroid-Support-Android-Bluetooth-Quality-Report/20210908-192118
base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: i386-randconfig-f003-20200320 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/0d4d42904b8f0e73fef4d95c76688c57fc7ed7d0
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Joseph-Hwang/Bluetooth-btandroid-Support-Android-Bluetooth-Quality-Report/20210908-192118
git checkout 0d4d42904b8f0e73fef4d95c76688c57fc7ed7d0
# save the attached .config to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
ld: drivers/bluetooth/hci_qca.o: in function `qca_setup':
>> drivers/bluetooth/hci_qca.c:1734: undefined reference to `btandroid_set_quality_report'
vim +1734 drivers/bluetooth/hci_qca.c
1693
1694 static int qca_setup(struct hci_uart *hu)
1695 {
1696 struct hci_dev *hdev = hu->hdev;
1697 struct qca_data *qca = hu->priv;
1698 unsigned int speed, qca_baudrate = QCA_BAUDRATE_115200;
1699 unsigned int retries = 0;
1700 enum qca_btsoc_type soc_type = qca_soc_type(hu);
1701 const char *firmware_name = qca_get_firmware_name(hu);
1702 int ret;
1703 struct qca_btsoc_version ver;
1704
1705 ret = qca_check_speeds(hu);
1706 if (ret)
1707 return ret;
1708
1709 clear_bit(QCA_ROM_FW, &qca->flags);
1710 /* Patch downloading has to be done without IBS mode */
1711 set_bit(QCA_IBS_DISABLED, &qca->flags);
1712
1713 /* Enable controller to do both LE scan and BR/EDR inquiry
1714 * simultaneously.
1715 */
1716 set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
1717
1718 bt_dev_info(hdev, "setting up %s",
1719 qca_is_wcn399x(soc_type) ? "wcn399x" :
1720 (soc_type == QCA_WCN6750) ? "wcn6750" : "ROME/QCA6390");
1721
1722 qca->memdump_state = QCA_MEMDUMP_IDLE;
1723
1724 retry:
1725 ret = qca_power_on(hdev);
1726 if (ret)
1727 goto out;
1728
1729 clear_bit(QCA_SSR_TRIGGERED, &qca->flags);
1730
1731 if (qca_is_wcn399x(soc_type) ||
1732 qca_is_wcn6750(soc_type)) {
1733 set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
> 1734 hdev->set_quality_report = btandroid_set_quality_report;
1735
1736 ret = qca_read_soc_version(hdev, &ver, soc_type);
1737 if (ret)
1738 goto out;
1739 } else {
1740 qca_set_speed(hu, QCA_INIT_SPEED);
1741 }
1742
1743 /* Setup user speed if needed */
1744 speed = qca_get_speed(hu, QCA_OPER_SPEED);
1745 if (speed) {
1746 ret = qca_set_speed(hu, QCA_OPER_SPEED);
1747 if (ret)
1748 goto out;
1749
1750 qca_baudrate = qca_get_baudrate_value(speed);
1751 }
1752
1753 if (!(qca_is_wcn399x(soc_type) ||
1754 qca_is_wcn6750(soc_type))) {
1755 /* Get QCA version information */
1756 ret = qca_read_soc_version(hdev, &ver, soc_type);
1757 if (ret)
1758 goto out;
1759 }
1760
1761 /* Setup patch / NVM configurations */
1762 ret = qca_uart_setup(hdev, qca_baudrate, soc_type, ver,
1763 firmware_name);
1764 if (!ret) {
1765 clear_bit(QCA_IBS_DISABLED, &qca->flags);
1766 qca_debugfs_init(hdev);
1767 hu->hdev->hw_error = qca_hw_error;
1768 hu->hdev->cmd_timeout = qca_cmd_timeout;
1769 hu->hdev->prevent_wake = qca_prevent_wake;
1770 } else if (ret == -ENOENT) {
1771 /* No patch/nvm-config found, run with original fw/config */
1772 set_bit(QCA_ROM_FW, &qca->flags);
1773 ret = 0;
1774 } else if (ret == -EAGAIN) {
1775 /*
1776 * Userspace firmware loader will return -EAGAIN in case no
1777 * patch/nvm-config is found, so run with original fw/config.
1778 */
1779 set_bit(QCA_ROM_FW, &qca->flags);
1780 ret = 0;
1781 }
1782
1783 out:
1784 if (ret && retries < MAX_INIT_RETRIES) {
1785 bt_dev_warn(hdev, "Retry BT power ON:%d", retries);
1786 qca_power_shutdown(hu);
1787 if (hu->serdev) {
1788 serdev_device_close(hu->serdev);
1789 ret = serdev_device_open(hu->serdev);
1790 if (ret) {
1791 bt_dev_err(hdev, "failed to open port");
1792 return ret;
1793 }
1794 }
1795 retries++;
1796 goto retry;
1797 }
1798
1799 /* Setup bdaddr */
1800 if (soc_type == QCA_ROME)
1801 hu->hdev->set_bdaddr = qca_set_bdaddr_rome;
1802 else
1803 hu->hdev->set_bdaddr = qca_set_bdaddr;
1804
1805 return ret;
1806 }
1807
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]