From 0e42d055d393e89f1d1d75c8f0ea579c225c424a Mon Sep 17 00:00:00 2001 From: Timothy Keys Date: Mon, 20 May 2024 15:58:20 +0100 Subject: [PATCH] Bluetooth: Controller: Enable Connection Subrating support in the SDC This enables experimental support for Connection Subrating. Signed-off-by: Timothy Keys --- subsys/bluetooth/controller/hci_driver.c | 15 +++++++++++++++ subsys/bluetooth/controller/hci_internal.c | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/subsys/bluetooth/controller/hci_driver.c b/subsys/bluetooth/controller/hci_driver.c index 22c9344c83a0..91cf89762cf1 100644 --- a/subsys/bluetooth/controller/hci_driver.c +++ b/subsys/bluetooth/controller/hci_driver.c @@ -860,6 +860,21 @@ static int configure_supported_features(void) } #endif + if (IS_ENABLED(CONFIG_BT_CTLR_SUBRATING)) { + if (IS_ENABLED(CONFIG_BT_CENTRAL)) { + err = sdc_support_connection_subrating_central(); + if (err) { + return -ENOTSUP; + } + } + if (IS_ENABLED(CONFIG_BT_PERIPHERAL)) { + err = sdc_support_connection_subrating_peripheral(); + if (err) { + return -ENOTSUP; + } + } + } + return 0; } diff --git a/subsys/bluetooth/controller/hci_internal.c b/subsys/bluetooth/controller/hci_internal.c index 592ca8108b3c..adc85efa1aaa 100644 --- a/subsys/bluetooth/controller/hci_internal.c +++ b/subsys/bluetooth/controller/hci_internal.c @@ -608,6 +608,11 @@ void hci_internal_supported_commands(sdc_hci_ip_supported_commands_t *cmds) #if defined(CONFIG_BT_CTLR_ISO_RX_BUFFERS) cmds->hci_le_iso_receive_test = 1; #endif + +#if defined(CONFIG_BT_CTLR_SUBRATING) + cmds->hci_le_set_default_subrate_command = 1; + cmds->hci_le_subrate_request_command = 1; +#endif } #if defined(CONFIG_BT_HCI_VS) @@ -781,6 +786,10 @@ void hci_internal_le_supported_features( #if defined(CONFIG_BT_CTLR_SDC_PAWR_SYNC) features->params.periodic_advertising_with_responses_scanner = 1; #endif + +#if defined(CONFIG_BT_CTLR_SUBRATING) + features->params.connection_subrating = 1; +#endif } static void le_read_supported_states(uint8_t *buf) @@ -1528,6 +1537,13 @@ static uint8_t le_controller_cmd_put(uint8_t const * const cmd, (void *)event_out_params); #endif +#if defined(CONFIG_BT_CTLR_SUBRATING) + case SDC_HCI_OPCODE_CMD_LE_SET_DEFAULT_SUBRATE: + return sdc_hci_cmd_le_set_default_subrate((void *)cmd_params); + case SDC_HCI_OPCODE_CMD_LE_SUBRATE_REQUEST: + return sdc_hci_cmd_le_subrate_request((void *)cmd_params); +#endif + default: return BT_HCI_ERR_UNKNOWN_CMD; }