hal: Fix device configuration mismatch when VOICE and VOIP are active
Device configuration mismatch is observed when VOICE and VOIP are active.
When VOICE and VOIP usecases are present, and device switch to speaker,
VoIP snd_device is set to speaker, but the related ACDB configuration
is not updated correctly.
Fix this by update voc cal data for VoIP when new device is selected.
CRs-Fixed: 1086922
Change-Id: I6655773af12a63acc302d2c9eeeace289cb46f70
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index e1292c1..61e9b89 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -998,6 +998,7 @@
struct audio_usecase *usecase;
bool switch_device[AUDIO_USECASE_MAX];
int i, num_uc_to_switch = 0;
+ int status = 0;
bool force_restart_session = false;
/*
* This function is to make sure that all the usecases that are active on
@@ -1098,6 +1099,11 @@
ALOGD("%s:becf: enabling usecase (%s) on (%s)", __func__,
use_case_table[usecase->id],
platform_get_snd_device_name(usecase->out_snd_device));
+ /* Update voc calibration before enabling VoIP route */
+ if (usecase->type == VOIP_CALL)
+ status = platform_switch_voice_call_device_post(adev->platform,
+ usecase->out_snd_device,
+ usecase->in_snd_device);
enable_audio_route(adev, usecase);
}
}
@@ -1114,6 +1120,7 @@
bool switch_device[AUDIO_USECASE_MAX];
int i, num_uc_to_switch = 0;
int backend_check_cond = AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND;
+ int status = 0;
bool force_routing = platform_check_and_set_capture_codec_backend_cfg(adev, uc_info,
snd_device);
@@ -1186,8 +1193,14 @@
/* Update the in_snd_device only before enabling the audio route */
if (switch_device[usecase->id] ) {
usecase->in_snd_device = snd_device;
- if (usecase->type != VOICE_CALL)
+ if (usecase->type != VOICE_CALL) {
+ /* Update voc calibration before enabling VoIP route */
+ if (usecase->type == VOIP_CALL)
+ status = platform_switch_voice_call_device_post(adev->platform,
+ usecase->out_snd_device,
+ usecase->in_snd_device);
enable_audio_route(adev, usecase);
+ }
}
}
}