static int enable_snd_device(struct audio_device *adev,
struct audio_usecase *uc_info,
- snd_device_t snd_device,
- bool update_mixer)
+ snd_device_t snd_device)
{
struct mixer_card *mixer_card;
struct listnode *node;
if (snd_device == SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES) {
ALOGV("Request to enable combo device: enable individual devices\n");
- enable_snd_device(adev, uc_info, SND_DEVICE_OUT_SPEAKER, update_mixer);
- enable_snd_device(adev, uc_info, SND_DEVICE_OUT_HEADPHONES, update_mixer);
+ enable_snd_device(adev, uc_info, SND_DEVICE_OUT_SPEAKER);
+ enable_snd_device(adev, uc_info, SND_DEVICE_OUT_HEADPHONES);
return 0;
}
adev->snd_dev_ref_cnt[snd_device]++;
usleep(DSP_POWEROFF_DELAY - elapsed_usec);
}
}
- update_mixer = true;
#endif /* DSP_POWEROFF_DELAY */
amplifier_enable_devices(snd_device, true);
- audio_route_apply_path(mixer_card->audio_route, snd_device_name);
- if (update_mixer) {
- audio_route_update_mixer(mixer_card->audio_route);
- }
+ audio_route_apply_and_update_path(mixer_card->audio_route, snd_device_name);
}
return 0;
int disable_snd_device(struct audio_device *adev,
struct audio_usecase *uc_info,
- snd_device_t snd_device,
- bool update_mixer)
+ snd_device_t snd_device)
{
struct mixer_card *mixer_card;
struct listnode *node;
if (snd_device == SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES) {
ALOGV("Request to disable combo device: disable individual devices\n");
- disable_snd_device(adev, uc_info, SND_DEVICE_OUT_SPEAKER, update_mixer);
- disable_snd_device(adev, uc_info, SND_DEVICE_OUT_HEADPHONES, update_mixer);
+ disable_snd_device(adev, uc_info, SND_DEVICE_OUT_SPEAKER);
+ disable_snd_device(adev, uc_info, SND_DEVICE_OUT_HEADPHONES);
return 0;
}
snd_device, snd_device_name);
list_for_each(node, &uc_info->mixer_list) {
mixer_card = node_to_item(node, struct mixer_card, uc_list_node[uc_info->id]);
-#ifdef DSP_POWEROFF_DELAY
- update_mixer = true;
-#endif /* DSP_POWEROFF_DELAY */
- audio_route_reset_path(mixer_card->audio_route, snd_device_name);
+ audio_route_reset_and_update_path(mixer_card->audio_route, snd_device_name);
if (snd_device > SND_DEVICE_IN_BEGIN && out_uc_info != NULL) {
/*
* Cycle the rx device to eliminate routing conflicts.
* route.
*/
out_snd_device_name = get_snd_device_name(out_uc_info->out_snd_device);
- audio_route_apply_path(mixer_card->audio_route, out_snd_device_name);
- update_mixer = true;
- }
- if (update_mixer) {
- audio_route_update_mixer(mixer_card->audio_route);
+ audio_route_apply_and_update_path(mixer_card->audio_route, out_snd_device_name);
}
amplifier_enable_devices(snd_device, false);
snd_device_t in_snd_device = SND_DEVICE_NONE;
struct audio_usecase *usecase = NULL;
struct audio_usecase *vc_usecase = NULL;
- struct listnode *node;
struct stream_in *active_input = NULL;
struct stream_out *active_out;
- struct mixer_card *mixer_card;
ALOGV("%s: usecase(%d)", __func__, uc_id);
/* Disable current sound devices */
if (usecase->out_snd_device != SND_DEVICE_NONE) {
- disable_snd_device(adev, usecase, usecase->out_snd_device, false);
+ disable_snd_device(adev, usecase, usecase->out_snd_device);
}
if (usecase->in_snd_device != SND_DEVICE_NONE) {
- disable_snd_device(adev, usecase, usecase->in_snd_device, false);
+ disable_snd_device(adev, usecase, usecase->in_snd_device);
}
/* Enable new sound devices */
set_voice_session_audio_path(adev->voice.session);
}
- enable_snd_device(adev, usecase, out_snd_device, false);
+ enable_snd_device(adev, usecase, out_snd_device);
}
if (in_snd_device != SND_DEVICE_NONE) {
- enable_snd_device(adev, usecase, in_snd_device, false);
- }
-
- list_for_each(node, &usecase->mixer_list) {
- mixer_card = node_to_item(node, struct mixer_card, uc_list_node[usecase->id]);
- audio_route_update_mixer(mixer_card->audio_route);
+ enable_snd_device(adev, usecase, in_snd_device);
}
usecase->in_snd_device = in_snd_device;
}
/* Disable the tx device */
- disable_snd_device(adev, uc_info, uc_info->in_snd_device, true);
+ disable_snd_device(adev, uc_info, uc_info->in_snd_device);
list_remove(&uc_info->adev_list_node);
free(uc_info);
__func__, out->usecase);
return -EINVAL;
}
- disable_snd_device(adev, uc_info, uc_info->out_snd_device, true);
+ disable_snd_device(adev, uc_info, uc_info->out_snd_device);
uc_release_pcm_devices(uc_info);
list_remove(&uc_info->adev_list_node);
free(uc_info);
return -EINVAL;
}
- disable_snd_device(adev, uc_info, uc_info->out_snd_device, false);
- disable_snd_device(adev, uc_info, uc_info->in_snd_device, true);
+ disable_snd_device(adev, uc_info, uc_info->out_snd_device);
+ disable_snd_device(adev, uc_info, uc_info->in_snd_device);
list_remove(&uc_info->adev_list_node);
free(uc_info);