drivers/bluetooth/hci_nokia.c
Source file repositories/reference/linux-study-clean/drivers/bluetooth/hci_nokia.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/bluetooth/hci_nokia.c- Extension
.c- Size
- 18420 bytes
- Lines
- 807
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/clk.hlinux/errno.hlinux/firmware.hlinux/gpio/consumer.hlinux/interrupt.hlinux/kernel.hlinux/module.hlinux/of.hlinux/pm_runtime.hlinux/serdev.hlinux/skbuff.hlinux/slab.hlinux/string.hlinux/types.hlinux/unaligned.hnet/bluetooth/bluetooth.hnet/bluetooth/hci_core.hhci_uart.hbtbcm.h
Detected Declarations
struct hci_nokia_neg_hdrstruct hci_nokia_neg_cmdstruct hci_nokia_alive_hdrstruct hci_nokia_alive_pktstruct hci_nokia_neg_evtstruct nokia_bt_devfunction nokia_flow_controlfunction wakeup_handlerfunction nokia_resetfunction nokia_send_alive_packetfunction nokia_send_negotiationfunction nokia_setup_fwfunction nokia_setupfunction nokia_openfunction nokia_flushfunction nokia_closefunction nokia_enqueuefunction nokia_recv_negotiation_packetfunction nokia_recv_alive_packetfunction nokia_recv_radiofunction nokia_recvfunction nokia_bluetooth_serdev_probefunction nokia_bluetooth_serdev_removefunction nokia_bluetooth_runtime_suspendfunction nokia_bluetooth_runtime_resume
Annotated Snippet
struct hci_nokia_neg_hdr {
u8 dlen;
} __packed;
struct hci_nokia_neg_cmd {
u8 ack;
u16 baud;
u16 unused1;
u8 proto;
u16 sys_clk;
u16 unused2;
} __packed;
#define NOKIA_ALIVE_REQ 0x55
#define NOKIA_ALIVE_RESP 0xcc
struct hci_nokia_alive_hdr {
u8 dlen;
} __packed;
struct hci_nokia_alive_pkt {
u8 mid;
u8 unused;
} __packed;
struct hci_nokia_neg_evt {
u8 ack;
u16 baud;
u16 unused1;
u8 proto;
u16 sys_clk;
u16 unused2;
u8 man_id;
u8 ver_id;
} __packed;
#define MAX_BAUD_RATE 3692300
#define SETUP_BAUD_RATE 921600
#define INIT_BAUD_RATE 120000
struct nokia_bt_dev {
struct hci_uart hu;
struct serdev_device *serdev;
struct gpio_desc *reset;
struct gpio_desc *wakeup_host;
struct gpio_desc *wakeup_bt;
unsigned long sysclk_speed;
int wake_irq;
struct sk_buff *rx_skb;
struct sk_buff_head txq;
bdaddr_t bdaddr;
int init_error;
struct completion init_completion;
u8 man_id;
u8 ver_id;
bool initialized;
bool tx_enabled;
bool rx_enabled;
};
static int nokia_enqueue(struct hci_uart *hu, struct sk_buff *skb);
static void nokia_flow_control(struct serdev_device *serdev, bool enable)
{
if (enable) {
serdev_device_set_rts(serdev, true);
serdev_device_set_flow_control(serdev, true);
} else {
serdev_device_set_flow_control(serdev, false);
serdev_device_set_rts(serdev, false);
}
}
static irqreturn_t wakeup_handler(int irq, void *data)
{
struct nokia_bt_dev *btdev = data;
struct device *dev = &btdev->serdev->dev;
int wake_state = gpiod_get_value(btdev->wakeup_host);
if (btdev->rx_enabled == wake_state)
return IRQ_HANDLED;
if (wake_state)
pm_runtime_get(dev);
else
Annotation
- Immediate include surface: `linux/clk.h`, `linux/errno.h`, `linux/firmware.h`, `linux/gpio/consumer.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/module.h`, `linux/of.h`.
- Detected declarations: `struct hci_nokia_neg_hdr`, `struct hci_nokia_neg_cmd`, `struct hci_nokia_alive_hdr`, `struct hci_nokia_alive_pkt`, `struct hci_nokia_neg_evt`, `struct nokia_bt_dev`, `function nokia_flow_control`, `function wakeup_handler`, `function nokia_reset`, `function nokia_send_alive_packet`.
- Atlas domain: Driver Families / drivers/bluetooth.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.