Patch "Bluetooth: btqcomsmd: Fix command timeout after setting BD address" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    Bluetooth: btqcomsmd: Fix command timeout after setting BD address

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     bluetooth-btqcomsmd-fix-command-timeout-after-settin.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 1270624549133ac75c055b30615e44a1cc760a7d
Author: Stephan Gerhold <stephan.gerhold@xxxxxxxxxxxxxxx>
Date:   Wed Mar 8 14:31:55 2023 +0100

    Bluetooth: btqcomsmd: Fix command timeout after setting BD address
    
    [ Upstream commit 5d44ab9e204200a78ad55cdf185aa2bb109b5950 ]
    
    On most devices using the btqcomsmd driver (e.g. the DragonBoard 410c
    and other devices based on the Qualcomm MSM8916/MSM8909/... SoCs)
    the Bluetooth firmware seems to become unresponsive for a while after
    setting the BD address. On recent kernel versions (at least 5.17+)
    this often causes timeouts for subsequent commands, e.g. the HCI reset
    sent by the Bluetooth core during initialization:
    
        Bluetooth: hci0: Opcode 0x c03 failed: -110
    
    Unfortunately this behavior does not seem to be documented anywhere.
    Experimentation suggests that the minimum necessary delay to avoid
    the problem is ~150us. However, to be sure add a sleep for > 1ms
    in case it is a bit longer on other firmware versions.
    
    Older kernel versions are likely also affected, although perhaps with
    slightly different errors or less probability. Side effects can easily
    hide the issue in most cases, e.g. unrelated incoming interrupts that
    cause the necessary delay.
    
    Fixes: 1511cc750c3d ("Bluetooth: Introduce Qualcomm WCNSS SMD based HCI driver")
    Signed-off-by: Stephan Gerhold <stephan.gerhold@xxxxxxxxxxxxxxx>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/bluetooth/btqcomsmd.c b/drivers/bluetooth/btqcomsmd.c
index 874172aa8e417..a698b1f6394b2 100644
--- a/drivers/bluetooth/btqcomsmd.c
+++ b/drivers/bluetooth/btqcomsmd.c
@@ -146,6 +146,21 @@ static int btqcomsmd_setup(struct hci_dev *hdev)
 	return 0;
 }
 
+static int btqcomsmd_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr)
+{
+	int ret;
+
+	ret = qca_set_bdaddr_rome(hdev, bdaddr);
+	if (ret)
+		return ret;
+
+	/* The firmware stops responding for a while after setting the bdaddr,
+	 * causing timeouts for subsequent commands. Sleep a bit to avoid this.
+	 */
+	usleep_range(1000, 10000);
+	return 0;
+}
+
 static int btqcomsmd_probe(struct platform_device *pdev)
 {
 	struct btqcomsmd *btq;
@@ -195,7 +210,7 @@ static int btqcomsmd_probe(struct platform_device *pdev)
 	hdev->close = btqcomsmd_close;
 	hdev->send = btqcomsmd_send;
 	hdev->setup = btqcomsmd_setup;
-	hdev->set_bdaddr = qca_set_bdaddr_rome;
+	hdev->set_bdaddr = btqcomsmd_set_bdaddr;
 
 	ret = hci_register_dev(hdev);
 	if (ret < 0)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux