summaryrefslogtreecommitdiff
path: root/sound/soc
diff options
context:
space:
mode:
authorAshish Jain <ashishj@codeaurora.org>2014-05-29 19:17:49 +0530
committerAshish Jain <ashishj@codeaurora.org>2014-07-10 19:09:45 +0530
commit427d17a99f2497be43517353303f8e497d844fc3 (patch)
treee128b17a030ab45393caeb6287ce01349d4ec734 /sound/soc
parentc3f737d59e2b32c4daba79b09887ae0f1a140146 (diff)
ASoC: msm: Configure correct gain on set Volume command
Output channel gain is product of per channel gain and master gain. Hence if only per channel gain is set and master gain is set to 0 then no audio is heard at the output. Ensure that if we change per channel gain then we set master gain to unity and vice versa. This enables only one gain to be effective. Change-Id: I4cc2990efbb3e86edcc3d4328761cb64ed8fa775 Signed-off-by: Ashish Jain <ashishj@codeaurora.org>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c
index b69bd4b9e766..34717ba76e68 100644
--- a/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c
+++ b/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c
@@ -177,8 +177,31 @@ static int msm_compr_set_volume(struct snd_compr_stream *cstream,
pr_debug("%s: call q6asm_set_lrgain\n", __func__);
rc = q6asm_set_lrgain(prtd->audio_client,
volume_l, volume_r);
+ if (rc < 0) {
+ pr_err("%s: set lrgain command failed rc=%d\n",
+ __func__, rc);
+ return rc;
+ }
+ /*
+ * set master gain to unity so that only lr gain
+ * is effective
+ */
+ rc = q6asm_set_volume(prtd->audio_client,
+ COMPRESSED_LR_VOL_MAX_STEPS);
} else {
pr_debug("%s: call q6asm_set_volume\n", __func__);
+ /*
+ * set left and right channel gain to unity so that
+ * only master gain is effective
+ */
+ rc = q6asm_set_lrgain(prtd->audio_client,
+ COMPRESSED_LR_VOL_MAX_STEPS,
+ COMPRESSED_LR_VOL_MAX_STEPS);
+ if (rc < 0) {
+ pr_err("%s: set lrgain command failed rc=%d\n",
+ __func__, rc);
+ return rc;
+ }
rc = q6asm_set_volume(prtd->audio_client, volume_l);
}
if (rc < 0) {