Linux-Bluetooth Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v1] Bluetooth: hci_qca: wait for Pre shutdown to command complete event before sending the Power off pulse
@ 2019-08-08  9:25 Harish Bandi
  2019-08-08 10:55 ` Balakrishna Godavarthi
  2019-08-08 14:59 ` Matthias Kaehlcke
  0 siblings, 2 replies; 5+ messages in thread
From: Harish Bandi @ 2019-08-08  9:25 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: mka, linux-kernel, linux-bluetooth, hemantg, linux-arm-msm,
	bgodavar, anubhavg, Harish Bandi

When SoC receives pre shut down command, it share the same
with other COEX shared clients. So SoC needs a short
time after sending VS pre shutdown command before
turning off the regulators and sending the power off pulse.

Signed-off-by: Harish Bandi <c-hbandi@codeaurora.org>
---
 drivers/bluetooth/btqca.c   | 5 +++--
 drivers/bluetooth/hci_qca.c | 2 ++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index 2221935..f20991e 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -106,8 +106,9 @@ int qca_send_pre_shutdown_cmd(struct hci_dev *hdev)
 
 	bt_dev_dbg(hdev, "QCA pre shutdown cmd");
 
-	skb = __hci_cmd_sync(hdev, QCA_PRE_SHUTDOWN_CMD, 0,
-				NULL, HCI_INIT_TIMEOUT);
+	skb = __hci_cmd_sync_ev(hdev, QCA_PRE_SHUTDOWN_CMD, 0,
+				NULL, HCI_EV_CMD_COMPLETE, HCI_INIT_TIMEOUT);
+
 	if (IS_ERR(skb)) {
 		err = PTR_ERR(skb);
 		bt_dev_err(hdev, "QCA preshutdown_cmd failed (%d)", err);
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 16db6c0..566aa28 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1386,6 +1386,8 @@ static int qca_power_off(struct hci_dev *hdev)
 	/* Perform pre shutdown command */
 	qca_send_pre_shutdown_cmd(hdev);
 
+	usleep_range(8000, 10000);
+
 	qca_power_shutdown(hu);
 	return 0;
 }
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


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

* Re: [PATCH v1] Bluetooth: hci_qca: wait for Pre shutdown to command complete event before sending the Power off pulse
  2019-08-08  9:25 [PATCH v1] Bluetooth: hci_qca: wait for Pre shutdown to command complete event before sending the Power off pulse Harish Bandi
@ 2019-08-08 10:55 ` Balakrishna Godavarthi
  2019-08-09  4:51   ` Harish Bandi
  2019-08-08 14:59 ` Matthias Kaehlcke
  1 sibling, 1 reply; 5+ messages in thread
From: Balakrishna Godavarthi @ 2019-08-08 10:55 UTC (permalink / raw)
  To: Harish Bandi
  Cc: marcel, johan.hedberg, mka, linux-kernel, linux-bluetooth,
	hemantg, linux-arm-msm, anubhavg

Hi Harish,

On 2019-08-08 14:55, Harish Bandi wrote:
> When SoC receives pre shut down command, it share the same
> with other COEX shared clients. So SoC needs a short
> time after sending VS pre shutdown command before
> turning off the regulators and sending the power off pulse.
> 
> Signed-off-by: Harish Bandi <c-hbandi@codeaurora.org>
> ---
>  drivers/bluetooth/btqca.c   | 5 +++--
>  drivers/bluetooth/hci_qca.c | 2 ++
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
> index 2221935..f20991e 100644
> --- a/drivers/bluetooth/btqca.c
> +++ b/drivers/bluetooth/btqca.c
> @@ -106,8 +106,9 @@ int qca_send_pre_shutdown_cmd(struct hci_dev *hdev)
> 
>  	bt_dev_dbg(hdev, "QCA pre shutdown cmd");
> 
> -	skb = __hci_cmd_sync(hdev, QCA_PRE_SHUTDOWN_CMD, 0,
> -				NULL, HCI_INIT_TIMEOUT);
> +	skb = __hci_cmd_sync_ev(hdev, QCA_PRE_SHUTDOWN_CMD, 0,
> +				NULL, HCI_EV_CMD_COMPLETE, HCI_INIT_TIMEOUT);

[Bala]: nit: can you also add reason in commit text for adding 
HCI_EV_CMD_COMPLETE

> +
>  	if (IS_ERR(skb)) {
>  		err = PTR_ERR(skb);
>  		bt_dev_err(hdev, "QCA preshutdown_cmd failed (%d)", err);
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 16db6c0..566aa28 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -1386,6 +1386,8 @@ static int qca_power_off(struct hci_dev *hdev)
>  	/* Perform pre shutdown command */
>  	qca_send_pre_shutdown_cmd(hdev);
> 
> +	usleep_range(8000, 10000);
> +
>  	qca_power_shutdown(hu);
>  	return 0;
>  }

Reviewed-by: Balakrishna Godavarthi <bgodavar@codeaurora.org>

-- 
Regards
Balakrishna.

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

* Re: [PATCH v1] Bluetooth: hci_qca: wait for Pre shutdown to command complete event before sending the Power off pulse
  2019-08-08  9:25 [PATCH v1] Bluetooth: hci_qca: wait for Pre shutdown to command complete event before sending the Power off pulse Harish Bandi
  2019-08-08 10:55 ` Balakrishna Godavarthi
@ 2019-08-08 14:59 ` Matthias Kaehlcke
  2019-08-09  5:12   ` Harish Bandi
  1 sibling, 1 reply; 5+ messages in thread
From: Matthias Kaehlcke @ 2019-08-08 14:59 UTC (permalink / raw)
  To: Harish Bandi
  Cc: marcel, johan.hedberg, linux-kernel, linux-bluetooth, hemantg,
	linux-arm-msm, bgodavar, anubhavg

On Thu, Aug 08, 2019 at 02:55:53PM +0530, Harish Bandi wrote:
> When SoC receives pre shut down command, it share the same
> with other COEX shared clients. So SoC needs a short
> time after sending VS pre shutdown command before
> turning off the regulators and sending the power off pulse.
> 
> Signed-off-by: Harish Bandi <c-hbandi@codeaurora.org>
> ---
>  drivers/bluetooth/btqca.c   | 5 +++--
>  drivers/bluetooth/hci_qca.c | 2 ++
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
> index 2221935..f20991e 100644
> --- a/drivers/bluetooth/btqca.c
> +++ b/drivers/bluetooth/btqca.c
> @@ -106,8 +106,9 @@ int qca_send_pre_shutdown_cmd(struct hci_dev *hdev)
>  
>  	bt_dev_dbg(hdev, "QCA pre shutdown cmd");
>  
> -	skb = __hci_cmd_sync(hdev, QCA_PRE_SHUTDOWN_CMD, 0,
> -				NULL, HCI_INIT_TIMEOUT);
> +	skb = __hci_cmd_sync_ev(hdev, QCA_PRE_SHUTDOWN_CMD, 0,
> +				NULL, HCI_EV_CMD_COMPLETE, HCI_INIT_TIMEOUT);
> +

The commit message does not mention this change, it only talks about
adding a delay.

>  	if (IS_ERR(skb)) {
>  		err = PTR_ERR(skb);
>  		bt_dev_err(hdev, "QCA preshutdown_cmd failed (%d)", err);
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 16db6c0..566aa28 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -1386,6 +1386,8 @@ static int qca_power_off(struct hci_dev *hdev)
>  	/* Perform pre shutdown command */
>  	qca_send_pre_shutdown_cmd(hdev);
>  
> +	usleep_range(8000, 10000);
> +
>  	qca_power_shutdown(hu);
>  	return 0;
>  }

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

* Re: [PATCH v1] Bluetooth: hci_qca: wait for Pre shutdown to command complete event before sending the Power off pulse
  2019-08-08 10:55 ` Balakrishna Godavarthi
@ 2019-08-09  4:51   ` Harish Bandi
  0 siblings, 0 replies; 5+ messages in thread
From: Harish Bandi @ 2019-08-09  4:51 UTC (permalink / raw)
  To: Balakrishna Godavarthi
  Cc: marcel, johan.hedberg, mka, linux-kernel, linux-bluetooth,
	hemantg, linux-arm-msm, anubhavg

Hi Bala,

On 2019-08-08 16:25, Balakrishna Godavarthi wrote:
> Hi Harish,
> 
> On 2019-08-08 14:55, Harish Bandi wrote:
>> When SoC receives pre shut down command, it share the same
>> with other COEX shared clients. So SoC needs a short
>> time after sending VS pre shutdown command before
>> turning off the regulators and sending the power off pulse.
>> 
>> Signed-off-by: Harish Bandi <c-hbandi@codeaurora.org>
>> ---
>>  drivers/bluetooth/btqca.c   | 5 +++--
>>  drivers/bluetooth/hci_qca.c | 2 ++
>>  2 files changed, 5 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
>> index 2221935..f20991e 100644
>> --- a/drivers/bluetooth/btqca.c
>> +++ b/drivers/bluetooth/btqca.c
>> @@ -106,8 +106,9 @@ int qca_send_pre_shutdown_cmd(struct hci_dev 
>> *hdev)
>> 
>>  	bt_dev_dbg(hdev, "QCA pre shutdown cmd");
>> 
>> -	skb = __hci_cmd_sync(hdev, QCA_PRE_SHUTDOWN_CMD, 0,
>> -				NULL, HCI_INIT_TIMEOUT);
>> +	skb = __hci_cmd_sync_ev(hdev, QCA_PRE_SHUTDOWN_CMD, 0,
>> +				NULL, HCI_EV_CMD_COMPLETE, HCI_INIT_TIMEOUT);
> 
> [Bala]: nit: can you also add reason in commit text for adding
> HCI_EV_CMD_COMPLETE
[Harish] - I will add reason fo HCI_EV_CMD_COMPLETE in commit text and 
post new patch.
> 
>> +
>>  	if (IS_ERR(skb)) {
>>  		err = PTR_ERR(skb);
>>  		bt_dev_err(hdev, "QCA preshutdown_cmd failed (%d)", err);
>> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
>> index 16db6c0..566aa28 100644
>> --- a/drivers/bluetooth/hci_qca.c
>> +++ b/drivers/bluetooth/hci_qca.c
>> @@ -1386,6 +1386,8 @@ static int qca_power_off(struct hci_dev *hdev)
>>  	/* Perform pre shutdown command */
>>  	qca_send_pre_shutdown_cmd(hdev);
>> 
>> +	usleep_range(8000, 10000);
>> +
>>  	qca_power_shutdown(hu);
>>  	return 0;
>>  }
> 
> Reviewed-by: Balakrishna Godavarthi <bgodavar@codeaurora.org>

Thanks,
Harish

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

* Re: [PATCH v1] Bluetooth: hci_qca: wait for Pre shutdown to command complete event before sending the Power off pulse
  2019-08-08 14:59 ` Matthias Kaehlcke
@ 2019-08-09  5:12   ` Harish Bandi
  0 siblings, 0 replies; 5+ messages in thread
From: Harish Bandi @ 2019-08-09  5:12 UTC (permalink / raw)
  To: Matthias Kaehlcke
  Cc: marcel, johan.hedberg, linux-kernel, linux-bluetooth, hemantg,
	linux-arm-msm, bgodavar, anubhavg

Hi Matthias,

On 2019-08-08 20:29, Matthias Kaehlcke wrote:
> On Thu, Aug 08, 2019 at 02:55:53PM +0530, Harish Bandi wrote:
>> When SoC receives pre shut down command, it share the same
>> with other COEX shared clients. So SoC needs a short
>> time after sending VS pre shutdown command before
>> turning off the regulators and sending the power off pulse.
>> 
>> Signed-off-by: Harish Bandi <c-hbandi@codeaurora.org>
>> ---
>>  drivers/bluetooth/btqca.c   | 5 +++--
>>  drivers/bluetooth/hci_qca.c | 2 ++
>>  2 files changed, 5 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
>> index 2221935..f20991e 100644
>> --- a/drivers/bluetooth/btqca.c
>> +++ b/drivers/bluetooth/btqca.c
>> @@ -106,8 +106,9 @@ int qca_send_pre_shutdown_cmd(struct hci_dev 
>> *hdev)
>> 
>>  	bt_dev_dbg(hdev, "QCA pre shutdown cmd");
>> 
>> -	skb = __hci_cmd_sync(hdev, QCA_PRE_SHUTDOWN_CMD, 0,
>> -				NULL, HCI_INIT_TIMEOUT);
>> +	skb = __hci_cmd_sync_ev(hdev, QCA_PRE_SHUTDOWN_CMD, 0,
>> +				NULL, HCI_EV_CMD_COMPLETE, HCI_INIT_TIMEOUT);
>> +
> 
> The commit message does not mention this change, it only talks about
> adding a delay.

[Harish] - I will add reason fo HCI_EV_CMD_COMPLETE in commit text and 
post new patch.
In commit text title I mentioned about command complete event, However I 
will add more details
about reason for command complete in commit text

> 
>>  	if (IS_ERR(skb)) {
>>  		err = PTR_ERR(skb);
>>  		bt_dev_err(hdev, "QCA preshutdown_cmd failed (%d)", err);
>> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
>> index 16db6c0..566aa28 100644
>> --- a/drivers/bluetooth/hci_qca.c
>> +++ b/drivers/bluetooth/hci_qca.c
>> @@ -1386,6 +1386,8 @@ static int qca_power_off(struct hci_dev *hdev)
>>  	/* Perform pre shutdown command */
>>  	qca_send_pre_shutdown_cmd(hdev);
>> 
>> +	usleep_range(8000, 10000);
>> +
>>  	qca_power_shutdown(hu);
>>  	return 0;
>>  }

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

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-08  9:25 [PATCH v1] Bluetooth: hci_qca: wait for Pre shutdown to command complete event before sending the Power off pulse Harish Bandi
2019-08-08 10:55 ` Balakrishna Godavarthi
2019-08-09  4:51   ` Harish Bandi
2019-08-08 14:59 ` Matthias Kaehlcke
2019-08-09  5:12   ` Harish Bandi

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org linux-bluetooth@archiver.kernel.org
	public-inbox-index linux-bluetooth


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/ public-inbox