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

Commit 3fb5f7c4 authored by Weiyin Jiang's avatar Weiyin Jiang Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: msm: qdsp6v2: force sending stereo volume for mono



Certain AAC has channel switch, so DSP decoder might reconfigure output
from mono to stereo in runtime. If only volume of FC is sent, output
pcm won't get applied with volume setting properly. We should force
sending FL/FR/FC volume gain for mono clips.

Change-Id: I656080f32053f1dc866d8cd981a9d5f03c2d963a
CRs-Fixed: 924685
Signed-off-by: default avatarWeiyin Jiang <wjiang@codeaurora.org>
parent 308bbda6
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -213,6 +213,7 @@ static int msm_compr_set_volume(struct snd_compr_stream *cstream,
	struct msm_compr_audio *prtd;
	int rc = 0, i;
	uint32_t avg_vol, gain_list[VOLUME_CONTROL_MAX_CHANNELS];
	uint32_t num_channels;
	struct snd_soc_pcm_runtime *rtd;
	struct msm_compr_pdata *pdata;
	bool use_default = true;
@@ -241,6 +242,7 @@ static int msm_compr_set_volume(struct snd_compr_stream *cstream,

	use_default = !(pdata->ch_map[rtd->dai_link->be_id]->set_ch_map);
	chmap = pdata->ch_map[rtd->dai_link->be_id]->channel_map;
	num_channels = prtd->num_channels;

	if (prtd->num_channels > 2) {
		/*
@@ -259,9 +261,15 @@ static int msm_compr_set_volume(struct snd_compr_stream *cstream,
	} else {
		gain_list[0] = volume_l;
		gain_list[1] = volume_r;
		/* force sending FR/FL/FC volume for mono */
		if (prtd->num_channels == 1) {
			gain_list[2] = volume_l;
			num_channels = 3;
			use_default = true;
		}
	}

	rc = q6asm_set_multich_gain(prtd->audio_client, prtd->num_channels,
	rc = q6asm_set_multich_gain(prtd->audio_client, num_channels,
				    gain_list, chmap, use_default);

	if (rc < 0)