drivers/bluetooth/btqca.c
Source file repositories/reference/linux-study-clean/drivers/bluetooth/btqca.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/bluetooth/btqca.c- Extension
.c- Size
- 26591 bytes
- Lines
- 1050
- Domain
- Driver Families
- Bucket
- drivers/bluetooth
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/firmware.hlinux/vmalloc.hnet/bluetooth/bluetooth.hnet/bluetooth/hci_core.hbtqca.h
Detected Declarations
function Copyrightfunction qca_read_fw_build_infofunction qca_send_patch_config_cmdfunction qca_send_resetfunction qca_read_fw_board_idfunction qca_send_pre_shutdown_cmdfunction qca_filename_has_extensionfunction qca_get_alt_nvm_filefunction qca_tlv_check_datafunction qca_tlv_send_segmentfunction qca_inject_cmd_complete_eventfunction qca_download_firmwarefunction qca_disable_soc_loggingfunction qca_set_bdaddr_romefunction qca_check_bdaddrfunction qca_get_nvm_name_by_boardfunction qca_uart_setupfunction qca_set_bdaddrexport qca_read_soc_versionexport qca_send_pre_shutdown_cmdexport qca_set_bdaddr_romeexport qca_uart_setupexport qca_set_bdaddr
Annotated Snippet
if (type == 4) {
if (fw_size < 2 * sizeof(struct tlv_type_hdr))
return -EINVAL;
tlv++;
type_len = le32_to_cpu(tlv->type_len);
length = type_len >> 8;
type = type_len & 0xff;
}
BT_DBG("TLV Type\t\t : 0x%x", type);
BT_DBG("Length\t\t : %d bytes", length);
if (type != 2)
break;
if (fw_size < length + (tlv->data - fw_data))
return -EINVAL;
idx = 0;
data = tlv->data;
while (idx < length - sizeof(struct tlv_type_nvm)) {
tlv_nvm = (struct tlv_type_nvm *)(data + idx);
tag_id = le16_to_cpu(tlv_nvm->tag_id);
tag_len = le16_to_cpu(tlv_nvm->tag_len);
if (length < idx + sizeof(struct tlv_type_nvm) + tag_len)
return -EINVAL;
/* Update NVM tags as needed */
switch (tag_id) {
case EDL_TAG_ID_BD_ADDR:
if (tag_len != sizeof(bdaddr_t))
return -EINVAL;
memcpy(&config->bdaddr, tlv_nvm->data, sizeof(bdaddr_t));
break;
case EDL_TAG_ID_HCI:
if (tag_len < 3)
return -EINVAL;
/* HCI transport layer parameters
* enabling software inband sleep
* onto controller side.
*/
tlv_nvm->data[0] |= 0x80;
/* UART Baud Rate */
if (soc_type >= QCA_WCN3991)
tlv_nvm->data[1] = nvm_baud_rate;
else
tlv_nvm->data[2] = nvm_baud_rate;
break;
case EDL_TAG_ID_DEEP_SLEEP:
if (tag_len < 1)
return -EINVAL;
/* Sleep enable mask
* enabling deep sleep feature on controller.
*/
tlv_nvm->data[0] |= 0x01;
break;
}
idx += sizeof(struct tlv_type_nvm) + tag_len;
}
break;
default:
BT_ERR("Unknown TLV type %d", config->type);
return -EINVAL;
}
return 0;
}
static int qca_tlv_send_segment(struct hci_dev *hdev, int seg_size,
const u8 *data, enum qca_tlv_dnld_mode mode,
enum qca_btsoc_type soc_type)
{
struct sk_buff *skb;
struct edl_event_hdr *edl;
struct tlv_seg_resp *tlv_resp;
Annotation
- Immediate include surface: `linux/module.h`, `linux/firmware.h`, `linux/vmalloc.h`, `net/bluetooth/bluetooth.h`, `net/bluetooth/hci_core.h`, `btqca.h`.
- Detected declarations: `function Copyright`, `function qca_read_fw_build_info`, `function qca_send_patch_config_cmd`, `function qca_send_reset`, `function qca_read_fw_board_id`, `function qca_send_pre_shutdown_cmd`, `function qca_filename_has_extension`, `function qca_get_alt_nvm_file`, `function qca_tlv_check_data`, `function qca_tlv_send_segment`.
- Atlas domain: Driver Families / drivers/bluetooth.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.