hal: add lpi enable support for voice call
Add lpi enable support in tx device for voice call
Change-Id: I9574858870f4ddcb7fe43d2d1fff3ad43ba8d3db
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index a997210..b16c5f7 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1307,6 +1307,8 @@
platform_set_island_cfg_on_device(adev, usecase->in_snd_device, false);
platform_set_power_mode_on_device(adev, usecase->in_snd_device, false);
platform_reset_island_power_status(adev->platform, usecase->in_snd_device);
+ if (voice_is_lte_call_active(adev))
+ platform_set_tx_lpi_mode(adev->platform, false);
ALOGD("%s: disable island cfg and power mode in voice tx path",
__func__);
}
@@ -1422,6 +1424,10 @@
platform_get_power_mode_on_device(adev->platform, snd_device)) {
platform_set_island_cfg_on_device(adev, snd_device, true);
platform_set_power_mode_on_device(adev, snd_device, true);
+ if (voice_is_lte_call_active(adev) &&
+ (snd_device >= SND_DEVICE_IN_BEGIN &&
+ snd_device < SND_DEVICE_IN_END))
+ platform_set_tx_lpi_mode(adev->platform, true);
ALOGD("%s: enable island cfg and power mode on: %s",
__func__, device_name);
}
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 22bb301..a545952 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -323,6 +323,7 @@
bool is_vbat_speaker;
bool is_bcl_speaker;
bool gsm_mode_enabled;
+ bool lpi_enabled;
bool is_slimbus_interface;
bool is_internal_codec;
bool is_default_be_config;
@@ -2042,6 +2043,24 @@
}
}
+void platform_set_tx_lpi_mode(void *platform, bool enable)
+{
+ struct platform_data *my_data = (struct platform_data *)platform;
+ struct audio_device *adev = my_data->adev;
+
+ if (!enable && my_data->lpi_enabled) {
+ my_data->lpi_enabled = false;
+ ALOGV("%s: disabling TX LPI mode", __func__);
+ audio_route_reset_and_update_path(adev->audio_route, "tx-lpi-enable");
+ }
+
+ if (enable) {
+ my_data->lpi_enabled = true;
+ ALOGD("%s: enabling TX LPI mode", __func__);
+ audio_route_apply_and_update_path(adev->audio_route, "tx-lpi-enable");
+ }
+}
+
static struct csd_data *open_csd_client(bool i2s_ext_modem)
{
struct csd_data *csd = calloc(1, sizeof(struct csd_data));
@@ -3191,6 +3210,7 @@
my_data->use_sprk_default_sample_rate = true;
my_data->fluence_in_voice_comm = false;
my_data->ec_car_state = false;
+ my_data->lpi_enabled = false;
my_data->is_multiple_sample_rate_combo_supported = true;
platform_reset_edid_info(my_data);
diff --git a/hal/platform_api.h b/hal/platform_api.h
index 7039d5d..f68d6e7 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -305,6 +305,7 @@
int platform_set_audio_device_interface(const char * device_name, const char *intf_name,
const char * codec_type);
void platform_set_gsm_mode(void *platform, bool enable);
+void platform_set_tx_lpi_mode(void *platform, bool enable);
bool platform_can_enable_spkr_prot_on_device(snd_device_t snd_device);
int platform_get_spkr_prot_acdb_id(snd_device_t snd_device);
int platform_get_spkr_prot_snd_device(snd_device_t snd_device);
diff --git a/hal/voice.c b/hal/voice.c
index 034eaa0..f4d7b46 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -203,6 +203,8 @@
disable_snd_device(adev, uc_info->out_snd_device);
disable_snd_device(adev, uc_info->in_snd_device);
+ adev->voice.lte_call = false;
+
list_remove(&uc_info->list);
free(uc_info);
@@ -639,6 +641,11 @@
return err;
}
+bool voice_is_lte_call_active(struct audio_device *adev)
+{
+ return adev->voice.lte_call;
+}
+
bool voice_get_mic_mute(struct audio_device *adev)
{
return adev->voice.mic_mute;
@@ -823,6 +830,7 @@
adev->voice.volume = 1.0f;
adev->voice.mic_mute = false;
adev->voice.in_call = false;
+ adev->voice.lte_call = false;
for (i = 0; i < max_voice_sessions; i++) {
adev->voice.session[i].pcm_rx = NULL;
adev->voice.session[i].pcm_tx = NULL;
diff --git a/hal/voice.h b/hal/voice.h
index 1f0978a..290ca3d 100644
--- a/hal/voice.h
+++ b/hal/voice.h
@@ -61,6 +61,7 @@
bool use_device_mute;
float volume;
bool in_call;
+ bool lte_call;
};
struct power_mode_cfg {
@@ -93,6 +94,7 @@
bool voice_is_in_call_or_call_screen(const struct audio_device *adev);
bool voice_is_in_call_rec_stream(const struct stream_in *in);
int voice_set_mic_mute(struct audio_device *dev, bool state);
+bool voice_is_lte_call_active(struct audio_device *adev);
bool voice_get_mic_mute(struct audio_device *dev);
int voice_set_volume(struct audio_device *adev, float volume);
int voice_check_and_set_incall_rec_usecase(struct audio_device *adev,
diff --git a/hal/voice_extn/voice_extn.c b/hal/voice_extn/voice_extn.c
index 1882f11..99e7706 100644
--- a/hal/voice_extn/voice_extn.c
+++ b/hal/voice_extn/voice_extn.c
@@ -615,6 +615,14 @@
}
if (is_valid_vsid(vsid) && is_valid_call_state(call_state)) {
+ err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_CALL_TYPE, str_value,
+ sizeof(str_value));
+ if (err >= 0) {
+ if (!strncmp("LTE", str_value, sizeof("LTE"))) {
+ adev->voice.lte_call = true;
+ ALOGD("%s: %s call is active",__func__, str_value);
+ }
+ }
ret = update_call_states(adev, vsid, call_state);
} else {
ALOGE("%s: invalid vsid:%x or call_state:%d",