[PATCH] Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT

Janaki Ramaiah Thota posted 1 patch 1 year, 11 months ago
drivers/bluetooth/hci_qca.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
[PATCH] Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT
Posted by Janaki Ramaiah Thota 1 year, 11 months ago
This change is done to avoid BT not to go UNCONFIGURED state when BDA
fwnode is not available in DT for QTI SOCs.

Signed-off-by: Janaki Ramaiah Thota <quic_janathot@quicinc.com>
---
 drivers/bluetooth/hci_qca.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 94b8c406f0c0..11d66f3e5f3f 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -7,6 +7,7 @@
  *
  *  Copyright (C) 2007 Texas Instruments, Inc.
  *  Copyright (c) 2010, 2012, 2018 The Linux Foundation. All rights reserved.
+ *  Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  *  Acknowledgements:
  *  This file is based on hci_ll.c, which was...
@@ -1904,7 +1905,17 @@ static int qca_setup(struct hci_uart *hu)
 	case QCA_WCN6750:
 	case QCA_WCN6855:
 	case QCA_WCN7850:
-		set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
+
+		/* Set BDA quirk bit for reading BDA value from fwnode property
+		 * only if that property exist in DT.
+		 */
+		if (fwnode_property_present(dev_fwnode(hdev->dev.parent), "local-bd-address")) {
+			set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
+			bt_dev_info(hdev, "setting quirk bit to read BDA from fwnode later");
+		} else {
+			bt_dev_info(hdev, "Not setting quirk bit for BDA");
+		}
+
 		hci_set_aosp_capable(hdev);
 
 		ret = qca_read_soc_version(hdev, &ver, soc_type);

base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d
prerequisite-patch-id: de5460a6c886a233feff19313b545ee6569369fb
prerequisite-patch-id: e18252a26d0f289afcbec18113b7f636a46a9aed
prerequisite-patch-id: 26e607ac96dc6d0d295793a0449a5b4c0f7ddc92
prerequisite-patch-id: c8d7f229399fc8075722ffe05260675ece93f691
prerequisite-patch-id: 554cc93ba4899eabe31585bf9591052058609d96
prerequisite-patch-id: 99c00a3d8d98a880c0d3a5545def0ca9ade0f903
prerequisite-patch-id: b1ef1add471677d1e1b60eaaab3e109abf7c7b2b
prerequisite-patch-id: 96131754c09914f327f353dee4daabb7ab5e6f29
prerequisite-patch-id: 610b5ec4a338d15cf8dba0459d5a1bfd28dccb4d
prerequisite-patch-id: 5172cd9d99462e123f264f0fd9a9768f2cae5498
prerequisite-patch-id: f57b8285516730da78089325d53f6125daaf2e6a
prerequisite-patch-id: 69dc26e36476660935070261f0e11cdd55c35688
prerequisite-patch-id: 8087dd28f6ef90fc3ad847b4bcde8a096ff721b5
prerequisite-patch-id: 8640fbfd7e5dcbdb4eacf5b748ea49678a2e6675
prerequisite-patch-id: b3613c0002cfd9cc77923f6ce781cec90a2f0cd1
prerequisite-patch-id: dc4f4077bfa02a5d5128bb39ef3a36dfc3db27bc
prerequisite-patch-id: 9c9aa8de9b4c50252d451a2dd76717c287fe1848
prerequisite-patch-id: 3c4a931debe7e8aa7d0b70870456421a17ff86a5
prerequisite-patch-id: df500031c7b6de9320021d52b060338b71340d91
prerequisite-patch-id: 14758d2fb4b6151aa9c27ab7e3cb8c742988f1d7
prerequisite-patch-id: 1c28faa0d8a4e294752229611ade87a216da0ce6
prerequisite-patch-id: 03680549373d9a5b0ab0e4c94260e8aaea04ef25
prerequisite-patch-id: cfcc27083466c9c87801628fe9c0f2131fc22dae
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Re: [PATCH] Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT
Posted by Paul Menzel 1 year, 11 months ago
Dear Janaki,


Thank you for your patch.


Am 23.01.24 um 08:15 schrieb Janaki Ramaiah Thota:
> This change is done to avoid BT not to go UNCONFIGURED state when BDA

“This change is done to” is redundant, and can be left out.

> fwnode is not available in DT for QTI SOCs.

It’d be great if you documented the test setup exactly, on how to 
reproduce this.

Please also add a Fixes: tag.

> Signed-off-by: Janaki Ramaiah Thota <quic_janathot@quicinc.com>
> ---
>   drivers/bluetooth/hci_qca.c | 13 ++++++++++++-
>   1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 94b8c406f0c0..11d66f3e5f3f 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -7,6 +7,7 @@
>    *
>    *  Copyright (C) 2007 Texas Instruments, Inc.
>    *  Copyright (c) 2010, 2012, 2018 The Linux Foundation. All rights reserved.
> + *  Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
>    *
>    *  Acknowledgements:
>    *  This file is based on hci_ll.c, which was...
> @@ -1904,7 +1905,17 @@ static int qca_setup(struct hci_uart *hu)
>   	case QCA_WCN6750:
>   	case QCA_WCN6855:
>   	case QCA_WCN7850:
> -		set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
> +
> +		/* Set BDA quirk bit for reading BDA value from fwnode property
> +		 * only if that property exist in DT.
> +		 */
> +		if (fwnode_property_present(dev_fwnode(hdev->dev.parent), "local-bd-address")) {
> +			set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
> +			bt_dev_info(hdev, "setting quirk bit to read BDA from fwnode later");
> +		} else {
> +			bt_dev_info(hdev, "Not setting quirk bit for BDA");

In my opinion, the message in the else branch, should be a debug 
message, and should also contain that `local-bd-address` is not present 
in the devicetree..

> +		}
> +
>   		hci_set_aosp_capable(hdev);
>   
>   		ret = qca_read_soc_version(hdev, &ver, soc_type);
> 
> base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d
> prerequisite-patch-id: de5460a6c886a233feff19313b545ee6569369fb
> prerequisite-patch-id: e18252a26d0f289afcbec18113b7f636a46a9aed
> prerequisite-patch-id: 26e607ac96dc6d0d295793a0449a5b4c0f7ddc92
> prerequisite-patch-id: c8d7f229399fc8075722ffe05260675ece93f691
> prerequisite-patch-id: 554cc93ba4899eabe31585bf9591052058609d96
> prerequisite-patch-id: 99c00a3d8d98a880c0d3a5545def0ca9ade0f903
> prerequisite-patch-id: b1ef1add471677d1e1b60eaaab3e109abf7c7b2b
> prerequisite-patch-id: 96131754c09914f327f353dee4daabb7ab5e6f29
> prerequisite-patch-id: 610b5ec4a338d15cf8dba0459d5a1bfd28dccb4d
> prerequisite-patch-id: 5172cd9d99462e123f264f0fd9a9768f2cae5498
> prerequisite-patch-id: f57b8285516730da78089325d53f6125daaf2e6a
> prerequisite-patch-id: 69dc26e36476660935070261f0e11cdd55c35688
> prerequisite-patch-id: 8087dd28f6ef90fc3ad847b4bcde8a096ff721b5
> prerequisite-patch-id: 8640fbfd7e5dcbdb4eacf5b748ea49678a2e6675
> prerequisite-patch-id: b3613c0002cfd9cc77923f6ce781cec90a2f0cd1
> prerequisite-patch-id: dc4f4077bfa02a5d5128bb39ef3a36dfc3db27bc
> prerequisite-patch-id: 9c9aa8de9b4c50252d451a2dd76717c287fe1848
> prerequisite-patch-id: 3c4a931debe7e8aa7d0b70870456421a17ff86a5
> prerequisite-patch-id: df500031c7b6de9320021d52b060338b71340d91
> prerequisite-patch-id: 14758d2fb4b6151aa9c27ab7e3cb8c742988f1d7
> prerequisite-patch-id: 1c28faa0d8a4e294752229611ade87a216da0ce6
> prerequisite-patch-id: 03680549373d9a5b0ab0e4c94260e8aaea04ef25
> prerequisite-patch-id: cfcc27083466c9c87801628fe9c0f2131fc22dae

What to do about these lines?


Kind regards,

PPaul
Re: [PATCH] Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT
Posted by Janaki Ramaiah Thota 1 year, 11 months ago
Hi Paul Menzel,
Thanks for the review, addressed comments in-lined.

On 1/23/2024 3:08 PM, Paul Menzel wrote:
> Dear Janaki,
> 
> 
> Thank you for your patch.
> 
> 
> Am 23.01.24 um 08:15 schrieb Janaki Ramaiah Thota:
>> This change is done to avoid BT not to go UNCONFIGURED state when BDA
> 
> “This change is done to” is redundant, and can be left out.
> 
Agreed, addressed in incremental patch.
>> fwnode is not available in DT for QTI SOCs.
> 
> It’d be great if you documented the test setup exactly, on how to reproduce this.
> 
> Please also add a Fixes: tag.
> 
sure, addressed in incremental patch.
>> Signed-off-by: Janaki Ramaiah Thota <quic_janathot@quicinc.com>
>> ---
>>   drivers/bluetooth/hci_qca.c | 13 ++++++++++++-
>>   1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
>> index 94b8c406f0c0..11d66f3e5f3f 100644
>> --- a/drivers/bluetooth/hci_qca.c
>> +++ b/drivers/bluetooth/hci_qca.c
>> @@ -7,6 +7,7 @@
>>    *
>>    *  Copyright (C) 2007 Texas Instruments, Inc.
>>    *  Copyright (c) 2010, 2012, 2018 The Linux Foundation. All rights reserved.
>> + *  Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
>>    *
>>    *  Acknowledgements:
>>    *  This file is based on hci_ll.c, which was...
>> @@ -1904,7 +1905,17 @@ static int qca_setup(struct hci_uart *hu)
>>       case QCA_WCN6750:
>>       case QCA_WCN6855:
>>       case QCA_WCN7850:
>> -        set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
>> +
>> +        /* Set BDA quirk bit for reading BDA value from fwnode property
>> +         * only if that property exist in DT.
>> +         */
>> +        if (fwnode_property_present(dev_fwnode(hdev->dev.parent), "local-bd-address")) {
>> +            set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);
>> +            bt_dev_info(hdev, "setting quirk bit to read BDA from fwnode later");
>> +        } else {
>> +            bt_dev_info(hdev, "Not setting quirk bit for BDA");
> 
> In my opinion, the message in the else branch, should be a debug message, and should also contain that `local-bd-address` is not present in the devicetree..
> 
Agreed, addressed in incremental patch.
>> +        }
>> +
>>           hci_set_aosp_capable(hdev);
>>           ret = qca_read_soc_version(hdev, &ver, soc_type);
>>
>> base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d
>> prerequisite-patch-id: de5460a6c886a233feff19313b545ee6569369fb
>> prerequisite-patch-id: e18252a26d0f289afcbec18113b7f636a46a9aed
>> prerequisite-patch-id: 26e607ac96dc6d0d295793a0449a5b4c0f7ddc92
>> prerequisite-patch-id: c8d7f229399fc8075722ffe05260675ece93f691
>> prerequisite-patch-id: 554cc93ba4899eabe31585bf9591052058609d96
>> prerequisite-patch-id: 99c00a3d8d98a880c0d3a5545def0ca9ade0f903
>> prerequisite-patch-id: b1ef1add471677d1e1b60eaaab3e109abf7c7b2b
>> prerequisite-patch-id: 96131754c09914f327f353dee4daabb7ab5e6f29
>> prerequisite-patch-id: 610b5ec4a338d15cf8dba0459d5a1bfd28dccb4d
>> prerequisite-patch-id: 5172cd9d99462e123f264f0fd9a9768f2cae5498
>> prerequisite-patch-id: f57b8285516730da78089325d53f6125daaf2e6a
>> prerequisite-patch-id: 69dc26e36476660935070261f0e11cdd55c35688
>> prerequisite-patch-id: 8087dd28f6ef90fc3ad847b4bcde8a096ff721b5
>> prerequisite-patch-id: 8640fbfd7e5dcbdb4eacf5b748ea49678a2e6675
>> prerequisite-patch-id: b3613c0002cfd9cc77923f6ce781cec90a2f0cd1
>> prerequisite-patch-id: dc4f4077bfa02a5d5128bb39ef3a36dfc3db27bc
>> prerequisite-patch-id: 9c9aa8de9b4c50252d451a2dd76717c287fe1848
>> prerequisite-patch-id: 3c4a931debe7e8aa7d0b70870456421a17ff86a5
>> prerequisite-patch-id: df500031c7b6de9320021d52b060338b71340d91
>> prerequisite-patch-id: 14758d2fb4b6151aa9c27ab7e3cb8c742988f1d7
>> prerequisite-patch-id: 1c28faa0d8a4e294752229611ade87a216da0ce6
>> prerequisite-patch-id: 03680549373d9a5b0ab0e4c94260e8aaea04ef25
>> prerequisite-patch-id: cfcc27083466c9c87801628fe9c0f2131fc22dae
> 
> What to do about these lines?
> 
These are auto generated, not related to change.
> 
> Kind regards,
> 
> PPaul