From 7f380a67fa71f0a0a4eefe8c33b375e16505af06 Mon Sep 17 00:00:00 2001 From: Simon Wilson Date: Sun, 17 Jul 2011 17:50:53 -0700 Subject: 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 --- audio/audio_hw.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'audio') 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); -- cgit v1.1