* [PATCH v1] Bluetooth: qca: Refactor code on the basis of chipset names
@ 2026-02-10 12:01 Vivek Sahu
2026-02-10 12:13 ` Dmitry Baryshkov
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Vivek Sahu @ 2026-02-10 12:01 UTC (permalink / raw)
To: Bartosz Golaszewski, Marcel Holtmann, Luiz Augusto von Dentz
Cc: quic_mohamull, quic_hbandi, linux-arm-msm, linux-bluetooth,
linux-kernel, Vivek Sahu
Whenever new chipset support is added to the driver code,
we ended up adding chipset name to the last of the switch case
arising code readability issue because of improper sorting of
the chipset names in various places of the code.
Refactor code such a way that new chipset can be added easily
in the code without compromising code readability.
Signed-off-by: Vivek Sahu <vivek.sahu@oss.qualcomm.com>
---
drivers/bluetooth/btqca.c | 37 +++++++++++++++++++------------------
drivers/bluetooth/hci_qca.c | 30 +++++++++++++++---------------
2 files changed, 34 insertions(+), 33 deletions(-)
diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index 74f820e89655..9f7e13fcb20e 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -799,6 +799,14 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
snprintf(config.fwname, sizeof(config.fwname), "qca/%s", rampatch_name);
} else {
switch (soc_type) {
+ case QCA_QCA2066:
+ snprintf(config.fwname, sizeof(config.fwname),
+ "qca/hpbtfw%02x.tlv", rom_ver);
+ break;
+ case QCA_QCA6390:
+ snprintf(config.fwname, sizeof(config.fwname),
+ "qca/htbtfw%02x.tlv", rom_ver);
+ break;
case QCA_WCN3950:
snprintf(config.fwname, sizeof(config.fwname),
"qca/cmbtfw%02x.tlv", rom_ver);
@@ -813,14 +821,6 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
snprintf(config.fwname, sizeof(config.fwname),
"qca/apbtfw%02x.tlv", rom_ver);
break;
- case QCA_QCA2066:
- snprintf(config.fwname, sizeof(config.fwname),
- "qca/hpbtfw%02x.tlv", rom_ver);
- break;
- case QCA_QCA6390:
- snprintf(config.fwname, sizeof(config.fwname),
- "qca/htbtfw%02x.tlv", rom_ver);
- break;
case QCA_WCN6750:
/* Choose mbn file by default.If mbn file is not found
* then choose tlv file
@@ -890,6 +890,16 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
}
} else {
switch (soc_type) {
+ case QCA_QCA2066:
+ qca_get_nvm_name_by_board(config.fwname,
+ sizeof(config.fwname),
+ "hpnv", soc_type, ver,
+ rom_ver, boardid);
+ break;
+ case QCA_QCA6390:
+ snprintf(config.fwname, sizeof(config.fwname),
+ "qca/htnv%02x.bin", rom_ver);
+ break;
case QCA_WCN3950:
if (le32_to_cpu(ver.soc_id) == QCA_WCN3950_SOC_ID_T)
variant = "t";
@@ -912,15 +922,6 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
snprintf(config.fwname, sizeof(config.fwname),
"qca/apnv%02x.bin", rom_ver);
break;
- case QCA_QCA2066:
- qca_get_nvm_name_by_board(config.fwname,
- sizeof(config.fwname), "hpnv", soc_type, ver,
- rom_ver, boardid);
- break;
- case QCA_QCA6390:
- snprintf(config.fwname, sizeof(config.fwname),
- "qca/htnv%02x.bin", rom_ver);
- break;
case QCA_WCN6750:
snprintf(config.fwname, sizeof(config.fwname),
"qca/msnv%02x.bin", rom_ver);
@@ -954,9 +955,9 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
}
switch (soc_type) {
- case QCA_WCN3991:
case QCA_QCA2066:
case QCA_QCA6390:
+ case QCA_WCN3991:
case QCA_WCN6750:
case QCA_WCN6855:
case QCA_WCN7850:
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index c511546f793e..d8e5957a2edf 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1850,6 +1850,7 @@ static int qca_power_on(struct hci_dev *hdev)
return 0;
switch (soc_type) {
+ case QCA_QCA6390:
case QCA_WCN3950:
case QCA_WCN3988:
case QCA_WCN3990:
@@ -1858,7 +1859,6 @@ static int qca_power_on(struct hci_dev *hdev)
case QCA_WCN6750:
case QCA_WCN6855:
case QCA_WCN7850:
- case QCA_QCA6390:
ret = qca_regulator_init(hu);
break;
@@ -2092,6 +2092,18 @@ static const struct hci_uart_proto qca_proto = {
.dequeue = qca_dequeue,
};
+static const struct qca_device_data qca_soc_data_qca2066 __maybe_unused = {
+ .soc_type = QCA_QCA2066,
+ .num_vregs = 0,
+ .capabilities = QCA_CAP_WIDEBAND_SPEECH | QCA_CAP_VALID_LE_STATES |
+ QCA_CAP_HFP_HW_OFFLOAD,
+};
+
+static const struct qca_device_data qca_soc_data_qca6390 __maybe_unused = {
+ .soc_type = QCA_QCA6390,
+ .num_vregs = 0,
+};
+
static const struct qca_device_data qca_soc_data_wcn3950 __maybe_unused = {
.soc_type = QCA_WCN3950,
.vregs = (struct qca_vreg []) {
@@ -2148,18 +2160,6 @@ static const struct qca_device_data qca_soc_data_wcn3998 __maybe_unused = {
.num_vregs = 4,
};
-static const struct qca_device_data qca_soc_data_qca2066 __maybe_unused = {
- .soc_type = QCA_QCA2066,
- .num_vregs = 0,
- .capabilities = QCA_CAP_WIDEBAND_SPEECH | QCA_CAP_VALID_LE_STATES |
- QCA_CAP_HFP_HW_OFFLOAD,
-};
-
-static const struct qca_device_data qca_soc_data_qca6390 __maybe_unused = {
- .soc_type = QCA_QCA6390,
- .num_vregs = 0,
-};
-
static const struct qca_device_data qca_soc_data_wcn6750 __maybe_unused = {
.soc_type = QCA_WCN6750,
.vregs = (struct qca_vreg []) {
@@ -2398,6 +2398,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
qcadev->btsoc_type = QCA_ROME;
switch (qcadev->btsoc_type) {
+ case QCA_QCA6390:
case QCA_WCN3950:
case QCA_WCN3988:
case QCA_WCN3990:
@@ -2406,7 +2407,6 @@ static int qca_serdev_probe(struct serdev_device *serdev)
case QCA_WCN6750:
case QCA_WCN6855:
case QCA_WCN7850:
- case QCA_QCA6390:
qcadev->bt_power = devm_kzalloc(&serdev->dev,
sizeof(struct qca_power),
GFP_KERNEL);
@@ -2418,9 +2418,9 @@ static int qca_serdev_probe(struct serdev_device *serdev)
}
switch (qcadev->btsoc_type) {
+ case QCA_WCN6750:
case QCA_WCN6855:
case QCA_WCN7850:
- case QCA_WCN6750:
if (!device_property_present(&serdev->dev, "enable-gpios")) {
/*
* Backward compatibility with old DT sources. If the
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1] Bluetooth: qca: Refactor code on the basis of chipset names
2026-02-10 12:01 [PATCH v1] Bluetooth: qca: Refactor code on the basis of chipset names Vivek Sahu
@ 2026-02-10 12:13 ` Dmitry Baryshkov
2026-02-10 13:21 ` [v1] " bluez.test.bot
2026-02-11 20:00 ` [PATCH v1] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2026-02-10 12:13 UTC (permalink / raw)
To: Vivek Sahu
Cc: Bartosz Golaszewski, Marcel Holtmann, Luiz Augusto von Dentz,
quic_mohamull, quic_hbandi, linux-arm-msm, linux-bluetooth,
linux-kernel
On Tue, Feb 10, 2026 at 05:31:01PM +0530, Vivek Sahu wrote:
> Whenever new chipset support is added to the driver code,
> we ended up adding chipset name to the last of the switch case
> arising code readability issue because of improper sorting of
> the chipset names in various places of the code.
If it was true, the file would have been less oragnized than it is now.
Aside from that,
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>
> Refactor code such a way that new chipset can be added easily
> in the code without compromising code readability.
>
> Signed-off-by: Vivek Sahu <vivek.sahu@oss.qualcomm.com>
> ---
> drivers/bluetooth/btqca.c | 37 +++++++++++++++++++------------------
> drivers/bluetooth/hci_qca.c | 30 +++++++++++++++---------------
> 2 files changed, 34 insertions(+), 33 deletions(-)
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [v1] Bluetooth: qca: Refactor code on the basis of chipset names
2026-02-10 12:01 [PATCH v1] Bluetooth: qca: Refactor code on the basis of chipset names Vivek Sahu
2026-02-10 12:13 ` Dmitry Baryshkov
@ 2026-02-10 13:21 ` bluez.test.bot
2026-02-11 20:00 ` [PATCH v1] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2026-02-10 13:21 UTC (permalink / raw)
To: linux-bluetooth, vivek.sahu
[-- Attachment #1: Type: text/plain, Size: 2957 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=1052703
---Test result---
Test Summary:
CheckPatch PENDING 0.39 seconds
GitLint PENDING 0.36 seconds
SubjectPrefix PASS 0.09 seconds
BuildKernel PASS 26.16 seconds
CheckAllWarning PASS 29.43 seconds
CheckSparse WARNING 31.79 seconds
BuildKernel32 PASS 25.05 seconds
TestRunnerSetup PASS 561.64 seconds
TestRunner_l2cap-tester PASS 28.53 seconds
TestRunner_iso-tester PASS 73.51 seconds
TestRunner_bnep-tester PASS 6.26 seconds
TestRunner_mgmt-tester FAIL 113.41 seconds
TestRunner_rfcomm-tester PASS 9.32 seconds
TestRunner_sco-tester FAIL 14.47 seconds
TestRunner_ioctl-tester PASS 10.07 seconds
TestRunner_mesh-tester FAIL 11.50 seconds
TestRunner_smp-tester PASS 8.45 seconds
TestRunner_userchan-tester PASS 6.70 seconds
IncrementalBuild PENDING 0.65 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: CheckSparse - WARNING
Desc: Run sparse tool with linux kernel
Output:
drivers/bluetooth/btqca.c:1043:1: error: bad constant expressiondrivers/bluetooth/btqca.c:1044:1: error: bad constant expressiondrivers/bluetooth/btqca.c:1045:1: error: bad constant expressiondrivers/bluetooth/btqca.c:1045:1: error: bad constant expression
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 494, Passed: 489 (99.0%), Failed: 1, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.103 seconds
##############################
Test: TestRunner_sco-tester - FAIL
Desc: Run sco-tester with test-runner
Output:
WARNING: possible circular locking dependency detected
BUG: sleeping function called from invalid context at net/core/sock.c:3782
Total: 30, Passed: 30 (100.0%), Failed: 0, Not Run: 0
##############################
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.929 seconds
Mesh - Send cancel - 2 Timed out 1.992 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: qca: Refactor code on the basis of chipset names
2026-02-10 12:01 [PATCH v1] Bluetooth: qca: Refactor code on the basis of chipset names Vivek Sahu
2026-02-10 12:13 ` Dmitry Baryshkov
2026-02-10 13:21 ` [v1] " bluez.test.bot
@ 2026-02-11 20:00 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2026-02-11 20:00 UTC (permalink / raw)
To: Vivek Sahu
Cc: brgl, marcel, luiz.dentz, quic_mohamull, quic_hbandi,
linux-arm-msm, linux-bluetooth, linux-kernel
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Tue, 10 Feb 2026 17:31:01 +0530 you wrote:
> Whenever new chipset support is added to the driver code,
> we ended up adding chipset name to the last of the switch case
> arising code readability issue because of improper sorting of
> the chipset names in various places of the code.
>
> Refactor code such a way that new chipset can be added easily
> in the code without compromising code readability.
>
> [...]
Here is the summary with links:
- [v1] Bluetooth: qca: Refactor code on the basis of chipset names
https://git.kernel.org/bluetooth/bluetooth-next/c/c2b82511ef7d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-02-11 20:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-10 12:01 [PATCH v1] Bluetooth: qca: Refactor code on the basis of chipset names Vivek Sahu
2026-02-10 12:13 ` Dmitry Baryshkov
2026-02-10 13:21 ` [v1] " bluez.test.bot
2026-02-11 20:00 ` [PATCH v1] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox