Merge "hal: check for sco device to ensure a2dp can be disabled"
diff --git a/configs/msmnile_au/msmnile_au.mk b/configs/msmnile_au/msmnile_au.mk
index 2d47885..f698e6d 100644
--- a/configs/msmnile_au/msmnile_au.mk
+++ b/configs/msmnile_au/msmnile_au.mk
@@ -11,7 +11,11 @@
 BOARD_USES_ALSA_AUDIO := true
 
 ifneq ($(TARGET_USES_AOSP_FOR_AUDIO), true)
+ifeq ($(TARGET_FWK_SUPPORTS_FULL_VALUEADDS),true)
 USE_CUSTOM_AUDIO_POLICY := 1
+else
+USE_CUSTOM_AUDIO_POLICY := 0
+endif
 AUDIO_FEATURE_QSSI_COMPLIANCE := true
 AUDIO_FEATURE_ENABLED_COMPRESS_CAPTURE := false
 AUDIO_FEATURE_ENABLED_COMPRESS_INPUT := true
@@ -49,6 +53,9 @@
 
 USE_XML_AUDIO_POLICY_CONF := 1
 BOARD_SUPPORTS_SOUND_TRIGGER := true
+BOARD_SUPPORTS_OPENSOURCE_STHAL := true
+AUDIO_FEATURE_ENABLED_SVA_CHANNEL_IDX := true
+AUDIO_FEATURE_QSSI_COMPLIANCE := true
 AUDIO_FEATURE_ENABLED_INSTANCE_ID := true
 ifeq ($(TARGET_HAS_GENERIC_KERNEL_HEADERS), true)
 AUDIO_FEATURE_ENABLED_GKI := true
diff --git a/configs/msmnile_au/sound_trigger_platform_info.xml b/configs/msmnile_au/sound_trigger_platform_info.xml
index 6efdcdd..a7d0459 100644
--- a/configs/msmnile_au/sound_trigger_platform_info.xml
+++ b/configs/msmnile_au/sound_trigger_platform_info.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
-<!--- Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.       -->
+<!--- Copyright (c) 2013-2021, 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    -->
@@ -26,18 +26,20 @@
 <!--- OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN    -->
 <!--- IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                             -->
 <sound_trigger_platform_info>
-    <param version="0x0103" /> <!-- this must be the first param -->
+    <param version="0x0106" /> <!-- this must be the first param -->
 <!--- Version History:                                                          -->
 <!--- 0x0101: Legacy version.                                                   -->
 <!--- 0x0102: Includes acdb_ids param with the gcs_usecase tag. This matches    -->
 <!--- the gcs_usecase with the acdb device that uses it.                        -->
 <!--- 0x0103: app_type and in_channels added to <lsm usecase> and out_channels  -->
 <!--- added to <adm_config>                                                     -->
+<!--- 0x0104: instance id support for both WDSP<CPE> and ADSP lsm usecases      -->
+<!--- 0x0105: Select <lsm_usecase> based on capture device                      -->
+<!--- 0x0106: Add module_params tag to support multiple module and param ids    -->
+<!--- per <lsm_usecase>                                                         -->
 
     <common_config>
-        <param implementer_version="0x0100" />
-        <param max_cpe_sessions="1" />
-        <param max_wdsp_sessions="2" />
+        <param implementer_version="0x0102" />
         <param max_ape_sessions="8" />
         <param enable_failure_detection="false" />
         <param support_device_switch="false" />
@@ -51,6 +53,7 @@
         <param backend_dai_name="TERT_TDM_TX_0" />
         <!-- Param used to indicate if SVA has dedicated SLIM ports -->
         <param dedicated_sva_path="true" />
+        <param platform_lpi_enable="false" />
         <param concurrent_capture="true" />
         <param concurrent_voice_call="false" />
         <param concurrent_voip_call="false" />
@@ -76,27 +79,16 @@
     <!-- QTI SVA -->
     <sound_model_config>
         <param vendor_uuid="68ab2d40-e860-11e3-95ef-0002a5d5c51b" />
-        <param execution_type="ADSP" /> <!-- value: "WDSP" "ADSP" "DYNAMIC" -->
-        <param library="libsmwrapper.so" />
-        <param max_cpe_phrases="6" />
-        <param max_cpe_users="3" />
+        <param execution_type="ADSP" />
+        <param merge_first_stage_sound_models="false"/>
         <param max_ape_phrases="20" />
         <param max_ape_users="10" />
         <!-- Profile specific data which the algorithm can support -->
         <param sample_rate="16000" />
         <param bit_width="16" />
         <param out_channels="1"/> <!-- Module output channels -->
+        <param dam_token_id="1"/>
 
-        <!-- adm_cfg_profile should match with the one defined under adm_config -->
-        <!-- Set it to NONE if LSM directly connects to AFE -->
-        <param adm_cfg_profile="FFECNS" />
-        <!-- fluence_type: "FLUENCE", "FLUENCE_DMIC", "FLUENCE_TMIC"   -->
-        <!-- "FLUENCE_QMIC". Param value is valid when adm_cfg_profile -->
-        <!-- is one of FLUENCE, FLUENCE_STEREO, FFECNS values          -->
-        <param fluence_type="FLUENCE_QMIC" />
-        <!-- wdsp_fluence_type: fluence disabled: "NONE" -->
-        <!-- fluence enabled: "FLUENCE_DMIC", "FLUENCE_TMIC", "FLUENCE_QMIC" -->
-        <param wdsp_fluence_type="NONE" />
         <arm_ss_usecase>
             <!-- Options are "KEYWORD_DETECTION", "USER_VERIFICATION", "CUSTOM_DETECTION"  -->
             <param sm_detection_type= "KEYWORD_DETECTION" />
@@ -114,66 +106,58 @@
             <param bit_wdith="16"/>
             <param channel_count="1"/>
         </arm_ss_usecase>
-        <gcs_usecase>
-            <param uid="0x1" />
-            <param acdb_devices="DEVICE_HANDSET_MIC_CPE, DEVICE_HANDSET_TMIC_CPE, DEVICE_HEADSET_MIC_CPE" />
-            <!-- module_id, instance_id, param_id -->
-            <param load_sound_model_ids="0x00012C0D, 0x2, 0x00012C14" />
-            <param confidence_levels_ids="0x00012C0D, 0x2, 0x00012C28" />
-            <param detection_event_ids="0x00012C0D, 0x2, 0x00012B05" />
-            <param read_cmd_ids="0x00020013, 0x2, 0x00020015" />
-            <param read_rsp_ids="0x00020013, 0x2, 0x00020016" />
-            <param custom_config_ids="0x00012C0D, 0x2, 0x00012C20" />
-            <param det_event_type_ids="0x00012C0D, 0x2, 0x00012C2A" />
-        </gcs_usecase>
-        <gcs_usecase>
-            <param uid="0x2" />
-            <param acdb_devices="DEVICE_HANDSET_MIC_CPE, DEVICE_HANDSET_TMIC_CPE, DEVICE_HEADSET_MIC_CPE" />
-            <param load_sound_model_ids="0x00012C0D, 0x3, 0x00012C14" />
-            <param confidence_levels_ids="0x00012C0D, 0x3, 0x00012C28" />
-            <param detection_event_ids="0x00012C0D, 0x3, 0x00012B05" />
-            <param read_cmd_ids="0x00020013, 0x3, 0x00020015" />
-            <param read_rsp_ids="0x00020013, 0x3, 0x00020016" />
-            <param custom_config_ids="0x00012C0D, 0x3, 0x00012C20" />
-            <param det_event_type_ids="0x00012C0D, 0x3, 0x00012C2A" />
-        </gcs_usecase>
-        <gcs_usecase>
-            <param uid="0x7" />
-            <param acdb_devices="DEVICE_HANDSET_DMIC_CPE" />
-            <param load_sound_model_ids="0x00012C0D, 0x7, 0x00012C14" />
-            <param confidence_levels_ids="0x00012C0D, 0x7, 0x00012C28" />
-            <param detection_event_ids="0x00012C0D, 0x7, 0x00012B05" />
-            <param read_cmd_ids="0x00020013, 0x7, 0x00020015" />
-            <param read_rsp_ids="0x00020013, 0x7, 0x00020016" />
-            <param custom_config_ids="0x00012C0D, 0x7, 0x00012C20" />
-            <param det_event_type_ids="0x00012C0D, 0x7, 0x00012C2A" />
-        </gcs_usecase>
-        <gcs_usecase>
-            <param uid="0x8" />
-            <param acdb_devices="DEVICE_HANDSET_DMIC_CPE" />
-            <param load_sound_model_ids="0x00012C0D, 0x8, 0x00012C14" />
-            <param confidence_levels_ids="0x00012C0D, 0x8, 0x00012C28" />
-            <param detection_event_ids="0x00012C0D, 0x8, 0x00012B05" />
-            <param read_cmd_ids="0x00020013, 0x8, 0x00020015" />
-            <param read_rsp_ids="0x00020013, 0x8, 0x00020016" />
-            <param custom_config_ids="0x00012C0D, 0x8, 0x00012C20" />
-            <param det_event_type_ids="0x00012C0D, 0x8, 0x00012C2A" />
-        </gcs_usecase>
+        <arm_ss_usecase>
+            <param sm_detection_type= "KEYWORD_DETECTION" />
+            <param sm_id="0x8" />
+            <param module_lib="libcapiv2svarnn.so"/>
+            <param sample_rate="16000"/>
+            <param bit_wdith="16"/>
+            <param channel_count="1"/>
+        </arm_ss_usecase>
         <!-- Module and param ids with which the algorithm is integrated
             in non-graphite firmware (note these must come after gcs params)
             Extends flexibility to have different ids based on execution type.
             valid execution_type values: "WDSP" "ADSP" -->
         <lsm_usecase>
+            <param capture_device="HANDSET" />
+            <!-- adm_cfg_profile should match with the one defined under adm_config -->
+            <!-- Set it to NONE if LSM directly connects to AFE -->
+            <param adm_cfg_profile="FFECNS" />
+            <!-- fluence_type: "FLUENCE", "FLUENCE_DMIC", "FLUENCE_TMIC"   -->
+            <!-- "FLUENCE_QMIC". Param value is valid when adm_cfg_profile -->
+            <!-- is one of FLUENCE, FLUENCE_STEREO, FFECNS values          -->
+            <param fluence_type="FLUENCE_QMIC" />
             <param execution_mode="ADSP" />
+            <!-- lpi_mode: "NON_LPI_BARGE_IN", "NON_LPI", "LPI" -->
+            <!-- NON_LPI_BARGE_IN: Default non-LPI mode type. lsm_usecase -->
+            <!-- must be present with this mode type to handle barge-in. -->
+            <!-- NON_LPI: If another lsm_usecase is present with this mode -->
+            <!-- type, it will be used for non-LPI non-barge-in usecases. -->
+            <!-- If not present, NON_LPI_BARGE_IN mode type will be used. -->
+            <!-- LPI: This mode type will be used for LPI usecases. -->
             <param app_type="2" /> <!-- app type used in ACDB -->
+            <param pdk5_app_type="1" />
             <param in_channels="4"/> <!-- Module input channels -->
-            <param load_sound_model_ids="0x00012C1C, 0x00012C14" />
-            <param unload_sound_model_ids="0x00012C1C, 0x00012C15" />
-            <param confidence_levels_ids="0x00012C1C, 0x00012C07" />
-            <param operation_mode_ids="0x00012C1C, 0x00012C02" />
-            <param polling_enable_ids="0x00012C1C, 0x00012C1B" />
-            <param custom_config_ids="0x00012C1C, 0x00012C20" />
-            <param det_event_type_ids="0x00012C1C, 0x00012C2C" />
+            <module_params>
+                <param module_type="GMM" />
+                <param load_sound_model_ids="0x00012C1C, 0x0, 0x00012C14" />
+                <param unload_sound_model_ids="0x00012C1C, 0x0, 0x00012C15" />
+                <param confidence_levels_ids="0x00012C1C, 0x0, 0x00012C07" />
+                <param operation_mode_ids="0x00012C1C, 0x0, 0x00012C02" />
+                <param polling_enable_ids="0x00012C1C, 0x0, 0x00012C1B" />
+                <param custom_config_ids="0x00012C1C, 0x0, 0x00012C20" />
+                <param det_event_type_ids="0x00012C1C, 0x0, 0x00012C2C" />
+                <param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
+            </module_params>
+            <module_params>
+                <param module_type="PDK5" />
+                <param load_sound_model_ids="0x00012C35, 0x0, 0x00012C36" />
+                <param unload_sound_model_ids="0x00012C35, 0x0, 0x00012C37" />
+                <param confidence_levels_ids="0x00012C35, 0x0, 0x00012C38" />
+                <param custom_config_ids="0x00012C35, 0x0, 0x00012C20" />
+                <param det_event_type_ids="0x00012C35, 0x0, 0x00012C2C" />
+                <param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
+            </module_params>
         </lsm_usecase>
 
         <!-- format: "ADPCM_packet" or "PCM_packet" !-->
@@ -182,17 +166,12 @@
             transfer mode -->
         <param capture_keyword="PCM_packet, RT, 2000" />
         <param client_capture_read_delay="2000" />
-        <param lpi_enable="false" />
-        <param concurrent_capture="true" />
-        <param concurrent_voice_call="false" />
-        <param concurrent_voip_call="false" />
     </sound_model_config>
 
-    <!-- QTI Music Detection !-->
+ <!-- QTI Music Detection !-->
     <sound_model_config>
         <param vendor_uuid="876c1b46-9d4d-40cc-a4fd-4d5ec7a80e47" />
         <param execution_type="WDSP" /> <!-- value: "WDSP" "ADSP" "DYNAMIC" -->
-        <param library="libsmwrapper.so" />
         <param max_cpe_phrases="1" />
         <param max_cpe_users="1" />
         <param max_ape_phrases="1" />
@@ -211,18 +190,6 @@
         <!-- wdsp_fluence_type: fluence disabled: "NONE" -->
         <!-- fluence enabled: "FLUENCE_DMIC", "FLUENCE_TMIC", "FLUENCE_QMIC" -->
         <param wdsp_fluence_type="NONE" />
-        <gcs_usecase>
-            <param uid="0x5" />
-            <param acdb_devices="DEVICE_HANDSET_MIC_CPE, DEVICE_HANDSET_TMIC_CPE, DEVICE_HEADSET_MIC_CPE" />
-            <!-- module_id, instance_id, param_id -->
-            <param load_sound_model_ids="0x00012C2E, 0x6, 0x00012C14" />
-            <param confidence_levels_ids="0x00012C2E, 0x6, 0x00012C28" />
-            <param detection_event_ids="0x00012C2E, 0x6, 0x00012B05" />
-            <param read_cmd_ids="0x00020013, 0x6, 0x00020015" />
-            <param read_rsp_ids="0x00020013, 0x6, 0x00020016" />
-            <param custom_config_ids="0x00012C2E, 0x6, 0x00012C2D" />
-            <param det_event_type_ids="0x00012C2E, 0x6, 0x00012C2C" />
-        </gcs_usecase>
         <!-- Module and param ids with which the algorithm is integrated
             in non-graphite firmware (note these must come after gcs params)
             Extends flexibility to have different ids based on execution type.
@@ -231,11 +198,13 @@
             <param execution_mode="ADSP" />
             <param app_type="4" /> <!-- app type for MD used in ACDB -->
             <param in_channels="1"/> <!-- Module input channels -->
-            <param load_sound_model_ids="0x00012C22, 0x00012C14" />
-            <param unload_sound_model_ids="0x00012C22, 0x00012C15" />
-            <param confidence_levels_ids="0x00012C22, 0x00012C07" />
-            <param det_event_type_ids="0x00012C22, 0x00012C2C" />
-            <param custom_config_ids="0x00012C22, 0x00012C30" />
+            <module_params>
+                <param load_sound_model_ids="0x00012C22, 0x0, 0x00012C14" />
+                <param unload_sound_model_ids="0x00012C22, 0x0, 0x00012C15" />
+                <param confidence_levels_ids="0x00012C22, 0x0, 0x00012C07" />
+                <param det_event_type_ids="0x00012C22, 0x0, 0x00012C2C" />
+                <param custom_config_ids="0x00012C22, 0x0, 0x00012C30" />
+            </module_params>
         </lsm_usecase>
 
         <!-- format: "ADPCM_packet" or "PCM_packet" !-->
@@ -250,7 +219,6 @@
     <sound_model_config>
         <param vendor_uuid="7038ddc8-30f2-11e6-b0ac-40a8f03d3f15" />
         <param execution_type="WDSP" /> <!-- value: "WDSP" "ADSP" "DYNAMIC" -->
-        <param library="none" />
         <param max_cpe_phrases="1" />
         <param max_cpe_users="1" />
         <param max_ape_phrases="1" />
@@ -269,39 +237,18 @@
         <!-- wdsp_fluence_type: fluence disabled: "NONE" -->
         <!-- fluence enabled: "FLUENCE_DMIC", "FLUENCE_QMIC" -->
         <param wdsp_fluence_type="NONE" />
-        <gcs_usecase>
-            <param uid="0x3" />
-            <param acdb_devices="DEVICE_HANDSET_MIC_CPE" />
-            <param load_sound_model_ids="0x18000001, 0x4, 0x18000100" />
-            <param start_engine_ids="0x18000001, 0x4, 0x18000101" />
-            <param confidence_levels_ids="0x18000001, 0x4, 0x00012C28" />
-            <param detection_event_ids="0x18000001, 0x4, 0x00012C29" />
-            <param custom_config_ids="0x18000001, 0x4, 0x00012C20" />
-            <param read_cmd_ids="0x00020013, 0x4, 0x00020015" />
-            <param read_rsp_ids="0x00020013, 0x4, 0x00020016" />
-        </gcs_usecase>
-        <gcs_usecase>
-            <param uid="0x4" />
-            <param acdb_devices="DEVICE_HANDSET_DMIC_CPE" />
-            <param load_sound_model_ids="0x18000001, 0x5, 0x18000100" />
-            <param start_engine_ids="0x18000001, 0x5, 0x18000101" />
-            <param confidence_levels_ids="0x18000001, 0x5, 0x00012C28" />
-            <param detection_event_ids="0x18000001, 0x5, 0x00012C29" />
-            <param custom_config_ids="0x18000001, 0x5, 0x00012C20" />
-            <param read_cmd_ids="0x00020013, 0x5, 0x00020015" />
-            <param read_rsp_ids="0x00020013, 0x5, 0x00020016" />
-        </gcs_usecase>
-
         <lsm_usecase>
             <param execution_mode="ADSP" />
             <param app_type="3" /> <!-- app type used in ACDB -->
             <param in_channels="1"/> <!-- Module input channels -->
-            <param load_sound_model_ids="0x18000001, 0x00012C14" />
-            <param unload_sound_model_ids="0x18000001, 0x00012C15" />
-            <param confidence_levels_ids="0x18000001, 0x00012C07" />
-            <param operation_mode_ids="0x18000001, 0x00012C02" />
-            <param polling_enable_ids="0x18000001, 0x00012C1B" />
-            <param custom_config_ids="0x18000001, 0x00012C20" />
+            <module_params>
+                <param load_sound_model_ids="0x18000001, 0x0, 0x00012C14" />
+                <param unload_sound_model_ids="0x18000001, 0x0, 0x00012C15" />
+                <param confidence_levels_ids="0x18000001, 0x0, 0x00012C07" />
+                <param operation_mode_ids="0x18000001, 0x0, 0x00012C02" />
+                <param polling_enable_ids="0x18000001, 0x0, 0x00012C1B" />
+                <param custom_config_ids="0x18000001, 0x0, 0x00012C20" />
+            </module_params>
         </lsm_usecase>
 
         <!-- format: "ADPCM_packet" or "PCM_packet" !-->
@@ -316,20 +263,31 @@
     <sound_model_config>
         <param vendor_uuid="9f6ad62a-1f0b-11e7-87c5-40a8f03d3f15" />
         <param execution_type="WDSP" /> <!-- value: "WDSP" "ADSP" "DYNAMIC" -->
-        <param library="none" />
+        <param max_ape_phrases="1" />
+        <param max_ape_users="1" />
+        <!-- Profile specific data which the algorithm can support -->
+        <param sample_rate="16000" />
+        <param bit_width="16" />
+        <param out_channels="1"/> <!-- Module output channels -->
         <!-- fluence enabled: "FLUENCE_DMIC", "FLUENCE_QMIC" -->
         <param wdsp_fluence_type="NONE" />
-        <gcs_usecase>
-            <param uid="0x6" />
-            <param acdb_devices="DEVICE_HANDSET_MIC_CPE" />
-            <param load_sound_model_ids="0x18000001, 0x4, 0x18000102" />
-            <param start_engine_ids="0x18000001, 0x4, 0x18000103" />
-            <param confidence_levels_ids="0x18000001, 0x4, 0x00012C28" />
-            <param detection_event_ids="0x18000001, 0x4, 0x00012C29" />
-            <param custom_config_ids="0x18000001, 0x4, 0x00012C20" />
-            <param read_cmd_ids="0x00020013, 0x7, 0x00020015" />
-            <param read_rsp_ids="0x00020013, 0x7, 0x00020016" />
-        </gcs_usecase>
+        <!-- adm_cfg_profile should match with the one defined under adm_config -->
+        <!-- Set it to NONE if LSM directly connects to AFE -->
+        <param adm_cfg_profile="NONE" />
+        <param fluence_type="FLUENCE_DMIC" />
+        <lsm_usecase>
+            <param execution_mode="ADSP" />
+            <param app_type="3" /> <!-- app type used in ACDB -->
+            <param in_channels="1"/> <!-- Module input channels -->
+            <module_params>
+                <param load_sound_model_ids="0x18000001, 0x0, 0x00012C14" />
+                <param unload_sound_model_ids="0x18000001, 0x0, 0x00012C15" />
+                <param confidence_levels_ids="0x18000001, 0x0, 0x00012C07" />
+                <param operation_mode_ids="0x18000001, 0x0, 0x00012C02" />
+                <param polling_enable_ids="0x18000001, 0x0, 0x00012C1B" />
+                <param custom_config_ids="0x18000001, 0x0, 0x00012C20" />
+            </module_params>
+        </lsm_usecase>
         <!--  kw_duration is in milli seconds. It is valid only for FTRT
             transfer mode -->
         <param capture_keyword="MULAW_raw, FTRT, 5000" />
diff --git a/configs/msmsteppe_au/msmsteppe_au.mk b/configs/msmsteppe_au/msmsteppe_au.mk
index 9d990a5..49fb0c6 100644
--- a/configs/msmsteppe_au/msmsteppe_au.mk
+++ b/configs/msmsteppe_au/msmsteppe_au.mk
@@ -4,7 +4,11 @@
 BOARD_USES_ALSA_AUDIO := true
 
 ifneq ($(TARGET_USES_AOSP_FOR_AUDIO), true)
+ifeq ($(TARGET_FWK_SUPPORTS_FULL_VALUEADDS),true)
 USE_CUSTOM_AUDIO_POLICY := 1
+else
+USE_CUSTOM_AUDIO_POLICY := 0
+endif
 AUDIO_FEATURE_ENABLED_COMPRESS_CAPTURE := false
 AUDIO_FEATURE_ENABLED_COMPRESS_VOIP := false
 AUDIO_FEATURE_ENABLED_DYNAMIC_ECNS := true
@@ -39,6 +43,9 @@
 USE_XML_AUDIO_POLICY_CONF := 1
 AUDIO_FEATURE_ENABLED_DLKM := true
 BOARD_SUPPORTS_SOUND_TRIGGER := true
+BOARD_SUPPORTS_OPENSOURCE_STHAL := true
+AUDIO_FEATURE_ENABLED_SVA_CHANNEL_IDX := true
+AUDIO_FEATURE_QSSI_COMPLIANCE := true
 AUDIO_FEATURE_ENABLED_INSTANCE_ID := true
 ifeq ($(TARGET_HAS_GENERIC_KERNEL_HEADERS), true)
 AUDIO_FEATURE_ENABLED_GKI := true
diff --git a/configs/msmsteppe_au/sound_trigger_platform_info.xml b/configs/msmsteppe_au/sound_trigger_platform_info.xml
index 1545922..a7d0459 100644
--- a/configs/msmsteppe_au/sound_trigger_platform_info.xml
+++ b/configs/msmsteppe_au/sound_trigger_platform_info.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
-<!--- Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.       -->
+<!--- Copyright (c) 2013-2021, 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    -->
@@ -26,17 +26,20 @@
 <!--- OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN    -->
 <!--- IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                             -->
 <sound_trigger_platform_info>
-    <param version="0x0103" /> <!-- this must be the first param -->
+    <param version="0x0106" /> <!-- this must be the first param -->
 <!--- Version History:                                                          -->
 <!--- 0x0101: Legacy version.                                                   -->
 <!--- 0x0102: Includes acdb_ids param with the gcs_usecase tag. This matches    -->
 <!--- the gcs_usecase with the acdb device that uses it.                        -->
 <!--- 0x0103: app_type and in_channels added to <lsm usecase> and out_channels  -->
 <!--- added to <adm_config>                                                     -->
+<!--- 0x0104: instance id support for both WDSP<CPE> and ADSP lsm usecases      -->
+<!--- 0x0105: Select <lsm_usecase> based on capture device                      -->
+<!--- 0x0106: Add module_params tag to support multiple module and param ids    -->
+<!--- per <lsm_usecase>                                                         -->
+
     <common_config>
-        <param implementer_version="0x0100" />
-        <param max_cpe_sessions="1" />
-        <param max_wdsp_sessions="2" />
+        <param implementer_version="0x0102" />
         <param max_ape_sessions="8" />
         <param enable_failure_detection="false" />
         <param support_device_switch="false" />
@@ -45,55 +48,47 @@
         <param transit_to_adsp_on_battery_charging="false" />
         <!-- Below backend params must match with port used in mixer path file -->
         <!-- param used to configure backend sample rate, format and channels -->
-        <!-- uncomment TX_CDC_DMA_TX_3 values for internal codec and comment SLIM_0_TX values -->
         <param backend_port_name="TERT_TDM_TX_0" />
-        <!-- param backend_port_name="TX_CDC_DMA_TX_3" /-->
         <!-- Param used to match and obtain device backend index -->
         <param backend_dai_name="TERT_TDM_TX_0" />
-        <!-- param backend_dai_name="TX_CDC_DMA_TX_3" /-->
+        <!-- Param used to indicate if SVA has dedicated SLIM ports -->
+        <param dedicated_sva_path="true" />
+        <param platform_lpi_enable="false" />
         <param concurrent_capture="true" />
         <param concurrent_voice_call="false" />
         <param concurrent_voip_call="false" />
     </common_config>
     <acdb_ids>
-        <!--For internal codec please enable below device-->
-        <!--param DEVICE_HANDSET_MIC_APE="130" /-->
         <param DEVICE_HANDSET_MIC_APE="100" />
         <param DEVICE_HANDSET_MIC_CPE="128" />
         <param DEVICE_HANDSET_MIC_ECPP_CPE="128" />
         <param DEVICE_HANDSET_TMIC_CPE="130" />
+        <param DEVICE_HANDSET_TMIC_APE="157" />
         <param DEVICE_HANDSET_MIC_PP_APE="135" />
         <param DEVICE_HANDSET_QMIC_APE="132" />
         <param DEVICE_HEADSET_MIC_CPE="139" />
+        <param DEVICE_HEADSET_MIC_APE="141" />
         <param DEVICE_HANDSET_DMIC_APE="149" />
-        <param DEVICE_HANDSET_DMIC_CPE="153" />
-        <param DEVICE_HANDSET_TMIC_APE="157" />
+        <param DEVICE_HANDSET_DMIC_CPE="148" />
     </acdb_ids>
+
     <!-- Multiple sound_model_config tags can be listed, each with unique   -->
     <!-- vendor_uuid. The below tag represents QTI SVA engine sound model   -->
     <!-- configuration. ISV must use their own unique vendor_uuid.          -->
+
+    <!-- QTI SVA -->
     <sound_model_config>
         <param vendor_uuid="68ab2d40-e860-11e3-95ef-0002a5d5c51b" />
-        <param execution_type="ADSP" /> <!-- value: "WDSP" "ADSP" "DYNAMIC" -->
-        <param library="libsmwrapper.so" />
-        <param max_cpe_phrases="6" />
-        <param max_cpe_users="3" />
+        <param execution_type="ADSP" />
+        <param merge_first_stage_sound_models="false"/>
         <param max_ape_phrases="20" />
         <param max_ape_users="10" />
         <!-- Profile specific data which the algorithm can support -->
         <param sample_rate="16000" />
         <param bit_width="16" />
         <param out_channels="1"/> <!-- Module output channels -->
-        <!-- adm_cfg_profile should match with the one defined under adm_config -->
-        <!-- Set it to NONE if LSM directly connects to AFE -->
-        <param adm_cfg_profile="FFECNS" />
-        <!-- fluence_type: "FLUENCE", "FLUENCE_DMIC", "FLUENCE_TMIC"   -->
-        <!-- "FLUENCE_QMIC". Param value is valid when adm_cfg_profile -->
-        <!-- is one of FLUENCE, FLUENCE_STEREO, FFECNS values          -->
-        <param fluence_type="FLUENCE_QMIC" />
-        <!-- wdsp_fluence_type: fluence disabled: "NONE" -->
-        <!-- fluence enabled: "FLUENCE_DMIC", "FLUENCE_TMIC", "FLUENCE_QMIC" -->
-        <param wdsp_fluence_type="NONE" />
+        <param dam_token_id="1"/>
+
         <arm_ss_usecase>
             <!-- Options are "KEYWORD_DETECTION", "USER_VERIFICATION", "CUSTOM_DETECTION"  -->
             <param sm_detection_type= "KEYWORD_DETECTION" />
@@ -111,72 +106,58 @@
             <param bit_wdith="16"/>
             <param channel_count="1"/>
         </arm_ss_usecase>
-        <gcs_usecase>
-            <param uid="0x1" />
-            <param acdb_devices="DEVICE_HANDSET_MIC_CPE, DEVICE_HANDSET_TMIC_CPE, DEVICE_HEADSET_MIC_CPE" />
-            <!-- module_id, instance_id, param_id -->
-            <param load_sound_model_ids="0x00012C0D, 0x2, 0x00012C14" />
-            <param confidence_levels_ids="0x00012C0D, 0x2, 0x00012C28" />
-            <param detection_event_ids="0x00012C0D, 0x2, 0x00012C29" />
-            <param read_cmd_ids="0x00020013, 0x2, 0x00020015" />
-            <param read_rsp_ids="0x00020013, 0x2, 0x00020016" />
-            <param custom_config_ids="0x00012C0D, 0x2, 0x00012C20" />
-        </gcs_usecase>
-        <gcs_usecase>
-            <param uid="0x2" />
-            <param acdb_devices="DEVICE_HANDSET_MIC_CPE, DEVICE_HANDSET_TMIC_CPE, DEVICE_HEADSET_MIC_CPE" />
-            <param load_sound_model_ids="0x00012C0D, 0x3, 0x00012C14" />
-            <param confidence_levels_ids="0x00012C0D, 0x3, 0x00012C28" />
-            <param detection_event_ids="0x00012C0D, 0x3, 0x00012C29" />
-            <param read_cmd_ids="0x00020013, 0x3, 0x00020015" />
-            <param read_rsp_ids="0x00020013, 0x3, 0x00020016" />
-            <param custom_config_ids="0x00012C0D, 0x3, 0x00012C20" />
-        </gcs_usecase>
-        <gcs_usecase>
-            <param uid="0x7" />
-            <param acdb_devices="DEVICE_HANDSET_DMIC_CPE" />
-            <param load_sound_model_ids="0x00012C0D, 0x7, 0x00012C14" />
-            <param confidence_levels_ids="0x00012C0D, 0x7, 0x00012C28" />
-            <param detection_event_ids="0x00012C0D, 0x7, 0x00012B05" />
-            <param read_cmd_ids="0x00020013, 0x7, 0x00020015" />
-            <param read_rsp_ids="0x00020013, 0x7, 0x00020016" />
-            <param custom_config_ids="0x00012C0D, 0x7, 0x00012C20" />
-            <param det_event_type_ids="0x00012C0D, 0x7, 0x00012C2A" />
-        </gcs_usecase>
-        <gcs_usecase>
-            <param uid="0x8" />
-            <param acdb_devices="DEVICE_HANDSET_DMIC_CPE" />
-            <param load_sound_model_ids="0x00012C0D, 0x8, 0x00012C14" />
-            <param confidence_levels_ids="0x00012C0D, 0x8, 0x00012C28" />
-            <param detection_event_ids="0x00012C0D, 0x8, 0x00012B05" />
-            <param read_cmd_ids="0x00020013, 0x8, 0x00020015" />
-            <param read_rsp_ids="0x00020013, 0x8, 0x00020016" />
-            <param custom_config_ids="0x00012C0D, 0x8, 0x00012C20" />
-            <param det_event_type_ids="0x00012C0D, 0x8, 0x00012C2A" />
-        </gcs_usecase>
+        <arm_ss_usecase>
+            <param sm_detection_type= "KEYWORD_DETECTION" />
+            <param sm_id="0x8" />
+            <param module_lib="libcapiv2svarnn.so"/>
+            <param sample_rate="16000"/>
+            <param bit_wdith="16"/>
+            <param channel_count="1"/>
+        </arm_ss_usecase>
         <!-- Module and param ids with which the algorithm is integrated
             in non-graphite firmware (note these must come after gcs params)
             Extends flexibility to have different ids based on execution type.
             valid execution_type values: "WDSP" "ADSP" -->
         <lsm_usecase>
+            <param capture_device="HANDSET" />
+            <!-- adm_cfg_profile should match with the one defined under adm_config -->
+            <!-- Set it to NONE if LSM directly connects to AFE -->
+            <param adm_cfg_profile="FFECNS" />
+            <!-- fluence_type: "FLUENCE", "FLUENCE_DMIC", "FLUENCE_TMIC"   -->
+            <!-- "FLUENCE_QMIC". Param value is valid when adm_cfg_profile -->
+            <!-- is one of FLUENCE, FLUENCE_STEREO, FFECNS values          -->
+            <param fluence_type="FLUENCE_QMIC" />
             <param execution_mode="ADSP" />
+            <!-- lpi_mode: "NON_LPI_BARGE_IN", "NON_LPI", "LPI" -->
+            <!-- NON_LPI_BARGE_IN: Default non-LPI mode type. lsm_usecase -->
+            <!-- must be present with this mode type to handle barge-in. -->
+            <!-- NON_LPI: If another lsm_usecase is present with this mode -->
+            <!-- type, it will be used for non-LPI non-barge-in usecases. -->
+            <!-- If not present, NON_LPI_BARGE_IN mode type will be used. -->
+            <!-- LPI: This mode type will be used for LPI usecases. -->
             <param app_type="2" /> <!-- app type used in ACDB -->
+            <param pdk5_app_type="1" />
             <param in_channels="4"/> <!-- Module input channels -->
-            <param load_sound_model_ids="0x00012C1C, 0x00012C14" />
-            <param unload_sound_model_ids="0x00012C1C, 0x00012C15" />
-            <param confidence_levels_ids="0x00012C1C, 0x00012C07" />
-            <param operation_mode_ids="0x00012C1C, 0x00012C02" />
-            <param polling_enable_ids="0x00012C1C, 0x00012C1B" />
-            <param custom_config_ids="0x00012C1C, 0x00012C20" />
-            <param det_event_type_ids="0x00012C1C, 0x00012C2C" />
-        </lsm_usecase>
-        <lsm_usecase>
-            <param execution_mode="WDSP" />
-            <param load_sound_model_ids="0x00012C0D, 0x00012C14" />
-            <param unload_sound_model_ids="0x00012C0D, 0x00012C15" />
-            <param confidence_levels_ids="0x00012C0D, 0x00012C07" />
-            <param operation_mode_ids="0x00012C0D, 0x00012C02" />
-            <param custom_config_ids="0x00012C0D, 0x00012C20" />
+            <module_params>
+                <param module_type="GMM" />
+                <param load_sound_model_ids="0x00012C1C, 0x0, 0x00012C14" />
+                <param unload_sound_model_ids="0x00012C1C, 0x0, 0x00012C15" />
+                <param confidence_levels_ids="0x00012C1C, 0x0, 0x00012C07" />
+                <param operation_mode_ids="0x00012C1C, 0x0, 0x00012C02" />
+                <param polling_enable_ids="0x00012C1C, 0x0, 0x00012C1B" />
+                <param custom_config_ids="0x00012C1C, 0x0, 0x00012C20" />
+                <param det_event_type_ids="0x00012C1C, 0x0, 0x00012C2C" />
+                <param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
+            </module_params>
+            <module_params>
+                <param module_type="PDK5" />
+                <param load_sound_model_ids="0x00012C35, 0x0, 0x00012C36" />
+                <param unload_sound_model_ids="0x00012C35, 0x0, 0x00012C37" />
+                <param confidence_levels_ids="0x00012C35, 0x0, 0x00012C38" />
+                <param custom_config_ids="0x00012C35, 0x0, 0x00012C20" />
+                <param det_event_type_ids="0x00012C35, 0x0, 0x00012C2C" />
+                <param lab_dam_cfg_ids="0x00012C08, 0x0, 0x000102C4" />
+            </module_params>
         </lsm_usecase>
 
         <!-- format: "ADPCM_packet" or "PCM_packet" !-->
@@ -185,17 +166,12 @@
             transfer mode -->
         <param capture_keyword="PCM_packet, RT, 2000" />
         <param client_capture_read_delay="2000" />
-        <param lpi_enable="false" />
-        <param concurrent_capture="true" />
-        <param concurrent_voice_call="false" />
-        <param concurrent_voip_call="false" />
     </sound_model_config>
 
-    <!-- QTI Music Detection !-->
+ <!-- QTI Music Detection !-->
     <sound_model_config>
         <param vendor_uuid="876c1b46-9d4d-40cc-a4fd-4d5ec7a80e47" />
-        <param execution_type="ADSP" /> <!-- value: "WDSP" "ADSP" "DYNAMIC" -->
-        <param library="libsmwrapper.so" />
+        <param execution_type="WDSP" /> <!-- value: "WDSP" "ADSP" "DYNAMIC" -->
         <param max_cpe_phrases="1" />
         <param max_cpe_users="1" />
         <param max_ape_phrases="1" />
@@ -214,18 +190,6 @@
         <!-- wdsp_fluence_type: fluence disabled: "NONE" -->
         <!-- fluence enabled: "FLUENCE_DMIC", "FLUENCE_TMIC", "FLUENCE_QMIC" -->
         <param wdsp_fluence_type="NONE" />
-        <gcs_usecase>
-            <param uid="0x5" />
-            <param acdb_devices="DEVICE_HANDSET_MIC_CPE, DEVICE_HANDSET_TMIC_CPE, DEVICE_HEADSET_MIC_CPE" />
-            <!-- module_id, instance_id, param_id -->
-            <param load_sound_model_ids="0x00012C2E, 0x6, 0x00012C14" />
-            <param confidence_levels_ids="0x00012C2E, 0x6, 0x00012C28" />
-            <param detection_event_ids="0x00012C2E, 0x6, 0x00012B05" />
-            <param read_cmd_ids="0x00020013, 0x6, 0x00020015" />
-            <param read_rsp_ids="0x00020013, 0x6, 0x00020016" />
-            <param custom_config_ids="0x00012C2E, 0x6, 0x00012C2D" />
-            <param det_event_type_ids="0x00012C2E, 0x6, 0x00012C2C" />
-        </gcs_usecase>
         <!-- Module and param ids with which the algorithm is integrated
             in non-graphite firmware (note these must come after gcs params)
             Extends flexibility to have different ids based on execution type.
@@ -234,11 +198,13 @@
             <param execution_mode="ADSP" />
             <param app_type="4" /> <!-- app type for MD used in ACDB -->
             <param in_channels="1"/> <!-- Module input channels -->
-            <param load_sound_model_ids="0x00012C22, 0x00012C14" />
-            <param unload_sound_model_ids="0x00012C22, 0x00012C15" />
-            <param confidence_levels_ids="0x00012C22, 0x00012C07" />
-            <param det_event_type_ids="0x00012C22, 0x00012C2C" />
-            <param custom_config_ids="0x00012C22, 0x00012C30" />
+            <module_params>
+                <param load_sound_model_ids="0x00012C22, 0x0, 0x00012C14" />
+                <param unload_sound_model_ids="0x00012C22, 0x0, 0x00012C15" />
+                <param confidence_levels_ids="0x00012C22, 0x0, 0x00012C07" />
+                <param det_event_type_ids="0x00012C22, 0x0, 0x00012C2C" />
+                <param custom_config_ids="0x00012C22, 0x0, 0x00012C30" />
+            </module_params>
         </lsm_usecase>
 
         <!-- format: "ADPCM_packet" or "PCM_packet" !-->
@@ -249,11 +215,10 @@
         <param client_capture_read_delay="2000" />
     </sound_model_config>
 
-<!-- Sound model config for Hotword !-->
+    <!-- Google Hotword -->
     <sound_model_config>
         <param vendor_uuid="7038ddc8-30f2-11e6-b0ac-40a8f03d3f15" />
         <param execution_type="WDSP" /> <!-- value: "WDSP" "ADSP" "DYNAMIC" -->
-        <param library="none" />
         <param max_cpe_phrases="1" />
         <param max_cpe_users="1" />
         <param max_ape_phrases="1" />
@@ -265,62 +230,67 @@
         <!-- adm_cfg_profile should match with the one defined under adm_config -->
         <!-- Set it to NONE if LSM directly connects to AFE -->
         <param adm_cfg_profile="NONE" />
-        <!-- fluence_type: "FLUENCE", "FLUENCE_DMIC", "FLUENCE_TMIC", -->
-        <!-- "FLUENCE_QMIC". param value is valid when adm_cfg_profile="FLUENCE"-->
+        <!-- fluence_type: "FLUENCE", "FLUENCE_DMIC", "FLUENCE_TMIC"   -->
+        <!-- "FLUENCE_QMIC". Param value is valid when adm_cfg_profile -->
+        <!-- is one of FLUENCE, FLUENCE_STEREO, FFECNS values          -->
         <param fluence_type="FLUENCE_DMIC" />
         <!-- wdsp_fluence_type: fluence disabled: "NONE" -->
-        <!-- fluence enabled: "FLUENCE_DMIC", "FLUENCE_TMIC", "FLUENCE_QMIC" -->
+        <!-- fluence enabled: "FLUENCE_DMIC", "FLUENCE_QMIC" -->
         <param wdsp_fluence_type="NONE" />
-        <gcs_usecase>
-            <param uid="0x3" />
-            <param acdb_devices="DEVICE_HANDSET_MIC_CPE, DEVICE_HANDSET_TMIC_CPE" />
-            <param load_sound_model_ids="0x18000001, 0x4, 0x00012C14" />
-            <param confidence_levels_ids="0x18000001, 0x4, 0x00012C28" />
-            <param detection_event_ids="0x18000001, 0x4, 0x00012C29" />
-            <param read_cmd_ids="0x00020013, 0x4, 0x00020015" />
-            <param read_rsp_ids="0x00020013, 0x4, 0x00020016" />
-            <param custom_config_ids="0x18000001, 0x4, 0x00012C20" />
-        </gcs_usecase>
-        <gcs_usecase>
-            <param uid="0x4" />
-            <param acdb_devices="DEVICE_HANDSET_DMIC_CPE" />
-            <param load_sound_model_ids="0x18000001, 0x5, 0x00012C14" />
-            <param confidence_levels_ids="0x18000001, 0x5, 0x00012C28" />
-            <param detection_event_ids="0x18000001, 0x5, 0x00012C29" />
-            <param read_cmd_ids="0x00020013, 0x5, 0x00020015" />
-            <param read_rsp_ids="0x00020013, 0x5, 0x00020016" />
-            <param custom_config_ids="0x18000001, 0x5, 0x00012C20" />
-        </gcs_usecase>
-        <!-- Module and param ids with which the algorithm is integrated
-            in non-graphite firmware (note these must come after gcs params)
-            Extends flexibility to have different ids based on execution type.
-            valid execution_type values: "WDSP" "ADSP" -->
         <lsm_usecase>
             <param execution_mode="ADSP" />
             <param app_type="3" /> <!-- app type used in ACDB -->
             <param in_channels="1"/> <!-- Module input channels -->
-            <param load_sound_model_ids="0x18000001, 0x00012C14" />
-            <param unload_sound_model_ids="0x18000001, 0x00012C15" />
-            <param confidence_levels_ids="0x18000001, 0x00012C07" />
-            <param operation_mode_ids="0x18000001, 0x00012C02" />
-            <param polling_enable_ids="0x18000001, 0x00012C1B" />
-            <param custom_config_ids="0x18000001, 0x00012C20" />
-        </lsm_usecase>
-
-        <lsm_usecase>
-            <param execution_mode="WDSP" />
-            <param load_sound_model_ids="0x18000001, 0x00012C14" />
-            <param unload_sound_model_ids="0x18000001, 0x00012C15" />
-            <param confidence_levels_ids="0x18000001, 0x00012C07" />
-            <param operation_mode_ids="0x18000001, 0x00012C02" />
-            <param custom_config_ids="0x18000001, 0x00012C20" />
+            <module_params>
+                <param load_sound_model_ids="0x18000001, 0x0, 0x00012C14" />
+                <param unload_sound_model_ids="0x18000001, 0x0, 0x00012C15" />
+                <param confidence_levels_ids="0x18000001, 0x0, 0x00012C07" />
+                <param operation_mode_ids="0x18000001, 0x0, 0x00012C02" />
+                <param polling_enable_ids="0x18000001, 0x0, 0x00012C1B" />
+                <param custom_config_ids="0x18000001, 0x0, 0x00012C20" />
+            </module_params>
         </lsm_usecase>
 
         <!-- format: "ADPCM_packet" or "PCM_packet" !-->
         <!-- transfer_mode: "FTRT" or "RT" -->
         <!--  kw_duration is in milli seconds. It is valid only for FTRT
             transfer mode -->
-        <param capture_keyword="PCM_packet, RT, 2000" />
+        <param capture_keyword="PCM_raw, FTRT, 2000" />
+        <param client_capture_read_delay="2000" />
+    </sound_model_config>
+
+    <!-- Google Music Detection -->
+    <sound_model_config>
+        <param vendor_uuid="9f6ad62a-1f0b-11e7-87c5-40a8f03d3f15" />
+        <param execution_type="WDSP" /> <!-- value: "WDSP" "ADSP" "DYNAMIC" -->
+        <param max_ape_phrases="1" />
+        <param max_ape_users="1" />
+        <!-- Profile specific data which the algorithm can support -->
+        <param sample_rate="16000" />
+        <param bit_width="16" />
+        <param out_channels="1"/> <!-- Module output channels -->
+        <!-- fluence enabled: "FLUENCE_DMIC", "FLUENCE_QMIC" -->
+        <param wdsp_fluence_type="NONE" />
+        <!-- adm_cfg_profile should match with the one defined under adm_config -->
+        <!-- Set it to NONE if LSM directly connects to AFE -->
+        <param adm_cfg_profile="NONE" />
+        <param fluence_type="FLUENCE_DMIC" />
+        <lsm_usecase>
+            <param execution_mode="ADSP" />
+            <param app_type="3" /> <!-- app type used in ACDB -->
+            <param in_channels="1"/> <!-- Module input channels -->
+            <module_params>
+                <param load_sound_model_ids="0x18000001, 0x0, 0x00012C14" />
+                <param unload_sound_model_ids="0x18000001, 0x0, 0x00012C15" />
+                <param confidence_levels_ids="0x18000001, 0x0, 0x00012C07" />
+                <param operation_mode_ids="0x18000001, 0x0, 0x00012C02" />
+                <param polling_enable_ids="0x18000001, 0x0, 0x00012C1B" />
+                <param custom_config_ids="0x18000001, 0x0, 0x00012C20" />
+            </module_params>
+        </lsm_usecase>
+        <!--  kw_duration is in milli seconds. It is valid only for FTRT
+            transfer mode -->
+        <param capture_keyword="MULAW_raw, FTRT, 5000" />
         <param client_capture_read_delay="2000" />
     </sound_model_config>
 
diff --git a/hal/audio_extn/a2dp.c b/hal/audio_extn/a2dp.c
index 4a0f964..b8a696f 100644
--- a/hal/audio_extn/a2dp.c
+++ b/hal/audio_extn/a2dp.c
@@ -94,6 +94,7 @@
 #define MIXER_AFE_SINK_CHANNELS_SLIM7    "AFE Output Channels SLIM7"
 #define MIXER_FMT_TWS_CHANNEL_MODE "TWS Channel Mode"
 #define MIXER_FMT_LC3_CHANNEL_MODE "LC3 Channel Mode"
+#define MIXER_SLIM7_TX_ADM_CHANNEL "SLIM7_TX ADM Channels"
 #define ENCODER_LATENCY_SBC        10
 #define ENCODER_LATENCY_APTX       40
 #define ENCODER_LATENCY_APTX_HD    20
@@ -1326,6 +1327,7 @@
     char *rate_str = NULL, *channels = NULL;
     uint32_t sampling_rate;
     struct mixer_ctl *ctl_sample_rate = NULL, *ctrl_channels = NULL;
+    struct mixer_ctl *adm_ctrl_channels = NULL;
     bool is_configured = false;
 
     if (direction == SINK) {
@@ -1466,12 +1468,15 @@
         }
 
         ALOGD("%s: set afe dec channels =%s", __func__, channels);
-        if (a2dp.bt_decoder_format == CODEC_TYPE_LC3)
+        if (a2dp.bt_decoder_format == CODEC_TYPE_LC3) {
             ctrl_channels = mixer_get_ctl_by_name(a2dp.adev->mixer,
                                                 MIXER_AFE_SINK_CHANNELS_SLIM7);
-        else
+            adm_ctrl_channels = mixer_get_ctl_by_name(a2dp.adev->mixer,
+                                                MIXER_SLIM7_TX_ADM_CHANNEL);
+        } else {
             ctrl_channels = mixer_get_ctl_by_name(a2dp.adev->mixer,
                                                 MIXER_AFE_SINK_CHANNELS);
+        }
     } else {
         //Configure AFE enc channels
         switch (a2dp.enc_channels) {
@@ -1498,6 +1503,20 @@
             goto fail;
         }
     }
+    // need to set adm channel for LC3 decoder
+    if (a2dp.bt_decoder_format == CODEC_TYPE_LC3 &&
+        direction == SINK) {
+        if (!adm_ctrl_channels) {
+            ALOGE(" ERROR ADM channels mixer control not identified");
+        } else {
+            if (mixer_ctl_set_enum_by_string(adm_ctrl_channels, channels) != 0) {
+                ALOGE("%s: Failed to set ADM channels =%s", __func__, channels);
+                is_configured = false;
+                goto fail;
+            }
+        }
+    }
+
     is_configured = true;
 fail:
     return is_configured;
@@ -1615,7 +1634,7 @@
 {
     const char *rate_str = "KHZ_8", *channels = "Zero";
     struct mixer_ctl *ctl_sample_rate = NULL, *ctl_sample_rate_tx = NULL;
-    struct mixer_ctl *ctrl_channels = NULL;
+    struct mixer_ctl *ctrl_channels = NULL, *adm_ctrl_channels = NULL;
 
     // Reset backend sampling rate
     if (direction == SINK) {
@@ -1647,7 +1666,6 @@
             }
         }
     } else {
-
         ctl_sample_rate = mixer_get_ctl_by_name(a2dp.adev->mixer,
                                         MIXER_SAMPLE_RATE_DEFAULT);
         if (!ctl_sample_rate) {
@@ -1679,6 +1697,13 @@
         ALOGE("%s: Failed to reset AFE in channels = %d", __func__, a2dp.enc_channels);
         return -ENOSYS;
     }
+    // Reset adm channels for slim7 tx if available
+    adm_ctrl_channels = mixer_get_ctl_by_name(a2dp.adev->mixer,
+                                            MIXER_SLIM7_TX_ADM_CHANNEL);
+    if (adm_ctrl_channels) {
+        if (mixer_ctl_set_enum_by_string(adm_ctrl_channels, channels) != 0)
+            ALOGE("%s: Failed to reset ADM in channels = %d", __func__, a2dp.dec_channels);
+    }
 
     return 0;
 }
@@ -1953,6 +1978,8 @@
     is_configured = true;
     a2dp.bt_decoder_format = CODEC_TYPE_LC3;
     a2dp.dec_channels = CH_STEREO;
+    a2dp.dec_sampling_rate =
+        lc3_dsp_cfg.dec_codec.from_Air_cfg.fromAirConfig.sampling_freq;
 
 fail:
     return is_configured;
@@ -3101,6 +3128,13 @@
         /* Start abr for LC3 decoder*/
         if (a2dp.bt_decoder_format == CODEC_TYPE_LC3) {
             a2dp.abr_config.is_abr_enabled = true;
+            /*
+             * Before starting abr, we must ensure to set correct acdb id
+             * because abr will trigger port open which needs acdb_id
+             */
+            fp_platform_switch_voice_call_device_post(a2dp.adev->platform,
+                                               SND_DEVICE_OUT_BT_SCO_WB,
+                                               SND_DEVICE_IN_BT_SCO_MIC_WB);
             start_abr();
         }
     }
diff --git a/hal/audio_extn/soundtrigger.c b/hal/audio_extn/soundtrigger.c
index 330c9cb..b3df579 100644
--- a/hal/audio_extn/soundtrigger.c
+++ b/hal/audio_extn/soundtrigger.c
@@ -561,7 +561,7 @@
     struct stream_in *active_input = adev_get_active_input(st_dev->adev);
     audio_source_t  source = (active_input == NULL) ?
                                AUDIO_SOURCE_DEFAULT : active_input->source;
-    if (voice_is_call_state_active_in_call(st_dev->adev)) {
+    if (voice_is_in_call(st_dev->adev)) {
         ev_info.u.usecase.type = USECASE_TYPE_VOICE_CALL;
     } else if ((st_dev->adev->mode == AUDIO_MODE_IN_COMMUNICATION ||
                 source == AUDIO_SOURCE_VOICE_COMMUNICATION) &&
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index 31ce934..1f61d6d 100755
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -1367,6 +1367,8 @@
             if (voice_is_in_call_rec_stream(usecase->stream.in)) {
                 audio_extn_btsco_get_sample_rate(usecase->in_snd_device,
                                                  &usecase->stream.in->app_type_cfg.sample_rate);
+            } if (SND_DEVICE_IN_BT_A2DP == snd_device) {
+                audio_extn_a2dp_get_dec_sample_rate(&usecase->stream.in->app_type_cfg.sample_rate);
             } else {
                 audio_extn_btsco_get_sample_rate(snd_device,
                                                  &usecase->stream.in->app_type_cfg.sample_rate);
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 7fcd229..0855185 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -5490,7 +5490,9 @@
         latency = period_ms + platform_render_latency(out) / 1000;
     } else {
         latency = (out->config.period_count * out->config.period_size * 1000) /
-           (out->config.rate);
+                   (out->config.rate);
+        if (out->usecase == USECASE_AUDIO_PLAYBACK_DEEP_BUFFER)
+            latency += platform_render_latency(out)/1000;
     }
 
     if (!out->standby && is_a2dp_out_device_type(&out->device_list))
diff --git a/hal/voice.c b/hal/voice.c
index fdca74a..230ceed 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
  * Not a contribution.
  *
  * Copyright (C) 2013 The Android Open Source Project
@@ -204,6 +204,7 @@
     disable_snd_device(adev, uc_info->in_snd_device);
 
     adev->voice.lte_call = false;
+    adev->voice.in_call = false;
 
     list_remove(&uc_info->list);
     free(uc_info);
@@ -244,6 +245,8 @@
         return -ENOMEM;
     }
 
+    adev->voice.in_call = true;
+
     uc_info->id = usecase_id;
     uc_info->type = VOICE_CALL;
     uc_info->stream.out = adev->current_call_output;
@@ -263,7 +266,6 @@
 
     if (is_sco_out_device_type(&uc_info->device_list) && !adev->bt_sco_on) {
         ALOGE("start_call: couldn't find BT SCO, SCO is not ready");
-        adev->voice.in_call = false;
         ret = -EIO;
         goto error_start_voice;
     }
@@ -725,12 +727,12 @@
 {
     int ret = 0;
 
-    adev->voice.in_call = false;
     ret = voice_extn_stop_call(adev);
     if (ret == -ENOSYS) {
         ret = voice_stop_usecase(adev, USECASE_VOICE_CALL);
     }
 
+    adev->voice.in_call = false;
     return ret;
 }