Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: a1c49c434e15 ("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>

authored by

Sean Wang and committed by
Luiz Augusto von Dentz
fd3f1066 a0476f6a

+14
+14
drivers/bluetooth/btusb.c
··· 2482 2482 2483 2483 set_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags); 2484 2484 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 + 2485 2495 err = __hci_cmd_send(hdev, 0xfc6f, hlen, wc); 2486 2496 2487 2497 if (err < 0) { 2488 2498 clear_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags); 2499 + usb_autopm_put_interface(data->intf); 2489 2500 goto err_free_wc; 2490 2501 } 2491 2502 2492 2503 /* Submit control IN URB on demand to process the WMT event */ 2493 2504 err = btusb_mtk_submit_wmt_recv_urb(hdev); 2505 + 2506 + usb_autopm_put_interface(data->intf); 2507 + 2494 2508 if (err < 0) 2495 2509 goto err_free_wc; 2496 2510