ASoC: msm: Apply cached volume and mute at call start.

Volume and mute settings before voice call is started are cached
in the driver, apply the cached settings at call start.

Change-Id: Iabc1f47c46a8e986c79106545ac3ee977fbca99c
Signed-off-by: Neema Shetty <nshetty@codeaurora.org>
This commit is contained in:
Neema Shetty 2012-07-11 18:58:17 -07:00 committed by Stephen Boyd
parent 63388726c7
commit c5409eae07

View file

@ -2344,6 +2344,9 @@ static int voice_destroy_vocproc(struct voice_data *v)
/* send stop voice cmd */
voice_send_stop_voice_cmd(v);
/* Clear mute setting */
v->dev_tx.mute = common.default_mute_val;
/* detach VOCPROC and wait for response from mvm */
mvm_d_vocproc_cmd.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
APR_HDR_LEN(APR_HDR_SIZE),
@ -3106,7 +3109,9 @@ int voc_set_tx_mute(uint16_t session_id, uint32_t dir, uint32_t mute)
v->dev_tx.mute = mute;
if (v->voc_state == VOC_RUN)
if ((v->voc_state == VOC_RUN) ||
(v->voc_state == VOC_CHANGE) ||
(v->voc_state == VOC_STANDBY))
ret = voice_send_mute_cmd(v);
mutex_unlock(&v->lock);
@ -3312,7 +3317,9 @@ int voc_set_rx_vol_index(uint16_t session_id, uint32_t dir, uint32_t vol_idx)
v->dev_rx.volume = vol_idx;
if (v->voc_state == VOC_RUN)
if ((v->voc_state == VOC_RUN) ||
(v->voc_state == VOC_CHANGE) ||
(v->voc_state == VOC_STANDBY))
ret = voice_send_vol_index_cmd(v);
mutex_unlock(&v->lock);
@ -3501,6 +3508,15 @@ int voc_start_voice_call(uint16_t session_id)
pr_err("setup voice failed\n");
goto fail;
}
ret = voice_send_vol_index_cmd(v);
if (ret < 0)
pr_err("voice volume failed\n");
ret = voice_send_mute_cmd(v);
if (ret < 0)
pr_err("voice mute failed\n");
ret = voice_send_start_voice_cmd(v);
if (ret < 0) {
pr_err("start voice failed\n");
@ -3998,7 +4014,7 @@ static int __init voice_init(void)
memset((void *)common.cvs_cal.buf, 0, CVS_CAL_SIZE);
cont:
/* set default value */
common.default_mute_val = 1; /* default is mute */
common.default_mute_val = 0; /* default is un-mute */
common.default_vol_val = 0;
common.default_sample_val = 8000;