All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND v3] Bluetooth: btusb: mediatek: fix WMT command failure during runtime suspend
@ 2022-07-29 14:43 sean.wang
  2022-07-29 16:11 ` [RESEND,v3] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: sean.wang @ 2022-07-29 14:43 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz
  Cc: sean.wang, Soul.Huang, YN.Chen, Leon.Yen, Eric-SY.Chang,
	Deren.Wu, km.lin, robin.chiu, Eddie.Chen, ch.yeh, posh.sun,
	ted.huang, Stella.Chang, Tom.Chou, steve.lee, jsiuda, frankgor,
	abhishekpandit, michaelfsun, mcchou, shawnku, linux-bluetooth,
	linux-mediatek, linux-kernel, Jing Cai

From: Sean Wang <sean.wang@mediatek.com>

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>
---
v2:
1. move usb_autopm_[get, put]_interface to btusb_mtk_hci_wmt_sync whenever
wmt cmd is invoked.
2. add the explanation why we needed the specific
usb_autopm_[get, put]_interface there.

v3: correct the version and there is no logic changed
---
 drivers/bluetooth/btusb.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 480ea891c09a..bdcfc3deea6c 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2453,15 +2453,29 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev,
 
 	set_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags);
 
+	/* 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.
+	 */
+	err = usb_autopm_get_interface(data->intf);
+	if (err < 0)
+		goto err_free_wc;
+
 	err = __hci_cmd_send(hdev, 0xfc6f, hlen, wc);
 
 	if (err < 0) {
 		clear_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags);
+		usb_autopm_put_interface(data->intf);
 		goto err_free_wc;
 	}
 
 	/* Submit control IN URB on demand to process the WMT event */
 	err = btusb_mtk_submit_wmt_recv_urb(hdev);
+
+	usb_autopm_put_interface(data->intf);
+
 	if (err < 0)
 		goto err_free_wc;
 
-- 
2.25.1


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

* RE: [RESEND,v3] Bluetooth: btusb: mediatek: fix WMT command failure during runtime suspend
  2022-07-29 14:43 [PATCH RESEND v3] Bluetooth: btusb: mediatek: fix WMT command failure during runtime suspend sean.wang
@ 2022-07-29 16:11 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2022-07-29 16:11 UTC (permalink / raw)
  To: linux-bluetooth, sean.wang

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=664093

---Test result---

Test Summary:
CheckPatch                    PASS      1.81 seconds
GitLint                       FAIL      0.55 seconds
SubjectPrefix                 PASS      0.42 seconds
BuildKernel                   PASS      39.40 seconds
BuildKernel32                 PASS      34.29 seconds
Incremental Build with patchesPASS      46.34 seconds
TestRunner: Setup             PASS      563.81 seconds
TestRunner: l2cap-tester      PASS      17.85 seconds
TestRunner: bnep-tester       PASS      6.79 seconds
TestRunner: mgmt-tester       PASS      105.84 seconds
TestRunner: rfcomm-tester     PASS      10.14 seconds
TestRunner: sco-tester        PASS      9.90 seconds
TestRunner: smp-tester        PASS      9.74 seconds
TestRunner: userchan-tester   PASS      6.81 seconds

Details
##############################
Test: GitLint - FAIL - 0.55 seconds
Run gitlint with rule in .gitlint
[RESEND,v3] Bluetooth: btusb: mediatek: fix WMT command failure during runtime suspend
1: T1 Title exceeds max length (86>80): "[RESEND,v3] Bluetooth: btusb: mediatek: fix WMT command failure during runtime suspend"




---
Regards,
Linux Bluetooth


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

end of thread, other threads:[~2022-07-29 16:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-29 14:43 [PATCH RESEND v3] Bluetooth: btusb: mediatek: fix WMT command failure during runtime suspend sean.wang
2022-07-29 16:11 ` [RESEND,v3] " bluez.test.bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.