hal: Add new CSD API to reduce in call device switch delay
New CSD api is added to reduce device switch delay during voice call.
This api is called before enabling the devices so that csd voice call
sequence on MDM can run in parallel with device enable configuration
on APQ.
Change-Id: I9239ff21e1c07370516d0ed668e1e94af12f9eb2
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 40fed4e..1b732d4 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -416,6 +416,13 @@
__func__, dlerror());
goto error;
}
+ csd->enable_device_config = (enable_device_config_t)dlsym(csd->csd_client,
+ "csd_client_enable_device_config");
+ if (csd->enable_device_config == NULL) {
+ ALOGE("%s: dlsym error %s for csd_client_enable_device_config",
+ __func__, dlerror());
+ goto error;
+ }
csd->enable_device = (enable_device_t)dlsym(csd->csd_client,
"csd_client_enable_device");
if (csd->enable_device == NULL) {
@@ -831,6 +838,32 @@
return ret;
}
+int platform_switch_voice_call_enable_device_config(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) {
+ ret = my_data->csd->enable_device_config(acdb_rx_id, acdb_tx_id);
+ if (ret < 0) {
+ ALOGE("%s: csd_enable_device_config, failed, error %d",
+ __func__, ret);
+ }
+ } else {
+ ALOGE("%s: Incorrect ACDB IDs (rx: %d tx: %d)", __func__,
+ acdb_rx_id, acdb_tx_id);
+ }
+ }
+ return ret;
+}
+
int platform_switch_voice_call_device_post(void *platform,
snd_device_t out_snd_device,
snd_device_t in_snd_device)
diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h
index 3ea068d..9749be4 100644
--- a/hal/msm8974/platform.h
+++ b/hal/msm8974/platform.h
@@ -218,6 +218,7 @@
typedef int (*init_t)();
typedef int (*deinit_t)();
typedef int (*disable_device_t)();
+typedef int (*enable_device_config_t)(int, int);
typedef int (*enable_device_t)(int, int, uint32_t);
typedef int (*volume_t)(uint32_t, int);
typedef int (*mic_mute_t)(uint32_t, int);
@@ -234,6 +235,7 @@
init_t init;
deinit_t deinit;
disable_device_t disable_device;
+ enable_device_config_t enable_device_config;
enable_device_t enable_device;
volume_t volume;
mic_mute_t mic_mute;