mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
Bluetooth: btmtk: Add reset mechanism if downloading firmware failed
Add a new flag 'BTMTK_FIRMWARE_DL_RETRY'. If an error occurs during mt79xx firmware download process, this flag will be set and cleared after a reset. If the flag is already set and firmware still cannot be loaded successfully after a reset, no further reset attempts will be made. In other words, if there is a problem during firmware download, only one reset will be attempted. Signed-off-by: Chris Lu <chris.lu@mediatek.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
committed by
Luiz Augusto von Dentz
parent
b27a306e9f
commit
679621a767
@@ -1344,6 +1344,9 @@ int btmtk_usb_setup(struct hci_dev *hdev)
|
||||
err = btmtk_setup_firmware_79xx(hdev, fw_bin_name,
|
||||
btmtk_usb_hci_wmt_sync);
|
||||
if (err < 0) {
|
||||
/* retry once if setup firmware error */
|
||||
if (!test_and_set_bit(BTMTK_FIRMWARE_DL_RETRY, &btmtk_data->flags))
|
||||
btmtk_reset_sync(hdev);
|
||||
bt_dev_err(hdev, "Failed to set up firmware (%d)", err);
|
||||
return err;
|
||||
}
|
||||
@@ -1371,6 +1374,9 @@ int btmtk_usb_setup(struct hci_dev *hdev)
|
||||
hci_set_msft_opcode(hdev, 0xFD30);
|
||||
hci_set_aosp_capable(hdev);
|
||||
|
||||
/* Clear BTMTK_FIRMWARE_DL_RETRY if setup successfully */
|
||||
test_and_clear_bit(BTMTK_FIRMWARE_DL_RETRY, &btmtk_data->flags);
|
||||
|
||||
/* Set up ISO interface after protocol enabled */
|
||||
if (test_bit(BTMTK_ISOPKT_OVER_INTR, &btmtk_data->flags)) {
|
||||
if (!btmtk_usb_isointf_init(hdev))
|
||||
|
||||
@@ -147,6 +147,7 @@ enum {
|
||||
BTMTK_HW_RESET_ACTIVE,
|
||||
BTMTK_ISOPKT_OVER_INTR,
|
||||
BTMTK_ISOPKT_RUNNING,
|
||||
BTMTK_FIRMWARE_DL_RETRY,
|
||||
};
|
||||
|
||||
typedef int (*btmtk_reset_sync_func_t)(struct hci_dev *, void *);
|
||||
|
||||
Reference in New Issue
Block a user