st-hal: Fix single MIC ACDB device selection and preproc controls

Previously, the single MIC ACDB device was selected based only on
profile type. This change incorporates LPI status into the device
selection logic, which is consistent with other MIC configurations.
Additionally, port and usecases will append "preproc" based on LPI
status instead of profile type.

Change-Id: I75e10b69bb5d668fdb6fcc689734083af49f68c1
diff --git a/sound_trigger_platform.c b/sound_trigger_platform.c
index 6a4e73a..7b1adac 100644
--- a/sound_trigger_platform.c
+++ b/sound_trigger_platform.c
@@ -3980,7 +3980,7 @@
     case AUDIO_DEVICE_IN_WIRED_HEADSET:
         if ((ST_EXEC_MODE_CPE == exec_mode) ||
             (ST_EXEC_MODE_ADSP == exec_mode)) {
-            if (my_data->codec_backend_cfg.lpi_enable)
+            if (my_data->stdev->lpi_enable)
                 st_device = ST_DEVICE_HEADSET_MIC_LPI;
             else
                 st_device = ST_DEVICE_HEADSET_MIC;
@@ -4048,10 +4048,10 @@
                 else
                     st_device = ST_DEVICE_HANDSET_DMIC;
             } else if (channel_count == SOUND_TRIGGER_CHANNEL_MODE_MONO) {
-                if (v_info->profile_type != ST_PROFILE_TYPE_NONE)
-                    st_device = ST_DEVICE_HANDSET_MIC_PP;
-                else
+                if (my_data->stdev->lpi_enable)
                     st_device = ST_DEVICE_HANDSET_MIC;
+                else
+                    st_device = ST_DEVICE_HANDSET_MIC_PP;
             } else {
                 ALOGE("%s: Invalid channel count %d", __func__, channel_count);
             }
@@ -5732,12 +5732,13 @@
 
 void platform_stdev_check_and_append_usecase
 (
-   void *platform __unused,
-   char *use_case,
-   st_profile_type_t profile_type
+   void *platform,
+   char *use_case
 )
 {
-    if (profile_type != ST_PROFILE_TYPE_NONE)
+    struct platform_data *my_data = (struct platform_data *)platform;
+
+    if (!my_data->stdev->lpi_enable)
         strlcat(use_case, " preproc", USECASE_STRING_SIZE);
 
     ALOGV("%s: return usecase %s", __func__, use_case);
diff --git a/sound_trigger_platform.h b/sound_trigger_platform.h
index 4d976cf..59dd5d5 100644
--- a/sound_trigger_platform.h
+++ b/sound_trigger_platform.h
@@ -657,8 +657,7 @@
 void platform_stdev_check_and_append_usecase
 (
    void *platform,
-   char *use_case,
-   st_profile_type_t profile_type
+   char *use_case
 );
 
 void platform_stdev_check_and_update_ec_ref_config
diff --git a/st_hw_session_lsm.c b/st_hw_session_lsm.c
index d2e673e..1ff1abc 100644
--- a/st_hw_session_lsm.c
+++ b/st_hw_session_lsm.c
@@ -611,7 +611,7 @@
                 p_ses->stdev->ape_pcm_use_cases[p_ses->use_case_idx].use_case,
                 USECASE_STRING_SIZE);
         platform_stdev_check_and_append_usecase(p_ses->stdev->platform,
-                                               use_case, profile_type);
+                                                use_case);
         ALOGD("%s: enable use case = %s", __func__, use_case);
         platform_stdev_send_stream_app_type_cfg(p_ses->stdev->platform,
                                    p_lsm_ses->pcm_id, p_ses->st_device,
@@ -648,7 +648,6 @@
 {
     int ret = 0;
     char port_ctrl[USECASE_STRING_SIZE] = {0};
-    st_profile_type_t profile_type = get_profile_type(p_ses);
     st_hw_session_lsm_t *p_lsm_ses = (st_hw_session_lsm_t *)p_ses;
 
     if (enable) {
@@ -656,7 +655,7 @@
                 p_ses->stdev->ape_pcm_use_cases[p_ses->use_case_idx].use_case,
                 USECASE_STRING_SIZE);
         platform_stdev_check_and_append_usecase(p_ses->stdev->platform,
-                                                port_ctrl, profile_type);
+                                                port_ctrl);
         strlcat(port_ctrl, " port", USECASE_STRING_SIZE);
 
         ALOGV("%s: enable = %s", __func__, port_ctrl);