diff options
author | Simon Wilson <simonwilson@google.com> | 2011-07-17 17:50:53 -0700 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2011-07-17 17:50:56 -0700 |
commit | d2106f3ede60f2f2d4381262a5d298e256164188 (patch) | |
tree | 2301f43971420f51503b58bfce70a3240fa59b0b /audio | |
parent | 22c777089fb008e6756fb775b7ce5ed3fa0b3a67 (diff) | |
download | device_samsung_tuna-d2106f3ede60f2f2d4381262a5d298e256164188.zip device_samsung_tuna-d2106f3ede60f2f2d4381262a5d298e256164188.tar.gz device_samsung_tuna-d2106f3ede60f2f2d4381262a5d298e256164188.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.c | 12 |
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); |