WCN7850 will first attempt to use ELF_TYPE_PATCH,
and if that fails, it will fall back to TLV_TYPE_PATCH.
To code uniformity, move WCN7850 workaround to the caller.
Signed-off-by: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
---
drivers/bluetooth/btqca.c | 39 ++++++++++++++++++---------------------
1 file changed, 18 insertions(+), 21 deletions(-)
diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index 7c958d606..561e51fa9 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -581,28 +581,11 @@ static int qca_download_firmware(struct hci_dev *hdev,
ret = request_firmware(&fw, config->fwname, &hdev->dev);
if (ret) {
- /* For WCN6750, if mbn file is not present then check for
- * tlv file.
- */
- if (soc_type == QCA_WCN6750 && config->type == ELF_TYPE_PATCH) {
- bt_dev_dbg(hdev, "QCA Failed to request file: %s (%d)",
- config->fwname, ret);
- config->type = TLV_TYPE_PATCH;
- snprintf(config->fwname, sizeof(config->fwname),
- "qca/msbtfw%02x.tlv", rom_ver);
- bt_dev_info(hdev, "QCA Downloading %s", config->fwname);
- ret = request_firmware(&fw, config->fwname, &hdev->dev);
- if (ret) {
- bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
- config->fwname, ret);
- return ret;
- }
- }
/* If the board-specific file is missing, try loading the default
* one, unless that was attempted already.
*/
- else if (config->type == TLV_TYPE_NVM &&
- qca_get_alt_nvm_file(config->fwname, sizeof(config->fwname))) {
+ if (config->type == TLV_TYPE_NVM &&
+ qca_get_alt_nvm_file(config->fwname, sizeof(config->fwname))) {
bt_dev_info(hdev, "QCA Downloading %s", config->fwname);
ret = request_firmware(&fw, config->fwname, &hdev->dev);
if (ret) {
@@ -861,8 +844,22 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
}
err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
- if (err < 0) {
- bt_dev_err(hdev, "QCA Failed to download patch (%d)", err);
+ /* For WCN6750, if mbn file is not present then check for
+ * tlv file.
+ */
+ if (err < 0 && soc_type == QCA_WCN6750) {
+ bt_dev_dbg(hdev, "QCA Failed to request file: %s (%d)",
+ config.fwname, err);
+ config.type = TLV_TYPE_PATCH;
+ snprintf(config.fwname, sizeof(config.fwname),
+ "qca/msbtfw%02x.tlv", rom_ver);
+ bt_dev_info(hdev, "QCA Downloading %s", config.fwname);
+ err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
+ }
+
+ if (err) {
+ bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
+ config.fwname, err);
return err;
}
--
2.34.1
On Mon, Jan 05, 2026 at 01:56:45PM +0800, Shuai Zhang wrote:
> WCN7850 will first attempt to use ELF_TYPE_PATCH,
> and if that fails, it will fall back to TLV_TYPE_PATCH.
>
> To code uniformity, move WCN7850 workaround to the caller.
>
> Signed-off-by: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
> ---
> drivers/bluetooth/btqca.c | 39 ++++++++++++++++++---------------------
> 1 file changed, 18 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
> index 7c958d606..561e51fa9 100644
> --- a/drivers/bluetooth/btqca.c
> +++ b/drivers/bluetooth/btqca.c
> @@ -581,28 +581,11 @@ static int qca_download_firmware(struct hci_dev *hdev,
>
> ret = request_firmware(&fw, config->fwname, &hdev->dev);
> if (ret) {
> - /* For WCN6750, if mbn file is not present then check for
> - * tlv file.
> - */
> - if (soc_type == QCA_WCN6750 && config->type == ELF_TYPE_PATCH) {
> - bt_dev_dbg(hdev, "QCA Failed to request file: %s (%d)",
> - config->fwname, ret);
> - config->type = TLV_TYPE_PATCH;
> - snprintf(config->fwname, sizeof(config->fwname),
> - "qca/msbtfw%02x.tlv", rom_ver);
> - bt_dev_info(hdev, "QCA Downloading %s", config->fwname);
> - ret = request_firmware(&fw, config->fwname, &hdev->dev);
> - if (ret) {
> - bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
> - config->fwname, ret);
> - return ret;
> - }
> - }
> /* If the board-specific file is missing, try loading the default
> * one, unless that was attempted already.
> */
> - else if (config->type == TLV_TYPE_NVM &&
> - qca_get_alt_nvm_file(config->fwname, sizeof(config->fwname))) {
> + if (config->type == TLV_TYPE_NVM &&
> + qca_get_alt_nvm_file(config->fwname, sizeof(config->fwname))) {
> bt_dev_info(hdev, "QCA Downloading %s", config->fwname);
> ret = request_firmware(&fw, config->fwname, &hdev->dev);
> if (ret) {
> @@ -861,8 +844,22 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
> }
>
> err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
> - if (err < 0) {
> - bt_dev_err(hdev, "QCA Failed to download patch (%d)", err);
> + /* For WCN6750, if mbn file is not present then check for
> + * tlv file.
> + */
> + if (err < 0 && soc_type == QCA_WCN6750) {
> + bt_dev_dbg(hdev, "QCA Failed to request file: %s (%d)",
> + config.fwname, err);
> + config.type = TLV_TYPE_PATCH;
> + snprintf(config.fwname, sizeof(config.fwname),
> + "qca/msbtfw%02x.tlv", rom_ver);
> + bt_dev_info(hdev, "QCA Downloading %s", config.fwname);
> + err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
> + }
> +
> + if (err) {
You can keep the `if (err < 0) {` here.
> + bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
> + config.fwname, err);
> return err;
> }
>
> --
> 2.34.1
>
--
With best wishes
Dmitry
On 1/6/2026 8:21 AM, Dmitry Baryshkov wrote:
> On Mon, Jan 05, 2026 at 01:56:45PM +0800, Shuai Zhang wrote:
>> WCN7850 will first attempt to use ELF_TYPE_PATCH,
>> and if that fails, it will fall back to TLV_TYPE_PATCH.
>>
>> To code uniformity, move WCN7850 workaround to the caller.
>>
>> Signed-off-by: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
>> ---
>> drivers/bluetooth/btqca.c | 39 ++++++++++++++++++---------------------
>> 1 file changed, 18 insertions(+), 21 deletions(-)
>>
>> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
>> index 7c958d606..561e51fa9 100644
>> --- a/drivers/bluetooth/btqca.c
>> +++ b/drivers/bluetooth/btqca.c
>> @@ -581,28 +581,11 @@ static int qca_download_firmware(struct hci_dev *hdev,
>>
>> ret = request_firmware(&fw, config->fwname, &hdev->dev);
>> if (ret) {
>> - /* For WCN6750, if mbn file is not present then check for
>> - * tlv file.
>> - */
>> - if (soc_type == QCA_WCN6750 && config->type == ELF_TYPE_PATCH) {
>> - bt_dev_dbg(hdev, "QCA Failed to request file: %s (%d)",
>> - config->fwname, ret);
>> - config->type = TLV_TYPE_PATCH;
>> - snprintf(config->fwname, sizeof(config->fwname),
>> - "qca/msbtfw%02x.tlv", rom_ver);
>> - bt_dev_info(hdev, "QCA Downloading %s", config->fwname);
>> - ret = request_firmware(&fw, config->fwname, &hdev->dev);
>> - if (ret) {
>> - bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
>> - config->fwname, ret);
>> - return ret;
>> - }
>> - }
>> /* If the board-specific file is missing, try loading the default
>> * one, unless that was attempted already.
>> */
>> - else if (config->type == TLV_TYPE_NVM &&
>> - qca_get_alt_nvm_file(config->fwname, sizeof(config->fwname))) {
>> + if (config->type == TLV_TYPE_NVM &&
>> + qca_get_alt_nvm_file(config->fwname, sizeof(config->fwname))) {
>> bt_dev_info(hdev, "QCA Downloading %s", config->fwname);
>> ret = request_firmware(&fw, config->fwname, &hdev->dev);
>> if (ret) {
>> @@ -861,8 +844,22 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
>> }
>>
>> err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
>> - if (err < 0) {
>> - bt_dev_err(hdev, "QCA Failed to download patch (%d)", err);
>> + /* For WCN6750, if mbn file is not present then check for
>> + * tlv file.
>> + */
>> + if (err < 0 && soc_type == QCA_WCN6750) {
>> + bt_dev_dbg(hdev, "QCA Failed to request file: %s (%d)",
>> + config.fwname, err);
>> + config.type = TLV_TYPE_PATCH;
>> + snprintf(config.fwname, sizeof(config.fwname),
>> + "qca/msbtfw%02x.tlv", rom_ver);
>> + bt_dev_info(hdev, "QCA Downloading %s", config.fwname);
>> + err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
>> + }
>> +
>> + if (err) {
> You can keep the `if (err < 0) {` here.
I will update it.
>
>> + bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
>> + config.fwname, err);
>> return err;
>> }
>>
>> --
>> 2.34.1
>>
© 2016 - 2026 Red Hat, Inc.