summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorSimon Wilson <simonwilson@google.com>2011-08-08 19:57:43 -0700
committerSimon Wilson <simonwilson@google.com>2011-08-09 09:17:45 -0700
commita25c2e62c0659e9348561da047494d26c37f8dc2 (patch)
tree7ba913940f883c26d945d5c0bee111fb8e929fe1 /audio
parentc31e6f1ded318a1c49a2bf4272aabcf80793138c (diff)
downloaddevice_samsung_tuna-a25c2e62c0659e9348561da047494d26c37f8dc2.zip
device_samsung_tuna-a25c2e62c0659e9348561da047494d26c37f8dc2.tar.gz
device_samsung_tuna-a25c2e62c0659e9348561da047494d26c37f8dc2.tar.bz2
audio: fix mic path when headphones are used
Fixes bug 5118167 - when headphones without a mic are connected, use the main microphone during a voice call. Change-Id: I846d923d71e88e65adf43001ab13a4d1927a696d
Diffstat (limited to 'audio')
-rw-r--r--audio/audio_hw.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 949158f..0fe1b5d 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -463,6 +463,7 @@ static void select_mode(struct tuna_audio_device *adev)
static void select_output_device(struct tuna_audio_device *adev)
{
int headset_on;
+ int headphone_on;
int speaker_on;
int earpiece_on;
int bt_on;
@@ -473,12 +474,12 @@ static void select_output_device(struct tuna_audio_device *adev)
if (adev->in_call)
end_call(adev);
- headset_on = adev->devices &
- (AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE);
+ headset_on = adev->devices & AUDIO_DEVICE_OUT_WIRED_HEADSET;
+ headphone_on = adev->devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE;
speaker_on = adev->devices & AUDIO_DEVICE_OUT_SPEAKER;
earpiece_on = adev->devices & AUDIO_DEVICE_OUT_EARPIECE;
bt_on = adev->devices & AUDIO_DEVICE_OUT_ALL_SCO;
- dl1_on = headset_on | earpiece_on | bt_on;
+ dl1_on = headset_on | headphone_on | earpiece_on | bt_on;
/* Select front end */
mixer_ctl_set_value(adev->mixer_ctls.mm_dl2, 0, speaker_on);
@@ -488,7 +489,8 @@ static void select_output_device(struct tuna_audio_device *adev)
mixer_ctl_set_value(adev->mixer_ctls.vx_dl1, 0,
dl1_on && (adev->mode == AUDIO_MODE_IN_CALL));
/* Select back end */
- mixer_ctl_set_value(adev->mixer_ctls.dl1_headset, 0, headset_on | earpiece_on);
+ mixer_ctl_set_value(adev->mixer_ctls.dl1_headset, 0,
+ headset_on | headphone_on | earpiece_on);
mixer_ctl_set_value(adev->mixer_ctls.dl1_bt, 0, bt_on);
mixer_ctl_set_value(adev->mixer_ctls.earpiece_enable, 0, earpiece_on);
@@ -499,7 +501,7 @@ 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 {
- if (headset_on || earpiece_on)
+ if (headset_on || headphone_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);
@@ -507,7 +509,7 @@ static void select_output_device(struct tuna_audio_device *adev)
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 :
+ (earpiece_on || headphone_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");