From 29eec8b3f7df4d4231504cbc9f736c3bd8f82fa5 Mon Sep 17 00:00:00 2001 From: Nazar Palamar Date: Thu, 20 Jan 2022 15:51:13 +0200 Subject: [PATCH] Bluetooth: H4: added support for HCI vendor-specific Setup feature. Updated H4 driver to initialize setup function. Finally bt_h4_vnd_setup function must be implemented in vendor-specific HCI extension module if CONFIG_BT_HCI_SETUP is enabled. BT_HCI_SETUP feature is useful when the BT Controller requires execution of the vendor-specific commands sequence to initialize the BT Controller before the BT Host executes a Reset sequence. To enable this feature the CONFIG_BT_HCI_SETUP should be enable. Fixes #41140 Signed-off-by: Nazar Palamar --- drivers/bluetooth/hci/h4.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/bluetooth/hci/h4.c b/drivers/bluetooth/hci/h4.c index 9b145be82de..6f86afe5345 100644 --- a/drivers/bluetooth/hci/h4.c +++ b/drivers/bluetooth/hci/h4.c @@ -528,11 +528,29 @@ static int h4_open(void) return 0; } +#if defined(CONFIG_BT_HCI_SETUP) +static int h4_setup(void) +{ + /* Extern bt_h4_vnd_setup function. + * This function executes vendor-specific commands sequence to + * initialize BT Controller before BT Host executes Reset sequence. + * bt_h4_vnd_setup function must be implemented in vendor-specific HCI + * extansion module if CONFIG_BT_HCI_SETUP is enabled. + */ + extern int bt_h4_vnd_setup(const struct device *dev); + + return bt_h4_vnd_setup(h4_dev); +} +#endif + static const struct bt_hci_driver drv = { .name = "H:4", .bus = BT_HCI_DRIVER_BUS_UART, .open = h4_open, .send = h4_send, +#if defined(CONFIG_BT_HCI_SETUP) + .setup = h4_setup +#endif }; static int bt_uart_init(const struct device *unused)