[PATCH 1/3] Bluetooth: qca: add QCC2072 support
From: Wei Deng
Date: Wed Dec 02 2026 - 01:14:27 EST
From: Vivek Sahu <vivek.sahu@xxxxxxxxxxxxxxxx>
QCC2072 uses the ORN firmware and NVM naming scheme. The tested RB3 Gen 2
Industrial BT-over-UART setup also needs the BCS calibration TLV to be
combined with the selected NVM before download.
Keep the BCS/NVM combination in a helper so missing calibration data or
allocation failures can fall back to downloading the NVM alone without a
local skip label.
Select the NVM file and BCS calibration file using the controller board ID
when available, with fallback to the default files. Initialize the BCS
calibration filename independently of the NVM filename source so custom NVM
firmware-name paths do not leave it unset.
Route QCC2072 through the same UART setup, speed switching and
power-control paths in hci_qca as recent Qualcomm Bluetooth controllers.
The controller sits on an M.2 module and is instantiated as an auxiliary
device by the power sequencing driver, so no devicetree compatible is
registered.
This continues the QCC2072 enablement work previously posted by Vivek Sahu
and later extended by Yepuri Siddu for the RB3 Gen 2 Industrial
BT-over-UART use case.
Signed-off-by: Vivek Sahu <vivek.sahu@xxxxxxxxxxxxxxxx>
Co-developed-by: Yepuri Siddu <yepuri.siddu@xxxxxxxxxxxxxxxx>
Signed-off-by: Yepuri Siddu <yepuri.siddu@xxxxxxxxxxxxxxxx>
Co-developed-by: Rahul Samana <rahul.samana@xxxxxxxxxxxxxxxx>
Signed-off-by: Rahul Samana <rahul.samana@xxxxxxxxxxxxxxxx>
[wei: drop the devicetree compatible and keep the QCC2072 case labels sorted]
Signed-off-by: Wei Deng <wei.deng@xxxxxxxxxxxxxxxx>
---
drivers/bluetooth/btqca.c | 72 ++++++++++++++++++++++++++++++++++++++++++++-
drivers/bluetooth/btqca.h | 2 ++
drivers/bluetooth/hci_qca.c | 18 ++++++++++++
3 files changed, 91 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index 2b186de8f64d..1e77c364f413 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -551,6 +551,54 @@ static int qca_inject_cmd_complete_event(struct hci_dev *hdev)
return hci_recv_frame(hdev, skb);
}
+static void qca_combine_nvm_calib(struct hci_dev *hdev, u8 **data,
+ int *size, char *calib_name,
+ size_t max_size)
+{
+ const struct firmware *calib_fw;
+ struct tlv_type_hdr *outer_hdr;
+ size_t inner_len, combined_size;
+ u8 *combined_data;
+ int err;
+
+ err = request_firmware(&calib_fw, calib_name, &hdev->dev);
+ if (err) {
+ if (qca_get_alt_nvm_file(calib_name, max_size))
+ err = request_firmware(&calib_fw, calib_name, &hdev->dev);
+
+ if (err) {
+ bt_dev_err(hdev, "QCA Failed to request file: %s (%d)",
+ calib_name, err);
+ return;
+ }
+ }
+
+ bt_dev_info(hdev, "QCA Downloading %s", calib_name);
+
+ inner_len = *size + calib_fw->size;
+ combined_size = sizeof(*outer_hdr) + inner_len;
+ combined_data = vmalloc(combined_size);
+ if (!combined_data) {
+ bt_dev_warn(hdev,
+ "QCA Failed to allocate memory for file: %s",
+ calib_name);
+ release_firmware(calib_fw);
+ return;
+ }
+
+ outer_hdr = (struct tlv_type_hdr *)combined_data;
+ /* high 24 bits = payload length, low 8 bits = type */
+ outer_hdr->type_len = cpu_to_le32((inner_len << 8) | 4);
+ memcpy(combined_data + sizeof(*outer_hdr), *data, *size);
+ memcpy(combined_data + sizeof(*outer_hdr) + *size,
+ calib_fw->data, calib_fw->size);
+ release_firmware(calib_fw);
+
+ vfree(*data);
+ *data = combined_data;
+ *size = combined_size;
+}
+
static int qca_download_firmware(struct hci_dev *hdev,
struct qca_fw_config *config,
enum qca_btsoc_type soc_type,
@@ -596,6 +644,11 @@ static int qca_download_firmware(struct hci_dev *hdev,
memcpy(data, fw->data, size);
release_firmware(fw);
+ if (soc_type == QCA_QCC2072 && config->type == TLV_TYPE_NVM)
+ qca_combine_nvm_calib(hdev, &data, &size,
+ config->calib_name,
+ sizeof(config->calib_name));
+
ret = qca_tlv_check_data(hdev, config, data, size, soc_type);
if (ret)
goto out;
@@ -793,6 +846,10 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
snprintf(config.fwname, sizeof(config.fwname),
"qca/htbtfw%02x.tlv", rom_ver);
break;
+ case QCA_QCC2072:
+ snprintf(config.fwname, sizeof(config.fwname),
+ "qca/ornbtfw%02x.tlv", rom_ver);
+ break;
case QCA_WCN3950:
snprintf(config.fwname, sizeof(config.fwname),
"qca/cmbtfw%02x.tlv", rom_ver);
@@ -860,7 +917,8 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
/* Give the controller some time to get ready to receive the NVM */
msleep(10);
- if (soc_type == QCA_QCA2066 || soc_type == QCA_WCN7850)
+ if (soc_type == QCA_QCA2066 || soc_type == QCA_WCN7850 ||
+ soc_type == QCA_QCC2072)
qca_read_fw_board_id(hdev, &boardid);
/* Download NVM configuration */
@@ -886,6 +944,11 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
snprintf(config.fwname, sizeof(config.fwname),
"qca/htnv%02x.bin", rom_ver);
break;
+ case QCA_QCC2072:
+ qca_get_nvm_name_by_board(config.fwname, sizeof(config.fwname),
+ "ornnv", soc_type, ver,
+ rom_ver, boardid);
+ break;
case QCA_WCN3950:
if (le32_to_cpu(ver.soc_id) == QCA_WCN3950_SOC_ID_T)
variant = "t";
@@ -927,6 +990,12 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
}
}
+ if (soc_type == QCA_QCC2072)
+ qca_get_nvm_name_by_board(config.calib_name,
+ sizeof(config.calib_name),
+ "ornbcscal", soc_type, ver,
+ rom_ver, boardid);
+
err = qca_download_firmware(hdev, &config, soc_type, rom_ver);
if (err < 0 && !firmware_name && soc_type == QCA_WCN6855) {
qca_get_nvm_name_by_board(config.fwname, sizeof(config.fwname),
@@ -985,6 +1054,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
case QCA_WCN3991:
case QCA_WCN6750:
case QCA_QCA2066:
+ case QCA_QCC2072:
case QCA_WCN6855:
case QCA_WCN7850:
/* get fw build info */
diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h
index 8f3c1b1c77b3..425133096eda 100644
--- a/drivers/bluetooth/btqca.h
+++ b/drivers/bluetooth/btqca.h
@@ -94,6 +94,7 @@ enum qca_tlv_type {
struct qca_fw_config {
u8 type;
char fwname[64];
+ char calib_name[64];
uint8_t user_baud_rate;
enum qca_tlv_dnld_mode dnld_mode;
enum qca_tlv_dnld_mode dnld_type;
@@ -158,6 +159,7 @@ enum qca_btsoc_type {
QCA_WCN6750,
QCA_WCN6855,
QCA_WCN7850,
+ QCA_QCC2072,
};
#if IS_ENABLED(CONFIG_BT_QCA)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 7599ead74287..a39015290890 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1378,6 +1378,7 @@ static int qca_set_baudrate(struct hci_dev *hdev, uint8_t baudrate)
/* Give the controller time to process the request */
switch (qca_soc_type(hu)) {
+ case QCA_QCC2072:
case QCA_WCN3950:
case QCA_WCN3988:
case QCA_WCN3990:
@@ -1466,6 +1467,7 @@ static unsigned int qca_get_speed(struct hci_uart *hu,
static int qca_check_speeds(struct hci_uart *hu)
{
switch (qca_soc_type(hu)) {
+ case QCA_QCC2072:
case QCA_WCN3950:
case QCA_WCN3988:
case QCA_WCN3990:
@@ -1510,6 +1512,7 @@ static int qca_set_speed(struct hci_uart *hu, enum qca_speed_type speed_type)
* changing the baudrate of chip and host.
*/
switch (soc_type) {
+ case QCA_QCC2072:
case QCA_WCN3950:
case QCA_WCN3988:
case QCA_WCN3990:
@@ -1546,6 +1549,7 @@ static int qca_set_speed(struct hci_uart *hu, enum qca_speed_type speed_type)
error:
switch (soc_type) {
+ case QCA_QCC2072:
case QCA_WCN3950:
case QCA_WCN3988:
case QCA_WCN3990:
@@ -1891,6 +1895,7 @@ static int qca_power_on(struct hci_dev *hdev)
switch (soc_type) {
case QCA_QCA6390:
+ case QCA_QCC2072:
case QCA_WCN3950:
case QCA_WCN3988:
case QCA_WCN3990:
@@ -1979,6 +1984,10 @@ static int qca_setup(struct hci_uart *hu)
soc_name = "qca2066";
break;
+ case QCA_QCC2072:
+ soc_name = "qcc2072";
+ break;
+
case QCA_WCN3950:
case QCA_WCN3988:
case QCA_WCN3990:
@@ -2014,6 +2023,7 @@ static int qca_setup(struct hci_uart *hu)
clear_bit(QCA_SSR_TRIGGERED, &qca->flags);
switch (soc_type) {
+ case QCA_QCC2072:
case QCA_WCN3950:
case QCA_WCN3988:
case QCA_WCN3990:
@@ -2048,6 +2058,7 @@ static int qca_setup(struct hci_uart *hu)
}
switch (soc_type) {
+ case QCA_QCC2072:
case QCA_WCN3950:
case QCA_WCN3988:
case QCA_WCN3990:
@@ -2210,6 +2221,12 @@ static const struct qca_device_data qca_soc_data_wcn3998 __maybe_unused = {
.num_vregs = 4,
};
+static const struct qca_device_data qca_soc_data_qcc2072 __maybe_unused = {
+ .soc_type = QCA_QCC2072,
+ .num_vregs = 0,
+ .capabilities = QCA_CAP_WIDEBAND_SPEECH | QCA_CAP_VALID_LE_STATES,
+};
+
static const struct qca_device_data qca_soc_data_wcn6750 __maybe_unused = {
.soc_type = QCA_WCN6750,
.vregs = (struct qca_vreg []) {
@@ -2314,6 +2331,7 @@ static void qca_power_off(struct hci_uart *hu)
qca_regulator_disable(qcadev);
break;
+ case QCA_QCC2072:
case QCA_WCN6750:
case QCA_QCA2066:
case QCA_WCN6855:
--
2.34.1