hal: change voice call sequence on APQ targets
Send device disable command to external modem before voice call
mixer controls are disabled on APQ side. Enable device command
also should be sent only after enabling mixer controls on APQ side.
Change-Id: I2e4dc321b16f695564460771b3656cd2c4a089a9
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 873e5e2..58f9132 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -657,8 +657,8 @@
* device.
*/
if (usecase->type == VOICE_CALL || usecase->type == VOIP_CALL) {
- disable_all_usecases_of_type(adev, usecase->type, true);
status = platform_switch_voice_call_device_pre(adev->platform);
+ disable_all_usecases_of_type(adev, VOICE_CALL, true);
}
/* Disable current sound devices */
@@ -699,6 +699,15 @@
else
enable_audio_route(adev, usecase, true);
+ /* Applicable only on the targets that has external modem.
+ * Enable device command should be sent to modem only after
+ * enabling voice call mixer controls
+ */
+ if (usecase->type == VOICE_CALL)
+ status = platform_switch_voice_call_usecase_route_post(adev->platform,
+ out_snd_device,
+ in_snd_device);
+
return status;
}
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 352c4d8..1a53f32 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -640,7 +640,8 @@
struct platform_data *my_data = (struct platform_data *)platform;
int ret = 0;
- if (my_data->csd != NULL) {
+ if (my_data->csd != NULL &&
+ my_data->adev->mode == AUDIO_MODE_IN_CALL) {
/* This must be called before disabling mixer controls on APQ side */
ret = my_data->csd->disable_device();
if (ret < 0) {
@@ -657,14 +658,13 @@
{
struct platform_data *my_data = (struct platform_data *)platform;
int acdb_rx_id, acdb_tx_id;
- int ret = 0;
-
- acdb_rx_id = acdb_device_table[out_snd_device];
- acdb_tx_id = acdb_device_table[in_snd_device];
if (my_data->acdb_send_voice_cal == NULL) {
ALOGE("%s: dlsym error for acdb_send_voice_call", __func__);
} else {
+ acdb_rx_id = acdb_device_table[out_snd_device];
+ acdb_tx_id = acdb_device_table[in_snd_device];
+
if (acdb_rx_id > 0 && acdb_tx_id > 0)
my_data->acdb_send_voice_cal(acdb_rx_id, acdb_tx_id);
else
@@ -672,8 +672,22 @@
acdb_rx_id, acdb_tx_id);
}
+ return 0;
+}
+
+int platform_switch_voice_call_usecase_route_post(void *platform,
+ snd_device_t out_snd_device,
+ snd_device_t in_snd_device)
+{
+ struct platform_data *my_data = (struct platform_data *)platform;
+ int acdb_rx_id, acdb_tx_id;
+ int ret = 0;
+
+ acdb_rx_id = acdb_device_table[out_snd_device];
+ acdb_tx_id = acdb_device_table[in_snd_device];
+
if (my_data->csd != NULL) {
- if (acdb_rx_id > 0 || acdb_tx_id > 0) {
+ if (acdb_rx_id > 0 && acdb_tx_id > 0) {
ret = my_data->csd->enable_device(acdb_rx_id, acdb_tx_id,
my_data->adev->acdb_settings);
if (ret < 0) {
diff --git a/hal/platform_api.h b/hal/platform_api.h
index dac3fd9..44ad790 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -32,6 +32,9 @@
int platform_switch_voice_call_device_post(void *platform,
snd_device_t out_snd_device,
snd_device_t in_snd_device);
+int platform_switch_voice_call_usecase_route_post(void *platform,
+ snd_device_t out_snd_device,
+ snd_device_t in_snd_device);
int platform_start_voice_call(void *platform, uint32_t vsid);
int platform_stop_voice_call(void *platform, uint32_t vsid);
int platform_set_voice_volume(void *platform, int volume);