Bluetooth: btusb: Handle download_firmware failure cases.
Subsystems (2)
PATCH 1/1 Bluetooth: btusb: Handle download_firmware failure cases.
From: mark-yw.chen <[email protected]>
For Mediatek chipset, if there are no firmware bin or command_timeout, the process should be terminated in btusb_mtk_setup().
--- drivers/bluetooth/btmtk.c | 1 + drivers/bluetooth/btusb.c | 4 ++++ 2 files changed, 5 insertions(+)
drivers/bluetooth/btmtk.c +1 -0
@@ -121,6 +121,7 @@ int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname, }else {bt_dev_err (hdev,"Failed wmt patch dwnld status (%d)" , status); + err = -EIO ; goto err_release_fw; } }
drivers/bluetooth/btusb.c +4 -0
@@ -2554,6 +2554,10 @@ static int btusb_mtk_setup(struct hci_dev *hdev) dev_id & 0xffff, (fw_version & 0xff) + 1); err =btmtk_setup_firmware_79xx (hdev, fw_bin_name, btusb_mtk_hci_wmt_sync); +if (err <0 ) { +bt_dev_err (hdev,"Failed to setup firmware (%d)" , err); +return err; + }/* It's Device EndPoint Reset Option Register */ btusb_mtk_uhw_reg_write (data,MTK_EP_RST_OPT ,MTK_EP_RST_IN_OUT_OPT );
Signature · 1 line
2.18.0
Dear Mark,
Some small nitpicks:
Am 06.12.21 um 10:25 schrieb [email protected]:
Quoted 1 line
From: mark-yw.chen <[email protected]>
Instead of the user name, maybe you can use Mark Chen (or the whole name)?
$ git config --global user.name "Mark Chen"
$ git commit --amend --reset-author="Mark Chen
<[email protected]>"Also could you please remove the trailing dot/period at the end of the git commit message summary?
Quoted 2 lines
For Mediatek chipset, if there are no firmware bin or
command_timeout, the process should be terminated inbtusb_mtk_setup().
Otherwise what happens?
Quoted 2 lines
Signed-off-by mark-yw.chen <[email protected]>Change-Id I99f1d7b72fa70643d9123e7e6cdc8d0b4369ce52
To what Gerrit instance does the Change-Id belong? Without that information (Reviewed-on tag?), it should be removed?
Quoted 22 lines
--- drivers/bluetooth/btmtk.c | 1 + drivers/bluetooth/btusb.c | 4 ++++ 2 files changed, 5 insertions(+)drivers/bluetooth/btmtk.c +1
-0@@ -121,6 +121,7 @@ int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname, }else {bt_dev_err (hdev,"Failed wmt patch dwnld status (%d)" , status); + err = -EIO ; goto err_release_fw; } }drivers/bluetooth/btusb.c +0
-0
drivers/bluetooth/btusb.c static int btusb_mtk_setup(struct hci_dev *hdev) · line 2558
Quoted 5 lines
drivers/bluetooth/btusb.c +2
-0@@ -2554,6 +2554,10 @@ static int btusb_mtk_setup(struct hci_dev *hdev) dev_id & 0xffff, (fw_version & 0xff) + 1); err =btmtk_setup_firmware_79xx (hdev, fw_bin_name, btusb_mtk_hci_wmt_sync); +if (err <0 ) { +bt_dev_err (hdev,"Failed to setup firmware (%d)" , err);
The verb is spelled with a space: set up.
Also, this error message seems unrelated to the patch in question. Maybe add it in a separate commit?
drivers/bluetooth/btusb.c static int btusb_mtk_setup(struct hci_dev *hdev) · line 2563
Quoted 6 lines
drivers/bluetooth/btusb.c +2
-0+return err; + }/* It's Device EndPoint Reset Option Register */ btusb_mtk_uhw_reg_write (data,MTK_EP_RST_OPT ,MTK_EP_RST_IN_OUT_OPT );
Kind regards,
Paul
Hi Paul,
Thanks for your comment.
Quoted 27 lines
-----Original Message-----
From: Paul Menzel <[email protected]>
Sent: Monday, December 6, 2021 5:51 PM
To: Mark-YW Chen (陳揚文) <[email protected]>
Cc: Aaron Hou (侯俊仰) <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Luiz Augusto von Dentz <[email protected]>; Sean Wang <[email protected]>
Subject: Re: [PATCH] Bluetooth: btusb: Handledownload_firmwarefailure cases.Dear Mark,
Some small nitpicks:
Am 06.12.21 um 10:25 schrieb [email protected]:
Quoted 1 line
From: mark-yw.chen <[email protected]>
Instead of the user name, maybe you can use Mark Chen (or the whole name)?
$ git config --global user.name "Mark Chen" $ git commit --amend --reset-author="Mark Chen <[email protected]>"
Quoted 7 lines
Also could you please remove the trailing dot/period at the end of the git commit message summary?
Quoted 2 lines
For Mediatek chipset, if there are no firmware bin or
command_timeout, the process should be terminated inbtusb_mtk_setup().Otherwise what happens?
For Mediatek Chipset, it cannot be enabled if there are something wrong in btmtk_setup_firmware_79xx().
err = btmtk_setup_firmware_79xx(hdev, fw_bin_name,
btusb_mtk_hci_wmt_sync);
/* Enable Bluetooth protocol */
param = 1;
wmt_params.op = BTMTK_WMT_FUNC_CTRL;
wmt_params.flag = 0;
wmt_params.dlen = sizeof(param);
wmt_params.data = ¶m;
wmt_params.status = NULL;
err = btusb_mtk_hci_wmt_sync(hdev, &wmt_params);
if (err < 0) {
| bt_dev_err(hdev, "Failed to send wmt func ctrl (%d)", err); | return err;
}
The process should be terminated and returned the error code.
Quoted 55 lines
Quoted 3 lines
Signed-off-by mark-yw.chen <[email protected]>Change-Id I99f1d7b72fa70643d9123e7e6cdc8d0b4369ce52To what Gerrit instance does the Change-Id belong? Without that information (Reviewed-on tag?), it should be removed?
drivers/bluetooth/btmtk.c int btmtk_setup_firmware_79xx(struct hci_dev
Quoted 10 lines
--- drivers/bluetooth/btmtk.c | 1 + drivers/bluetooth/btusb.c | 4 ++++ 2 files changed, 5 insertions(+)drivers/bluetooth/btmtk.c +0
-0@@ -121,6 +121,7 @@ int btmtk_setup_firmware_79xx(struct hci_dev*hdev, const char *fwname,
drivers/bluetooth/btmtk.c int btmtk_setup_firmware_79xx(struct hci_dev · line 122
Quoted 2 lines
drivers/bluetooth/btmtk.c +0
-0}else { bt_dev_err(hdev, "Failed wmt patch dwnldstatus (%d)",
drivers/bluetooth/btusb.c static int btusb_mtk_setup(struct hci_dev
Quoted 10 lines
drivers/bluetooth/btmtk.c +1
-0status); + err = -EIO ; goto err_release_fw; } }drivers/bluetooth/btusb.c +0
-0@@ -2554,6 +2554,10 @@ static int btusb_mtk_setup(struct hci_dev*hdev)
drivers/bluetooth/btusb.c static int btusb_mtk_setup(struct hci_dev *hdev) · line 2558
Quoted 5 lines
drivers/bluetooth/btusb.c +2
-0dev_id & 0xffff, (fw_version & 0xff) + 1); err =btmtk_setup_firmware_79xx (hdev, fw_bin_name, btusb_mtk_hci_wmt_sync); +if (err <0 ) { +bt_dev_err (hdev,"Failed to setup firmware (%d)" , err);The verb is spelled with a space: set up.
Also, this error message seems unrelated to the patch in question. Maybe add it in a separate commit?
Quoted 7 lines
drivers/bluetooth/btusb.c +2
-0+return err; + }/* It's Device EndPoint Reset Option Register */ btusb_mtk_uhw_reg_write(data, MTK_EP_RST_OPT,
MTK_EP_RST_IN_OUT_OPT);Kind regards,
Paul