* Re: [PATCH 2/4] Bluetooth: btmtksdio: handle runtime pm only when sdio_func is available
[not found] <74A2D0D6-6A65-4832-BAFC-BCBA68F8DE78@holtmann.org--annotate>
@ 2021-11-25 8:22 ` sean.wang
0 siblings, 0 replies; 3+ messages in thread
From: sean.wang @ 2021-11-25 8:22 UTC (permalink / raw)
To: marcel, johan.hedberg
Cc: Mark-YW.Chen, 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, jemele, abhishekpandit, michaelfsun,
mcchou, shawnku, linux-bluetooth, linux-mediatek, linux-kernel
From: Sean Wang <sean.wang@mediatek.com>
>>Hi Sean,
>
>> Runtime pm ops is not aware the sdio_func status that is probably
>> being disabled by btmtksdio_close. Thus, we are only able to access
>> the sdio_func for the runtime pm operations only when the sdio_func is
>> available.
>>
>> Fixes: 7f3c563c575e7 ("Bluetooth: btmtksdio: Add runtime PM support to
>> SDIO based Bluetooth")
>> Co-developed-by: Mark-yw Chen <mark-yw.chen@mediatek.com>
>> Signed-off-by: Mark-yw Chen <mark-yw.chen@mediatek.com>
>> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
>> ---
>> drivers/bluetooth/btmtksdio.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/bluetooth/btmtksdio.c
>> b/drivers/bluetooth/btmtksdio.c index 4f3412ad8fca..4c46c62e4623
>> 100644
>> --- a/drivers/bluetooth/btmtksdio.c
>> +++ b/drivers/bluetooth/btmtksdio.c
>> @@ -1037,6 +1037,9 @@ static int btmtksdio_runtime_suspend(struct device *dev)
>> if (!bdev)
>> return 0;
>>
>> + if (!test_bit(HCI_RUNNING, &bdev->hdev->flags))
>> + return 0;
>> +
>> sdio_claim_host(bdev->func);
>>
>> sdio_writel(bdev->func, C_FW_OWN_REQ_SET, MTK_REG_CHLPCR, &err); @@
>> -1064,6 +1067,9 @@ static int btmtksdio_runtime_resume(struct device *dev)
>> if (!bdev)
>> return 0;
>>
>> + if (!test_bit(HCI_RUNNING, &bdev->hdev->flags))
>> + return 0;
>> +
>> sdio_claim_host(bdev->func);
>>
>> sdio_writel(bdev->func, C_FW_OWN_REQ_CLR, MTK_REG_CHLPCR, &err);
>
>I dislike looking at HCI_RUNNING since that check should be removed from a driver. Do you really need it? I mean, a driver should now if it is running or not.
We don't really need it, instead we can use internal flags in the driver to know the status. I will do this in v2.
Sean
>
>Regards
>
>Marcel
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/4] Bluetooth: btmtksdio: handle runtime pm only when sdio_func is available
2021-11-19 22:25 ` [PATCH 2/4] Bluetooth: btmtksdio: handle runtime pm only when sdio_func is available sean.wang
@ 2021-11-24 14:53 ` Marcel Holtmann
0 siblings, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2021-11-24 14:53 UTC (permalink / raw)
To: Sean Wang
Cc: Johan Hedberg, "Mark-YW Chen (陳揚文)",
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, jemele,
abhishekpandit, michaelfsun, mcchou, shawnku, linux-bluetooth,
linux-mediatek, linux-kernel
Hi Sean,
> Runtime pm ops is not aware the sdio_func status that is probably
> being disabled by btmtksdio_close. Thus, we are only able to access the
> sdio_func for the runtime pm operations only when the sdio_func is
> available.
>
> Fixes: 7f3c563c575e7 ("Bluetooth: btmtksdio: Add runtime PM support to SDIO based Bluetooth")
> Co-developed-by: Mark-yw Chen <mark-yw.chen@mediatek.com>
> Signed-off-by: Mark-yw Chen <mark-yw.chen@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
> drivers/bluetooth/btmtksdio.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
> index 4f3412ad8fca..4c46c62e4623 100644
> --- a/drivers/bluetooth/btmtksdio.c
> +++ b/drivers/bluetooth/btmtksdio.c
> @@ -1037,6 +1037,9 @@ static int btmtksdio_runtime_suspend(struct device *dev)
> if (!bdev)
> return 0;
>
> + if (!test_bit(HCI_RUNNING, &bdev->hdev->flags))
> + return 0;
> +
> sdio_claim_host(bdev->func);
>
> sdio_writel(bdev->func, C_FW_OWN_REQ_SET, MTK_REG_CHLPCR, &err);
> @@ -1064,6 +1067,9 @@ static int btmtksdio_runtime_resume(struct device *dev)
> if (!bdev)
> return 0;
>
> + if (!test_bit(HCI_RUNNING, &bdev->hdev->flags))
> + return 0;
> +
> sdio_claim_host(bdev->func);
>
> sdio_writel(bdev->func, C_FW_OWN_REQ_CLR, MTK_REG_CHLPCR, &err);
I dislike looking at HCI_RUNNING since that check should be removed from a driver. Do you really need it? I mean, a driver should now if it is running or not.
Regards
Marcel
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/4] Bluetooth: btmtksdio: handle runtime pm only when sdio_func is available
2021-11-19 22:25 [PATCH 1/4] Bluetooth: btmtksdio: drop the unnecessary variable created sean.wang
@ 2021-11-19 22:25 ` sean.wang
2021-11-24 14:53 ` Marcel Holtmann
0 siblings, 1 reply; 3+ messages in thread
From: sean.wang @ 2021-11-19 22:25 UTC (permalink / raw)
To: marcel, johan.hedberg
Cc: Mark-YW.Chen, 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, jemele, abhishekpandit, michaelfsun,
mcchou, shawnku, linux-bluetooth, linux-mediatek, linux-kernel,
Mark-yw Chen
From: Sean Wang <sean.wang@mediatek.com>
Runtime pm ops is not aware the sdio_func status that is probably
being disabled by btmtksdio_close. Thus, we are only able to access the
sdio_func for the runtime pm operations only when the sdio_func is
available.
Fixes: 7f3c563c575e7 ("Bluetooth: btmtksdio: Add runtime PM support to SDIO based Bluetooth")
Co-developed-by: Mark-yw Chen <mark-yw.chen@mediatek.com>
Signed-off-by: Mark-yw Chen <mark-yw.chen@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/bluetooth/btmtksdio.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index 4f3412ad8fca..4c46c62e4623 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -1037,6 +1037,9 @@ static int btmtksdio_runtime_suspend(struct device *dev)
if (!bdev)
return 0;
+ if (!test_bit(HCI_RUNNING, &bdev->hdev->flags))
+ return 0;
+
sdio_claim_host(bdev->func);
sdio_writel(bdev->func, C_FW_OWN_REQ_SET, MTK_REG_CHLPCR, &err);
@@ -1064,6 +1067,9 @@ static int btmtksdio_runtime_resume(struct device *dev)
if (!bdev)
return 0;
+ if (!test_bit(HCI_RUNNING, &bdev->hdev->flags))
+ return 0;
+
sdio_claim_host(bdev->func);
sdio_writel(bdev->func, C_FW_OWN_REQ_CLR, MTK_REG_CHLPCR, &err);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-25 8:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <74A2D0D6-6A65-4832-BAFC-BCBA68F8DE78@holtmann.org--annotate>
2021-11-25 8:22 ` [PATCH 2/4] Bluetooth: btmtksdio: handle runtime pm only when sdio_func is available sean.wang
2021-11-19 22:25 [PATCH 1/4] Bluetooth: btmtksdio: drop the unnecessary variable created sean.wang
2021-11-19 22:25 ` [PATCH 2/4] Bluetooth: btmtksdio: handle runtime pm only when sdio_func is available sean.wang
2021-11-24 14:53 ` Marcel Holtmann
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).