From 78665972348cd1654f3d965cc6a9fc235b1ba773 Mon Sep 17 00:00:00 2001 From: Daniel Hillenbrand Date: Fri, 16 Aug 2013 00:35:52 +0200 Subject: n7100: audio: disable voicecall route on init and leaving incall state Original Change-Id in I9300 tree: I5e1ca99f19a715ef509825d46103c60f10d35ce2 Change-Id: I4b3f42ab561dd260d20507f04b1c4398cd07154b --- audio/audio_hw.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'audio') diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 80a5ecc..9ddfeb1 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -209,7 +209,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; @@ -588,6 +588,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); } @@ -668,26 +673,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) { @@ -695,12 +700,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); @@ -2577,12 +2582,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); } } @@ -3053,10 +3058,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; @@ -3068,6 +3069,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->pcm_bt_dl = NULL; -- cgit v1.2.3