]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Bluetooth: btusb: Allow firmware re-download when version matches
authorShuai Zhang <shuai.zhang@oss.qualcomm.com>
Thu, 21 May 2026 05:25:47 +0000 (13:25 +0800)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 27 May 2026 20:44:02 +0000 (16:44 -0400)
The Bluetooth host decides whether to download firmware by reading the
controller firmware download completion flag and firmware version
information.

If a USB error occurs during the firmware download process (for example
due to a USB disconnect), the download is aborted immediately. An
incomplete firmware transfer does not cause the controller to set the
download completion flag, but the firmware version information may be
updated at an early stage of the download process.

In this case, after USB reconnection, the host attempts to re-download
the firmware because the download completion flag is not set. However,
since the controller reports the same firmware version as the target
firmware, the download is skipped. This ultimately results in the
firmware not being properly updated on the controller.

This change removes the restriction that skips firmware download when
the versions are equal. It covers scenarios where the USB connection
can be disconnected at any time and ensures that firmware download can
be retriggered after USB reconnection, allowing the Bluetooth firmware
to be correctly and completely updated.

Fixes: 3267c884cefa ("Bluetooth: btusb: Add support for QCA ROME chipset family")
Cc: stable@vger.kernel.org
Signed-off-by: Shuai Zhang <shuai.zhang@oss.qualcomm.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
drivers/bluetooth/btusb.c

index 7f5fce93d98488dd242c559c4338200b77da1b04..830fefb342c6b170db00d3269aa59a9af67259d7 100644 (file)
@@ -3540,7 +3540,13 @@ static int btusb_setup_qca_load_rampatch(struct hci_dev *hdev,
                    "firmware rome 0x%x build 0x%x",
                    rver_rom, rver_patch, ver_rom, ver_patch);
 
-       if (rver_rom != ver_rom || rver_patch <= ver_patch) {
+       /* Allow rampatch when the patch version equals the firmware version.
+        * A firmware download may be aborted by a transient USB error (e.g.
+        * disconnect) after the controller updates version info but before
+        * completion.
+        * Allowing equal versions enables re-flashing during recovery.
+        */
+       if (rver_rom != ver_rom || rver_patch < ver_patch) {
                bt_dev_err(hdev, "rampatch file version did not match with firmware");
                err = -EINVAL;
                goto done;