summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorSimon Wilson <simonwilson@google.com>2011-07-17 17:50:53 -0700
committerSimon Wilson <simonwilson@google.com>2011-07-17 17:50:56 -0700
commit7f380a67fa71f0a0a4eefe8c33b375e16505af06 (patch)
tree984b66c1d396501dcc61528d81ff56cb645446be /audio
parent32fd4e18785eb3f6028c16d9fc274e9c7478bebf (diff)
downloaddevice_samsung_tuna-7f380a67fa71f0a0a4eefe8c33b375e16505af06.zip
device_samsung_tuna-7f380a67fa71f0a0a4eefe8c33b375e16505af06.tar.gz
device_samsung_tuna-7f380a67fa71f0a0a4eefe8c33b375e16505af06.tar.bz2
audio: reselect output device when changing mode
It's necessary to reselect the output device when changing from the AUDIO_MODE_IN_CALL state to AUDIO_MODE_NORMAL, otherwise the ASoC driver cannot find a route from the PCM to the endpoint. This is possibly a workaround for a bug in the ASoC driver. Also, this change means the audio HAL will no longer disable the multimedia mixer routes when in a call. This is because audio can be played during a call. Change-Id: I58c4b23289f8d6f9ad53b436215ec9a5d48f4fe1
Diffstat (limited to 'audio')
-rw-r--r--audio/audio_hw.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 641f0cb..bf9680c 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -299,6 +299,8 @@ struct tuna_stream_in {
struct tuna_audio_device *dev;
};
+static void select_output_device(struct tuna_audio_device *adev);
+
/* The enable flag when 0 makes the assumption that enums are disabled by
* "Off" and integers/booleans by 0 */
static int set_route_by_array(struct mixer *mixer, struct route_setting *route,
@@ -385,6 +387,7 @@ static void select_mode(struct tuna_audio_device *adev)
{
if (adev->mode == AUDIO_MODE_IN_CALL) {
if (!adev->in_call) {
+ select_output_device(adev);
set_route_by_array(adev->mixer, amic_vx, 1);
start_call(adev);
adev->in_call = 1;
@@ -393,6 +396,7 @@ static void select_mode(struct tuna_audio_device *adev)
if (adev->in_call) {
adev->in_call = 0;
end_call(adev);
+ select_output_device(adev);
set_route_by_array(adev->mixer, amic_vx, 0);
}
}
@@ -413,13 +417,13 @@ static void select_output_device(struct tuna_audio_device *adev)
/* Select output route(s) */
mixer_ctl_set_value(adev->mixer_ctls.headset_mm, 0,
- headset_on && !adev->in_call);
+ headset_on);
mixer_ctl_set_value(adev->mixer_ctls.headset_vx, 0,
- headset_on && adev->in_call);
+ headset_on && (adev->mode == AUDIO_MODE_IN_CALL));
mixer_ctl_set_value(adev->mixer_ctls.speaker_mm, 0,
- speaker_on && !adev->in_call);
+ speaker_on);
mixer_ctl_set_value(adev->mixer_ctls.speaker_vx, 0,
- speaker_on && adev->in_call);
+ speaker_on && (adev->mode == AUDIO_MODE_IN_CALL));
if (adev->out_device & AUDIO_DEVICE_OUT_EARPIECE)
set_route_by_array(adev->mixer, earpiece_switch, 1);