linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btmtksdio: Add in-band wakeup support
@ 2022-06-10  0:17 sean.wang
  2022-06-10  2:58 ` bluez.test.bot
  2022-06-10  7:16 ` [PATCH] " Paul Menzel
  0 siblings, 2 replies; 4+ messages in thread
From: sean.wang @ 2022-06-10  0:17 UTC (permalink / raw)
  To: marcel, johan.hedberg
  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, Eric.Liang, Stella.Chang, Tom.Chou, steve.lee, jsiuda,
	frankgor, abhishekpandit, michaelfsun, mcchou, shawnku,
	linux-bluetooth, linux-mediatek, linux-kernel, Yake Yang

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

'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 <yake.yang@mediatek.com>
Signed-off-by: Yake Yang <yake.yang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 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");
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread
[parent not found: <1472eccd-429b-0a18-565c-7de2e5ed44f2@molgen.mpg.de--annotate>]

end of thread, other threads:[~2022-06-21 22:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10  0:17 [PATCH] Bluetooth: btmtksdio: Add in-band wakeup support sean.wang
2022-06-10  2:58 ` bluez.test.bot
2022-06-10  7:16 ` [PATCH] " Paul Menzel
     [not found] <1472eccd-429b-0a18-565c-7de2e5ed44f2@molgen.mpg.de--annotate>
2022-06-21 22:51 ` sean.wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).