Browse Source

msm: featurize support for 32channels from QDSP6

Add configuration flag to make use of 32channel support from
QDSP6.

Change-Id: I1e491b1ec870234140e914add4f177e5351b9953
Signed-off-by: Mangesh Kunchamwar <[email protected]>
Mangesh Kunchamwar 6 years ago
parent
commit
9f295c71fe
5 changed files with 30 additions and 10 deletions
  1. 12 8
      asoc/msm-pcm-q6-v2.c
  2. 1 0
      config/qcs405auto.conf
  3. 1 0
      config/qcs405autoconf.h
  4. 3 2
      dsp/q6adm.c
  5. 13 0
      include/dsp/q6core.h

+ 12 - 8
asoc/msm-pcm-q6-v2.c

@@ -386,9 +386,10 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
 			return -ENOMEM;
 		}
 	} else {
-		if (q6core_get_avcs_api_version_per_service(
+		if ((q6core_get_avcs_api_version_per_service(
 				APRV2_IDS_SERVICE_ID_ADSP_ASM_V) >=
-				ADSP_ASM_API_VERSION_V2)
+				ADSP_ASM_API_VERSION_V2) &&
+					q6core_use_Q6_32ch_support())
 			ret = q6asm_open_write_v5(prtd->audio_client,
 				fmt_type, bits_per_sample);
 		else
@@ -434,9 +435,10 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
 			prtd->channel_map, bits_per_sample);
 	} else {
 
-		if (q6core_get_avcs_api_version_per_service(
+		if ((q6core_get_avcs_api_version_per_service(
 				APRV2_IDS_SERVICE_ID_ADSP_ASM_V) >=
-				ADSP_ASM_API_VERSION_V2) {
+				ADSP_ASM_API_VERSION_V2) &&
+					q6core_use_Q6_32ch_support()) {
 
 			ret = q6asm_media_format_block_multi_ch_pcm_v5(
 				prtd->audio_client, runtime->rate,
@@ -510,9 +512,10 @@ static int msm_pcm_capture_prepare(struct snd_pcm_substream *substream)
 				__func__, params_channels(params),
 				prtd->audio_client->perf_mode);
 
-		if (q6core_get_avcs_api_version_per_service(
+		if ((q6core_get_avcs_api_version_per_service(
 				APRV2_IDS_SERVICE_ID_ADSP_ASM_V) >=
-				ADSP_ASM_API_VERSION_V2)
+				ADSP_ASM_API_VERSION_V2) &&
+					q6core_use_Q6_32ch_support())
 			ret = q6asm_open_read_v5(prtd->audio_client,
 				FORMAT_LINEAR_PCM,
 				bits_per_sample, false, ENC_CFG_ID_NONE);
@@ -587,9 +590,10 @@ static int msm_pcm_capture_prepare(struct snd_pcm_substream *substream)
 			__func__, prtd->samp_rate, prtd->channel_mode,
 			bits_per_sample, sample_word_size);
 
-	if (q6core_get_avcs_api_version_per_service(
+	if ((q6core_get_avcs_api_version_per_service(
 			APRV2_IDS_SERVICE_ID_ADSP_ASM_V) >=
-			ADSP_ASM_API_VERSION_V2)
+			ADSP_ASM_API_VERSION_V2) &&
+			q6core_use_Q6_32ch_support())
 		ret = q6asm_enc_cfg_blk_pcm_format_support_v5(
 						prtd->audio_client,
 						prtd->samp_rate,

+ 1 - 0
config/qcs405auto.conf

@@ -36,3 +36,4 @@ CONFIG_SND_SOC_MSM_STUB=m
 CONFIG_MSM_AVTIMER=m
 CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=m
 CONFIG_SND_SOC_EP92=m
+CONFIG_USE_Q6_32CH_SUPPORT=m

+ 1 - 0
config/qcs405autoconf.h

@@ -48,3 +48,4 @@
 #define CONFIG_MSM_AVTIMER 1
 #define CONFIG_SND_SOC_MSM_HDMI_CODEC_RX 1
 #define CONFIG_SND_SOC_EP92 1
+#define CONFIG_USE_Q6_32CH_SUPPORT 1

+ 3 - 2
dsp/q6adm.c

@@ -2903,9 +2903,10 @@ int adm_open(int port_id, int path, int rate, int channel_mode, int topology,
 		}
 
 
-		if (q6core_get_avcs_api_version_per_service(
+		if ((q6core_get_avcs_api_version_per_service(
 				APRV2_IDS_SERVICE_ID_ADSP_ADM_V) >=
-					ADSP_ADM_API_VERSION_V3) {
+					ADSP_ADM_API_VERSION_V3) &&
+					q6core_use_Q6_32ch_support()) {
 			memset(&open_v8, 0, sizeof(open_v8));
 			memset(&ep1_payload, 0, sizeof(ep1_payload));
 			memset(&ep2_payload, 0, sizeof(ep2_payload));

+ 13 - 0
include/dsp/q6core.h

@@ -208,4 +208,17 @@ int32_t core_get_license_status(uint32_t module_id);
 
 int32_t q6core_load_unload_topo_modules(uint32_t topology_id,
 			bool preload_type);
+
+#if IS_ENABLED(CONFIG_USE_Q6_32CH_SUPPORT)
+static inline bool q6core_use_Q6_32ch_support(void)
+{
+	return true;
+}
+#else
+static inline bool q6core_use_Q6_32ch_support(void)
+{
+	return false;
+}
+#endif
+
 #endif /* __Q6CORE_H__ */