am a1f48050: hal: Support mute/unmute for HFP Tx
* commit 'a1f480505a2e11b65e8fe6590239bd87b3a33f11':
hal: Support mute/unmute for HFP Tx
diff --git a/hal/audio_extn/hfp.c b/hal/audio_extn/hfp.c
index 66d1f9b..f3075cf 100644
--- a/hal/audio_extn/hfp.c
+++ b/hal/audio_extn/hfp.c
@@ -120,6 +120,7 @@
ALOGD("%s: enter", __func__);
adev->enable_hfp = true;
+ platform_set_mic_mute(adev->platform, false);
uc_info = (struct audio_usecase *)calloc(1, sizeof(struct audio_usecase));
uc_info->id = hfpmod.ucid;
@@ -209,7 +210,6 @@
struct audio_usecase *uc_info;
ALOGD("%s: enter", __func__);
- adev->enable_hfp = false;
hfpmod.is_hfp_running = false;
/* 1. Close the PCM devices */
@@ -244,6 +244,16 @@
disable_snd_device(adev, uc_info->out_snd_device);
disable_snd_device(adev, uc_info->in_snd_device);
+ /* Disable the echo reference for HFP Tx */
+ platform_set_echo_reference(adev, false, AUDIO_DEVICE_NONE);
+
+ /* Set the unmute Tx mixer control */
+ if (voice_get_mic_mute(adev)) {
+ platform_set_mic_mute(adev->platform, false);
+ ALOGD("%s: unMute HFP Tx", __func__);
+ }
+ adev->enable_hfp = false;
+
list_remove(&uc_info->list);
free(uc_info);
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 134a2d8..cf49395 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -1607,9 +1607,13 @@
ALL_SESSION_VSID,
DEFAULT_MUTE_RAMP_DURATION_MS};
- if (adev->mode != AUDIO_MODE_IN_CALL)
+ if (adev->mode != AUDIO_MODE_IN_CALL &&
+ adev->mode != AUDIO_MODE_IN_COMMUNICATION)
return 0;
+ if (adev->enable_hfp)
+ mixer_ctl_name = "HFP Tx Mute";
+
set_values[0] = state;
ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
if (!ctl) {
diff --git a/hal/voice.c b/hal/voice.c
index a33305d..d2215b6 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -350,7 +350,8 @@
int err = 0;
adev->voice.mic_mute = state;
- if (adev->mode == AUDIO_MODE_IN_CALL)
+ if (adev->mode == AUDIO_MODE_IN_CALL ||
+ adev->mode == AUDIO_MODE_IN_COMMUNICATION)
err = platform_set_mic_mute(adev->platform, state);
return err;