Merge "st-hal: reset ec ref mixer path before setting"
diff --git a/sound_trigger_hw.h b/sound_trigger_hw.h
index 7e139c8..d1d725e 100644
--- a/sound_trigger_hw.h
+++ b/sound_trigger_hw.h
@@ -265,6 +265,7 @@
bool support_dynamic_ec_update;
bool screen_off;
bool barge_in_mode;
+ int ec_reset_pending_cnt;
};
typedef struct sound_trigger_device sound_trigger_device_t;
diff --git a/sound_trigger_platform.c b/sound_trigger_platform.c
index c382a3c..4fb305a 100644
--- a/sound_trigger_platform.c
+++ b/sound_trigger_platform.c
@@ -743,6 +743,7 @@
stdev->platform_lpi_enable = ST_PLATFORM_LPI_NONE;
stdev->screen_off = true;
stdev->support_dynamic_ec_update = true;
+ stdev->ec_reset_pending_cnt = 0;
platform->cpe_fe_to_be_fixed = true;
platform->bad_mic_channel_index = 0;
@@ -5690,6 +5691,12 @@
if (is_ec_profile(profile_type)) {
event_info.st_ec_ref_enabled = enable;
+ // reset the pending active EC mixer ctls first
+ if (!stdev->audio_ec_enabled && stdev->ec_reset_pending_cnt > 0) {
+ while (stdev->ec_reset_pending_cnt--)
+ audio_route_reset_and_update_path(stdev->audio_route,
+ my_data->ec_ref_mixer_path);
+ }
if (enable) {
stdev->audio_hal_cb(ST_EVENT_UPDATE_ECHO_REF, &event_info);
strlcpy(my_data->ec_ref_mixer_path, "echo-reference",
@@ -5710,6 +5717,7 @@
audio_route_reset_and_update_path(stdev->audio_route,
my_data->ec_ref_mixer_path);
} else {
+ stdev->ec_reset_pending_cnt++;
ALOGD("%s: audio hal has already enabled EC", __func__);
}
}