From nobody Fri Dec 19 18:41:52 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D92AC38A2D for ; Mon, 24 Oct 2022 14:06:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231132AbiJXOG3 (ORCPT ); Mon, 24 Oct 2022 10:06:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235443AbiJXOCu (ORCPT ); Mon, 24 Oct 2022 10:02:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5005CC06A2; Mon, 24 Oct 2022 05:48:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5B5F2612E7; Mon, 24 Oct 2022 12:40:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DC6DC433C1; Mon, 24 Oct 2022 12:40:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615253; bh=kOL2fNKhcpIrYPRQ+MlcJv2xdGAiH3dzLt3TQGFnz4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j2TVwrFSTisx93OHuiB3ixPxL6nOf0MEmMVpJ90BnGSziRdQVhsY+NdbgE786K/Ut BOqbUmTWj0bCcdFX6k25qr4S+oE4Eqc71dbX+KoyWiiPBJtmDfFwDAz1/uhO2OYlHE /keJSqjHhv4JIk1pdOz0Y5KaN2hd6OECv61UnmUo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jing Cai , Sean Wang , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 5.15 163/530] Bluetooth: btusb: mediatek: fix WMT failure during runtime suspend Date: Mon, 24 Oct 2022 13:28:27 +0200 Message-Id: <20221024113052.436988326@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Wang [ Upstream commit fd3f106677bac70437dc12e76c827294ed495a44 ] 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 M= T7668U USB devices") Co-developed-by: Jing Cai Signed-off-by: Jing Cai Signed-off-by: Sean Wang Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- drivers/bluetooth/btusb.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 627436329b50..64d72ea0c310 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -2435,15 +2435,29 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *h= dev, =20 set_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags); =20 + /* 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 =3D usb_autopm_get_interface(data->intf); + if (err < 0) + goto err_free_wc; + err =3D __hci_cmd_send(hdev, 0xfc6f, hlen, wc); =20 if (err < 0) { clear_bit(BTUSB_TX_WAIT_VND_EVT, &data->flags); + usb_autopm_put_interface(data->intf); goto err_free_wc; } =20 /* Submit control IN URB on demand to process the WMT event */ err =3D btusb_mtk_submit_wmt_recv_urb(hdev); + + usb_autopm_put_interface(data->intf); + if (err < 0) goto err_free_wc; =20 --=20 2.35.1