drivers/bluetooth/btmrvl_main.c
Source file repositories/reference/linux-study-clean/drivers/bluetooth/btmrvl_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/bluetooth/btmrvl_main.c- Extension
.c- Size
- 17732 bytes
- Lines
- 786
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/of.hlinux/string_choices.hnet/bluetooth/bluetooth.hnet/bluetooth/hci_core.hlinux/mmc/sdio_func.hbtmrvl_drv.hbtmrvl_sdio.h
Detected Declarations
function Copyrightfunction btmrvl_check_evtpktfunction btmrvl_process_eventfunction btmrvl_send_sync_cmdfunction btmrvl_send_module_cfg_cmdfunction btmrvl_enable_sco_routing_to_hostfunction btmrvl_pscan_window_reportingfunction btmrvl_send_hscfg_cmdfunction btmrvl_enable_psfunction btmrvl_enable_hsfunction btmrvl_prepare_commandfunction btmrvl_tx_pktfunction btmrvl_init_adapterfunction btmrvl_free_adapterfunction btmrvl_send_framefunction btmrvl_flushfunction btmrvl_closefunction btmrvl_openfunction btmrvl_download_cal_datafunction btmrvl_check_device_treefunction btmrvl_setupfunction btmrvl_set_bdaddrfunction btmrvl_wakeupfunction btmrvl_service_main_threadfunction btmrvl_register_hdevfunction btmrvl_remove_cardexport btmrvl_interruptexport btmrvl_check_evtpktexport btmrvl_process_eventexport btmrvl_send_module_cfg_cmdexport btmrvl_pscan_window_reportingexport btmrvl_send_hscfg_cmdexport btmrvl_enable_psexport btmrvl_enable_hsexport btmrvl_register_hdevexport btmrvl_add_cardexport btmrvl_remove_card
Annotated Snippet
if (priv->btmrvl_dev.sendcmdflag) {
priv->btmrvl_dev.sendcmdflag = false;
priv->adapter->cmd_complete = true;
wake_up_interruptible(&priv->adapter->cmd_wait_q);
if (hci_opcode_ogf(opcode) == 0x3F) {
BT_DBG("vendor event skipped: opcode=%#4.4x",
opcode);
kfree_skb(skb);
return false;
}
}
}
return true;
}
EXPORT_SYMBOL_GPL(btmrvl_check_evtpkt);
int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb)
{
struct btmrvl_adapter *adapter = priv->adapter;
struct btmrvl_event *event;
int ret = 0;
event = (struct btmrvl_event *) skb->data;
if (event->ec != 0xff) {
BT_DBG("Not Marvell Event=%x", event->ec);
ret = -EINVAL;
goto exit;
}
switch (event->data[0]) {
case BT_EVENT_AUTO_SLEEP_MODE:
if (!event->data[2]) {
if (event->data[1] == BT_PS_ENABLE)
adapter->psmode = 1;
else
adapter->psmode = 0;
BT_DBG("PS Mode:%s",
str_enable_disable(adapter->psmode));
} else {
BT_DBG("PS Mode command failed");
}
break;
case BT_EVENT_HOST_SLEEP_CONFIG:
if (!event->data[3])
BT_DBG("gpio=%x, gap=%x", event->data[1],
event->data[2]);
else
BT_DBG("HSCFG command failed");
break;
case BT_EVENT_HOST_SLEEP_ENABLE:
if (!event->data[1]) {
adapter->hs_state = HS_ACTIVATED;
if (adapter->psmode)
adapter->ps_state = PS_SLEEP;
wake_up_interruptible(&adapter->event_hs_wait_q);
BT_DBG("HS ACTIVATED!");
} else {
BT_DBG("HS Enable failed");
}
break;
case BT_EVENT_MODULE_CFG_REQ:
if (priv->btmrvl_dev.sendcmdflag &&
event->data[1] == MODULE_BRINGUP_REQ) {
BT_DBG("EVENT:%s",
((event->data[2] == MODULE_BROUGHT_UP) ||
(event->data[2] == MODULE_ALREADY_UP)) ?
"Bring-up succeed" : "Bring-up failed");
} else if (priv->btmrvl_dev.sendcmdflag &&
event->data[1] == MODULE_SHUTDOWN_REQ) {
BT_DBG("EVENT:%s", (event->data[2]) ?
"Shutdown failed" : "Shutdown succeed");
} else {
BT_DBG("BT_CMD_MODULE_CFG_REQ resp for APP");
ret = -EINVAL;
}
break;
case BT_EVENT_POWER_STATE:
if (event->data[1] == BT_PS_SLEEP)
adapter->ps_state = PS_SLEEP;
BT_DBG("EVENT:%s",
(adapter->ps_state) ? "PS_SLEEP" : "PS_AWAKE");
break;
default:
Annotation
- Immediate include surface: `linux/module.h`, `linux/of.h`, `linux/string_choices.h`, `net/bluetooth/bluetooth.h`, `net/bluetooth/hci_core.h`, `linux/mmc/sdio_func.h`, `btmrvl_drv.h`, `btmrvl_sdio.h`.
- Detected declarations: `function Copyright`, `function btmrvl_check_evtpkt`, `function btmrvl_process_event`, `function btmrvl_send_sync_cmd`, `function btmrvl_send_module_cfg_cmd`, `function btmrvl_enable_sco_routing_to_host`, `function btmrvl_pscan_window_reporting`, `function btmrvl_send_hscfg_cmd`, `function btmrvl_enable_ps`, `function btmrvl_enable_hs`.
- Atlas domain: Driver Families / drivers/bluetooth.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.