Parcourir la source

btfmcodec: Update usecase start

This change will notify client about usecase start
if transport selected is bt advance audio.

Change-Id: I5c85d32e0701cec4f36e0dda4110cc20338bf6a4
Signed-off-by: Balakrishna Godavarthi <[email protected]>
Balakrishna Godavarthi il y a 1 an
Parent
commit
7bd1a061bb
2 fichiers modifiés avec 23 ajouts et 0 suppressions
  1. 14 0
      btfmcodec/btfm_codec_interface.c
  2. 9 0
      btfmcodec/include/btfm_codec_pkt.h

+ 14 - 0
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) {

+ 9 - 0
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;