Loading hal/audio_extn/fm.c +4 −4 Original line number Diff line number Diff line /* * Copyright (c) 2013, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2013 The Android Open Source Project Loading Loading @@ -123,11 +123,11 @@ static int32_t fm_stop(struct audio_device *adev) } /* 2. Get and set stream specific mixer controls */ disable_audio_route(adev, uc_info, true); disable_audio_route(adev, uc_info); /* 3. Disable the rx and tx devices */ disable_snd_device(adev, uc_info->out_snd_device, false); disable_snd_device(adev, uc_info->in_snd_device, true); disable_snd_device(adev, uc_info->out_snd_device); disable_snd_device(adev, uc_info->in_snd_device); list_remove(&uc_info->list); free(uc_info); Loading hal/audio_extn/hfp.c +3 −3 Original line number Diff line number Diff line Loading @@ -245,11 +245,11 @@ static int32_t stop_hfp(struct audio_device *adev) } /* 2. Get and set stream specific mixer controls */ disable_audio_route(adev, uc_info, true); disable_audio_route(adev, uc_info); /* 3. Disable the rx and tx devices */ disable_snd_device(adev, uc_info->out_snd_device, false); disable_snd_device(adev, uc_info->in_snd_device, true); disable_snd_device(adev, uc_info->out_snd_device); disable_snd_device(adev, uc_info->in_snd_device); list_remove(&uc_info->list); free(uc_info); Loading hal/audio_extn/spkr_protection.c +17 −17 Original line number Diff line number Diff line /* * Copyright (c) 2013, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are Loading Loading @@ -227,8 +227,8 @@ static int spkr_calibrate(int t0) uc_info_rx->out_snd_device = SND_DEVICE_OUT_SPEAKER_PROTECTED; pthread_mutex_lock(&adev->lock); disable_rx = true; enable_snd_device(adev, SND_DEVICE_OUT_SPEAKER_PROTECTED, true); enable_audio_route(adev, uc_info_rx, true); enable_snd_device(adev, SND_DEVICE_OUT_SPEAKER_PROTECTED); enable_audio_route(adev, uc_info_rx); pthread_mutex_unlock(&adev->lock); pcm_dev_rx_id = platform_get_pcm_device_id(uc_info_rx->id, PCM_PLAYBACK); Loading Loading @@ -257,8 +257,8 @@ static int spkr_calibrate(int t0) pthread_mutex_lock(&adev->lock); disable_tx = true; enable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK, true); enable_audio_route(adev, uc_info_tx, true); enable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK); enable_audio_route(adev, uc_info_tx); pthread_mutex_unlock(&adev->lock); pcm_dev_tx_id = platform_get_pcm_device_id(uc_info_tx->id, PCM_CAPTURE); Loading Loading @@ -336,12 +336,12 @@ exit: handle.pcm_tx = NULL; pthread_mutex_lock(&adev->lock); if (disable_rx) { disable_snd_device(adev, SND_DEVICE_OUT_SPEAKER_PROTECTED, true); disable_audio_route(adev, uc_info_rx, true); disable_snd_device(adev, SND_DEVICE_OUT_SPEAKER_PROTECTED); disable_audio_route(adev, uc_info_rx); } if (disable_tx) { disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK, true); disable_audio_route(adev, uc_info_tx, true); disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK); disable_audio_route(adev, uc_info_tx); } pthread_mutex_unlock(&adev->lock); Loading Loading @@ -598,7 +598,7 @@ int audio_extn_spkr_prot_start_processing(snd_device_t snd_device) } ALOGV("%s: snd_device(%d: %s)", __func__, snd_device, platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER_PROTECTED)); audio_route_apply_path(adev->audio_route, audio_route_apply_and_update_path(adev->audio_route, platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER_PROTECTED)); pthread_mutex_lock(&handle.mutex_spkr_prot); Loading @@ -610,8 +610,8 @@ int audio_extn_spkr_prot_start_processing(snd_device_t snd_device) uc_info_tx.out_snd_device = SND_DEVICE_NONE; handle.pcm_tx = NULL; enable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK, true); enable_audio_route(adev, &uc_info_tx, true); enable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK); enable_audio_route(adev, &uc_info_tx); pcm_dev_tx_id = platform_get_pcm_device_id(uc_info_tx.id, PCM_CAPTURE); if (pcm_dev_tx_id < 0) { Loading Loading @@ -642,8 +642,8 @@ exit: if (handle.pcm_tx) pcm_close(handle.pcm_tx); handle.pcm_tx = NULL; disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK, true); disable_audio_route(adev, &uc_info_tx, true); disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK); disable_audio_route(adev, &uc_info_tx); } else handle.spkr_processing_state = SPKR_PROCESSING_IN_PROGRESS; pthread_mutex_unlock(&handle.mutex_spkr_prot); Loading @@ -667,12 +667,12 @@ void audio_extn_spkr_prot_stop_processing() if (handle.pcm_tx) pcm_close(handle.pcm_tx); handle.pcm_tx = NULL; disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK, true); disable_audio_route(adev, &uc_info_tx, true); disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK); disable_audio_route(adev, &uc_info_tx); } handle.spkr_processing_state = SPKR_PROCESSING_IN_IDLE; pthread_mutex_unlock(&handle.mutex_spkr_prot); audio_route_reset_path(adev->audio_route, audio_route_reset_and_update_path(adev->audio_route, platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER_PROTECTED)); ALOGV("%s: Exit", __func__); } Loading hal/audio_hw.c +25 −35 Original line number Diff line number Diff line Loading @@ -215,8 +215,7 @@ static int get_snd_codec_id(audio_format_t format) } int enable_audio_route(struct audio_device *adev, struct audio_usecase *usecase, bool __unused update_mixer) struct audio_usecase *usecase) { snd_device_t snd_device; char mixer_path[MIXER_PATH_MAX_LENGTH]; Loading Loading @@ -244,8 +243,7 @@ int enable_audio_route(struct audio_device *adev, } int disable_audio_route(struct audio_device *adev, struct audio_usecase *usecase, bool __unused update_mixer) struct audio_usecase *usecase) { snd_device_t snd_device; char mixer_path[MIXER_PATH_MAX_LENGTH]; Loading @@ -267,8 +265,7 @@ int disable_audio_route(struct audio_device *adev, } int enable_snd_device(struct audio_device *adev, snd_device_t snd_device, bool __unused update_mixer) snd_device_t snd_device) { char device_name[DEVICE_NAME_MAX_SIZE] = {0}; Loading Loading @@ -321,8 +318,7 @@ int enable_snd_device(struct audio_device *adev, } int disable_snd_device(struct audio_device *adev, snd_device_t snd_device, bool __unused update_mixer) snd_device_t snd_device) { char device_name[DEVICE_NAME_MAX_SIZE] = {0}; Loading Loading @@ -401,7 +397,7 @@ static void check_usecases_codec_backend(struct audio_device *adev, ALOGV("%s: Usecase (%s) is active on (%s) - disabling ..", __func__, use_case_table[usecase->id], platform_get_snd_device_name(usecase->out_snd_device)); disable_audio_route(adev, usecase, false); disable_audio_route(adev, usecase); switch_device[usecase->id] = true; num_uc_to_switch++; } Loading @@ -413,20 +409,17 @@ static void check_usecases_codec_backend(struct audio_device *adev, 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); } } 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); } } /* 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) { Loading @@ -434,7 +427,7 @@ static void check_usecases_codec_backend(struct audio_device *adev, /* Update the out_snd_device only before enabling the audio route */ if (switch_device[usecase->id] ) { usecase->out_snd_device = snd_device; enable_audio_route(adev, usecase, false); enable_audio_route(adev, usecase); } } } Loading Loading @@ -470,7 +463,7 @@ static void check_and_route_capture_usecases(struct audio_device *adev, ALOGV("%s: Usecase (%s) is active on (%s) - disabling ..", __func__, use_case_table[usecase->id], platform_get_snd_device_name(usecase->in_snd_device)); disable_audio_route(adev, usecase, false); disable_audio_route(adev, usecase); switch_device[usecase->id] = true; num_uc_to_switch++; } Loading @@ -482,20 +475,17 @@ static void check_and_route_capture_usecases(struct audio_device *adev, 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); } } 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); } } /* 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) { Loading @@ -503,7 +493,7 @@ static void check_and_route_capture_usecases(struct audio_device *adev, /* Update the in_snd_device only before enabling the audio route */ if (switch_device[usecase->id] ) { usecase->in_snd_device = snd_device; enable_audio_route(adev, usecase, false); enable_audio_route(adev, usecase); } } } Loading Loading @@ -676,25 +666,25 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id) /* 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_audio_route(adev, usecase); disable_snd_device(adev, usecase->out_snd_device); } if (usecase->in_snd_device != SND_DEVICE_NONE) { disable_audio_route(adev, usecase, true); disable_snd_device(adev, usecase->in_snd_device, false); disable_audio_route(adev, usecase); disable_snd_device(adev, usecase->in_snd_device); } /* Enable new sound devices */ if (out_snd_device != SND_DEVICE_NONE) { if (usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) check_usecases_codec_backend(adev, usecase, out_snd_device); enable_snd_device(adev, out_snd_device, false); enable_snd_device(adev, out_snd_device); } if (in_snd_device != SND_DEVICE_NONE) { check_and_route_capture_usecases(adev, usecase, in_snd_device); enable_snd_device(adev, in_snd_device, false); enable_snd_device(adev, in_snd_device); } if (usecase->type == VOICE_CALL || usecase->type == VOIP_CALL) Loading @@ -705,7 +695,7 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id) usecase->in_snd_device = in_snd_device; usecase->out_snd_device = out_snd_device; enable_audio_route(adev, usecase, true); enable_audio_route(adev, usecase); /* Applicable only on the targets that has external modem. * Enable device command should be sent to modem only after Loading Loading @@ -740,10 +730,10 @@ static int stop_input_stream(struct stream_in *in) voice_check_and_stop_incall_rec_usecase(adev, in); /* 1. Disable stream specific mixer controls */ disable_audio_route(adev, uc_info, true); disable_audio_route(adev, uc_info); /* 2. Disable the tx device */ disable_snd_device(adev, uc_info->in_snd_device, true); disable_snd_device(adev, uc_info->in_snd_device); list_remove(&uc_info->list); free(uc_info); Loading Loading @@ -1021,7 +1011,7 @@ static int check_and_set_hdmi_channels(struct audio_device *adev, usecase = node_to_item(node, struct audio_usecase, list); if (usecase->type == PCM_PLAYBACK && usecase->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) { disable_audio_route(adev, usecase, true); disable_audio_route(adev, usecase); } } Loading @@ -1033,7 +1023,7 @@ static int check_and_set_hdmi_channels(struct audio_device *adev, usecase = node_to_item(node, struct audio_usecase, list); if (usecase->type == PCM_PLAYBACK && usecase->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) { enable_audio_route(adev, usecase, true); enable_audio_route(adev, usecase); } } Loading Loading @@ -1063,10 +1053,10 @@ static int stop_output_stream(struct stream_out *out) } /* 1. Get and set stream specific mixer controls */ disable_audio_route(adev, uc_info, true); disable_audio_route(adev, uc_info); /* 2. Disable the rx device */ disable_snd_device(adev, uc_info->out_snd_device, true); disable_snd_device(adev, uc_info->out_snd_device); list_remove(&uc_info->list); free(uc_info); Loading hal/audio_hw.h +6 −8 Original line number Diff line number Diff line Loading @@ -242,17 +242,15 @@ struct audio_device { int select_devices(struct audio_device *adev, audio_usecase_t uc_id); int disable_audio_route(struct audio_device *adev, struct audio_usecase *usecase, bool update_mixer); struct audio_usecase *usecase); int disable_snd_device(struct audio_device *adev, snd_device_t snd_device, bool update_mixer); snd_device_t snd_device); int enable_snd_device(struct audio_device *adev, snd_device_t snd_device, bool update_mixer); snd_device_t snd_device); int enable_audio_route(struct audio_device *adev, struct audio_usecase *usecase, bool update_mixer); struct audio_usecase *usecase); struct audio_usecase *get_usecase_from_list(struct audio_device *adev, audio_usecase_t uc_id); Loading Loading
hal/audio_extn/fm.c +4 −4 Original line number Diff line number Diff line /* * Copyright (c) 2013, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright (C) 2013 The Android Open Source Project Loading Loading @@ -123,11 +123,11 @@ static int32_t fm_stop(struct audio_device *adev) } /* 2. Get and set stream specific mixer controls */ disable_audio_route(adev, uc_info, true); disable_audio_route(adev, uc_info); /* 3. Disable the rx and tx devices */ disable_snd_device(adev, uc_info->out_snd_device, false); disable_snd_device(adev, uc_info->in_snd_device, true); disable_snd_device(adev, uc_info->out_snd_device); disable_snd_device(adev, uc_info->in_snd_device); list_remove(&uc_info->list); free(uc_info); Loading
hal/audio_extn/hfp.c +3 −3 Original line number Diff line number Diff line Loading @@ -245,11 +245,11 @@ static int32_t stop_hfp(struct audio_device *adev) } /* 2. Get and set stream specific mixer controls */ disable_audio_route(adev, uc_info, true); disable_audio_route(adev, uc_info); /* 3. Disable the rx and tx devices */ disable_snd_device(adev, uc_info->out_snd_device, false); disable_snd_device(adev, uc_info->in_snd_device, true); disable_snd_device(adev, uc_info->out_snd_device); disable_snd_device(adev, uc_info->in_snd_device); list_remove(&uc_info->list); free(uc_info); Loading
hal/audio_extn/spkr_protection.c +17 −17 Original line number Diff line number Diff line /* * Copyright (c) 2013, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are Loading Loading @@ -227,8 +227,8 @@ static int spkr_calibrate(int t0) uc_info_rx->out_snd_device = SND_DEVICE_OUT_SPEAKER_PROTECTED; pthread_mutex_lock(&adev->lock); disable_rx = true; enable_snd_device(adev, SND_DEVICE_OUT_SPEAKER_PROTECTED, true); enable_audio_route(adev, uc_info_rx, true); enable_snd_device(adev, SND_DEVICE_OUT_SPEAKER_PROTECTED); enable_audio_route(adev, uc_info_rx); pthread_mutex_unlock(&adev->lock); pcm_dev_rx_id = platform_get_pcm_device_id(uc_info_rx->id, PCM_PLAYBACK); Loading Loading @@ -257,8 +257,8 @@ static int spkr_calibrate(int t0) pthread_mutex_lock(&adev->lock); disable_tx = true; enable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK, true); enable_audio_route(adev, uc_info_tx, true); enable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK); enable_audio_route(adev, uc_info_tx); pthread_mutex_unlock(&adev->lock); pcm_dev_tx_id = platform_get_pcm_device_id(uc_info_tx->id, PCM_CAPTURE); Loading Loading @@ -336,12 +336,12 @@ exit: handle.pcm_tx = NULL; pthread_mutex_lock(&adev->lock); if (disable_rx) { disable_snd_device(adev, SND_DEVICE_OUT_SPEAKER_PROTECTED, true); disable_audio_route(adev, uc_info_rx, true); disable_snd_device(adev, SND_DEVICE_OUT_SPEAKER_PROTECTED); disable_audio_route(adev, uc_info_rx); } if (disable_tx) { disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK, true); disable_audio_route(adev, uc_info_tx, true); disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK); disable_audio_route(adev, uc_info_tx); } pthread_mutex_unlock(&adev->lock); Loading Loading @@ -598,7 +598,7 @@ int audio_extn_spkr_prot_start_processing(snd_device_t snd_device) } ALOGV("%s: snd_device(%d: %s)", __func__, snd_device, platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER_PROTECTED)); audio_route_apply_path(adev->audio_route, audio_route_apply_and_update_path(adev->audio_route, platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER_PROTECTED)); pthread_mutex_lock(&handle.mutex_spkr_prot); Loading @@ -610,8 +610,8 @@ int audio_extn_spkr_prot_start_processing(snd_device_t snd_device) uc_info_tx.out_snd_device = SND_DEVICE_NONE; handle.pcm_tx = NULL; enable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK, true); enable_audio_route(adev, &uc_info_tx, true); enable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK); enable_audio_route(adev, &uc_info_tx); pcm_dev_tx_id = platform_get_pcm_device_id(uc_info_tx.id, PCM_CAPTURE); if (pcm_dev_tx_id < 0) { Loading Loading @@ -642,8 +642,8 @@ exit: if (handle.pcm_tx) pcm_close(handle.pcm_tx); handle.pcm_tx = NULL; disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK, true); disable_audio_route(adev, &uc_info_tx, true); disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK); disable_audio_route(adev, &uc_info_tx); } else handle.spkr_processing_state = SPKR_PROCESSING_IN_PROGRESS; pthread_mutex_unlock(&handle.mutex_spkr_prot); Loading @@ -667,12 +667,12 @@ void audio_extn_spkr_prot_stop_processing() if (handle.pcm_tx) pcm_close(handle.pcm_tx); handle.pcm_tx = NULL; disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK, true); disable_audio_route(adev, &uc_info_tx, true); disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK); disable_audio_route(adev, &uc_info_tx); } handle.spkr_processing_state = SPKR_PROCESSING_IN_IDLE; pthread_mutex_unlock(&handle.mutex_spkr_prot); audio_route_reset_path(adev->audio_route, audio_route_reset_and_update_path(adev->audio_route, platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER_PROTECTED)); ALOGV("%s: Exit", __func__); } Loading
hal/audio_hw.c +25 −35 Original line number Diff line number Diff line Loading @@ -215,8 +215,7 @@ static int get_snd_codec_id(audio_format_t format) } int enable_audio_route(struct audio_device *adev, struct audio_usecase *usecase, bool __unused update_mixer) struct audio_usecase *usecase) { snd_device_t snd_device; char mixer_path[MIXER_PATH_MAX_LENGTH]; Loading Loading @@ -244,8 +243,7 @@ int enable_audio_route(struct audio_device *adev, } int disable_audio_route(struct audio_device *adev, struct audio_usecase *usecase, bool __unused update_mixer) struct audio_usecase *usecase) { snd_device_t snd_device; char mixer_path[MIXER_PATH_MAX_LENGTH]; Loading @@ -267,8 +265,7 @@ int disable_audio_route(struct audio_device *adev, } int enable_snd_device(struct audio_device *adev, snd_device_t snd_device, bool __unused update_mixer) snd_device_t snd_device) { char device_name[DEVICE_NAME_MAX_SIZE] = {0}; Loading Loading @@ -321,8 +318,7 @@ int enable_snd_device(struct audio_device *adev, } int disable_snd_device(struct audio_device *adev, snd_device_t snd_device, bool __unused update_mixer) snd_device_t snd_device) { char device_name[DEVICE_NAME_MAX_SIZE] = {0}; Loading Loading @@ -401,7 +397,7 @@ static void check_usecases_codec_backend(struct audio_device *adev, ALOGV("%s: Usecase (%s) is active on (%s) - disabling ..", __func__, use_case_table[usecase->id], platform_get_snd_device_name(usecase->out_snd_device)); disable_audio_route(adev, usecase, false); disable_audio_route(adev, usecase); switch_device[usecase->id] = true; num_uc_to_switch++; } Loading @@ -413,20 +409,17 @@ static void check_usecases_codec_backend(struct audio_device *adev, 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); } } 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); } } /* 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) { Loading @@ -434,7 +427,7 @@ static void check_usecases_codec_backend(struct audio_device *adev, /* Update the out_snd_device only before enabling the audio route */ if (switch_device[usecase->id] ) { usecase->out_snd_device = snd_device; enable_audio_route(adev, usecase, false); enable_audio_route(adev, usecase); } } } Loading Loading @@ -470,7 +463,7 @@ static void check_and_route_capture_usecases(struct audio_device *adev, ALOGV("%s: Usecase (%s) is active on (%s) - disabling ..", __func__, use_case_table[usecase->id], platform_get_snd_device_name(usecase->in_snd_device)); disable_audio_route(adev, usecase, false); disable_audio_route(adev, usecase); switch_device[usecase->id] = true; num_uc_to_switch++; } Loading @@ -482,20 +475,17 @@ static void check_and_route_capture_usecases(struct audio_device *adev, 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); } } 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); } } /* 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) { Loading @@ -503,7 +493,7 @@ static void check_and_route_capture_usecases(struct audio_device *adev, /* Update the in_snd_device only before enabling the audio route */ if (switch_device[usecase->id] ) { usecase->in_snd_device = snd_device; enable_audio_route(adev, usecase, false); enable_audio_route(adev, usecase); } } } Loading Loading @@ -676,25 +666,25 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id) /* 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_audio_route(adev, usecase); disable_snd_device(adev, usecase->out_snd_device); } if (usecase->in_snd_device != SND_DEVICE_NONE) { disable_audio_route(adev, usecase, true); disable_snd_device(adev, usecase->in_snd_device, false); disable_audio_route(adev, usecase); disable_snd_device(adev, usecase->in_snd_device); } /* Enable new sound devices */ if (out_snd_device != SND_DEVICE_NONE) { if (usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND) check_usecases_codec_backend(adev, usecase, out_snd_device); enable_snd_device(adev, out_snd_device, false); enable_snd_device(adev, out_snd_device); } if (in_snd_device != SND_DEVICE_NONE) { check_and_route_capture_usecases(adev, usecase, in_snd_device); enable_snd_device(adev, in_snd_device, false); enable_snd_device(adev, in_snd_device); } if (usecase->type == VOICE_CALL || usecase->type == VOIP_CALL) Loading @@ -705,7 +695,7 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id) usecase->in_snd_device = in_snd_device; usecase->out_snd_device = out_snd_device; enable_audio_route(adev, usecase, true); enable_audio_route(adev, usecase); /* Applicable only on the targets that has external modem. * Enable device command should be sent to modem only after Loading Loading @@ -740,10 +730,10 @@ static int stop_input_stream(struct stream_in *in) voice_check_and_stop_incall_rec_usecase(adev, in); /* 1. Disable stream specific mixer controls */ disable_audio_route(adev, uc_info, true); disable_audio_route(adev, uc_info); /* 2. Disable the tx device */ disable_snd_device(adev, uc_info->in_snd_device, true); disable_snd_device(adev, uc_info->in_snd_device); list_remove(&uc_info->list); free(uc_info); Loading Loading @@ -1021,7 +1011,7 @@ static int check_and_set_hdmi_channels(struct audio_device *adev, usecase = node_to_item(node, struct audio_usecase, list); if (usecase->type == PCM_PLAYBACK && usecase->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) { disable_audio_route(adev, usecase, true); disable_audio_route(adev, usecase); } } Loading @@ -1033,7 +1023,7 @@ static int check_and_set_hdmi_channels(struct audio_device *adev, usecase = node_to_item(node, struct audio_usecase, list); if (usecase->type == PCM_PLAYBACK && usecase->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) { enable_audio_route(adev, usecase, true); enable_audio_route(adev, usecase); } } Loading Loading @@ -1063,10 +1053,10 @@ static int stop_output_stream(struct stream_out *out) } /* 1. Get and set stream specific mixer controls */ disable_audio_route(adev, uc_info, true); disable_audio_route(adev, uc_info); /* 2. Disable the rx device */ disable_snd_device(adev, uc_info->out_snd_device, true); disable_snd_device(adev, uc_info->out_snd_device); list_remove(&uc_info->list); free(uc_info); Loading
hal/audio_hw.h +6 −8 Original line number Diff line number Diff line Loading @@ -242,17 +242,15 @@ struct audio_device { int select_devices(struct audio_device *adev, audio_usecase_t uc_id); int disable_audio_route(struct audio_device *adev, struct audio_usecase *usecase, bool update_mixer); struct audio_usecase *usecase); int disable_snd_device(struct audio_device *adev, snd_device_t snd_device, bool update_mixer); snd_device_t snd_device); int enable_snd_device(struct audio_device *adev, snd_device_t snd_device, bool update_mixer); snd_device_t snd_device); int enable_audio_route(struct audio_device *adev, struct audio_usecase *usecase, bool update_mixer); struct audio_usecase *usecase); struct audio_usecase *get_usecase_from_list(struct audio_device *adev, audio_usecase_t uc_id); Loading