st-hal: reset backend when there could be lpi mode switch

When session is in buffering and a lpi mode switch
event is triggered, session switch can be postponed
and also the backend reset is skipped.
Move the backend reset to session start whenever
lpi mode switch can happen.

Change-Id: I3ea1ef630cfac5297cb83b48d3ab29bbaaa2dd87
diff --git a/sound_trigger_hw.c b/sound_trigger_hw.c
index 6f9b6f1..91ff15f 100644
--- a/sound_trigger_hw.c
+++ b/sound_trigger_hw.c
@@ -905,8 +905,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) {
@@ -1149,8 +1147,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) {
@@ -1203,8 +1199,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_session.c b/st_session.c
index 732125f..5582c5f 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);
     }
 
     /*