drivers/bluetooth/hci_bcm.c

Source file repositories/reference/linux-study-clean/drivers/bluetooth/hci_bcm.c

File Facts

System
Linux kernel
Corpus path
drivers/bluetooth/hci_bcm.c
Extension
.c
Size
40105 bytes
Lines
1631
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct bcm_device_data {
	bool	no_early_set_baudrate;
	bool	drive_rts_on_open;
	bool	no_uart_clock_set;
	u32	max_autobaud_speed;
	u32	max_speed;
};

/**
 * struct bcm_device - device driver resources
 * @serdev_hu: HCI UART controller struct
 * @list: bcm_device_list node
 * @dev: physical UART slave
 * @name: device name logged by bt_dev_*() functions
 * @device_wakeup: BT_WAKE pin,
 *	assert = Bluetooth device must wake up or remain awake,
 *	deassert = Bluetooth device may sleep when sleep criteria are met
 * @shutdown: BT_REG_ON pin,
 *	power up or power down Bluetooth device internal regulators
 * @reset: BT_RST_N pin,
 *	active low resets the Bluetooth logic core
 * @set_device_wakeup: callback to toggle BT_WAKE pin
 *	either by accessing @device_wakeup or by calling @btlp
 * @set_shutdown: callback to toggle BT_REG_ON pin
 *	either by accessing @shutdown or by calling @btpu/@btpd
 * @btlp: Apple ACPI method to toggle BT_WAKE pin ("Bluetooth Low Power")
 * @btpu: Apple ACPI method to drive BT_REG_ON pin high ("Bluetooth Power Up")
 * @btpd: Apple ACPI method to drive BT_REG_ON pin low ("Bluetooth Power Down")
 * @gpio_count: internal counter for GPIO resources associated with ACPI device
 * @gpio_int_idx: index in _CRS for GpioInt() resource
 * @txco_clk: external reference frequency clock used by Bluetooth device
 * @lpo_clk: external LPO clock used by Bluetooth device
 * @supplies: VBAT and VDDIO supplies used by Bluetooth device
 * @res_enabled: whether clocks and supplies are prepared and enabled
 * @init_speed: default baudrate of Bluetooth device;
 *	the host UART is initially set to this baudrate so that
 *	it can configure the Bluetooth device for @oper_speed
 * @oper_speed: preferred baudrate of Bluetooth device;
 *	set to 0 if @init_speed is already the preferred baudrate
 * @irq: interrupt triggered by HOST_WAKE_BT pin
 * @irq_active_low: whether @irq is active low
 * @irq_acquired: flag to show if IRQ handler has been assigned
 * @hu: pointer to HCI UART controller struct,
 *	used to disable flow control during runtime suspend and system sleep
 * @is_suspended: whether flow control is currently disabled
 * @no_early_set_baudrate: don't set_baudrate before setup()
 * @drive_rts_on_open: drive RTS signal on ->open() when platform requires it
 * @no_uart_clock_set: UART clock set command for >3Mbps mode is unavailable
 * @pcm_int_params: keep the initial PCM configuration
 * @use_autobaud_mode: start Bluetooth device in autobaud mode
 * @max_autobaud_speed: max baudrate supported by device in autobaud mode
 */
struct bcm_device {
	/* Must be the first member, hci_serdev.c expects this. */
	struct hci_uart		serdev_hu;
	struct list_head	list;

	struct device		*dev;

	const char		*name;
	struct gpio_desc	*device_wakeup;
	struct gpio_desc	*shutdown;
	struct gpio_desc	*reset;
	int			(*set_device_wakeup)(struct bcm_device *, bool);
	int			(*set_shutdown)(struct bcm_device *, bool);
#ifdef CONFIG_ACPI
	acpi_handle		btlp, btpu, btpd;
	int			gpio_count;
	int			gpio_int_idx;
#endif

	struct clk		*txco_clk;
	struct clk		*lpo_clk;
	struct regulator_bulk_data supplies[BCM_NUM_SUPPLIES];
	bool			res_enabled;

	u32			init_speed;
	u32			oper_speed;
	int			irq;
	bool			irq_active_low;
	bool			irq_acquired;

#ifdef CONFIG_PM
	struct hci_uart		*hu;
	bool			is_suspended;
#endif
	bool			no_early_set_baudrate;
	bool			drive_rts_on_open;
	bool			no_uart_clock_set;
	bool			use_autobaud_mode;

Annotation

Implementation Notes