summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUday Kishore Pasupuleti <upasupul@codeaurora.org>2015-09-08 22:49:18 +0900
committerPrashant Malani <pmalani@google.com>2015-10-08 11:11:04 -0700
commita1f480505a2e11b65e8fe6590239bd87b3a33f11 (patch)
tree1971cb79f37624a1560493ef0bc966444b49d552
parentfb21e4e53923416672ebbf33910d3c4bea5d15f5 (diff)
downloadandroid_hardware_qcom_audio-a1f480505a2e11b65e8fe6590239bd87b3a33f11.tar.gz
android_hardware_qcom_audio-a1f480505a2e11b65e8fe6590239bd87b3a33f11.tar.bz2
android_hardware_qcom_audio-a1f480505a2e11b65e8fe6590239bd87b3a33f11.zip
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>
-rw-r--r--hal/audio_extn/hfp.c12
-rw-r--r--hal/msm8974/platform.c6
-rw-r--r--hal/voice.c3
3 files changed, 18 insertions, 3 deletions
diff --git a/hal/audio_extn/hfp.c b/hal/audio_extn/hfp.c
index 66d1f9b0..f3075cfa 100644
--- a/hal/audio_extn/hfp.c
+++ b/hal/audio_extn/hfp.c
@@ -120,6 +120,7 @@ static int32_t start_hfp(struct audio_device *adev,
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 @@ static int32_t stop_hfp(struct audio_device *adev)
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 @@ static int32_t stop_hfp(struct audio_device *adev)
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 134a2d87..cf493952 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -1607,9 +1607,13 @@ int platform_set_mic_mute(void *platform, bool state)
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 a33305d3..d2215b61 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -350,7 +350,8 @@ int voice_set_mic_mute(struct audio_device *adev, bool state)
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;