summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorSimon Wilson <simonwilson@google.com>2011-08-08 16:15:45 -0700
committerSimon Wilson <simonwilson@google.com>2011-08-08 16:21:49 -0700
commit975e915dae0414e54decaa9f1fe3786ee5fbd87d (patch)
treef87e9847be7b1dc29acc6cd3bc2992f3e4ee4585 /audio
parent41694793e06f9198684f9deaeff1a7bdcc4c39c9 (diff)
downloaddevice_samsung_tuna-975e915dae0414e54decaa9f1fe3786ee5fbd87d.zip
device_samsung_tuna-975e915dae0414e54decaa9f1fe3786ee5fbd87d.tar.gz
device_samsung_tuna-975e915dae0414e54decaa9f1fe3786ee5fbd87d.tar.bz2
audio: use sub mic for handsfree voice calls
Using the sub mic is necessary to avoid echo due to the physical placement of the main mic. Change-Id: I716db818ec439d812f162b3f4170195c98c51539
Diffstat (limited to 'audio')
-rw-r--r--audio/audio_hw.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index b0399da..949158f 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -240,7 +240,7 @@ struct route_setting mm_ul2_amic[] = {
};
/* VX UL front-end paths */
-struct route_setting vx_ul_amic[] = {
+struct route_setting vx_ul_amic_left[] = {
{
.ctl_name = MIXER_MUX_VX0,
.strval = MIXER_AMIC0,
@@ -258,6 +258,24 @@ struct route_setting vx_ul_amic[] = {
},
};
+struct route_setting vx_ul_amic_right[] = {
+ {
+ .ctl_name = MIXER_MUX_VX0,
+ .strval = MIXER_AMIC1,
+ },
+ {
+ .ctl_name = MIXER_MUX_VX1,
+ .strval = MIXER_AMIC0,
+ },
+ {
+ .ctl_name = MIXER_VOICE_CAPTURE_MIXER_CAPTURE,
+ .intval = 1,
+ },
+ {
+ .ctl_name = NULL,
+ },
+};
+
struct route_setting vx_ul_bt[] = {
{
.ctl_name = MIXER_MUX_VX0,
@@ -481,14 +499,18 @@ static void select_output_device(struct tuna_audio_device *adev)
if (bt_on)
set_route_by_array(adev->mixer, vx_ul_bt, bt_on);
else {
- set_route_by_array(adev->mixer, vx_ul_amic,
- (speaker_on | headset_on | earpiece_on));
- if (headset_on)
- mixer_ctl_set_enum_by_string(adev->mixer_ctls.left_capture, MIXER_HS_MIC);
+ if (headset_on || earpiece_on)
+ set_route_by_array(adev->mixer, vx_ul_amic_left, 1);
+ else if (speaker_on)
+ set_route_by_array(adev->mixer, vx_ul_amic_right, 1);
else
- mixer_ctl_set_enum_by_string(adev->mixer_ctls.left_capture,
- (speaker_on | earpiece_on) ?
- MIXER_MAIN_MIC : "Off");
+ set_route_by_array(adev->mixer, vx_ul_amic_left, 0);
+
+ mixer_ctl_set_enum_by_string(adev->mixer_ctls.left_capture,
+ earpiece_on ? MIXER_MAIN_MIC :
+ (headset_on ? MIXER_HS_MIC : "Off"));
+ mixer_ctl_set_enum_by_string(adev->mixer_ctls.right_capture,
+ speaker_on ? MIXER_SUB_MIC : "Off");
}
}
if (adev->in_call)
@@ -530,7 +552,7 @@ static void select_input_device(struct tuna_audio_device *adev)
/* Select front end */
set_route_by_array(adev->mixer, mm_ul2_amic,
anlg_mic_on && (port != PORT_VX));
- set_route_by_array(adev->mixer, vx_ul_amic,
+ set_route_by_array(adev->mixer, vx_ul_amic_left,
anlg_mic_on && (port == PORT_VX));
/* Select back end */