From 9f295c71fef2e6375c2634012822389cda84d170 Mon Sep 17 00:00:00 2001 From: Mangesh Kunchamwar Date: Mon, 8 Oct 2018 18:20:41 +0530 Subject: [PATCH] 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 --- asoc/msm-pcm-q6-v2.c | 20 ++++++++++++-------- config/qcs405auto.conf | 1 + config/qcs405autoconf.h | 1 + dsp/q6adm.c | 5 +++-- include/dsp/q6core.h | 13 +++++++++++++ 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/asoc/msm-pcm-q6-v2.c b/asoc/msm-pcm-q6-v2.c index 714197487d53..eb32f633ed55 100644 --- a/asoc/msm-pcm-q6-v2.c +++ b/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, diff --git a/config/qcs405auto.conf b/config/qcs405auto.conf index 61620ebb6d39..afa8140b6e04 100644 --- a/config/qcs405auto.conf +++ b/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 diff --git a/config/qcs405autoconf.h b/config/qcs405autoconf.h index 98cd1660335c..fd9407bdbce3 100644 --- a/config/qcs405autoconf.h +++ b/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 diff --git a/dsp/q6adm.c b/dsp/q6adm.c index b39b44922242..fcc1fa13184d 100644 --- a/dsp/q6adm.c +++ b/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)); diff --git a/include/dsp/q6core.h b/include/dsp/q6core.h index 4d5a973d2956..eaca526f8dda 100644 --- a/include/dsp/q6core.h +++ b/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__ */