mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] Bluetooth: hci_qca: Wait for baudrate change event on WCN6750/6855/7850/QCC2072
@ 2026-12-02 13:14 Shuai Zhang
  2026-12-03  2:40 ` kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Shuai Zhang @ 2026-12-02 13:14 UTC (permalink / raw)
  To: Bartosz Golaszewski, Marcel Holtmann, Luiz Augusto von Dentz
  Cc: linux-arm-msm, linux-bluetooth, linux-kernel, chejiang,
	quic_chezhou, wei.deng, jinwang.li, mengshi.wu, Cheng Jiang,
	Shuai Zhang

From: Cheng Jiang <cheng.jiang@oss.qualcomm.com>

The baudrate change command (0xfc48) is written straight to the UART, so
the HCI core does not track it. WCN6750, WCN6855, WCN7850 and QCC2072
answer it with a Command Complete event. The event arrives while the
first firmware download command is pending and ends up as:

  Bluetooth: hci0: unexpected event for opcode 0xfc48

Handle these SoCs like WCN3988/WCN3990: drop the event in
qca_recv_event() and wait for it in qca_set_speed().

Getting the event also confirms that the controller really switched to
the new baudrate. Without the wait, a mismatch between host and
controller only shows up later as a firmware download timeout.

Signed-off-by: Cheng Jiang <cheng.jiang@oss.qualcomm.com>
Signed-off-by: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
---
changes for v2
 -- Change the commit author
 -- Link v1
    https://lore.kernel.org/all/20261202110933.2986272-1-shuai.zhang@oss.qualcomm.com/
---
 drivers/bluetooth/hci_qca.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index b6d7d0120..73722bbf1 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1229,7 +1229,10 @@ static int qca_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
 		 * vendor command).
 		 */
 
-		if (hdr->evt == HCI_EV_VENDOR)
+		/* Newer SoCs answer the baudrate change with a Command Complete
+		 * instead of a vendor event. Drop it too.
+		 */
+		if (hdr->evt == HCI_EV_VENDOR || hdr->evt == HCI_EV_CMD_COMPLETE)
 			complete(&qca->drop_ev_comp);
 
 		kfree_skb(skb);
@@ -1527,6 +1530,10 @@ static int qca_set_speed(struct hci_uart *hu, enum qca_speed_type speed_type)
 
 		switch (soc_type) {
 		case QCA_WCN3990:
+		case QCA_WCN6750:
+		case QCA_WCN6855:
+		case QCA_WCN7850:
+		case QCA_QCC2072:
 			reinit_completion(&qca->drop_ev_comp);
 			set_bit(QCA_DROP_VENDOR_EVENT, &qca->flags);
 			break;
@@ -1563,6 +1570,10 @@ static int qca_set_speed(struct hci_uart *hu, enum qca_speed_type speed_type)
 
 		switch (soc_type) {
 		case QCA_WCN3990:
+		case QCA_WCN6750:
+		case QCA_WCN6855:
+		case QCA_WCN7850:
+		case QCA_QCC2072:
 			/* Wait for the controller to send the vendor event
 			 * for the baudrate change command.
 			 */
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] Bluetooth: hci_qca: Wait for baudrate change event on WCN6750/6855/7850/QCC2072
  2026-12-02 13:14 [PATCH v2] Bluetooth: hci_qca: Wait for baudrate change event on WCN6750/6855/7850/QCC2072 Shuai Zhang
@ 2026-12-03  2:40 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-12-03  2:40 UTC (permalink / raw)
  To: Shuai Zhang, Bartosz Golaszewski, Marcel Holtmann,
	Luiz Augusto von Dentz
  Cc: llvm, oe-kbuild-all, linux-arm-msm, linux-bluetooth,
	linux-kernel, chejiang, quic_chezhou, wei.deng, jinwang.li,
	mengshi.wu, Cheng Jiang, Shuai Zhang

Hi Shuai,

kernel test robot noticed the following build errors:

[auto build test ERROR on bluetooth/master]
[also build test ERROR on bluetooth-next/master linus/master v7.4-rc5 next-20261202]
[cannot apply to linux-review/Shuai-Zhang/Bluetooth-hci_qca-Wait-for-baudrate-change-event-on-WCN6750-6855-7850-QCC2072/20261202-190933]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Shuai-Zhang/Bluetooth-hci_qca-Wait-for-baudrate-change-event-on-WCN6750-6855-7850-QCC2072/20261202-211436
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
patch link:    https://lore.kernel.org/r/20261202131436.3448000-1-shuai.zhang%40oss.qualcomm.com
patch subject: [PATCH v2] Bluetooth: hci_qca: Wait for baudrate change event on WCN6750/6855/7850/QCC2072
config: i386-randconfig-1000-20261203 (https://download.01.org/0day-ci/archive/20261203/20261203103436.SmEVip6z-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261203/20261203103436.SmEVip6z-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261203103436.SmEVip6z-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/bluetooth/hci_qca.c:1540:8: error: use of undeclared identifier 'QCA_QCC2072'; did you mean 'QCA_QCA2066'?
    1540 |                 case QCA_QCC2072:
         |                      ^~~~~~~~~~~
         |                      QCA_QCA2066
   drivers/bluetooth/btqca.h:156:2: note: 'QCA_QCA2066' declared here
     156 |         QCA_QCA2066,
         |         ^
   drivers/bluetooth/hci_qca.c:1580:8: error: use of undeclared identifier 'QCA_QCC2072'; did you mean 'QCA_QCA2066'?
    1580 |                 case QCA_QCC2072:
         |                      ^~~~~~~~~~~
         |                      QCA_QCA2066
   drivers/bluetooth/btqca.h:156:2: note: 'QCA_QCA2066' declared here
     156 |         QCA_QCA2066,
         |         ^
   2 errors generated.


vim +1540 drivers/bluetooth/hci_qca.c

  1497	
  1498	static int qca_set_speed(struct hci_uart *hu, enum qca_speed_type speed_type)
  1499	{
  1500		unsigned int speed, qca_baudrate;
  1501		struct qca_data *qca = hu->priv;
  1502		int ret = 0;
  1503	
  1504		if (speed_type == QCA_INIT_SPEED) {
  1505			speed = qca_get_speed(hu, QCA_INIT_SPEED);
  1506			if (speed)
  1507				host_set_baudrate(hu, speed);
  1508		} else {
  1509			enum qca_btsoc_type soc_type = qca_soc_type(hu);
  1510	
  1511			speed = qca_get_speed(hu, QCA_OPER_SPEED);
  1512			if (!speed)
  1513				return 0;
  1514	
  1515			/* Disable flow control for wcn3990 to deassert RTS while
  1516			 * changing the baudrate of chip and host.
  1517			 */
  1518			switch (soc_type) {
  1519			case QCA_WCN3950:
  1520			case QCA_WCN3988:
  1521			case QCA_WCN3990:
  1522			case QCA_WCN3991:
  1523			case QCA_WCN3998:
  1524			case QCA_WCN6750:
  1525			case QCA_QCA2066:
  1526			case QCA_WCN6855:
  1527			case QCA_WCN7850:
  1528				hci_uart_set_flow_control(hu, true);
  1529				break;
  1530	
  1531			default:
  1532				break;
  1533			}
  1534	
  1535			switch (soc_type) {
  1536			case QCA_WCN3990:
  1537			case QCA_WCN6750:
  1538			case QCA_WCN6855:
  1539			case QCA_WCN7850:
> 1540			case QCA_QCC2072:
  1541				reinit_completion(&qca->drop_ev_comp);
  1542				set_bit(QCA_DROP_VENDOR_EVENT, &qca->flags);
  1543				break;
  1544	
  1545			default:
  1546				break;
  1547			}
  1548	
  1549			qca_baudrate = qca_get_baudrate_value(speed);
  1550			bt_dev_dbg(hu->hdev, "Set UART speed to %d", speed);
  1551			ret = qca_set_baudrate(hu->hdev, qca_baudrate);
  1552			if (ret)
  1553				goto error;
  1554	
  1555			host_set_baudrate(hu, speed);
  1556	
  1557	error:
  1558			switch (soc_type) {
  1559			case QCA_WCN3950:
  1560			case QCA_WCN3988:
  1561			case QCA_WCN3990:
  1562			case QCA_WCN3991:
  1563			case QCA_WCN3998:
  1564			case QCA_WCN6750:
  1565			case QCA_QCA2066:
  1566			case QCA_WCN6855:
  1567			case QCA_WCN7850:
  1568				hci_uart_set_flow_control(hu, false);
  1569				break;
  1570	
  1571			default:
  1572				break;
  1573			}
  1574	
  1575			switch (soc_type) {
  1576			case QCA_WCN3990:
  1577			case QCA_WCN6750:
  1578			case QCA_WCN6855:
  1579			case QCA_WCN7850:
  1580			case QCA_QCC2072:
  1581				/* Wait for the controller to send the vendor event
  1582				 * for the baudrate change command.
  1583				 */
  1584				if (!wait_for_completion_timeout(&qca->drop_ev_comp,
  1585							 msecs_to_jiffies(100))) {
  1586					bt_dev_err(hu->hdev,
  1587						   "Failed to change controller baudrate\n");
  1588					ret = -ETIMEDOUT;
  1589				}
  1590	
  1591				clear_bit(QCA_DROP_VENDOR_EVENT, &qca->flags);
  1592				break;
  1593	
  1594			default:
  1595				break;
  1596			}
  1597		}
  1598	
  1599		return ret;
  1600	}
  1601	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-03  2:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-02 13:14 [PATCH v2] Bluetooth: hci_qca: Wait for baudrate change event on WCN6750/6855/7850/QCC2072 Shuai Zhang
2026-12-03  2:40 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®