summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2013-09-04 08:51:10 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:10:41 -0700
commitdb4af0b8e44e7960ce1ac89be9d3bef714dc6840 (patch)
tree194673d22d9f2d56187648a98b0ddf1b36fe9fe0
parent0f65a07b71edaca3ad0971a8745ca70102fac119 (diff)
ASoc: msm: Send media format block for compress playback
Compress offload playback for AAC requires media format block to be sent to the DSP before the bitstream can be decoded. Send this as part of configuring the DSP Change-Id: Ia22bc52aa0c136a1ee3f70a1e150458f8e4b6866 Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org> Signed-off-by: Eric Laurent <elaurent@google.com> Git-commit: ed16e26a99b2b7904d0badae4bd0d30953873b9e Git-repo: https://android.googlesource.com/kernel/msm Signed-off-by: Dhananjay Kumar <dhakumar@codeaurora.org>
-rw-r--r--sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c
index 9e8c04dff8fa..929604a1291a 100644
--- a/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c
+++ b/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c
@@ -253,6 +253,35 @@ static void populate_codec_list(struct msm_compr_audio *prtd)
prtd->compr_cap.codecs[1] = SND_AUDIOCODEC_AAC;
}
+static int msm_compr_send_media_format_block(struct snd_compr_stream *cstream)
+{
+ struct snd_compr_runtime *runtime = cstream->runtime;
+ struct msm_compr_audio *prtd = runtime->private_data;
+ struct asm_aac_cfg aac_cfg;
+ int ret = 0;
+
+ switch (prtd->codec) {
+ case FORMAT_MP3:
+ /* no media format block needed */
+ break;
+ case FORMAT_MPEG4_AAC:
+ memset(&aac_cfg, 0x0, sizeof(struct asm_aac_cfg));
+ aac_cfg.aot = AAC_ENC_MODE_EAAC_P;
+ aac_cfg.format = 0x03;
+ aac_cfg.ch_cfg = prtd->num_channels;
+ aac_cfg.sample_rate = prtd->sample_rate;
+ ret = q6asm_media_format_block_aac(prtd->audio_client,
+ &aac_cfg);
+ if (ret < 0)
+ pr_err("%s: CMD Format block failed\n", __func__);
+ break;
+ default:
+ pr_debug("%s, unsupported format, skip", __func__);
+ break;
+ }
+ return ret;
+}
+
static int msm_compr_configure_dsp(struct snd_compr_stream *cstream)
{
struct snd_compr_runtime *runtime = cstream->runtime;
@@ -330,7 +359,13 @@ static int msm_compr_configure_dsp(struct snd_compr_stream *cstream)
prtd->buffer_paddr = prtd->audio_client->port[dir].buf[0].phys;
prtd->buffer_size = runtime->fragments * runtime->fragment_size;
- return 0;
+ ret = msm_compr_send_media_format_block(cstream);
+
+ if (ret < 0) {
+ pr_err("%s, failed to send media format block\n", __func__);
+ }
+
+ return ret;
}
static int msm_compr_open(struct snd_compr_stream *cstream)