st-hal: send LPI SVA acdb id to driver

In concurrent audio scenarios, driver ends up sending the cached non-LPI
afe topology when enabling VA LPI use case, resulting in failure/crash from
ADSP.

Sending LPI acdb id from sthal to driver prior to afe_port_start lets the
afe driver check against this acdb id for the VA backend port, and pick up
SVA LPI topology. Send the same in "Listen Stream App type Cfg"
mixer control during VA LPI use case enable.

Change-Id: Id8544eff44ff16cbd0927f67165c9ac2242247c1
diff --git a/sound_trigger_platform.c b/sound_trigger_platform.c
index 1f16826..d4d76fb 100644
--- a/sound_trigger_platform.c
+++ b/sound_trigger_platform.c
@@ -5330,7 +5330,7 @@
     bool found_profile = false;
     int st_device_be_idx = -EINVAL;
 
-    if (profile_type == ST_PROFILE_TYPE_NONE) {
+    if (!stdev->lpi_enable && (profile_type == ST_PROFILE_TYPE_NONE)) {
         ALOGV("%s: Profile set to None, ignore sending app type cfg",__func__);
         goto exit;
     }
@@ -5364,16 +5364,31 @@
         goto exit;
     }
 
-    list_for_each_safe(p_node, temp_node, &stdev->adm_cfg_list) {
-        cfg_info = node_to_item(p_node, struct adm_cfg_info, list_node);
-        if (cfg_info->profile_type == profile_type) {
-            found_profile = true;
-            app_type_cfg[len++] = cfg_info->app_type;
-            app_type_cfg[len++] = acdb_id;
-            app_type_cfg[len++] = cfg_info->sample_rate;
-            if (st_device_be_idx >= 0)
-                app_type_cfg[len++] = st_device_be_idx;
-            break;
+    if (stdev->lpi_enable) {
+        /*
+         * Though app_type_cfg is for ADM connection, driver needs atleast LPI
+         * acdb id  to avoid sending a cached non-lpi acdb stale topology of any
+         * concurrent audio use case for SVA LPI use case.
+         */
+        ALOGD("%s: send Stream App Type Cfg for LPI",__func__);
+        found_profile = true;
+        app_type_cfg[len++] = 0;
+        app_type_cfg[len++] = acdb_id;
+        app_type_cfg[len++] = SOUND_TRIGGER_SAMPLING_RATE_16000;
+        if (st_device_be_idx >= 0)
+            app_type_cfg[len++] = st_device_be_idx;
+    } else {
+        list_for_each_safe(p_node, temp_node, &stdev->adm_cfg_list) {
+            cfg_info = node_to_item(p_node, struct adm_cfg_info, list_node);
+            if (cfg_info->profile_type == profile_type) {
+                found_profile = true;
+                app_type_cfg[len++] = cfg_info->app_type;
+                app_type_cfg[len++] = acdb_id;
+                app_type_cfg[len++] = cfg_info->sample_rate;
+                if (st_device_be_idx >= 0)
+                    app_type_cfg[len++] = st_device_be_idx;
+                break;
+            }
         }
     }