From 092ca0fe363d0f4edcd8eccb96e2b4d8c1e2d0fd Mon Sep 17 00:00:00 2001 From: vivek mehta Date: Tue, 15 Dec 2015 17:22:32 -0800 Subject: [PATCH] ASoC: msm: send gain info for all channels mask - currently gain is added for only number of channels and clip channel count is send to dsp. - but it is possible that channel mask that driver has is different than what dsp discovers after decoding the codec config data - volume will not be applied to channels that differ between driver and dsp and device volume will not apply on these channels - change is to control multi-channel volume using master gain Change-Id: Icd8ca4e935d9095dd9ef8b65eff34629326fb563 Signed-off-by: vivek mehta --- sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c index 1f84b85a2b63..b9722314ad55 100755 --- a/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c +++ b/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c @@ -211,7 +211,7 @@ static int msm_compr_set_volume(struct snd_compr_stream *cstream, uint32_t volume_l, uint32_t volume_r) { struct msm_compr_audio *prtd; - int rc = 0, i; + int rc = 0; uint32_t avg_vol, gain_list[VOLUME_CONTROL_MAX_CHANNELS]; uint32_t num_channels; struct snd_soc_pcm_runtime *rtd; @@ -255,9 +255,7 @@ static int msm_compr_set_volume(struct snd_compr_stream *cstream, * */ avg_vol = (volume_l + volume_r) / 2; - for (i = 0; i < prtd->num_channels; i++) - gain_list[i] = avg_vol; - + rc = q6asm_set_volume(prtd->audio_client, avg_vol); } else { gain_list[0] = volume_l; gain_list[1] = volume_r; @@ -267,11 +265,10 @@ static int msm_compr_set_volume(struct snd_compr_stream *cstream, num_channels = 3; use_default = true; } + rc = q6asm_set_multich_gain(prtd->audio_client, num_channels, + gain_list, chmap, use_default); } - rc = q6asm_set_multich_gain(prtd->audio_client, num_channels, - gain_list, chmap, use_default); - if (rc < 0) pr_err("%s: Send vol gain command failed rc=%d\n", __func__, rc);