Skip to content

Commit fd3f106

Browse files
moore-brosVudentz
authored andcommitted
Bluetooth: btusb: mediatek: fix WMT failure during runtime suspend
WMT cmd/event doesn't follow up the generic HCI cmd/event handling, it needs constantly polling control pipe until the host received the WMT event, thus, we should require to specifically acquire PM counter on the USB to prevent the interface from entering auto suspended while WMT cmd/event in progress. Fixes: a1c49c4 ("Bluetooth: btusb: Add protocol support for MediaTek MT7668U USB devices") Co-developed-by: Jing Cai <jing.cai@mediatek.com> Signed-off-by: Jing Cai <jing.cai@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
1 parent a0476f6 commit fd3f106

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/bluetooth/btusb.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2482,15 +2482,29 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev,
24822482

24832483
set_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags);
24842484

2485+
/* WMT cmd/event doesn't follow up the generic HCI cmd/event handling,
2486+
* it needs constantly polling control pipe until the host received the
2487+
* WMT event, thus, we should require to specifically acquire PM counter
2488+
* on the USB to prevent the interface from entering auto suspended
2489+
* while WMT cmd/event in progress.
2490+
*/
2491+
err = usb_autopm_get_interface(data->intf);
2492+
if (err < 0)
2493+
goto err_free_wc;
2494+
24852495
err = __hci_cmd_send(hdev, 0xfc6f, hlen, wc);
24862496

24872497
if (err < 0) {
24882498
clear_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags);
2499+
usb_autopm_put_interface(data->intf);
24892500
goto err_free_wc;
24902501
}
24912502

24922503
/* Submit control IN URB on demand to process the WMT event */
24932504
err = btusb_mtk_submit_wmt_recv_urb(hdev);
2505+
2506+
usb_autopm_put_interface(data->intf);
2507+
24942508
if (err < 0)
24952509
goto err_free_wc;
24962510

0 commit comments

Comments
 (0)