diff options
author | Simon Wilson <simonwilson@google.com> | 2011-08-08 16:15:45 -0700 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2011-08-08 16:21:49 -0700 |
commit | c2b96c3839c015ae59a7f13da46291661939f4cb (patch) | |
tree | d37099c303f597c7fb3122f030f00c4a9667bee4 /audio | |
parent | 50a6c2540a0d5c4ed19b5295e6cebe9e228072a0 (diff) | |
download | device_samsung_tuna-c2b96c3839c015ae59a7f13da46291661939f4cb.tar.gz device_samsung_tuna-c2b96c3839c015ae59a7f13da46291661939f4cb.tar.bz2 device_samsung_tuna-c2b96c3839c015ae59a7f13da46291661939f4cb.zip |
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.c | 40 |
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 */ |