summaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorSean Wang <sean.wang@mediatek.com>2022-05-12 23:38:12 +0200
committerMarcel Holtmann <marcel@holtmann.org>2022-05-13 13:18:17 +0200
commit7469720563e01f479ec5afe06bd6f440f965d523 (patch)
tree6f468b3aee91bbeacb1c608e87767b6f760c3a25 /drivers/bluetooth
parentBluetooth: btmtksdio: fix use-after-free at btmtksdio_recv_event (diff)
downloadlinux-7469720563e01f479ec5afe06bd6f440f965d523.tar.xz
linux-7469720563e01f479ec5afe06bd6f440f965d523.zip
Bluetooth: btmtksdio: fix possible FW initialization failure
According to FW advised sequence, mt7921s need to re-acquire privilege immediately after the firmware download is complete before normal running. Otherwise, it is still possible the bus may be stuck in an abnormal status that causes FW initialization failure in the current driver. Fixes: 752aea58489f ("Bluetooth: mt7921s: fix bus hang with wrong privilege") Co-developed-by: Yake Yang <yake.yang@mediatek.com> Signed-off-by: Yake Yang <yake.yang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/btmtksdio.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index 4ae6631a7c29..5d13c1f61bd3 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -864,6 +864,14 @@ static int mt79xx_setup(struct hci_dev *hdev, const char *fwname)
return err;
}
+ err = btmtksdio_fw_pmctrl(bdev);
+ if (err < 0)
+ return err;
+
+ err = btmtksdio_drv_pmctrl(bdev);
+ if (err < 0)
+ return err;
+
/* Enable Bluetooth protocol */
wmt_params.op = BTMTK_WMT_FUNC_CTRL;
wmt_params.flag = 0;
@@ -1109,14 +1117,6 @@ static int btmtksdio_setup(struct hci_dev *hdev)
if (err < 0)
return err;
- err = btmtksdio_fw_pmctrl(bdev);
- if (err < 0)
- return err;
-
- err = btmtksdio_drv_pmctrl(bdev);
- if (err < 0)
- return err;
-
/* Enable SCO over I2S/PCM */
err = btmtksdio_sco_setting(hdev);
if (err < 0) {