diff --git a/btfmcodec/btfm_codec_interface.c b/btfmcodec/btfm_codec_interface.c index 38c2660861..eea4cf04bd 100644 --- a/btfmcodec/btfm_codec_interface.c +++ b/btfmcodec/btfm_codec_interface.c @@ -527,6 +527,19 @@ int btfmcodec_hwep_prepare(struct btfmcodec_data *btfmcodec, uint32_t sampling_r return ret; } +static int btfmcodec_notify_usecase_start(struct btfmcodec_data *btfmcodec, + uint8_t transport) +{ + struct btfmcodec_char_device *btfmcodec_dev = btfmcodec->btfmcodec_dev; + struct btm_usecase_start_ind ind; + + ind.opcode = BTM_BTFMCODEC_USECASE_START_IND; + ind.len = BTM_USECASE_START_IND_LEN; + ind.transport = transport; + return btfmcodec_dev_enqueue_pkt(btfmcodec_dev, &ind, (ind.len + + BTM_HEADER_LEN)); +} + static int btfmcodec_dai_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { @@ -550,6 +563,7 @@ static int btfmcodec_dai_prepare(struct snd_pcm_substream *substream, btfmcodec_get_current_transport(state) != BT_Connected) { BTFMCODEC_WARN("cached required info as state is:%s", coverttostring(btfmcodec_get_current_transport(state))); + btfmcodec_notify_usecase_start(btfmcodec, BTADV); } else { ret = btfmcodec_hwep_prepare(btfmcodec, sampling_rate, direction, id); /* if (ret >= 0) { diff --git a/btfmcodec/include/btfm_codec_pkt.h b/btfmcodec/include/btfm_codec_pkt.h index cc75c2e357..e6b1f8c67b 100644 --- a/btfmcodec/include/btfm_codec_pkt.h +++ b/btfmcodec/include/btfm_codec_pkt.h @@ -54,6 +54,9 @@ struct btm_ctrl_pkt { #define BTM_LOG_LVL_IND_LEN 1 #define BTM_ADSP_STATE_IND_LEN 4 +#define BTM_BTFMCODEC_USECASE_START_IND 0x58000008 +#define BTM_USECASE_START_IND_LEN 1 + enum rx_status { /* Waiting for response */ BTM_WAITING_RSP, @@ -91,6 +94,12 @@ struct btm_master_config_req { }__attribute__((packed)); +struct btm_usecase_start_ind { + btm_opcode opcode; + uint32_t len; + uint8_t transport; +} __packed; + struct btm_master_shutdown_req { btm_opcode opcode; uint32_t len;