All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btmtksdio: Add in-band wakeup support
@ 2022-06-10  0:17 ` sean.wang
  0 siblings, 0 replies; 6+ 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] 6+ messages in thread

* [PATCH] Bluetooth: btmtksdio: Add in-band wakeup support
@ 2022-06-10  0:17 ` sean.wang
  0 siblings, 0 replies; 6+ 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


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* RE: Bluetooth: btmtksdio: Add in-band wakeup support
  2022-06-10  0:17 ` sean.wang
  (?)
@ 2022-06-10  2:58 ` bluez.test.bot
  -1 siblings, 0 replies; 6+ messages in thread
From: bluez.test.bot @ 2022-06-10  2:58 UTC (permalink / raw)
  To: linux-bluetooth, sean.wang

[-- Attachment #1: Type: text/plain, Size: 1458 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=649029

---Test result---

Test Summary:
CheckPatch                    PASS      0.94 seconds
GitLint                       PASS      0.58 seconds
SubjectPrefix                 PASS      0.40 seconds
BuildKernel                   PASS      31.50 seconds
BuildKernel32                 PASS      27.88 seconds
Incremental Build with patchesPASS      38.46 seconds
TestRunner: Setup             PASS      476.73 seconds
TestRunner: l2cap-tester      PASS      17.07 seconds
TestRunner: bnep-tester       PASS      5.76 seconds
TestRunner: mgmt-tester       FAIL      104.69 seconds
TestRunner: rfcomm-tester     PASS      9.32 seconds
TestRunner: sco-tester        PASS      8.97 seconds
TestRunner: smp-tester        PASS      9.20 seconds
TestRunner: userchan-tester   PASS      6.01 seconds

Details
##############################
Test: TestRunner: mgmt-tester - FAIL - 104.69 seconds
Run test-runner with mgmt-tester
Total: 493, Passed: 491 (99.6%), Failed: 2, Not Run: 0

Failed Test Cases
Add Advertising - Success (Name+data+appear)         Timed out    2.360 seconds
Add Ext Advertising - Success (Name+data+appear)     Timed out    2.572 seconds



---
Regards,
Linux Bluetooth


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

* Re: [PATCH] Bluetooth: btmtksdio: Add in-band wakeup support
  2022-06-10  0:17 ` sean.wang
@ 2022-06-10  7:16   ` Paul Menzel
  -1 siblings, 0 replies; 6+ messages in thread
From: Paul Menzel @ 2022-06-10  7:16 UTC (permalink / raw)
  To: Sean Wang
  Cc: marcel, johan.hedberg, 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

Dear Sean,


Thank you for the patch.

Am 10.06.22 um 02:17 schrieb sean.wang@mediatek.com:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> 'ce64b3e94919 ("Bluetooth: mt7921s: Support wake on bluetooth")'
> have added the waken-on-bluetooth via dedicated GPIO.

Maybe:

Commit ce64b3e94919 ("Bluetooth: mt7921s: Support wake on bluetooth") 
adds the wake on bluethooth via a 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.

Maybe:

Extend the wake-on-bluetooth to use the SDIO DAT1 pin (in-band wakeup), 
when supported by the SDIO host driver.

How did you test this? In what datasheet is it documented?

> 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 */

Maybe:

Mark if MMC host supports wake on bluetooth 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");


Kind regards,

Paul

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

* Re: [PATCH] Bluetooth: btmtksdio: Add in-band wakeup support
@ 2022-06-10  7:16   ` Paul Menzel
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Menzel @ 2022-06-10  7:16 UTC (permalink / raw)
  To: Sean Wang
  Cc: marcel, johan.hedberg, 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

Dear Sean,


Thank you for the patch.

Am 10.06.22 um 02:17 schrieb sean.wang@mediatek.com:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> 'ce64b3e94919 ("Bluetooth: mt7921s: Support wake on bluetooth")'
> have added the waken-on-bluetooth via dedicated GPIO.

Maybe:

Commit ce64b3e94919 ("Bluetooth: mt7921s: Support wake on bluetooth") 
adds the wake on bluethooth via a 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.

Maybe:

Extend the wake-on-bluetooth to use the SDIO DAT1 pin (in-band wakeup), 
when supported by the SDIO host driver.

How did you test this? In what datasheet is it documented?

> 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 */

Maybe:

Mark if MMC host supports wake on bluetooth 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");


Kind regards,

Paul

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH] Bluetooth: btmtksdio: Add in-band wakeup support
       [not found] <1472eccd-429b-0a18-565c-7de2e5ed44f2@molgen.mpg.de--annotate>
@ 2022-06-21 22:51 ` sean.wang
  0 siblings, 0 replies; 6+ messages in thread
From: sean.wang @ 2022-06-21 22:51 UTC (permalink / raw)
  To: pmenzel
  Cc: marcel, johan.hedberg, 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

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

>Dear Sean,
>
>
>Thank you for the patch.
>
>Am 10.06.22 um 02:17 schrieb sean.wang@mediatek.com:
>> From: Sean Wang <sean.wang@mediatek.com>
>>
>> 'ce64b3e94919 ("Bluetooth: mt7921s: Support wake on bluetooth")'
>> have added the waken-on-bluetooth via dedicated GPIO.
>
>Maybe:
>
>Commit ce64b3e94919 ("Bluetooth: mt7921s: Support wake on bluetooth") adds the wake on bluethooth via a dedicated GPIO.

Thanks! Look good to me. I will add it in the next version.

>
>> 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.
>
>Maybe:
>
>Extend the wake-on-bluetooth to use the SDIO DAT1 pin (in-band wakeup), when supported by the SDIO host driver.
>

Thanks! Look good to me. I will add it in the next version.

>How did you test this? In what datasheet is it documented?

We tested it on the MT8186 platform with wakening up by the keyboard or mouse when the platform is in the suspend state.

We can see the details on SDIO DAT1 pin in SDIO specification ver 3.00 section 8.2 Asynchronous Interrupt:
During the asynchronous interrupt period, the host can stop providing an SD clock to the card and the card
can generate an interrupt via SDIO DATA1 without SD clock.

or you can check the patch ("mmc: mediatek: add support for SDIO eint wakup IRQ")
in https://patchwork.kernel.org/project/linux-arm-kernel/patch/20220523074017.12649-4-axe.yang@mediatek.com/
that is the actual patch btmtksdio was tested against on MT8186 platfrom.

>
>> 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 */
>
>Maybe:
>
>Mark if MMC host supports wake on bluetooth by SDIO

Thanks! Look good to me. I will add it in the next version.

>
>> +	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");
>
>
>Kind regards,
>
>Paul
>
>

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

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

Thread overview: 6+ 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  0:17 ` sean.wang
2022-06-10  2:58 ` bluez.test.bot
2022-06-10  7:16 ` [PATCH] " Paul Menzel
2022-06-10  7:16   ` Paul Menzel
     [not found] <1472eccd-429b-0a18-565c-7de2e5ed44f2@molgen.mpg.de--annotate>
2022-06-21 22:51 ` sean.wang

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.