[PATCH v1 1/2] Bluetooth: hci_qca: Refactor HFP hardware offload capability handling

Mengshi Wu posted 2 patches 2 weeks, 3 days ago
There is a newer version of this series
[PATCH v1 1/2] Bluetooth: hci_qca: Refactor HFP hardware offload capability handling
Posted by Mengshi Wu 2 weeks, 3 days ago
Replace SoC-specific check with capability-based approach for HFP
hardware offload configuration. Add QCA_CAP_HFP_HW_OFFLOAD capability
flag and support_hfp_hw_offload field to qca_serdev structure.

Signed-off-by: Mengshi Wu <mengshi.wu@oss.qualcomm.com>
---
 drivers/bluetooth/hci_qca.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 888176b0f..4e1e113f4 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -87,6 +87,7 @@ enum qca_flags {
 enum qca_capabilities {
 	QCA_CAP_WIDEBAND_SPEECH = BIT(0),
 	QCA_CAP_VALID_LE_STATES = BIT(1),
+	QCA_CAP_HFP_HW_OFFLOAD  = BIT(2),
 };
 
 /* HCI_IBS transmit side sleep protocol states */
@@ -229,6 +230,7 @@ struct qca_serdev {
 	u32 init_speed;
 	u32 oper_speed;
 	bool bdaddr_property_broken;
+	bool support_hfp_hw_offload;
 	const char *firmware_name[2];
 };
 
@@ -1879,7 +1881,7 @@ static int qca_setup(struct hci_uart *hu)
 	const char *rampatch_name = qca_get_rampatch_name(hu);
 	int ret;
 	struct qca_btsoc_version ver;
-	struct qca_serdev *qcadev;
+	struct qca_serdev *qcadev = serdev_device_get_drvdata(hu->serdev);
 	const char *soc_name;
 
 	ret = qca_check_speeds(hu);
@@ -1943,7 +1945,6 @@ static int qca_setup(struct hci_uart *hu)
 	case QCA_WCN6750:
 	case QCA_WCN6855:
 	case QCA_WCN7850:
-		qcadev = serdev_device_get_drvdata(hu->serdev);
 		if (qcadev->bdaddr_property_broken)
 			hci_set_quirk(hdev, HCI_QUIRK_BDADDR_PROPERTY_BROKEN);
 
@@ -2033,7 +2034,7 @@ static int qca_setup(struct hci_uart *hu)
 	else
 		hu->hdev->set_bdaddr = qca_set_bdaddr;
 
-	if (soc_type == QCA_QCA2066)
+	if (qcadev->support_hfp_hw_offload)
 		qca_configure_hfp_offload(hdev);
 
 	qca->fw_version = le16_to_cpu(ver.patch_ver);
@@ -2502,6 +2503,9 @@ static int qca_serdev_probe(struct serdev_device *serdev)
 
 		if (!(data->capabilities & QCA_CAP_VALID_LE_STATES))
 			hci_set_quirk(hdev, HCI_QUIRK_BROKEN_LE_STATES);
+
+		if (data->capabilities & QCA_CAP_HFP_HW_OFFLOAD)
+			qcadev->support_hfp_hw_offload = true;
 	}
 
 	return 0;
-- 
2.34.1
Re: [PATCH v1 1/2] Bluetooth: hci_qca: Refactor HFP hardware offload capability handling
Posted by Dmitry Baryshkov 2 weeks, 2 days ago
On Fri, Jan 23, 2026 at 01:52:42PM +0800, Mengshi Wu wrote:
> Replace SoC-specific check with capability-based approach for HFP
> hardware offload configuration. Add QCA_CAP_HFP_HW_OFFLOAD capability
> flag and support_hfp_hw_offload field to qca_serdev structure.
> 
> Signed-off-by: Mengshi Wu <mengshi.wu@oss.qualcomm.com>
> ---
>  drivers/bluetooth/hci_qca.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> @@ -2033,7 +2034,7 @@ static int qca_setup(struct hci_uart *hu)
>  	else
>  		hu->hdev->set_bdaddr = qca_set_bdaddr;
>  
> -	if (soc_type == QCA_QCA2066)
> +	if (qcadev->support_hfp_hw_offload)

At this point QCA2066 becomes broken until the next commit. This is not
a proper way to do things. At the very least, squash the first chunk of
your next commit into this patch.

>  		qca_configure_hfp_offload(hdev);
>  
>  	qca->fw_version = le16_to_cpu(ver.patch_ver);
> @@ -2502,6 +2503,9 @@ static int qca_serdev_probe(struct serdev_device *serdev)
>  
>  		if (!(data->capabilities & QCA_CAP_VALID_LE_STATES))
>  			hci_set_quirk(hdev, HCI_QUIRK_BROKEN_LE_STATES);
> +
> +		if (data->capabilities & QCA_CAP_HFP_HW_OFFLOAD)
> +			qcadev->support_hfp_hw_offload = true;
>  	}
>  
>  	return 0;
> -- 
> 2.34.1
> 

-- 
With best wishes
Dmitry
Re: [PATCH v1 1/2] Bluetooth: hci_qca: Refactor HFP hardware offload capability handling
Posted by Mengshi Wu 1 week, 6 days ago
Hi,

On 1/24/2026 3:26 AM, Dmitry Baryshkov wrote:
> On Fri, Jan 23, 2026 at 01:52:42PM +0800, Mengshi Wu wrote:
>> Replace SoC-specific check with capability-based approach for HFP
>> hardware offload configuration. Add QCA_CAP_HFP_HW_OFFLOAD capability
>> flag and support_hfp_hw_offload field to qca_serdev structure.
>>
>> Signed-off-by: Mengshi Wu <mengshi.wu@oss.qualcomm.com>
>> ---
>>  drivers/bluetooth/hci_qca.c | 10 +++++++---
>>  1 file changed, 7 insertions(+), 3 deletions(-)
>>
>> @@ -2033,7 +2034,7 @@ static int qca_setup(struct hci_uart *hu)
>>  	else
>>  		hu->hdev->set_bdaddr = qca_set_bdaddr;
>>  
>> -	if (soc_type == QCA_QCA2066)
>> +	if (qcadev->support_hfp_hw_offload)
> 
> At this point QCA2066 becomes broken until the next commit. This is not
> a proper way to do things. At the very least, squash the first chunk of
> your next commit into this patch.

Thanks for comments. I will fix this.

> 
>>  		qca_configure_hfp_offload(hdev);
>>  
>>  	qca->fw_version = le16_to_cpu(ver.patch_ver);
>> @@ -2502,6 +2503,9 @@ static int qca_serdev_probe(struct serdev_device *serdev)
>>  
>>  		if (!(data->capabilities & QCA_CAP_VALID_LE_STATES))
>>  			hci_set_quirk(hdev, HCI_QUIRK_BROKEN_LE_STATES);
>> +
>> +		if (data->capabilities & QCA_CAP_HFP_HW_OFFLOAD)
>> +			qcadev->support_hfp_hw_offload = true;
>>  	}
>>  
>>  	return 0;
>> -- 
>> 2.34.1
>>
> 

--
Best regards,
Mengshi Wu