summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorRamjee Singh <ramjee@codeaurora.org>2018-05-17 19:25:51 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2019-02-20 21:31:26 -0800
commitd3611a4a93ecbfee6b4bfee99ee52a8f75faeed9 (patch)
treec3dfa27c1787c4878259c367bedd97890e04665f /sound
parent2f2349ed452999de87b7c588ba42d0d65c546d73 (diff)
ASoC: msm: Add support for AVS version check
Updating pcm and compress driver to use asm read and write apis based on AVS version. Change-Id: Iec75114fed3a18f054074348d060726f013359cd Signed-off-by: Dhanalakshmi Siddani <dsiddani@codeaurora.org> Signed-off-by: Soumya Managoli <smanag@codeaurora.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c31
-rw-r--r--sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c73
2 files changed, 86 insertions, 18 deletions
diff --git a/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c
index edbd6b485dac..c52a797857d4 100644
--- a/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c
+++ b/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -1017,7 +1017,17 @@ static int msm_compr_send_media_format_block(struct snd_compr_stream *cstream,
sample_word_size = 16;
break;
}
- ret = q6asm_media_format_block_pcm_format_support_v4(
+ if (q6core_get_avs_version() == Q6_SUBSYS_AVS2_7)
+ ret = q6asm_media_format_block_pcm_format_support_v3(
+ prtd->audio_client,
+ prtd->sample_rate,
+ prtd->num_channels,
+ bit_width, stream_id,
+ use_default_chmap,
+ chmap,
+ sample_word_size);
+ else
+ ret = q6asm_media_format_block_pcm_format_support_v4(
prtd->audio_client,
prtd->sample_rate,
prtd->num_channels,
@@ -1323,7 +1333,13 @@ static int msm_compr_configure_dsp_for_playback
} else {
pr_debug("%s: stream_id %d bits_per_sample %d\n",
__func__, ac->stream_id, bits_per_sample);
- ret = q6asm_stream_open_write_v4(ac,
+ if (q6core_get_avs_version() == Q6_SUBSYS_AVS2_7)
+ ret = q6asm_stream_open_write_v3(ac,
+ prtd->codec, bits_per_sample,
+ ac->stream_id,
+ prtd->gapless_state.use_dsp_gapless_mode);
+ else
+ ret = q6asm_stream_open_write_v4(ac,
prtd->codec, bits_per_sample,
ac->stream_id,
prtd->gapless_state.use_dsp_gapless_mode);
@@ -2639,10 +2655,17 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd)
pr_debug("%s: open_write stream_id %d bits_per_sample %d",
__func__, stream_id, bits_per_sample);
- rc = q6asm_stream_open_write_v4(prtd->audio_client,
+ if (q6core_get_avs_version() == Q6_SUBSYS_AVS2_7)
+ rc = q6asm_stream_open_write_v3(prtd->audio_client,
+ prtd->codec, bits_per_sample,
+ stream_id,
+ prtd->gapless_state.use_dsp_gapless_mode);
+ else
+ rc = q6asm_stream_open_write_v4(prtd->audio_client,
prtd->codec, bits_per_sample,
stream_id,
prtd->gapless_state.use_dsp_gapless_mode);
+ break;
if (rc < 0) {
pr_err("%s: Session out open failed for gapless\n",
__func__);
diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
index 6798b50e682f..98a5c73785e0 100644
--- a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
+++ b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -384,6 +384,25 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
prtd->audio_client = NULL;
return -ENOMEM;
}
+ ret = q6asm_open_write_v3(prtd->audio_client,
+ FORMAT_LINEAR_PCM, bits_per_sample);
+ if (ret < 0) {
+ pr_err("%s: q6asm_open_write_v3 failed (%d)\n",
+ __func__, ret);
+ q6asm_audio_client_free(prtd->audio_client);
+ prtd->audio_client = NULL;
+ return -ENOMEM;
+ }
+ } else if (q6core_get_avs_version() == Q6_SUBSYS_AVS2_8) {
+ ret = q6asm_open_write_v4(prtd->audio_client,
+ FORMAT_LINEAR_PCM, bits_per_sample);
+ if (ret < 0) {
+ pr_err("%s: q6asm_open_write_v4 failed (%d)\n",
+ __func__, ret);
+ q6asm_audio_client_free(prtd->audio_client);
+ prtd->audio_client = NULL;
+ return -ENOMEM;
+ }
} else {
ret = q6asm_open_write_with_retry(prtd->audio_client,
fmt_type, bits_per_sample);
@@ -433,13 +452,21 @@ static int msm_pcm_playback_prepare(struct snd_pcm_substream *substream)
prtd->channel_map, bits_per_sample,
sample_word_size, ASM_LITTLE_ENDIAN,
DEFAULT_QF);
- else
- ret = q6asm_media_format_block_multi_ch_pcm_v4(
+ else {
+ if (q6core_get_avs_version() == Q6_SUBSYS_AVS2_7)
+ ret = q6asm_media_format_block_multi_ch_pcm_v3(
+ prtd->audio_client, runtime->rate,
+ runtime->channels, !prtd->set_channel_map,
+ prtd->channel_map, bits_per_sample,
+ sample_word_size);
+ else
+ ret = q6asm_media_format_block_multi_ch_pcm_v4(
prtd->audio_client, runtime->rate,
runtime->channels, !prtd->set_channel_map,
prtd->channel_map, bits_per_sample,
sample_word_size, ASM_LITTLE_ENDIAN,
DEFAULT_QF);
+ }
}
if (ret < 0)
pr_info("%s: CMD Format block failed\n", __func__);
@@ -497,10 +524,19 @@ static int msm_pcm_capture_prepare(struct snd_pcm_substream *substream)
pr_debug("%s Opening %d-ch PCM read stream, perf_mode %d\n",
__func__, params_channels(params),
prtd->audio_client->perf_mode);
-
- ret = q6asm_open_read_with_retry(prtd->audio_client,
+ if (q6core_get_avs_version() == Q6_SUBSYS_AVS2_7) {
+ ret = q6asm_open_read_v3(prtd->audio_client,
+ FORMAT_LINEAR_PCM,
+ bits_per_sample);
+ } else if (q6core_get_avs_version() == Q6_SUBSYS_AVS2_8) {
+ ret = q6asm_open_read_v4(prtd->audio_client,
+ FORMAT_LINEAR_PCM,
+ bits_per_sample, false);
+ } else {
+ ret = q6asm_open_read_with_retry(prtd->audio_client,
FORMAT_LINEAR_PCM,
bits_per_sample, false);
+ }
if (ret < 0) {
pr_err("%s: q6asm_open_read failed\n", __func__);
q6asm_audio_client_free(prtd->audio_client);
@@ -577,15 +613,24 @@ static int msm_pcm_capture_prepare(struct snd_pcm_substream *substream)
sample_word_size,
ASM_LITTLE_ENDIAN,
DEFAULT_QF);
- else
- ret = q6asm_enc_cfg_blk_pcm_format_support_v4(
- prtd->audio_client,
- prtd->samp_rate,
- prtd->channel_mode,
- bits_per_sample,
- sample_word_size,
- ASM_LITTLE_ENDIAN,
- DEFAULT_QF);
+ else {
+ if (q6core_get_avs_version() == Q6_SUBSYS_AVS2_7)
+ ret = q6asm_enc_cfg_blk_pcm_format_support_v3(
+ prtd->audio_client,
+ prtd->samp_rate,
+ prtd->channel_mode,
+ bits_per_sample,
+ sample_word_size);
+ else
+ ret = q6asm_enc_cfg_blk_pcm_format_support_v4(
+ prtd->audio_client,
+ prtd->samp_rate,
+ prtd->channel_mode,
+ bits_per_sample,
+ sample_word_size,
+ ASM_LITTLE_ENDIAN,
+ DEFAULT_QF);
+ }
if (ret < 0)
pr_debug("%s: cmd cfg pcm was block failed", __func__);