From patchwork Fri Jun 10 00:17:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 12876240 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 CD2B0C433EF for ; Fri, 10 Jun 2022 00:18:06 +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=86XEVptdsxYWv4liCEmkzJ+upFyEUDrprdF1BUZhKPw=; b=AF0zYUVrw2070v ktHfRbURkeXEnavTQrTMmj6MPeY814imsv+XzwF2trcZYi97mPtuOayyLcNZGkN4GgH2s8P6WvOjB z+m3EKt3TM7+gWiLoHhNEK4eFuudl1Vd78gfzfYxCyVoJ9YzgtcaYeIXoGdWD1yA4hGtzdTWqKZrq ZGmdGleCwJjBTrveZM5GJcwvYu29/KmkOhevMHXdPvIICe6hGaR0hvjFapnfapreYtkaJ6QBJI7E7 2FthisVelma8j8LGs1gHr3xdCWRl9y4zzqyi32ewBPXg6cgyoLhs6tsGrCvoXWfPkHBh0ihJLcqWQ h7WO78sMfJAXog/pHAhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzSLd-004jQe-FL; Fri, 10 Jun 2022 00:17:57 +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 1nzSLZ-004jMl-4B for linux-mediatek@lists.infradead.org; Fri, 10 Jun 2022 00:17:55 +0000 X-UUID: a90c986047724c3bba219eadcc39695e-20220609 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.5,REQID:47a09f64-41da-4f6b-8fd7-375f6c2f7d40,OB:0,LO B:0,IP:0,URL:5,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,RULE:Release_Ham,ACTI ON:release,TS:5 X-CID-META: VersionHash:2a19b09,CLOUDID:c7eb4ee5-2ba2-4dc1-b6c5-11feb6c769e0,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:1,File:nil ,QS:0,BEC:nil X-UUID: a90c986047724c3bba219eadcc39695e-20220609 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1478725538; Thu, 09 Jun 2022 17:17:25 -0700 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 9 Jun 2022 17:17:24 -0700 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Fri, 10 Jun 2022 08:17:18 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.3 via Frontend Transport; Fri, 10 Jun 2022 08:17:18 +0800 From: To: , CC: , , , , , , , , , , , , , , , , , , , , , , , , , "Yake Yang" Subject: [PATCH] Bluetooth: btmtksdio: Add in-band wakeup support Date: Fri, 10 Jun 2022 08:17:17 +0800 Message-ID: <742cdffcf110e1601257207fb2b0d3f426d4008c.1654819586.git.objelf@gmail.com> 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-20220609_171753_223989_2AD76D87 X-CRM114-Status: GOOD ( 12.93 ) 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 'ce64b3e94919 ("Bluetooth: mt7921s: Support wake on bluetooth")' have added the waken-on-bluetooth via dedicated GPIO. The patch extends the function to the waken-on-bluetooth via SDIO DAT1 pin (inband wakeup) when the SDIO host driver is able to support. Co-developed-by: Yake Yang Signed-off-by: Yake Yang Signed-off-by: Sean Wang --- drivers/bluetooth/btmtksdio.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c index d6700efcfe8c..9ed3af4ba51a 100644 --- a/drivers/bluetooth/btmtksdio.c +++ b/drivers/bluetooth/btmtksdio.c @@ -118,6 +118,7 @@ MODULE_DEVICE_TABLE(sdio, btmtksdio_table); #define BTMTKSDIO_FUNC_ENABLED 3 #define BTMTKSDIO_PATCH_ENABLED 4 #define BTMTKSDIO_HW_RESET_ACTIVE 5 +#define BTMTKSDIO_INBAND_WAKEUP 6 struct mtkbtsdio_hdr { __le16 len; @@ -1294,6 +1295,9 @@ static bool btmtksdio_sdio_wakeup(struct hci_dev *hdev) .wakeup_delay = cpu_to_le16(0x20), }; + if (test_bit(BTMTKSDIO_INBAND_WAKEUP, &bdev->tx_state)) + return may_wakeup; + if (may_wakeup && bdev->data->chipid == 0x7921) { struct sk_buff *skb; @@ -1384,6 +1388,10 @@ static int btmtksdio_probe(struct sdio_func *func, */ pm_runtime_put_noidle(bdev->dev); + /* Mark if the mmc host can support waken by SDIO */ + if (device_can_wakeup(func->card->host->parent)) + set_bit(BTMTKSDIO_INBAND_WAKEUP, &bdev->tx_state); + err = device_init_wakeup(bdev->dev, true); if (err) bt_dev_err(hdev, "failed to initialize device wakeup");