linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] Bluetooth: hci_qca: Drop unused event during BT on
@ 2024-08-21 10:50 Cheng Jiang
  2025-05-28  6:48 ` Steev Klimaszewski
  2025-05-29 16:37 ` [v2] Bluetooth: hci_qca: Drop unused event during BT on Steev Klimaszewski
  0 siblings, 2 replies; 3+ messages in thread
From: Cheng Jiang @ 2024-08-21 10:50 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz; +Cc: linux-bluetooth, linux-kernel

For the WCN6750/WCN6855/WCN7850, the vendor command for a baudrate
change is not sent as synchronous HCI command, controller sends the
corresponding vendor event with the new baudrate. It needs to be
dropped, otherwise it may be misinterpreted as response to a later
command.

According to
80-WL520-14_REV_F_Bluetooth_HCI_Vendor_Specific_Commands_Application_Note.pdf
event for set baudrate HCI command is sent with event code
HCI_EV_CMD_COMPLETE(0x0e), add related handle in qca_recv_event when
sending set baudrate HCI command.

Signed-off-by: Cheng Jiang <quic_chejiang@quicinc.com>
---
 drivers/bluetooth/hci_qca.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index ca6466676902..8dacf6dcf248 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1206,7 +1206,14 @@ static int qca_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
 		 * vendor command).
 		 */
 
-		if (hdr->evt == HCI_EV_VENDOR)
+		/* For the WCN6750/WCN6855/WCN7850, like the WCN3990, the
+		 * vendor command for a baudrate change command isn't sent as
+		 * synchronous HCI command, the controller sends the corresponding
+		 * command complete event with the new baudrate. The event is
+		 * received and properly decoded after changing the baudrate of
+		 * the host port. It needs to be dropped.
+		 */
+		if (hdr->evt == HCI_EV_VENDOR || hdr->evt == HCI_EV_CMD_COMPLETE)
 			complete(&qca->drop_ev_comp);
 
 		kfree_skb(skb);
@@ -1497,6 +1504,9 @@ 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:
 			reinit_completion(&qca->drop_ev_comp);
 			set_bit(QCA_DROP_VENDOR_EVENT, &qca->flags);
 			break;
@@ -1531,6 +1541,9 @@ 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:
 			/* Wait for the controller to send the vendor event
 			 * for the baudrate change command.
 			 */
-- 
2.25.1


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

* (no subject)
  2024-08-21 10:50 [PATCH v2] Bluetooth: hci_qca: Drop unused event during BT on Cheng Jiang
@ 2025-05-28  6:48 ` Steev Klimaszewski
  2025-05-29 16:37 ` [v2] Bluetooth: hci_qca: Drop unused event during BT on Steev Klimaszewski
  1 sibling, 0 replies; 3+ messages in thread
From: Steev Klimaszewski @ 2025-05-28  6:48 UTC (permalink / raw)
  To: quic_chejiang; +Cc: linux-bluetooth, linux-kernel, luiz.dentz, marcel


Subject: Re: [PATCH v2] Bluetooth: hci_qcca: Drop unused event during BT on

Hi Cheng,

I have been looking into a long standing issue on the Thinkpad X13s, which has a
WCN6855 where every so often would get the following error in dmesg output:

Bluetooth: hci0: unexpected event for opcode 0xfc48

I don't get the message super often, 11 times since 16 April, though I do not
know how many reboots happened in that time.

I noticed you wrote this patch 9 months ago, and I've applied it locally and in
my testing, with it applied, I cannot get the unexpected event anymore.  Looking
in patchwork, it says this patch was superseded, but I can't find what its
replacement is.

Does anyone know if this patch just fell through the cracks?

-- steev

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

* Re: [v2] Bluetooth: hci_qca: Drop unused event during BT on
  2024-08-21 10:50 [PATCH v2] Bluetooth: hci_qca: Drop unused event during BT on Cheng Jiang
  2025-05-28  6:48 ` Steev Klimaszewski
@ 2025-05-29 16:37 ` Steev Klimaszewski
  1 sibling, 0 replies; 3+ messages in thread
From: Steev Klimaszewski @ 2025-05-29 16:37 UTC (permalink / raw)
  To: quic_chejiang; +Cc: linux-bluetooth, linux-kernel, luiz.dentz, marcel

I have been looking into a long standing issue on the Thinkpad X13s, which has a
WCN6855 where every so often would get the following error in dmesg output:

Bluetooth: hci0: unexpected event for opcode 0xfc48

I don't get the message super often, 11 times since 16 April, though I do not
know how many reboots happened in that time.

I noticed you wrote this patch 9 months ago, and I've applied it locally and in
my testing, with it applied, I cannot get the unexpected event anymore.  Looking
in patchwork, it says this patch was superseded, but I can't find what its
replacement is.

Does anyone know if this patch just fell through the cracks?

-- steev

Resending due to the previous reply having an empty subject, I am not sure how
that happened as the subject seemed to move into the body of the email.  Sorry
for the noise!

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

end of thread, other threads:[~2025-05-29 16:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-21 10:50 [PATCH v2] Bluetooth: hci_qca: Drop unused event during BT on Cheng Jiang
2025-05-28  6:48 ` Steev Klimaszewski
2025-05-29 16:37 ` [v2] Bluetooth: hci_qca: Drop unused event during BT on Steev Klimaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).