From patchwork Thu May 12 21:38:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 12848152 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0BEF9C433FE for ; Thu, 12 May 2022 21:48:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=gAvrxyFmyDgifcAhL5gW4xkrFk1dhhKsjs65Zh85vEo=; b=CZPSi4Lqd/hbPQ dMVadWE1bkn40uZcZY24B7pX3XZ48/2U0YLZqqtK1883F0kwb0SIVdoJrvCrfv+jExXIuaEgxh8zt FgJB+30Xj4zMW9L06zSTD2jqrnPEN6mRX7WFrn9wuQq6inXxrPqh+eSNfTkw/0AJuqOqkHGYV1nu1 hK9aIYSkVSGLBfSoe9b2Zuqww6uDJvB0BsGhSsn2vl1g30QU97SNFSQfQwvT1g/3wwUNorMBkQObf TnbrIIYOilqL7kfY5YBrYqLAXgl5F8qr+d45TOlnRrSELvQtFpQ/Nmqs5cGLSX5dlVyFwXC0iqgNy k3YlSTu8I+UBdBT+xm8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1npGfb-00DftC-6e; Thu, 12 May 2022 21:48:27 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1npGfY-00DfsS-MS for linux-mediatek@lists.infradead.org; Thu, 12 May 2022 21:48:26 +0000 X-UUID: 2457f34b45af41cd85d3e10b0dd4c589-20220512 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.4, REQID:cb43ece5-bca8-49bd-85c9-9416e9e6690f, OB:0, LO B:0,IP:0,URL:5,TC:0,Content:55,EDM:0,RT:0,SF:0,FILE:0,RULE:Release_Ham,ACT ION:release,TS:60 X-CID-META: VersionHash:faefae9, CLOUDID:d5961aa7-eab7-4b74-a74d-5359964535a9, C OID:IGNORED,Recheck:0,SF:801,TC:nil,Content:3,EDM:-3,File:nil,QS:0,BEC:nil X-UUID: 2457f34b45af41cd85d3e10b0dd4c589-20220512 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 805009109; Thu, 12 May 2022 14:48:17 -0700 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 12 May 2022 14:38:15 -0700 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.3; Fri, 13 May 2022 05:38:14 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 13 May 2022 05:38:13 +0800 From: To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , "Yake Yang" Subject: [PATCH 1/2] Bluetooth: btmtksdio: fix the reset takes too long Date: Fri, 13 May 2022 05:38:11 +0800 Message-ID: X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220512_144824_789304_ACDF8F1F X-CRM114-Status: GOOD ( 12.69 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Sending WMT command during the reset in progress is invalid and would get no response from firmware until the reset is complete, so we ignore the WMT command here to resolve the issue which causes the whole reset process taking too long. Fixes: 8fafe702253d ("Bluetooth: mt7921s: support bluetooth reset mechanism") Co-developed-by: Yake Yang Signed-off-by: Yake Yang Signed-off-by: Sean Wang Tested-by: AngeloGioacchino Del Regno --- drivers/bluetooth/btmtksdio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c index 4ae6631a7c29..26e27fd79a21 100644 --- a/drivers/bluetooth/btmtksdio.c +++ b/drivers/bluetooth/btmtksdio.c @@ -1189,6 +1189,10 @@ static int btmtksdio_shutdown(struct hci_dev *hdev) */ pm_runtime_get_sync(bdev->dev); + /* wmt command only works until the reset is complete */ + if (test_bit(BTMTKSDIO_HW_RESET_ACTIVE, &bdev->tx_state)) + goto ignore_wmt_cmd; + /* Disable the device */ wmt_params.op = BTMTK_WMT_FUNC_CTRL; wmt_params.flag = 0; @@ -1202,6 +1206,7 @@ static int btmtksdio_shutdown(struct hci_dev *hdev) return err; } +ignore_wmt_cmd: pm_runtime_put_noidle(bdev->dev); pm_runtime_disable(bdev->dev);