Browse Source

Merge "dsp: Handle media fmt update events"

Linux Build Service Account 6 years ago
parent
commit
51b0cb7c71
2 changed files with 35 additions and 3 deletions
  1. 32 1
      dsp/q6asm.c
  2. 3 2
      include/dsp/apr_audio-v2.h

+ 32 - 1
dsp/q6asm.c

@@ -2342,10 +2342,13 @@ static int32_t q6asm_callback(struct apr_client_data *data, void *priv)
 		break;
 	case ASM_STREAM_PP_EVENT:
 	case ASM_STREAM_CMD_ENCDEC_EVENTS:
-	case ASM_STREAM_CMD_REGISTER_IEC_61937_FMT_UPDATE:
+	case ASM_IEC_61937_MEDIA_FMT_EVENT:
 		if (data->payload_size >= 2 * sizeof(uint32_t))
 			pr_debug("%s: ASM_STREAM_EVENT payload[0][0x%x] payload[1][0x%x]",
 					 __func__, payload[0], payload[1]);
+		else if (data->payload_size >= sizeof(uint32_t))
+			pr_debug("%s: ASM_STREAM_EVENT payload[0][0x%x]",
+				__func__, payload[0]);
 		else
 			pr_debug("%s: payload size of %x is less than expected.\n",
 				__func__, data->payload_size);
@@ -2380,6 +2383,34 @@ static int32_t q6asm_callback(struct apr_client_data *data, void *priv)
 		pp_event_package->payload_len = payload_size;
 		memcpy((void *)pp_event_package->payload,
 			data->payload, payload_size);
+		if ((data->opcode == ASM_IEC_61937_MEDIA_FMT_EVENT) &&
+		    (payload_size == 4)) {
+			switch (payload[0]) {
+			case ASM_MEDIA_FMT_AC3:
+				((uint32_t *)pp_event_package->payload)[0] =
+					SND_AUDIOCODEC_AC3;
+				break;
+			case ASM_MEDIA_FMT_EAC3:
+				((uint32_t *)pp_event_package->payload)[0] =
+					SND_AUDIOCODEC_EAC3;
+				break;
+			case ASM_MEDIA_FMT_DTS:
+				((uint32_t *)pp_event_package->payload)[0] =
+					SND_AUDIOCODEC_DTS;
+				break;
+			case ASM_MEDIA_FMT_TRUEHD:
+				((uint32_t *)pp_event_package->payload)[0] =
+					SND_AUDIOCODEC_TRUEHD;
+				break;
+			case ASM_MEDIA_FMT_AAC_V2:
+				((uint32_t *)pp_event_package->payload)[0] =
+					SND_AUDIOCODEC_AAC;
+				break;
+			default:
+				pr_debug("%s: Event with unknown media_fmt 0x%x\n",
+					__func__, payload[0]);
+			}
+		}
 		ac->cb(data->opcode, data->token,
 			(void *)pp_event_package, ac->priv);
 		kfree(pp_event_package);

+ 3 - 2
include/dsp/apr_audio-v2.h

@@ -646,8 +646,9 @@ struct adm_cmd_set_pp_params {
 
 #define ASM_STREAM_CMD_REGISTER_PP_EVENTS 0x00013213
 #define ASM_STREAM_PP_EVENT 0x00013214
-#define ASM_STREAM_CMD_REGISTER_IEC_61937_FMT_UPDATE 0x13333
-#define ASM_IEC_61937_MEDIA_FMT_EVENT 0x13334
+#define ASM_STREAM_CMD_REGISTER_IEC_61937_FMT_UPDATE 0x1321C
+#define ASM_IEC_61937_MEDIA_FMT_EVENT 0x1321D
+
 
 #define DSP_STREAM_CMD "ADSP Stream Cmd"
 #define DSP_STREAM_CALLBACK "ADSP Stream Callback Event"