summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
Diffstat (limited to 'audio')
-rw-r--r--audio/audio_hw.c40
1 files changed, 24 insertions, 16 deletions
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;