* [PATCH v5 0/1]] Bluetooth: btusb: add default nvm file
@ 2025-11-10 13:22 Shuai Zhang
2025-11-10 13:22 ` [PATCH v5 1/1] " Shuai Zhang
0 siblings, 1 reply; 4+ messages in thread
From: Shuai Zhang @ 2025-11-10 13:22 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz
Cc: linux-bluetooth, linux-kernel, linux-arm-msm, quic_chejiang,
quic_jiaymao, quic_chezhou, Shuai Zhang
this patch adds support for default NVM file
Changes v5:
- Explain the difference between the default NVM file and the board-specific NVM file.
- Clarify that board_id is required to select the correct NVM file.
- Link to v4
https://lore.kernel.org/all/20251110034134.1016537-1-quic_shuaz@quicinc.com/
Changes v4:
- Remove email CC @stable.
- Link to v3
https://lore.kernel.org/all/20251104112441.2667316-2-quic_shuaz@quicinc.com/
Changes v3:
- Remove rery, modify btusb_setup_qca_load_nvm, and add board_id to enable the use of the default NVM file.
- Link to v2
https://lore.kernel.org/all/20251029022955.827475-2-quic_shuaz@quicinc.com/
Changes v2:
- Add log for failed default nvm file request.
- Added Cc: stable@vger.kernel.org to comply with stable kernel rules.
- Link to v1:
https://lore.kernel.org/all/20251028120550.2225434-1-quic_shuaz@quicinc.com/
Shuai Zhang (1):
Bluetooth: btusb: add default nvm file
drivers/bluetooth/btusb.c | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v5 1/1] Bluetooth: btusb: add default nvm file
2025-11-10 13:22 [PATCH v5 0/1]] Bluetooth: btusb: add default nvm file Shuai Zhang
@ 2025-11-10 13:22 ` Shuai Zhang
2025-11-10 14:09 ` ] " bluez.test.bot
2025-11-10 14:57 ` [PATCH v5 1/1] " Paul Menzel
0 siblings, 2 replies; 4+ messages in thread
From: Shuai Zhang @ 2025-11-10 13:22 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz
Cc: linux-bluetooth, linux-kernel, linux-arm-msm, quic_chejiang,
quic_jiaymao, quic_chezhou, Shuai Zhang
If no NVM file matches the board_id, load the default NVM file to ensure
basic Bluetooth functionality. The default NVM file may differ in
functionality and performance because specific NVM files enable certain
vendor commands based on chip capabilities. This fallback improves
compatibility when a dedicated NVM file is not available.
Also, pass board_id explicitly to select the correct NVM file. This is
required for proper NVM file determination.
Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com>
---
drivers/bluetooth/btusb.c | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index dcbff7641..09e81320c 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -3482,15 +3482,14 @@ static int btusb_setup_qca_load_rampatch(struct hci_dev *hdev,
}
static void btusb_generate_qca_nvm_name(char *fwname, size_t max_size,
- const struct qca_version *ver)
+ const struct qca_version *ver,
+ u16 board_id)
{
u32 rom_version = le32_to_cpu(ver->rom_version);
const char *variant, *fw_subdir;
int len;
- u16 board_id;
fw_subdir = qca_get_fw_subdirectory(ver);
- board_id = qca_extract_board_id(ver);
switch (le32_to_cpu(ver->ram_version)) {
case WCN6855_2_0_RAM_VERSION_GF:
@@ -3517,14 +3516,14 @@ static void btusb_generate_qca_nvm_name(char *fwname, size_t max_size,
static int btusb_setup_qca_load_nvm(struct hci_dev *hdev,
struct qca_version *ver,
- const struct qca_device_info *info)
+ const struct qca_device_info *info,
+ u16 board_id)
{
const struct firmware *fw;
char fwname[80];
int err;
- btusb_generate_qca_nvm_name(fwname, sizeof(fwname), ver);
-
+ btusb_generate_qca_nvm_name(fwname, sizeof(fwname), ver, board_id);
err = request_firmware(&fw, fwname, &hdev->dev);
if (err) {
bt_dev_err(hdev, "failed to request NVM file: %s (%d)",
@@ -3606,10 +3605,21 @@ static int btusb_setup_qca(struct hci_dev *hdev)
btdata->qca_dump.controller_id = le32_to_cpu(ver.rom_version);
if (!(status & QCA_SYSCFG_UPDATED)) {
- err = btusb_setup_qca_load_nvm(hdev, &ver, info);
- if (err < 0)
- return err;
+ u16 board_id = qca_extract_board_id(&ver);
+ err = btusb_setup_qca_load_nvm(hdev, &ver, info, board_id);
+ if (err < 0) {
+ /* If the board-specific NVM file is not found, set board_id to 0
+ * and load the default NVM file to ensure basic functionality.
+ */
+ if (err == -ENOENT && board_id != 0) {
+ err = btusb_setup_qca_load_nvm(hdev, &ver, info, 0);
+ if (err < 0)
+ return err;
+ } else {
+ return err;
+ }
+ }
/* WCN6855 2.1 and later will reset to apply firmware downloaded here, so
* wait ~100ms for reset Done then go ahead, otherwise, it maybe
* cause potential enable failure.
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: ] Bluetooth: btusb: add default nvm file
2025-11-10 13:22 ` [PATCH v5 1/1] " Shuai Zhang
@ 2025-11-10 14:09 ` bluez.test.bot
2025-11-10 14:57 ` [PATCH v5 1/1] " Paul Menzel
1 sibling, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2025-11-10 14:09 UTC (permalink / raw)
To: linux-bluetooth, quic_shuaz
[-- Attachment #1: Type: text/plain, Size: 2376 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1021596
---Test result---
Test Summary:
CheckPatch PENDING 0.34 seconds
GitLint PENDING 0.32 seconds
SubjectPrefix PASS 0.12 seconds
BuildKernel PASS 25.61 seconds
CheckAllWarning PASS 27.74 seconds
CheckSparse PASS 31.13 seconds
BuildKernel32 PASS 24.97 seconds
TestRunnerSetup PASS 497.75 seconds
TestRunner_l2cap-tester PASS 23.92 seconds
TestRunner_iso-tester PASS 87.79 seconds
TestRunner_bnep-tester PASS 6.15 seconds
TestRunner_mgmt-tester FAIL 115.63 seconds
TestRunner_rfcomm-tester PASS 9.25 seconds
TestRunner_sco-tester PASS 14.32 seconds
TestRunner_ioctl-tester PASS 9.91 seconds
TestRunner_mesh-tester FAIL 11.57 seconds
TestRunner_smp-tester PASS 8.42 seconds
TestRunner_userchan-tester PASS 6.51 seconds
IncrementalBuild PENDING 0.99 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 492, Passed: 486 (98.8%), Failed: 2, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.100 seconds
LL Privacy - Set Flags 1 (Add to RL) Failed 0.153 seconds
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0
Failed Test Cases
Mesh - Send cancel - 1 Timed out 1.982 seconds
Mesh - Send cancel - 2 Timed out 1.995 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v5 1/1] Bluetooth: btusb: add default nvm file
2025-11-10 13:22 ` [PATCH v5 1/1] " Shuai Zhang
2025-11-10 14:09 ` ] " bluez.test.bot
@ 2025-11-10 14:57 ` Paul Menzel
1 sibling, 0 replies; 4+ messages in thread
From: Paul Menzel @ 2025-11-10 14:57 UTC (permalink / raw)
To: Shuai Zhang
Cc: Marcel Holtmann, Luiz Augusto von Dentz, linux-bluetooth,
linux-kernel, linux-arm-msm, quic_chejiang, quic_jiaymao,
quic_chezhou
Dear Shuai,
Am 10.11.25 um 14:22 schrieb Shuai Zhang:
> If no NVM file matches the board_id, load the default NVM file to ensure
> basic Bluetooth functionality. The default NVM file may differ in
> functionality and performance because specific NVM files enable certain
> vendor commands based on chip capabilities. This fallback improves
> compatibility when a dedicated NVM file is not available.
>
> Also, pass board_id explicitly to select the correct NVM file. This is
> required for proper NVM file determination.
>
> Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com>
> ---
> drivers/bluetooth/btusb.c | 28 +++++++++++++++++++---------
> 1 file changed, 19 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index dcbff7641..09e81320c 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -3482,15 +3482,14 @@ static int btusb_setup_qca_load_rampatch(struct hci_dev *hdev,
> }
>
> static void btusb_generate_qca_nvm_name(char *fwname, size_t max_size,
> - const struct qca_version *ver)
> + const struct qca_version *ver,
> + u16 board_id)
> {
> u32 rom_version = le32_to_cpu(ver->rom_version);
> const char *variant, *fw_subdir;
> int len;
> - u16 board_id;
>
> fw_subdir = qca_get_fw_subdirectory(ver);
> - board_id = qca_extract_board_id(ver);
>
> switch (le32_to_cpu(ver->ram_version)) {
> case WCN6855_2_0_RAM_VERSION_GF:
> @@ -3517,14 +3516,14 @@ static void btusb_generate_qca_nvm_name(char *fwname, size_t max_size,
>
> static int btusb_setup_qca_load_nvm(struct hci_dev *hdev,
> struct qca_version *ver,
> - const struct qca_device_info *info)
> + const struct qca_device_info *info,
> + u16 board_id)
> {
> const struct firmware *fw;
> char fwname[80];
> int err;
>
> - btusb_generate_qca_nvm_name(fwname, sizeof(fwname), ver);
> -
> + btusb_generate_qca_nvm_name(fwname, sizeof(fwname), ver, board_id);
> err = request_firmware(&fw, fwname, &hdev->dev);
> if (err) {
> bt_dev_err(hdev, "failed to request NVM file: %s (%d)",
> @@ -3606,10 +3605,21 @@ static int btusb_setup_qca(struct hci_dev *hdev)
> btdata->qca_dump.controller_id = le32_to_cpu(ver.rom_version);
>
> if (!(status & QCA_SYSCFG_UPDATED)) {
> - err = btusb_setup_qca_load_nvm(hdev, &ver, info);
> - if (err < 0)
> - return err;
> + u16 board_id = qca_extract_board_id(&ver);
>
> + err = btusb_setup_qca_load_nvm(hdev, &ver, info, board_id);
> + if (err < 0) {
> + /* If the board-specific NVM file is not found, set board_id to 0
> + * and load the default NVM file to ensure basic functionality.
> + */
> + if (err == -ENOENT && board_id != 0) {
> + err = btusb_setup_qca_load_nvm(hdev, &ver, info, 0);
> + if (err < 0)
> + return err;
> + } else {
> + return err;
> + }
> + }
> /* WCN6855 2.1 and later will reset to apply firmware downloaded here, so
> * wait ~100ms for reset Done then go ahead, otherwise, it maybe
> * cause potential enable failure.
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Kind regards,
Paul
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-11-10 14:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-10 13:22 [PATCH v5 0/1]] Bluetooth: btusb: add default nvm file Shuai Zhang
2025-11-10 13:22 ` [PATCH v5 1/1] " Shuai Zhang
2025-11-10 14:09 ` ] " bluez.test.bot
2025-11-10 14:57 ` [PATCH v5 1/1] " Paul Menzel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).