From 1c3ccd1cbf98430dc091240fe1aa494a51908980 Mon Sep 17 00:00:00 2001 From: MarcKe Date: Thu, 29 Jan 2015 20:32:59 +0100 Subject: audio: fix incall mute --- audio/audio_hw.c | 42 ++++++++++++++++++++++++++++++++++++++++++ audio/audio_hw.h | 7 +++++++ 2 files changed, 49 insertions(+) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 31aecad..5335d7d 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -2603,10 +2603,52 @@ static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode) static int adev_set_mic_mute(struct audio_hw_device *dev, bool state) { + int headset_on; + int headphone_on; + int speaker_on; + int earpiece_on; + int bt_on; + struct m0_audio_device *adev = (struct m0_audio_device *)dev; + headset_on = adev->out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET; + headphone_on = adev->out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE; + speaker_on = adev->out_device & AUDIO_DEVICE_OUT_SPEAKER; + earpiece_on = adev->out_device & AUDIO_DEVICE_OUT_EARPIECE; + bt_on = adev->out_device & AUDIO_DEVICE_OUT_ALL_SCO; + adev->mic_mute = state; + if (adev->mode == AUDIO_MODE_IN_CALL) { + if (state) { + if (speaker_on || earpiece_on || headphone_on) { + ALOGD("%s: set voicecall route: default_input_disable", __func__); + set_bigroute_by_array(adev->mixer, default_input_disable, 1); + } + if (headset_on) { + ALOGD("%s: set voicecall route: headset_input_disable", __func__); + set_bigroute_by_array(adev->mixer, headset_input_disable, 1); + } + if (bt_on) { + ALOGD("%s: set voicecall route: bt_input_disable", __func__); + set_bigroute_by_array(adev->mixer, bt_input_disable, 1); + } + } else { + if (speaker_on || earpiece_on || headphone_on) { + ALOGD("%s: set voicecall route: default_input", __func__); + set_bigroute_by_array(adev->mixer, default_input, 1); + } + if (headset_on) { + ALOGD("%s: set voicecall route: headset_input", __func__); + set_bigroute_by_array(adev->mixer, headset_input, 1); + } + if (bt_on) { + ALOGD("%s: set voicecall route: bt_input", __func__); + set_bigroute_by_array(adev->mixer, bt_input, 1); + } + } + } + return 0; } diff --git a/audio/audio_hw.h b/audio/audio_hw.h index 5ba0e9e..3481501 100644 --- a/audio/audio_hw.h +++ b/audio/audio_hw.h @@ -237,6 +237,13 @@ struct route_setting bt_input[] = { { .ctl_name = NULL, }, }; +struct route_setting bt_input_disable[] = { + { .ctl_name = "AIF2ADC Mux", .intval = 0, }, + { .ctl_name = "AIF1ADC1R Mixer AIF2 Switch", .intval = 0, }, + { .ctl_name = "AIF1ADC1L Mixer AIF2 Switch", .intval = 0, }, + { .ctl_name = NULL, }, +}; + struct route_setting bt_disable[] = { { .ctl_name = "AIF1DAC1 Volume", .intval = 96, }, { .ctl_name = "AIF1 Boost Volume", .intval = 0, }, -- cgit v1.1