public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] Bluetooth: btusb: add default nvm file
@ 2025-10-28 12:05 Shuai Zhang
  2025-10-28 12:50 ` [v1] " bluez.test.bot
  2025-10-28 16:57 ` [PATCH v1] " Dmitry Baryshkov
  0 siblings, 2 replies; 4+ messages in thread
From: Shuai Zhang @ 2025-10-28 12:05 UTC (permalink / raw)
  To: dmitry.baryshkov, marcel, luiz.dentz
  Cc: linux-bluetooth, stable, linux-arm-msm, linux-kernel,
	quic_chejiang, Shuai Zhang

If no NVM file matches the board_id, load the default NVM file.

Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com>
---
 drivers/bluetooth/btusb.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index dcbff7641..998dfd455 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:
@@ -3522,13 +3521,25 @@ static int btusb_setup_qca_load_nvm(struct hci_dev *hdev,
 	const struct firmware *fw;
 	char fwname[80];
 	int err;
+	u16 board_id = 0;
 
-	btusb_generate_qca_nvm_name(fwname, sizeof(fwname), ver);
+	board_id = qca_extract_board_id(ver);
 
+retry:
+	btusb_generate_qca_nvm_name(fwname, sizeof(fwname), ver, board_id);
 	err = request_firmware(&fw, fwname, &hdev->dev);
 	if (err) {
+		if (err == -EINVAL) {
+			bt_dev_err(hdev, "QCOM BT firmware file request failed (%d)", err);
+			return err;
+		}
+
 		bt_dev_err(hdev, "failed to request NVM file: %s (%d)",
 			   fwname, err);
+		if (err == -ENOENT && board_id != 0) {
+			board_id = 0;
+			goto retry;
+		}
 		return err;
 	}
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [v1] Bluetooth: btusb: add default nvm file
  2025-10-28 12:05 [PATCH v1] Bluetooth: btusb: add default nvm file Shuai Zhang
@ 2025-10-28 12:50 ` bluez.test.bot
  2025-10-28 16:57 ` [PATCH v1] " Dmitry Baryshkov
  1 sibling, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2025-10-28 12:50 UTC (permalink / raw)
  To: linux-bluetooth, quic_shuaz

[-- Attachment #1: Type: text/plain, Size: 2429 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=1016703

---Test result---

Test Summary:
CheckPatch                    PENDING   0.29 seconds
GitLint                       PENDING   0.29 seconds
SubjectPrefix                 PASS      0.09 seconds
BuildKernel                   PASS      25.18 seconds
CheckAllWarning               PASS      27.70 seconds
CheckSparse                   PASS      31.04 seconds
BuildKernel32                 PASS      24.76 seconds
TestRunnerSetup               PASS      500.96 seconds
TestRunner_l2cap-tester       PASS      24.53 seconds
TestRunner_iso-tester         FAIL      54.49 seconds
TestRunner_bnep-tester        PASS      6.60 seconds
TestRunner_mgmt-tester        FAIL      124.21 seconds
TestRunner_rfcomm-tester      PASS      9.33 seconds
TestRunner_sco-tester         PASS      14.37 seconds
TestRunner_ioctl-tester       PASS      9.94 seconds
TestRunner_mesh-tester        FAIL      11.45 seconds
TestRunner_smp-tester         PASS      8.36 seconds
TestRunner_userchan-tester    PASS      6.69 seconds
IncrementalBuild              PENDING   0.87 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
No test result found
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 490, Passed: 485 (99.0%), Failed: 1, Not Run: 4

Failed Test Cases
Read Exp Feature - Success                           Failed       0.098 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    2.099 seconds
Mesh - Send cancel - 2                               Timed out    1.993 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 v1] Bluetooth: btusb: add default nvm file
  2025-10-28 12:05 [PATCH v1] Bluetooth: btusb: add default nvm file Shuai Zhang
  2025-10-28 12:50 ` [v1] " bluez.test.bot
@ 2025-10-28 16:57 ` Dmitry Baryshkov
  2025-10-29  2:02   ` Shuai Zhang
  1 sibling, 1 reply; 4+ messages in thread
From: Dmitry Baryshkov @ 2025-10-28 16:57 UTC (permalink / raw)
  To: Shuai Zhang
  Cc: marcel, luiz.dentz, linux-bluetooth, stable, linux-arm-msm,
	linux-kernel, quic_chejiang

On Tue, Oct 28, 2025 at 08:05:50PM +0800, Shuai Zhang wrote:
> If no NVM file matches the board_id, load the default NVM file.
> 
> Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com>
> ---
>  drivers/bluetooth/btusb.c | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index dcbff7641..998dfd455 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:
> @@ -3522,13 +3521,25 @@ static int btusb_setup_qca_load_nvm(struct hci_dev *hdev,
>  	const struct firmware *fw;
>  	char fwname[80];
>  	int err;
> +	u16 board_id = 0;
>  
> -	btusb_generate_qca_nvm_name(fwname, sizeof(fwname), ver);
> +	board_id = qca_extract_board_id(ver);
>  
> +retry:
> +	btusb_generate_qca_nvm_name(fwname, sizeof(fwname), ver, board_id);
>  	err = request_firmware(&fw, fwname, &hdev->dev);
>  	if (err) {
> +		if (err == -EINVAL) {
> +			bt_dev_err(hdev, "QCOM BT firmware file request failed (%d)", err);
> +			return err;
> +		}
> +
>  		bt_dev_err(hdev, "failed to request NVM file: %s (%d)",
>  			   fwname, err);
> +		if (err == -ENOENT && board_id != 0) {
> +			board_id = 0;
> +			goto retry;
> +		}

I'd rather see here:

  } else {
	bt_dev_err(hdev, "QCOM BT firmware file request failed (%d)", err);
	return err;
  }

>  		return err;
>  	}
>  
> -- 
> 2.34.1
> 

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] Bluetooth: btusb: add default nvm file
  2025-10-28 16:57 ` [PATCH v1] " Dmitry Baryshkov
@ 2025-10-29  2:02   ` Shuai Zhang
  0 siblings, 0 replies; 4+ messages in thread
From: Shuai Zhang @ 2025-10-29  2:02 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: marcel, luiz.dentz, linux-bluetooth, stable, linux-arm-msm,
	linux-kernel, quic_chejiang

Hi Dmitry

On 10/29/2025 12:57 AM, Dmitry Baryshkov wrote:
> On Tue, Oct 28, 2025 at 08:05:50PM +0800, Shuai Zhang wrote:
>> If no NVM file matches the board_id, load the default NVM file.
>>
>> Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com>
>> ---
>>  drivers/bluetooth/btusb.c | 19 +++++++++++++++----
>>  1 file changed, 15 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
>> index dcbff7641..998dfd455 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:
>> @@ -3522,13 +3521,25 @@ static int btusb_setup_qca_load_nvm(struct hci_dev *hdev,
>>  	const struct firmware *fw;
>>  	char fwname[80];
>>  	int err;
>> +	u16 board_id = 0;
>>  
>> -	btusb_generate_qca_nvm_name(fwname, sizeof(fwname), ver);
>> +	board_id = qca_extract_board_id(ver);
>>  
>> +retry:
>> +	btusb_generate_qca_nvm_name(fwname, sizeof(fwname), ver, board_id);
>>  	err = request_firmware(&fw, fwname, &hdev->dev);
>>  	if (err) {
>> +		if (err == -EINVAL) {
>> +			bt_dev_err(hdev, "QCOM BT firmware file request failed (%d)", err);
>> +			return err;
>> +		}
>> +
>>  		bt_dev_err(hdev, "failed to request NVM file: %s (%d)",
>>  			   fwname, err);
>> +		if (err == -ENOENT && board_id != 0) {
>> +			board_id = 0;
>> +			goto retry;
>> +		}
> 
> I'd rather see here:
> 
>   } else {
> 	bt_dev_err(hdev, "QCOM BT firmware file request failed (%d)", err);
> 	return err;
>   }
> 

This will make the log clearer. Thank you for your suggestion;I will update it.

>>  		return err;
>>  	}
>>  
>> -- 
>> 2.34.1
>>
> 
BR,
Shuai


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-29  2:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-28 12:05 [PATCH v1] Bluetooth: btusb: add default nvm file Shuai Zhang
2025-10-28 12:50 ` [v1] " bluez.test.bot
2025-10-28 16:57 ` [PATCH v1] " Dmitry Baryshkov
2025-10-29  2:02   ` Shuai Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox