From 63bef5c56c9790a4cf7b010d0af7409bea45e8d3 Mon Sep 17 00:00:00 2001 From: Daniel Hillenbrand Date: Tue, 24 Jul 2012 16:17:24 +0200 Subject: audio: fix non working main-mic when unplugging headset during voicecall Change-Id: Ic1623756f73da275b48bffb59163961e92f45e39 --- audio/audio_hw.c | 21 ++++++++++++++++----- audio/audio_hw.h | 24 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 5 deletions(-) (limited to 'audio') diff --git a/audio/audio_hw.c b/audio/audio_hw.c index ebc57b3..65595fc 100755 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -592,25 +592,36 @@ static void select_output_device(struct m0_audio_device *adev) } if (headset_on || headphone_on || speaker_on || earpiece_on) { - ALOGD("%s: set bigroute: voicecall_input_default", __func__); + ALOGD("%s: set voicecall route: voicecall_default", __func__); set_bigroute_by_array(adev->mixer, voicecall_default, 1); } else { - ALOGD("%s: set bigroute: voicecall_input_default_disable", __func__); + ALOGD("%s: set voicecall route: voicecall_default_disable", __func__); set_bigroute_by_array(adev->mixer, voicecall_default_disable, 1); } + if (speaker_on || earpiece_on) { + ALOGD("%s: set voicecall route: default_input", __func__); + set_bigroute_by_array(adev->mixer, default_input, 1); + } else { + ALOGD("%s: set voicecall route: default_input_disable", __func__); + set_bigroute_by_array(adev->mixer, default_input_disable, 1); + } + if (headset_on || headphone_on) { - ALOGD("%s: set bigroute: headset_input", __func__); + ALOGD("%s: set voicecall route: headset_input", __func__); set_bigroute_by_array(adev->mixer, headset_input, 1); + } else { + ALOGD("%s: set voicecall route: headset_input_disable", __func__); + set_bigroute_by_array(adev->mixer, headset_input_disable, 1); } if (bt_on) { // bt uses a different port (PORT_BT) for playback, reopen the pcms end_call(adev); start_call(adev); - ALOGD("%s: set bigroute: bt_input", __func__); + ALOGD("%s: set voicecall route: bt_input", __func__); set_bigroute_by_array(adev->mixer, bt_input, 1); - ALOGD("%s: set bigroute: bt_output", __func__); + ALOGD("%s: set voicecall route: bt_output", __func__); set_bigroute_by_array(adev->mixer, bt_output, 1); } set_incall_device(adev); diff --git a/audio/audio_hw.h b/audio/audio_hw.h index 3cd62db..a2b33ca 100644 --- a/audio/audio_hw.h +++ b/audio/audio_hw.h @@ -137,6 +137,22 @@ struct route_setting voicecall_default_disable[] = { { .ctl_name = NULL, }, }; +struct route_setting default_input[] = { + { .ctl_name = "Main Mic Switch", .intval = 1, }, + { .ctl_name = "MIXINL IN1L Switch", .intval = 1, }, + { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 0, }, + { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 1, }, + { .ctl_name = NULL, }, +}; + +struct route_setting default_input_disable[] = { + { .ctl_name = "Main Mic Switch", .intval = 0, }, + { .ctl_name = "MIXINL IN1L Switch", .intval = 0, }, + { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 0, }, + { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 0, }, + { .ctl_name = NULL, }, +}; + struct route_setting headset_input[] = { { .ctl_name = "MIXINL IN1L Switch", .intval = 0, }, { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, @@ -153,6 +169,14 @@ struct route_setting headset_input[] = { { .ctl_name = NULL, }, }; +struct route_setting headset_input_disable[] = { + { .ctl_name = "Headset Mic Switch", .intval = 0, }, + { .ctl_name = "MIXINL IN2L Switch", .intval = 0, }, + { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 0, }, + { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 0, }, + { .ctl_name = NULL, }, +}; + struct route_setting bt_output[] = { { .ctl_name = "DAC1L Mixer AIF1.1 Switch", .intval = 1, }, { .ctl_name = "DAC1R Mixer AIF1.1 Switch", .intval = 1, }, -- cgit v1.1