Merge "hal: add support for external FM volume control"
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index a0e3300..f7d88ae 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -439,23 +439,22 @@
/* Make sure all the streams are de-routed before disabling the device */
audio_route_update_mixer(adev->audio_route);
+ /* Make sure the previous devices to be disabled first and then enable the
+ selected devices */
list_for_each(node, &adev->usecase_list) {
usecase = node_to_item(node, struct audio_usecase, list);
if (switch_device[usecase->id]) {
- disable_snd_device(adev, usecase->out_snd_device, false);
+ disable_snd_device(adev, usecase->out_snd_device, true);
}
}
list_for_each(node, &adev->usecase_list) {
usecase = node_to_item(node, struct audio_usecase, list);
if (switch_device[usecase->id]) {
- enable_snd_device(adev, snd_device, false);
+ enable_snd_device(adev, snd_device, true);
}
}
- /* Make sure new snd device is enabled before re-routing the streams */
- audio_route_update_mixer(adev->audio_route);
-
/* Re-route all the usecases on the shared backend other than the
specified usecase to new snd devices */
list_for_each(node, &adev->usecase_list) {
@@ -509,23 +508,22 @@
/* Make sure all the streams are de-routed before disabling the device */
audio_route_update_mixer(adev->audio_route);
+ /* Make sure the previous devices to be disabled first and then enable the
+ selected devices */
list_for_each(node, &adev->usecase_list) {
usecase = node_to_item(node, struct audio_usecase, list);
if (switch_device[usecase->id]) {
- disable_snd_device(adev, usecase->in_snd_device, false);
+ disable_snd_device(adev, usecase->in_snd_device, true);
}
}
list_for_each(node, &adev->usecase_list) {
usecase = node_to_item(node, struct audio_usecase, list);
if (switch_device[usecase->id]) {
- enable_snd_device(adev, snd_device, false);
+ enable_snd_device(adev, snd_device, true);
}
}
- /* Make sure new snd device is enabled before re-routing the streams */
- audio_route_update_mixer(adev->audio_route);
-
/* Re-route all the usecases on the shared backend other than the
specified usecase to new snd devices */
list_for_each(node, &adev->usecase_list) {
@@ -700,12 +698,12 @@
/* Disable current sound devices */
if (usecase->out_snd_device != SND_DEVICE_NONE) {
disable_audio_route(adev, usecase, true);
- disable_snd_device(adev, usecase->out_snd_device, false);
+ disable_snd_device(adev, usecase->out_snd_device, true);
}
if (usecase->in_snd_device != SND_DEVICE_NONE) {
disable_audio_route(adev, usecase, true);
- disable_snd_device(adev, usecase->in_snd_device, false);
+ disable_snd_device(adev, usecase->in_snd_device, true);
}
/* Applicable only on the targets that has external modem.