Merge "st-hal: fix session pause and lpi switch for concurrency"
diff --git a/sound_trigger_hw.c b/sound_trigger_hw.c
index eb22173..f5def84 100644
--- a/sound_trigger_hw.c
+++ b/sound_trigger_hw.c
@@ -909,8 +909,6 @@
                 }
             }
 
-            platform_stdev_reset_backend_cfg(stdev->platform);
-
             list_for_each(p_ses_node, &stdev->sound_model_list) {
                 p_ses = node_to_item(p_ses_node, st_session_t, list_node);
                 if (p_ses && p_ses->exec_mode == ST_EXEC_MODE_ADSP) {
@@ -1153,8 +1151,6 @@
             }
         }
 
-        platform_stdev_reset_backend_cfg(stdev->platform);
-
         list_for_each(p_ses_node, &stdev->sound_model_list) {
             p_ses = node_to_item(p_ses_node, st_session_t, list_node);
             if (p_ses && p_ses->exec_mode == ST_EXEC_MODE_ADSP) {
@@ -1207,8 +1203,6 @@
             }
         }
 
-        platform_stdev_reset_backend_cfg(stdev->platform);
-
         list_for_each(p_ses_node, &stdev->sound_model_list) {
             p_ses = node_to_item(p_ses_node, st_session_t, list_node);
             if (p_ses && p_ses->exec_mode == ST_EXEC_MODE_ADSP) {
diff --git a/st_hw_session_lsm.c b/st_hw_session_lsm.c
index 1ff1abc..f1a915b 100644
--- a/st_hw_session_lsm.c
+++ b/st_hw_session_lsm.c
@@ -580,7 +580,7 @@
 {
     st_profile_type_t profile_type;
 
-    profile_type = (p_ses->vendor_uuid_info && !p_ses->stdev->lpi_enable) ?
+    profile_type = (p_ses->vendor_uuid_info && !p_ses->lpi_enable) ?
                    p_ses->vendor_uuid_info->profile_type : ST_PROFILE_TYPE_NONE;
     return profile_type;
 }
diff --git a/st_session.c b/st_session.c
index 732125f..9bb1c09 100644
--- a/st_session.c
+++ b/st_session.c
@@ -4,7 +4,7 @@
  * user session. This state machine implements logic for handling all user
  * interactions, detectinos, SSR and Audio Concurencies.
  *
- * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -2512,6 +2512,7 @@
         hw_ses->lpi_enable = hw_ses->stdev->lpi_enable;
         hw_ses->barge_in_mode = hw_ses->stdev->barge_in_mode;
         do_unload = true;
+        platform_stdev_reset_backend_cfg(hw_ses->stdev->platform);
     }
 
     /*
@@ -3298,13 +3299,6 @@
             }
         }
     } else {
-        local_event = calloc(1, sizeof(*local_event) + payload_size);
-        if (!local_event) {
-            ALOGE("%s: event allocation failed, size %zd", __func__,
-                  payload_size);
-            status = -ENOMEM;
-            goto exit;
-        }
         memcpy(local_event->phrase_extras,
             stc_ses->rc_config->phrases, stc_ses->rc_config->num_phrases *
             sizeof(struct sound_trigger_phrase_recognition_extra));