Skip to content

Commit a6ca932

Browse files
committed
BACKPORT: bluetooth: btqca: move WCN7850 workaround to the caller
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. Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Signed-off-by: Shuai Zhang <shuai.zhang@oss.qualcomm.com> Link: https://lore.kernel.org/all/20260106043503.534557-2-shuai.zhang@oss.qualcomm.com/
1 parent 06f8ab9 commit a6ca932

1 file changed

Lines changed: 17 additions & 20 deletions

File tree

drivers/bluetooth/btqca.c

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -581,28 +581,11 @@ static int qca_download_firmware(struct hci_dev *hdev,
581581

582582
ret = request_firmware(&fw, config->fwname, &hdev->dev);
583583
if (ret) {
584-
/* For WCN6750, if mbn file is not present then check for
585-
* tlv file.
586-
*/
587-
if (soc_type == QCA_WCN6750 && config->type == ELF_TYPE_PATCH) {
588-
bt_dev_dbg(hdev, "QCA Failed to request file: %s (%d)",
589-
config->fwname, ret);
590-
config->type = TLV_TYPE_PATCH;
591-
snprintf(config->fwname, sizeof(config->fwname),
592-
"qca/msbtfw%02x.tlv", rom_ver);
593-
bt_dev_info(hdev, "QCA Downloading %s", config->fwname);
594-
ret = request_firmware(&fw, config->fwname, &hdev->dev);
595-
if (ret) {
596-
bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
597-
config->fwname, ret);
598-
return ret;
599-
}
600-
}
601584
/* If the board-specific file is missing, try loading the default
602585
* one, unless that was attempted already.
603586
*/
604-
else if (config->type == TLV_TYPE_NVM &&
605-
qca_get_alt_nvm_file(config->fwname, sizeof(config->fwname))) {
587+
if (config->type == TLV_TYPE_NVM &&
588+
qca_get_alt_nvm_file(config->fwname, sizeof(config->fwname))) {
606589
bt_dev_info(hdev, "QCA Downloading %s", config->fwname);
607590
ret = request_firmware(&fw, config->fwname, &hdev->dev);
608591
if (ret) {
@@ -861,8 +844,22 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
861844
}
862845

863846
err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
847+
/* For WCN6750, if mbn file is not present then check for
848+
* tlv file.
849+
*/
850+
if (err < 0 && soc_type == QCA_WCN6750) {
851+
bt_dev_dbg(hdev, "QCA Failed to request file: %s (%d)",
852+
config.fwname, err);
853+
config.type = TLV_TYPE_PATCH;
854+
snprintf(config.fwname, sizeof(config.fwname),
855+
"qca/msbtfw%02x.tlv", rom_ver);
856+
bt_dev_info(hdev, "QCA Downloading %s", config.fwname);
857+
err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
858+
}
859+
864860
if (err < 0) {
865-
bt_dev_err(hdev, "QCA Failed to download patch (%d)", err);
861+
bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
862+
config.fwname, err);
866863
return err;
867864
}
868865

0 commit comments

Comments
 (0)