drivers/bluetooth/hci_ath.c
Source file repositories/reference/linux-study-clean/drivers/bluetooth/hci_ath.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/bluetooth/hci_ath.c- Extension
.c- Size
- 5402 bytes
- Lines
- 272
- Domain
- Driver Families
- Bucket
- drivers/bluetooth
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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/kernel.hlinux/init.hlinux/slab.hlinux/tty.hlinux/errno.hlinux/ioctl.hlinux/skbuff.hnet/bluetooth/bluetooth.hnet/bluetooth/hci_core.hhci_uart.h
Detected Declarations
struct ath_structstruct ath_vendor_cmdfunction ath_wakeup_ar3kfunction ath_hci_uart_workfunction ath_openfunction ath_closefunction ath_flushfunction ath_vendor_cmdfunction ath_set_bdaddrfunction ath_setupfunction ath_recvfunction ath_enqueuefunction ath_initfunction ath_deinit
Annotated Snippet
struct ath_struct {
struct hci_uart *hu;
unsigned int cur_sleep;
struct sk_buff *rx_skb;
struct sk_buff_head txq;
struct work_struct ctxtsw;
};
#define OP_WRITE_TAG 0x01
#define INDEX_BDADDR 0x01
struct ath_vendor_cmd {
__u8 opcode;
__le16 index;
__u8 len;
__u8 data[251];
} __packed;
static int ath_wakeup_ar3k(struct tty_struct *tty)
{
int status = tty->driver->ops->tiocmget(tty);
if (status & TIOCM_CTS)
return status;
/* Clear RTS first */
tty->driver->ops->tiocmget(tty);
tty->driver->ops->tiocmset(tty, 0x00, TIOCM_RTS);
msleep(20);
/* Set RTS, wake up board */
tty->driver->ops->tiocmget(tty);
tty->driver->ops->tiocmset(tty, TIOCM_RTS, 0x00);
msleep(20);
status = tty->driver->ops->tiocmget(tty);
return status;
}
static void ath_hci_uart_work(struct work_struct *work)
{
int status;
struct ath_struct *ath;
struct hci_uart *hu;
struct tty_struct *tty;
ath = container_of(work, struct ath_struct, ctxtsw);
hu = ath->hu;
tty = hu->tty;
/* verify and wake up controller */
if (ath->cur_sleep) {
status = ath_wakeup_ar3k(tty);
if (!(status & TIOCM_CTS))
return;
}
/* Ready to send Data */
clear_bit(HCI_UART_SENDING, &hu->tx_state);
hci_uart_tx_wakeup(hu);
}
static int ath_open(struct hci_uart *hu)
{
struct ath_struct *ath;
BT_DBG("hu %p", hu);
if (!hci_uart_has_flow_control(hu))
return -EOPNOTSUPP;
ath = kzalloc_obj(*ath);
if (!ath)
return -ENOMEM;
skb_queue_head_init(&ath->txq);
hu->priv = ath;
ath->hu = hu;
INIT_WORK(&ath->ctxtsw, ath_hci_uart_work);
return 0;
}
static int ath_close(struct hci_uart *hu)
{
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/init.h`, `linux/slab.h`, `linux/tty.h`, `linux/errno.h`, `linux/ioctl.h`, `linux/skbuff.h`.
- Detected declarations: `struct ath_struct`, `struct ath_vendor_cmd`, `function ath_wakeup_ar3k`, `function ath_hci_uart_work`, `function ath_open`, `function ath_close`, `function ath_flush`, `function ath_vendor_cmd`, `function ath_set_bdaddr`, `function ath_setup`.
- Atlas domain: Driver Families / drivers/bluetooth.
- Implementation status: source 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.