From c77a546f147a12bcd43624cff4834bed75131d50 Mon Sep 17 00:00:00 2001 From: Nazar Palamar Date: Thu, 20 Jan 2022 15:48:42 +0200 Subject: [PATCH] Bluetooth: hci: added HCI vendor-specific Setup function feature - Added config BT_HCI_SETUP to enable HCI vendor-specific Setup feature, - Added pointer to 'setup' function in bt_hci_driver structure. 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/Kconfig | 13 +++++++++++++ include/drivers/bluetooth/hci_driver.h | 15 +++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/bluetooth/hci/Kconfig b/drivers/bluetooth/hci/Kconfig index d3315bd6eea..8987f75045d 100644 --- a/drivers/bluetooth/hci/Kconfig +++ b/drivers/bluetooth/hci/Kconfig @@ -131,3 +131,16 @@ config BT_DRIVER_QUIRK_NO_AUTO_DLE This has to be enabled when the BLE controller connected is Zephyr open source controller. + +config BT_HCI_SETUP + bool + help + Enable the HCI vendor-specific Setup function. + + This option has to be enabled 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. + + The user should generally avoid changing it via menuconfig or in + configuration files. This option are enabled by the vendor-specific + HCI extension, where the Setup function is implemented. diff --git a/include/drivers/bluetooth/hci_driver.h b/include/drivers/bluetooth/hci_driver.h index 7f1fd6ec810..16aaf454bd4 100644 --- a/include/drivers/bluetooth/hci_driver.h +++ b/include/drivers/bluetooth/hci_driver.h @@ -185,6 +185,21 @@ struct bt_hci_driver { * @return 0 on success or negative error number on failure. */ int (*send)(struct net_buf *buf); + +#if defined(CONFIG_BT_HCI_SETUP) || defined(__DOXYGEN__) + /** + * @brief HCI vendor-specific setup + * + * Executes vendor-specific commands sequence to initialize + * BT Controller before BT Host executes Reset sequence. + * + * @note @kconfig{CONFIG_BT_HCI_SETUP} must be selected for this + * field to be available. + * + * @return 0 on success or negative error number on failure. + */ + int (*setup)(void); +#endif /* defined(CONFIG_BT_HCI_SETUP) || defined(__DOXYGEN__)*/ }; /**