Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 803e2406 authored by Eric Laurent's avatar Eric Laurent Committed by Banajit Goswami
Browse files

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: default avatarHaynes Mathew George <hgeorge@codeaurora.org>
Signed-off-by: default avatarEric Laurent <elaurent@google.com>
Git-commit: ed16e26a99b2b7904d0badae4bd0d30953873b9e
Git-repo: https://android.googlesource.com/kernel/msm


Signed-off-by: default avatarDhananjay Kumar <dhakumar@codeaurora.org>
Signed-off-by: default avatarBanajit Goswami <bgoswami@codeaurora.org>
parent 25d23202
Loading
Loading
Loading
Loading
+35 −1
Original line number Diff line number Diff line
@@ -254,6 +254,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;
@@ -331,7 +360,12 @@ 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)