diff mbox series

[SRU,J] Bluetooth: btrtl: Ask ic_info to drop firmware

Message ID 20230705132904.22661-1-juerg.haefliger@canonical.com
State New
Headers show
Series [SRU,J] Bluetooth: btrtl: Ask ic_info to drop firmware | expand

Commit Message

Juerg Haefliger July 5, 2023, 1:29 p.m. UTC
From: Hilda Wu <hildawu@realtek.com>

BugLink: https://bugs.launchpad.net/bugs/2026028

Some un-support wakeup platforms keep USB power and suspend signal
is coming late, this makes Realtek some chip keep its firmware,
and make it never load new firmware.

So use vendor specific HCI command to ask them drop its firmware after
system shutdown or resume.

Signed-off-by: Hilda Wu <hildawu@realtek.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

(cherry picked from commit cd36742a957c37f6cd17124dac6dd1d61aeba4ab)
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
---
 drivers/bluetooth/btrtl.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Tim Gardner July 5, 2023, 1:51 p.m. UTC | #1
On 7/5/23 7:29 AM, Juerg Haefliger wrote:
> From: Hilda Wu <hildawu@realtek.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/2026028
> 
> Some un-support wakeup platforms keep USB power and suspend signal
> is coming late, this makes Realtek some chip keep its firmware,
> and make it never load new firmware.
> 
> So use vendor specific HCI command to ask them drop its firmware after
> system shutdown or resume.
> 
> Signed-off-by: Hilda Wu <hildawu@realtek.com>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> 
> (cherry picked from commit cd36742a957c37f6cd17124dac6dd1d61aeba4ab)
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>   drivers/bluetooth/btrtl.c | 12 +++++++-----
>   1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
> index 1f8afa0244d8..60ddba8962ff 100644
> --- a/drivers/bluetooth/btrtl.c
> +++ b/drivers/bluetooth/btrtl.c
> @@ -594,8 +594,10 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
>   	hci_rev = le16_to_cpu(resp->hci_rev);
>   	lmp_subver = le16_to_cpu(resp->lmp_subver);
>   
> -	if (resp->hci_ver == 0x8 && le16_to_cpu(resp->hci_rev) == 0x826c &&
> -	    resp->lmp_ver == 0x8 && le16_to_cpu(resp->lmp_subver) == 0xa99e)
> +	btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
> +					    hdev->bus);
> +
> +	if (!btrtl_dev->ic_info)
>   		btrtl_dev->drop_fw = true;
>   
>   	if (btrtl_dev->drop_fw) {
> @@ -634,13 +636,13 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
>   		hci_ver = resp->hci_ver;
>   		hci_rev = le16_to_cpu(resp->hci_rev);
>   		lmp_subver = le16_to_cpu(resp->lmp_subver);
> +
> +		btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
> +						    hdev->bus);
>   	}
>   out_free:
>   	kfree_skb(skb);
>   
> -	btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
> -					    hdev->bus);
> -
>   	if (!btrtl_dev->ic_info) {
>   		rtl_dev_info(hdev, "unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
>   			    lmp_subver, hci_rev, hci_ver);
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Andrei Gherzan July 7, 2023, 12:06 p.m. UTC | #2
On 23/07/05 03:29PM, Juerg Haefliger wrote:
> From: Hilda Wu <hildawu@realtek.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/2026028
> 
> Some un-support wakeup platforms keep USB power and suspend signal
> is coming late, this makes Realtek some chip keep its firmware,
> and make it never load new firmware.
> 
> So use vendor specific HCI command to ask them drop its firmware after
> system shutdown or resume.
> 
> Signed-off-by: Hilda Wu <hildawu@realtek.com>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> 

NIT: New line here.

> (cherry picked from commit cd36742a957c37f6cd17124dac6dd1d61aeba4ab)
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>  drivers/bluetooth/btrtl.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
> index 1f8afa0244d8..60ddba8962ff 100644
> --- a/drivers/bluetooth/btrtl.c
> +++ b/drivers/bluetooth/btrtl.c
> @@ -594,8 +594,10 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
>  	hci_rev = le16_to_cpu(resp->hci_rev);
>  	lmp_subver = le16_to_cpu(resp->lmp_subver);
>  
> -	if (resp->hci_ver == 0x8 && le16_to_cpu(resp->hci_rev) == 0x826c &&
> -	    resp->lmp_ver == 0x8 && le16_to_cpu(resp->lmp_subver) == 0xa99e)
> +	btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
> +					    hdev->bus);
> +
> +	if (!btrtl_dev->ic_info)
>  		btrtl_dev->drop_fw = true;
>  
>  	if (btrtl_dev->drop_fw) {
> @@ -634,13 +636,13 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
>  		hci_ver = resp->hci_ver;
>  		hci_rev = le16_to_cpu(resp->hci_rev);
>  		lmp_subver = le16_to_cpu(resp->lmp_subver);
> +
> +		btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
> +						    hdev->bus);
>  	}
>  out_free:
>  	kfree_skb(skb);
>  
> -	btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
> -					    hdev->bus);
> -
>  	if (!btrtl_dev->ic_info) {
>  		rtl_dev_info(hdev, "unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
>  			    lmp_subver, hci_rev, hci_ver);
> -- 
> 2.39.2

Acked-by: Andrei Gherzan <andrei.gherzan@canonical.com>
Roxana Nicolescu July 11, 2023, 11:44 a.m. UTC | #3
On 05/07/2023 15:29, Juerg Haefliger wrote:
> From: Hilda Wu <hildawu@realtek.com>
>
> BugLink: https://bugs.launchpad.net/bugs/2026028
>
> Some un-support wakeup platforms keep USB power and suspend signal
> is coming late, this makes Realtek some chip keep its firmware,
> and make it never load new firmware.
>
> So use vendor specific HCI command to ask them drop its firmware after
> system shutdown or resume.
>
> Signed-off-by: Hilda Wu <hildawu@realtek.com>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
>
> (cherry picked from commit cd36742a957c37f6cd17124dac6dd1d61aeba4ab)
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>   drivers/bluetooth/btrtl.c | 12 +++++++-----
>   1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
> index 1f8afa0244d8..60ddba8962ff 100644
> --- a/drivers/bluetooth/btrtl.c
> +++ b/drivers/bluetooth/btrtl.c
> @@ -594,8 +594,10 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
>   	hci_rev = le16_to_cpu(resp->hci_rev);
>   	lmp_subver = le16_to_cpu(resp->lmp_subver);
>   
> -	if (resp->hci_ver == 0x8 && le16_to_cpu(resp->hci_rev) == 0x826c &&
> -	    resp->lmp_ver == 0x8 && le16_to_cpu(resp->lmp_subver) == 0xa99e)
> +	btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
> +					    hdev->bus);
> +
> +	if (!btrtl_dev->ic_info)
>   		btrtl_dev->drop_fw = true;
>   
>   	if (btrtl_dev->drop_fw) {
> @@ -634,13 +636,13 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
>   		hci_ver = resp->hci_ver;
>   		hci_rev = le16_to_cpu(resp->hci_rev);
>   		lmp_subver = le16_to_cpu(resp->lmp_subver);
> +
> +		btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
> +						    hdev->bus);
>   	}
>   out_free:
>   	kfree_skb(skb);
>   
> -	btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
> -					    hdev->bus);
> -
>   	if (!btrtl_dev->ic_info) {
>   		rtl_dev_info(hdev, "unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
>   			    lmp_subver, hci_rev, hci_ver);
I would put the content of the buglink in a cover letter for a thorough 
explanation of this patch.

Acked-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
Roxana Nicolescu Aug. 2, 2023, 6:17 a.m. UTC | #4
On 05/07/2023 15:29, Juerg Haefliger wrote:
> From: Hilda Wu <hildawu@realtek.com>
>
> BugLink: https://bugs.launchpad.net/bugs/2026028
>
> Some un-support wakeup platforms keep USB power and suspend signal
> is coming late, this makes Realtek some chip keep its firmware,
> and make it never load new firmware.
>
> So use vendor specific HCI command to ask them drop its firmware after
> system shutdown or resume.
>
> Signed-off-by: Hilda Wu <hildawu@realtek.com>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
>
> (cherry picked from commit cd36742a957c37f6cd17124dac6dd1d61aeba4ab)
> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
> ---
>   drivers/bluetooth/btrtl.c | 12 +++++++-----
>   1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
> index 1f8afa0244d8..60ddba8962ff 100644
> --- a/drivers/bluetooth/btrtl.c
> +++ b/drivers/bluetooth/btrtl.c
> @@ -594,8 +594,10 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
>   	hci_rev = le16_to_cpu(resp->hci_rev);
>   	lmp_subver = le16_to_cpu(resp->lmp_subver);
>   
> -	if (resp->hci_ver == 0x8 && le16_to_cpu(resp->hci_rev) == 0x826c &&
> -	    resp->lmp_ver == 0x8 && le16_to_cpu(resp->lmp_subver) == 0xa99e)
> +	btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
> +					    hdev->bus);
> +
> +	if (!btrtl_dev->ic_info)
>   		btrtl_dev->drop_fw = true;
>   
>   	if (btrtl_dev->drop_fw) {
> @@ -634,13 +636,13 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
>   		hci_ver = resp->hci_ver;
>   		hci_rev = le16_to_cpu(resp->hci_rev);
>   		lmp_subver = le16_to_cpu(resp->lmp_subver);
> +
> +		btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
> +						    hdev->bus);
>   	}
>   out_free:
>   	kfree_skb(skb);
>   
> -	btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
> -					    hdev->bus);
> -
>   	if (!btrtl_dev->ic_info) {
>   		rtl_dev_info(hdev, "unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
>   			    lmp_subver, hci_rev, hci_ver);
Applied to jammy:master-next. I removed the line before "(cherry-picked 
from..".  Thanks!

Roxana
diff mbox series

Patch

diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 1f8afa0244d8..60ddba8962ff 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -594,8 +594,10 @@  struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
 	hci_rev = le16_to_cpu(resp->hci_rev);
 	lmp_subver = le16_to_cpu(resp->lmp_subver);
 
-	if (resp->hci_ver == 0x8 && le16_to_cpu(resp->hci_rev) == 0x826c &&
-	    resp->lmp_ver == 0x8 && le16_to_cpu(resp->lmp_subver) == 0xa99e)
+	btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
+					    hdev->bus);
+
+	if (!btrtl_dev->ic_info)
 		btrtl_dev->drop_fw = true;
 
 	if (btrtl_dev->drop_fw) {
@@ -634,13 +636,13 @@  struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
 		hci_ver = resp->hci_ver;
 		hci_rev = le16_to_cpu(resp->hci_rev);
 		lmp_subver = le16_to_cpu(resp->lmp_subver);
+
+		btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
+						    hdev->bus);
 	}
 out_free:
 	kfree_skb(skb);
 
-	btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
-					    hdev->bus);
-
 	if (!btrtl_dev->ic_info) {
 		rtl_dev_info(hdev, "unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
 			    lmp_subver, hci_rev, hci_ver);