From cef9ffb50b2742916fda2f9d5862c3c08362722b Mon Sep 17 00:00:00 2001 From: Daniel Hillenbrand Date: Fri, 16 Aug 2013 00:35:52 +0200 Subject: i9300: audio: disable voicecall route on init and leaving incall state Change-Id: I5e1ca99f19a715ef509825d46103c60f10d35ce2 --- audio/audio_hw.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index a322386..f2b7971 100755 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -207,7 +207,7 @@ static void in_update_aux_channels(struct m0_stream_in *in, effect_handle_t effe /* The enable flag when 0 makes the assumption that enums are disabled by * "Off" and integers/booleans by 0 */ -static int set_bigroute_by_array(struct mixer *mixer, struct route_setting *route, +static int set_voicecall_route_by_array(struct mixer *mixer, struct route_setting *route, int enable) { struct mixer_ctl *ctl; @@ -534,6 +534,11 @@ static void select_mode(struct m0_audio_device *adev) adev->in_call = 0; end_call(adev); force_all_standby(adev); + + /* Disable voicecall route */ + ALOGE("Disabling voicecall route"); + set_voicecall_route_by_array(adev->mixer, voicecall_default_disable, 1); + select_output_device(adev); select_input_device(adev); } @@ -620,26 +625,26 @@ static void select_output_device(struct m0_audio_device *adev) if (headset_on || headphone_on || speaker_on || earpiece_on) { ALOGD("%s: set voicecall route: voicecall_default", __func__); - set_bigroute_by_array(adev->mixer, voicecall_default, 1); + set_voicecall_route_by_array(adev->mixer, voicecall_default, 1); } else { ALOGD("%s: set voicecall route: voicecall_default_disable", __func__); - set_bigroute_by_array(adev->mixer, voicecall_default_disable, 1); + set_voicecall_route_by_array(adev->mixer, voicecall_default_disable, 1); } if (speaker_on || earpiece_on || headphone_on) { ALOGD("%s: set voicecall route: default_input", __func__); - set_bigroute_by_array(adev->mixer, default_input, 1); + set_voicecall_route_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); + set_voicecall_route_by_array(adev->mixer, default_input_disable, 1); } if (headset_on) { ALOGD("%s: set voicecall route: headset_input", __func__); - set_bigroute_by_array(adev->mixer, headset_input, 1); + set_voicecall_route_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); + set_voicecall_route_by_array(adev->mixer, headset_input_disable, 1); } if (bt_on) { @@ -647,12 +652,12 @@ static void select_output_device(struct m0_audio_device *adev) end_call(adev); start_call(adev); ALOGD("%s: set voicecall route: bt_input", __func__); - set_bigroute_by_array(adev->mixer, bt_input, 1); + set_voicecall_route_by_array(adev->mixer, bt_input, 1); ALOGD("%s: set voicecall route: bt_output", __func__); - set_bigroute_by_array(adev->mixer, bt_output, 1); + set_voicecall_route_by_array(adev->mixer, bt_output, 1); } else { ALOGD("%s: set voicecall route: bt_disable", __func__); - set_bigroute_by_array(adev->mixer, bt_disable, 1); + set_voicecall_route_by_array(adev->mixer, bt_disable, 1); } set_incall_device(adev); @@ -2532,12 +2537,12 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) ALOGE("%s: enabling two mic control", __func__); ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_ON); /* sub mic */ - set_bigroute_by_array(adev->mixer, noise_suppression, 1); + set_voicecall_route_by_array(adev->mixer, noise_suppression, 1); } else { ALOGE("%s: disabling two mic control", __func__); ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_OFF); /* sub mic */ - set_bigroute_by_array(adev->mixer, noise_suppression_disable, 1); + set_voicecall_route_by_array(adev->mixer, noise_suppression_disable, 1); } } @@ -3009,10 +3014,6 @@ static int adev_open(const hw_module_t* module, const char* name, return -EINVAL; } - /* +30db boost for mics */ - adev->mixer_ctls.mixinl_in1l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN1L Volume"); - adev->mixer_ctls.mixinl_in2l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN2L Volume"); - ret = adev_config_parse(adev); if (ret != 0) goto err_mixer; @@ -3024,6 +3025,13 @@ static int adev_open(const hw_module_t* module, const char* name, adev->in_device = AUDIO_DEVICE_IN_BUILTIN_MIC & ~AUDIO_DEVICE_BIT_IN; select_devices(adev); + /* +30db boost for mics */ + adev->mixer_ctls.mixinl_in1l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN1L Volume"); + adev->mixer_ctls.mixinl_in2l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN2L Volume"); + + /* Disable voicecall route */ + set_voicecall_route_by_array(adev->mixer, voicecall_default_disable, 1); + adev->pcm_modem_dl = NULL; adev->pcm_modem_ul = NULL; adev->voice_volume = 1.0f; -- cgit v1.1