Merge "hal: audio: port missing changes from master" into av-userspace.lnx.2.0-dev
diff --git a/configs/msm8937/sound_trigger_mixer_paths_wcd9335.xml b/configs/msm8937/sound_trigger_mixer_paths_wcd9335.xml
index aaf2981..94d00c5 100644
--- a/configs/msm8937/sound_trigger_mixer_paths_wcd9335.xml
+++ b/configs/msm8937/sound_trigger_mixer_paths_wcd9335.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
-<!--- Copyright (c) 2015, The Linux Foundation. All rights reserved.
+<!--- Copyright (c) 2015-2016, 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
@@ -45,6 +45,10 @@
     <ctl name="AIF4_MAD Mixer SLIM TX12" value="0" />
     <ctl name="AIF4_MAD Mixer SLIM TX13" value="0" />
     <ctl name="CPE AFE MAD Enable" value="0"/>
+    <ctl name="CLK MODE" value="EXTERNAL" />
+    <ctl name="EC BUF MUX INP" value="ZERO" />
+    <ctl name="ADC MUX1" value="DMIC" />
+    <ctl name="DMIC MUX1" value="ZERO" />
 
     <path name="listen-voice-wakeup-1">
         <ctl name="SLIMBUS_5_TX LSM Function" value="AUDIO" />
@@ -88,13 +92,20 @@
         <ctl name="CPE AFE MAD Enable" value="1"/>
     </path>
 
+    <path name="listen-cpe-handset-mic-ecpp">
+        <ctl name="CLK MODE" value="INTERNAL" />
+        <ctl name="EC BUF MUX INP" value="DEC1" />
+        <ctl name="ADC MUX1" value="DMIC" />
+        <ctl name="DMIC MUX1" value="DMIC0" />
+    </path>
+
     <!-- path name used for low bandwidth FTRT codec interface -->
     <path name="listen-cpe-handset-mic low-speed-intf">
         <ctl name="MADONOFF Switch" value="1" />
         <ctl name="AIF4_MAD Mixer SLIM TX12" value="1" />
         <ctl name="MAD Input" value="DMIC0" />
         <ctl name="CPE AFE MAD Enable" value="1"/>
-     </path>
+    </path>
 
     <path name="listen-ape-handset-mic">
         <ctl name="MAD_BROADCAST Switch" value="1" />
diff --git a/configs/msm8937/sound_trigger_platform_info.xml b/configs/msm8937/sound_trigger_platform_info.xml
index 752ce99..28026f7 100644
--- a/configs/msm8937/sound_trigger_platform_info.xml
+++ b/configs/msm8937/sound_trigger_platform_info.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
-<!--- Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.       -->
+<!--- Copyright (c) 2013-2016, 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,35 +26,48 @@
 <!--- 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>
-    <device name="DEVICE_HANDSET_APE_ACDB_ID" value="130" />
-    <device name="DEVICE_HANDSET_CPE_ACDB_ID" value="128" />
-    <ctrl name="execution_type" value="APE" /> <!-- value: "CPE" "APE" -->
-    <ctrl name="max_cpe_sessions" value="1" />
-    <ctrl name="max_ape_sessions" value="5" />
-    <ctrl name="enable_failure_detection" value="false" />
-    <ctrl name="rx_concurrency_disabled" value="true" />
-    <ctrl name="rx_conc_max_st_ses" value="1" />
+    <param version="0x0101" /> <!-- this must be the first param -->
 
-    <!-- vendor_uuid for a soundmodel. More than one vendor_uuid tags can be -->
-    <!-- listed in sequence, the below vendor uuid is reserved for QTI  -->
-    <!-- module. ISV must use their own unique vendor uuid. app_type,        -->
-    <!-- module_id, param_id must match to the calibration database          -->
-    <!-- If ISV vendor_uuid is present, execution_type will be forced to APE -->
-    <vendor_uuid value="68ab2d40-e860-11e3-95ef-0002a5d5c51b" app_type="2" library="libsmwrapper.so">
+    <common_config>
+        <param execution_type="APE" /> <!-- value: "CPE" "APE" -->
+        <param max_cpe_sessions="1" />
+        <param max_ape_sessions="5" />
+        <param enable_failure_detection="false" />
+        <param rx_concurrency_disabled="true" />
+        <param rx_conc_max_st_ses="1" />
+    </common_config>
+
+    <acdb_ids>
+        <param DEVICE_HANDSET_APE_ACDB_ID="130" />
+        <param DEVICE_HANDSET_CPE_ACDB_ID="128" />
+        <param DEVICE_HANDSET_CPE_ECPP_ACDB_ID="128" />
+    </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.           -->
+    <sound_model_config>
+        <param vendor_uuid="68ab2d40-e860-11e3-95ef-0002a5d5c51b" />
+        <param app_type="2" /> <!-- app type used in ACDB -->
+        <param library="libsmwrapper.so" />
+        <param max_cpe_phrases="6" />
+        <param max_cpe_users="3" />
+        <param max_ape_phrases="10" />
+        <param max_ape_users="10" />
+        <param sample_rate="16000" />
+
+        <!-- Module and param ids with which the algorithm is integrated in firmware -->
+        <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" />
+
         <!-- 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 -->
-        <capture_keyword format="PCM_packet" transfer_mode="RT" kw_duration="2000" />
-        <param_type name="load_sound_model" module_id="0x00012C0D" param_id="0x00012C14"/>
-        <param_type name="unload_sound_model" module_id="0x00012C0D" param_id="0x00012C15"/>
-        <param_type name="confidence_levels" module_id="0x00012C0D" param_id="0x00012C07"/>
-        <param_type name="operation_mode" module_id="0x00012C0D" param_id="0x00012C02"/>
-        <ctrl name="max_cpe_phrases" value="6" />
-        <ctrl name="max_cpe_users" value="3" />
-        <ctrl name="max_ape_phrases" value="10" />
-        <ctrl name="max_ape_users" value="10" />
-        <ctrl name="client_capture_read_delay" value="2000" /> <!-- in milli seconds -->
-    </vendor_uuid>
+        <param capture_keyword="PCM_packet, RT, 2000" />
+        <param client_capture_read_delay="2000" />
+    </sound_model_config>
 
 </sound_trigger_platform_info>
 
diff --git a/configs/msm8953/sound_trigger_mixer_paths_wcd9335.xml b/configs/msm8953/sound_trigger_mixer_paths_wcd9335.xml
index aaf2981..94d00c5 100644
--- a/configs/msm8953/sound_trigger_mixer_paths_wcd9335.xml
+++ b/configs/msm8953/sound_trigger_mixer_paths_wcd9335.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
-<!--- Copyright (c) 2015, The Linux Foundation. All rights reserved.
+<!--- Copyright (c) 2015-2016, 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
@@ -45,6 +45,10 @@
     <ctl name="AIF4_MAD Mixer SLIM TX12" value="0" />
     <ctl name="AIF4_MAD Mixer SLIM TX13" value="0" />
     <ctl name="CPE AFE MAD Enable" value="0"/>
+    <ctl name="CLK MODE" value="EXTERNAL" />
+    <ctl name="EC BUF MUX INP" value="ZERO" />
+    <ctl name="ADC MUX1" value="DMIC" />
+    <ctl name="DMIC MUX1" value="ZERO" />
 
     <path name="listen-voice-wakeup-1">
         <ctl name="SLIMBUS_5_TX LSM Function" value="AUDIO" />
@@ -88,13 +92,20 @@
         <ctl name="CPE AFE MAD Enable" value="1"/>
     </path>
 
+    <path name="listen-cpe-handset-mic-ecpp">
+        <ctl name="CLK MODE" value="INTERNAL" />
+        <ctl name="EC BUF MUX INP" value="DEC1" />
+        <ctl name="ADC MUX1" value="DMIC" />
+        <ctl name="DMIC MUX1" value="DMIC0" />
+    </path>
+
     <!-- path name used for low bandwidth FTRT codec interface -->
     <path name="listen-cpe-handset-mic low-speed-intf">
         <ctl name="MADONOFF Switch" value="1" />
         <ctl name="AIF4_MAD Mixer SLIM TX12" value="1" />
         <ctl name="MAD Input" value="DMIC0" />
         <ctl name="CPE AFE MAD Enable" value="1"/>
-     </path>
+    </path>
 
     <path name="listen-ape-handset-mic">
         <ctl name="MAD_BROADCAST Switch" value="1" />
diff --git a/configs/msm8953/sound_trigger_platform_info.xml b/configs/msm8953/sound_trigger_platform_info.xml
index 752ce99..28026f7 100644
--- a/configs/msm8953/sound_trigger_platform_info.xml
+++ b/configs/msm8953/sound_trigger_platform_info.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
-<!--- Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.       -->
+<!--- Copyright (c) 2013-2016, 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,35 +26,48 @@
 <!--- 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>
-    <device name="DEVICE_HANDSET_APE_ACDB_ID" value="130" />
-    <device name="DEVICE_HANDSET_CPE_ACDB_ID" value="128" />
-    <ctrl name="execution_type" value="APE" /> <!-- value: "CPE" "APE" -->
-    <ctrl name="max_cpe_sessions" value="1" />
-    <ctrl name="max_ape_sessions" value="5" />
-    <ctrl name="enable_failure_detection" value="false" />
-    <ctrl name="rx_concurrency_disabled" value="true" />
-    <ctrl name="rx_conc_max_st_ses" value="1" />
+    <param version="0x0101" /> <!-- this must be the first param -->
 
-    <!-- vendor_uuid for a soundmodel. More than one vendor_uuid tags can be -->
-    <!-- listed in sequence, the below vendor uuid is reserved for QTI  -->
-    <!-- module. ISV must use their own unique vendor uuid. app_type,        -->
-    <!-- module_id, param_id must match to the calibration database          -->
-    <!-- If ISV vendor_uuid is present, execution_type will be forced to APE -->
-    <vendor_uuid value="68ab2d40-e860-11e3-95ef-0002a5d5c51b" app_type="2" library="libsmwrapper.so">
+    <common_config>
+        <param execution_type="APE" /> <!-- value: "CPE" "APE" -->
+        <param max_cpe_sessions="1" />
+        <param max_ape_sessions="5" />
+        <param enable_failure_detection="false" />
+        <param rx_concurrency_disabled="true" />
+        <param rx_conc_max_st_ses="1" />
+    </common_config>
+
+    <acdb_ids>
+        <param DEVICE_HANDSET_APE_ACDB_ID="130" />
+        <param DEVICE_HANDSET_CPE_ACDB_ID="128" />
+        <param DEVICE_HANDSET_CPE_ECPP_ACDB_ID="128" />
+    </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.           -->
+    <sound_model_config>
+        <param vendor_uuid="68ab2d40-e860-11e3-95ef-0002a5d5c51b" />
+        <param app_type="2" /> <!-- app type used in ACDB -->
+        <param library="libsmwrapper.so" />
+        <param max_cpe_phrases="6" />
+        <param max_cpe_users="3" />
+        <param max_ape_phrases="10" />
+        <param max_ape_users="10" />
+        <param sample_rate="16000" />
+
+        <!-- Module and param ids with which the algorithm is integrated in firmware -->
+        <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" />
+
         <!-- 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 -->
-        <capture_keyword format="PCM_packet" transfer_mode="RT" kw_duration="2000" />
-        <param_type name="load_sound_model" module_id="0x00012C0D" param_id="0x00012C14"/>
-        <param_type name="unload_sound_model" module_id="0x00012C0D" param_id="0x00012C15"/>
-        <param_type name="confidence_levels" module_id="0x00012C0D" param_id="0x00012C07"/>
-        <param_type name="operation_mode" module_id="0x00012C0D" param_id="0x00012C02"/>
-        <ctrl name="max_cpe_phrases" value="6" />
-        <ctrl name="max_cpe_users" value="3" />
-        <ctrl name="max_ape_phrases" value="10" />
-        <ctrl name="max_ape_users" value="10" />
-        <ctrl name="client_capture_read_delay" value="2000" /> <!-- in milli seconds -->
-    </vendor_uuid>
+        <param capture_keyword="PCM_packet, RT, 2000" />
+        <param client_capture_read_delay="2000" />
+    </sound_model_config>
 
 </sound_trigger_platform_info>
 
diff --git a/configs/msm8996/sound_trigger_mixer_paths.xml b/configs/msm8996/sound_trigger_mixer_paths.xml
index 4136e98..0125371 100644
--- a/configs/msm8996/sound_trigger_mixer_paths.xml
+++ b/configs/msm8996/sound_trigger_mixer_paths.xml
@@ -44,6 +44,10 @@
     <ctl name="AIF4_MAD Mixer SLIM TX12" value="0" />
     <ctl name="AIF4_MAD Mixer SLIM TX13" value="0" />
     <ctl name="CPE AFE MAD Enable" value="0"/>
+    <ctl name="CLK MODE" value="EXTERNAL" />
+    <ctl name="EC BUF MUX INP" value="ZERO" />
+    <ctl name="ADC MUX1" value="DMIC" />
+    <ctl name="DMIC MUX1" value="ZERO" />
 
     <path name="listen-voice-wakeup-1">
         <ctl name="SLIMBUS_5_TX LSM Function" value="AUDIO" />
@@ -87,6 +91,13 @@
         <ctl name="CPE AFE MAD Enable" value="1"/>
     </path>
 
+    <path name="listen-cpe-handset-mic-ecpp">
+        <ctl name="CLK MODE" value="INTERNAL" />
+        <ctl name="EC BUF MUX INP" value="DEC1" />
+        <ctl name="ADC MUX1" value="DMIC" />
+        <ctl name="DMIC MUX1" value="DMIC0" />
+    </path>
+
     <!-- path name used for low bandwidth FTRT codec interface -->
     <path name="listen-cpe-handset-mic low-speed-intf">
         <ctl name="MADONOFF Switch" value="1" />
diff --git a/configs/msm8996/sound_trigger_platform_info.xml b/configs/msm8996/sound_trigger_platform_info.xml
index 675f232..b92ea48 100644
--- a/configs/msm8996/sound_trigger_platform_info.xml
+++ b/configs/msm8996/sound_trigger_platform_info.xml
@@ -26,33 +26,45 @@
 <!--- 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>
-    <device name="DEVICE_HANDSET_APE_ACDB_ID" value="100" />
-    <device name="DEVICE_HANDSET_CPE_ACDB_ID" value="128" />
-    <ctrl name="execution_type" value="CPE" /> <!-- value: "CPE" "APE" -->
-    <ctrl name="max_cpe_sessions" value="1" />
-    <ctrl name="max_ape_sessions" value="8" />
-    <ctrl name="enable_failure_detection" value="false" />
+    <param version="0x0101" /> <!-- this must be the first param -->
 
-    <!-- vendor_uuid for a soundmodel. More than one vendor_uuid tags can be -->
-    <!-- listed in sequence, the below vendor uuid is reserved for QTI  -->
-    <!-- module. ISV must use their own unique vendor uuid. app_type,        -->
-    <!-- module_id, param_id must match to the calibration database          -->
-    <!-- If ISV vendor_uuid is present, execution_type will be forced to APE -->
-    <vendor_uuid value="68ab2d40-e860-11e3-95ef-0002a5d5c51b" app_type="2" library="libsmwrapper.so">
+    <common_config>
+        <param execution_type="CPE" /> <!-- value: "CPE" "APE" -->
+        <param max_cpe_sessions="1" />
+        <param max_ape_sessions="8" />
+        <param enable_failure_detection="false" />
+    </common_config>
+
+    <acdb_ids>
+        <param DEVICE_HANDSET_APE_ACDB_ID="100" />
+        <param DEVICE_HANDSET_CPE_ACDB_ID="128" />
+        <param DEVICE_HANDSET_CPE_ECPP_ACDB_ID="128" />
+    </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.           -->
+    <sound_model_config>
+        <param vendor_uuid="68ab2d40-e860-11e3-95ef-0002a5d5c51b" />
+        <param app_type="2" /> <!-- app type used in ACDB -->
+        <param library="libsmwrapper.so" />
+        <param max_cpe_phrases="6" />
+        <param max_cpe_users="3" />
+        <param max_ape_phrases="10" />
+        <param max_ape_users="10" />
+        <param sample_rate="16000" />
+
+        <!-- Module and param ids with which the algorithm is integrated in firmware -->
+        <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" />
+
         <!-- 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 -->
-        <capture_keyword format="PCM_packet" transfer_mode="RT" kw_duration="2000" />
-        <param_type name="load_sound_model" module_id="0x00012C0D" param_id="0x00012C14"/>
-        <param_type name="unload_sound_model" module_id="0x00012C0D" param_id="0x00012C15"/>
-        <param_type name="confidence_levels" module_id="0x00012C0D" param_id="0x00012C07"/>
-        <param_type name="operation_mode" module_id="0x00012C0D" param_id="0x00012C02"/>
-        <ctrl name="max_cpe_phrases" value="6" />
-        <ctrl name="max_cpe_users" value="3" />
-        <ctrl name="max_ape_phrases" value="10" />
-        <ctrl name="max_ape_users" value="10" />
-        <ctrl name="client_capture_read_delay" value="2000" /> <!-- in milli seconds -->
-    </vendor_uuid>
+        <param capture_keyword="PCM_packet, RT, 2000" />
+        <param client_capture_read_delay="2000" />
+    </sound_model_config>
 
 </sound_trigger_platform_info>
-
diff --git a/configs/msmcobalt/sound_trigger_mixer_paths.xml b/configs/msmcobalt/sound_trigger_mixer_paths.xml
index 4136e98..0125371 100644
--- a/configs/msmcobalt/sound_trigger_mixer_paths.xml
+++ b/configs/msmcobalt/sound_trigger_mixer_paths.xml
@@ -44,6 +44,10 @@
     <ctl name="AIF4_MAD Mixer SLIM TX12" value="0" />
     <ctl name="AIF4_MAD Mixer SLIM TX13" value="0" />
     <ctl name="CPE AFE MAD Enable" value="0"/>
+    <ctl name="CLK MODE" value="EXTERNAL" />
+    <ctl name="EC BUF MUX INP" value="ZERO" />
+    <ctl name="ADC MUX1" value="DMIC" />
+    <ctl name="DMIC MUX1" value="ZERO" />
 
     <path name="listen-voice-wakeup-1">
         <ctl name="SLIMBUS_5_TX LSM Function" value="AUDIO" />
@@ -87,6 +91,13 @@
         <ctl name="CPE AFE MAD Enable" value="1"/>
     </path>
 
+    <path name="listen-cpe-handset-mic-ecpp">
+        <ctl name="CLK MODE" value="INTERNAL" />
+        <ctl name="EC BUF MUX INP" value="DEC1" />
+        <ctl name="ADC MUX1" value="DMIC" />
+        <ctl name="DMIC MUX1" value="DMIC0" />
+    </path>
+
     <!-- path name used for low bandwidth FTRT codec interface -->
     <path name="listen-cpe-handset-mic low-speed-intf">
         <ctl name="MADONOFF Switch" value="1" />
diff --git a/configs/msmcobalt/sound_trigger_platform_info.xml b/configs/msmcobalt/sound_trigger_platform_info.xml
index 675f232..b92ea48 100644
--- a/configs/msmcobalt/sound_trigger_platform_info.xml
+++ b/configs/msmcobalt/sound_trigger_platform_info.xml
@@ -26,33 +26,45 @@
 <!--- 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>
-    <device name="DEVICE_HANDSET_APE_ACDB_ID" value="100" />
-    <device name="DEVICE_HANDSET_CPE_ACDB_ID" value="128" />
-    <ctrl name="execution_type" value="CPE" /> <!-- value: "CPE" "APE" -->
-    <ctrl name="max_cpe_sessions" value="1" />
-    <ctrl name="max_ape_sessions" value="8" />
-    <ctrl name="enable_failure_detection" value="false" />
+    <param version="0x0101" /> <!-- this must be the first param -->
 
-    <!-- vendor_uuid for a soundmodel. More than one vendor_uuid tags can be -->
-    <!-- listed in sequence, the below vendor uuid is reserved for QTI  -->
-    <!-- module. ISV must use their own unique vendor uuid. app_type,        -->
-    <!-- module_id, param_id must match to the calibration database          -->
-    <!-- If ISV vendor_uuid is present, execution_type will be forced to APE -->
-    <vendor_uuid value="68ab2d40-e860-11e3-95ef-0002a5d5c51b" app_type="2" library="libsmwrapper.so">
+    <common_config>
+        <param execution_type="CPE" /> <!-- value: "CPE" "APE" -->
+        <param max_cpe_sessions="1" />
+        <param max_ape_sessions="8" />
+        <param enable_failure_detection="false" />
+    </common_config>
+
+    <acdb_ids>
+        <param DEVICE_HANDSET_APE_ACDB_ID="100" />
+        <param DEVICE_HANDSET_CPE_ACDB_ID="128" />
+        <param DEVICE_HANDSET_CPE_ECPP_ACDB_ID="128" />
+    </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.           -->
+    <sound_model_config>
+        <param vendor_uuid="68ab2d40-e860-11e3-95ef-0002a5d5c51b" />
+        <param app_type="2" /> <!-- app type used in ACDB -->
+        <param library="libsmwrapper.so" />
+        <param max_cpe_phrases="6" />
+        <param max_cpe_users="3" />
+        <param max_ape_phrases="10" />
+        <param max_ape_users="10" />
+        <param sample_rate="16000" />
+
+        <!-- Module and param ids with which the algorithm is integrated in firmware -->
+        <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" />
+
         <!-- 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 -->
-        <capture_keyword format="PCM_packet" transfer_mode="RT" kw_duration="2000" />
-        <param_type name="load_sound_model" module_id="0x00012C0D" param_id="0x00012C14"/>
-        <param_type name="unload_sound_model" module_id="0x00012C0D" param_id="0x00012C15"/>
-        <param_type name="confidence_levels" module_id="0x00012C0D" param_id="0x00012C07"/>
-        <param_type name="operation_mode" module_id="0x00012C0D" param_id="0x00012C02"/>
-        <ctrl name="max_cpe_phrases" value="6" />
-        <ctrl name="max_cpe_users" value="3" />
-        <ctrl name="max_ape_phrases" value="10" />
-        <ctrl name="max_ape_users" value="10" />
-        <ctrl name="client_capture_read_delay" value="2000" /> <!-- in milli seconds -->
-    </vendor_uuid>
+        <param capture_keyword="PCM_packet, RT, 2000" />
+        <param client_capture_read_delay="2000" />
+    </sound_model_config>
 
 </sound_trigger_platform_info>
-
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index a5e0978..8b12475 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -97,6 +97,37 @@
     return flag;
 }
 #endif /*VOICE_CONCURRENCY*/
+
+void AudioPolicyManagerCustom::moveGlobalEffect()
+{
+    audio_io_handle_t dstOutput = getOutputForEffect();
+    if (hasPrimaryOutput() && dstOutput != mPrimaryOutput->mIoHandle) {
+#ifdef DOLBY_ENABLE
+        status_t status =
+                        mpClientInterface->moveEffects(AUDIO_SESSION_OUTPUT_MIX,
+                                                    mPrimaryOutput->mIoHandle,
+                                                    dstOutput);
+        if (status == NO_ERROR) {
+            for (size_t i = 0; i < mEffects.size(); i++) {
+                 sp<EffectDescriptor> desc = mEffects.valueAt(i);
+                 if (desc->mSession == AUDIO_SESSION_OUTPUT_MIX) {
+                     // update the mIo member of EffectDescriptor
+                     // for the global effect
+                     ALOGV("%s updating mIo", __FUNCTION__);
+                     desc->mIo = dstOutput;
+                 }
+            }
+        } else {
+                ALOGW("%s moveEffects from %d to %d failed", __FUNCTION__,
+                                     mPrimaryOutput->mIoHandle, dstOutput);
+        }
+#else // DOLBY_END
+        mpClientInterface->moveEffects(AUDIO_SESSION_OUTPUT_MIX,
+                                   mPrimaryOutput->mIoHandle, dstOutput);
+#endif
+    }
+}
+
 // ----------------------------------------------------------------------------
 // AudioPolicyInterface implementation
 // ----------------------------------------------------------------------------
@@ -771,6 +802,10 @@
                 }
             }
         }
+        // If effects where present on any of the above closed outputs,
+        // audioflinger moved them to the primary output by default
+        // move them back to the appropriate output.
+        moveGlobalEffect();
     }
 
     if ((AUDIO_MODE_IN_CALL == oldState || AUDIO_MODE_IN_COMMUNICATION == oldState) &&
@@ -839,6 +874,10 @@
                     closeOutput(mOutputs.keyAt(i));
                 }
             }
+            // If effects where present on any of the above closed outputs,
+            // audioflinger moved them to the primary output by default
+            // move them back to the appropriate output.
+            moveGlobalEffect();
         } else if ((oldState == AUDIO_MODE_IN_COMMUNICATION) &&
                     (mEngine->getPhoneState() == AUDIO_MODE_NORMAL)) {
             // call invalidate for music so that music can fallback to compress
@@ -1990,6 +2029,10 @@
                 closeOutput(mOutputs.keyAt(i));
             }
         }
+        // If effects where present on any of the above closed outputs,
+        // audioflinger moved them to the primary output by default
+        // move them back to the appropriate output.
+        moveGlobalEffect();
     }
 #endif
 
diff --git a/policy_hal/AudioPolicyManager.h b/policy_hal/AudioPolicyManager.h
index 6f47a54..dfda1c9 100644
--- a/policy_hal/AudioPolicyManager.h
+++ b/policy_hal/AudioPolicyManager.h
@@ -114,6 +114,7 @@
         static audio_output_flags_t getFallBackPath();
         int mFallBackflag;
 #endif /*VOICE_CONCURRENCY*/
+        void moveGlobalEffect();
 
         // handle special cases for sonification strategy while in call: mute streams or replace by
         // a special tone in the device used for communication