hal: Support mute/unmute for HFP Tx

Current hal doesn't support mute/unmute for HFP Tx. So add the feature
to support mute/unmute for HFP Tx

Bug: 23559037
Change-Id: Ibd67225ce926516974ca87059bb139e6af0083ac
Signed-off-by: Uday Kishore Pasupuleti <upasupul@codeaurora.org>
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);