hfp: send hci_rtk_configure_sco_routing after codec exchange

This commit is contained in:
Matthias Ringwald 2021-10-19 14:57:30 +02:00
parent 1645c45c5d
commit 2b5f92fd17
4 changed files with 36 additions and 0 deletions

View File

@ -827,6 +827,9 @@ void hfp_handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet
#endif
#ifdef ENABLE_BCM_PCM_WBS
hfp_bcm_prepare_for_sco(hfp_connection);
#endif
#ifdef ENABLE_RTK_PCM_WBS
hfp_connection->rtk_send_sco_config = true;
#endif
log_info("accept sco %u\n", hfp_connection->accept_sco);
hfp_sco_establishment_active = hfp_connection;

View File

@ -727,6 +727,9 @@ typedef struct hfp_connection {
bool bcm_send_disable_wbs;
bool bcm_send_write_i2spcm_interface_param;
#endif
#ifdef ENABLE_RTK_PCM_WBS
bool rtk_send_sco_config;
#endif
} hfp_connection_t;
// UTILS_START : TODO move to utils

View File

@ -632,6 +632,9 @@ static int codecs_exchange_state_machine(hfp_connection_t * hfp_connection){
hfp_init_link_settings(hfp_connection, hfp_ag_esco_s4_supported(hfp_connection));
#ifdef ENABLE_CC256X_ASSISTED_HFP
hfp_cc256x_prepare_for_sco(hfp_connection);
#endif
#ifdef ENABLE_RTK_PCM_WBS
hfp_connection->rtk_send_sco_config = true;
#endif
return 1;
default:
@ -2197,6 +2200,20 @@ static void hfp_ag_run_for_context(hfp_connection_t *hfp_connection){
return;
}
#endif
#ifdef ENABLE_RTK_PCM_WBS
// Configure CVSD vs. mSBC
if (hfp_connection->rtk_send_sco_config){
hfp_connection->rtk_send_sco_config = false;
if (hfp_connection->negotiated_codec == HFP_CODEC_MSBC){
log_info("RTK SCO: 16k + mSBC");
hci_send_cmd(&hci_rtk_configure_sco_routing, 0x81, 0x90, 0x00, 0x00, 0x1a, 0x0c, 0x00, 0x00, 0x41);
} else {
log_info("RTK SCO: 16k + CVSD");
hci_send_cmd(&hci_rtk_configure_sco_routing, 0x81, 0x90, 0x00, 0x00, 0x1a, 0x0c, 0x0c, 0x00, 0x01);
}
return;
}
#endif
#if defined (ENABLE_CC256X_ASSISTED_HFP) || defined (ENABLE_BCM_PCM_WBS)
if (hfp_connection->state == HFP_W4_WBS_SHUTDOWN){
hfp_finalize_connection_context(hfp_connection);

View File

@ -785,6 +785,19 @@ static void hfp_hf_run_for_context(hfp_connection_t * hfp_connection){
return;
}
#endif
#ifdef ENABLE_RTK_PCM_WBS
if (hfp_connection->rtk_send_sco_config){
hfp_connection->rtk_send_sco_config = false;
if (hfp_connection->negotiated_codec == HFP_CODEC_MSBC){
log_info("RTK SCO: 16k + mSBC");
hci_send_cmd(&hci_rtk_configure_sco_routing, 0x81, 0x90, 0x00, 0x00, 0x1a, 0x0c, 0x00, 0x00, 0x41);
} else {
log_info("RTK SCO: 16k + CVSD");
hci_send_cmd(&hci_rtk_configure_sco_routing, 0x81, 0x90, 0x00, 0x00, 0x1a, 0x0c, 0x0c, 0x00, 0x01);
}
return;
}
#endif
#if defined (ENABLE_CC256X_ASSISTED_HFP) || defined (ENABLE_BCM_PCM_WBS)
if (hfp_connection->state == HFP_W4_WBS_SHUTDOWN){
hfp_finalize_connection_context(hfp_connection);