Merge baf78dbd65d82f052d4a5e6ce34443330aea2589 on remote branch

Change-Id: I8c4bb09a57651e16bbea7c04abf8239382056eb3
diff --git a/configs/audio_vendor_product.mk b/configs/audio_vendor_product.mk
index c68e42e..88ff881 100644
--- a/configs/audio_vendor_product.mk
+++ b/configs/audio_vendor_product.mk
@@ -141,6 +141,7 @@
 MM_AUDIO += capi_v2_synth
 MM_AUDIO += capi_v2_avc
 MM_AUDIO += capi_v2_asrc
+MM_AUDIO += capi_v2_ecmx
 MM_AUDIO += icc_module.so.1
 MM_AUDIO += sec_module.so.1
 MM_AUDIO += audio-nxp-auto
diff --git a/configs/common_au/audio_policy_configuration.xml b/configs/common_au/audio_policy_configuration.xml
index 90e7f99..3ca2ba1 100644
--- a/configs/common_au/audio_policy_configuration.xml
+++ b/configs/common_au/audio_policy_configuration.xml
@@ -57,6 +57,7 @@
                 <item>Sys Notification Bus</item>
                 <item>Nav Guidance Bus</item>
                 <item>Phone Bus</item>
+                <item>Alerts Bus</item>
                 <item>Front Passenger Bus</item>
                 <item>Rear Seat Bus</item>
                 <item>Built-In Mic</item>
@@ -105,6 +106,10 @@
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
                 </mixPort>
+                <mixPort name="alerts" role="source">
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+                </mixPort>
                 <mixPort name="front_passenger" role="source">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
@@ -227,6 +232,15 @@
                                 minValueMB="-6000" maxValueMB="600" defaultValueMB="0" stepValueMB="100"/>
                     </gains>
                 </devicePort>
+                <devicePort tagName="Alerts Bus" role="sink" type="AUDIO_DEVICE_OUT_BUS"
+                        address="BUS05_ALERTS">
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+                    <gains>
+                        <gain name="" mode="AUDIO_GAIN_MODE_JOINT"
+                                minValueMB="-6000" maxValueMB="600" defaultValueMB="0" stepValueMB="100"/>
+                    </gains>
+                </devicePort>
                 <devicePort tagName="Front Passenger Bus" role="sink" type="AUDIO_DEVICE_OUT_BUS"
                         address="BUS08_FRONT_PASSENGER">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
@@ -321,6 +335,8 @@
                        sources="nav_guidance"/>
                 <route type="mix" sink="Phone Bus"
                        sources="phone"/>
+                <route type="mix" sink="Alerts Bus"
+                       sources="alerts"/>
                 <route type="mix" sink="Front Passenger Bus"
                        sources="front_passenger"/>
                 <route type="mix" sink="Rear Seat Bus"
diff --git a/configs/common_au/car_audio_configuration.xml b/configs/common_au/car_audio_configuration.xml
index edf3600..d2af7e7 100644
--- a/configs/common_au/car_audio_configuration.xml
+++ b/configs/common_au/car_audio_configuration.xml
@@ -42,10 +42,6 @@
                         <context context="alarm"/>
                         <context context="notification"/>
                         <context context="system_sound"/>
-                        <context context="emergency"/>
-                        <context context="safety"/>
-                        <context context="vehicle_status"/>
-                        <context context="announcement"/>
                     </device>
                 </group>
                 <group>
@@ -60,6 +56,14 @@
                         <context context="call_ring"/>
                     </device>
                 </group>
+                <group>
+                    <device address="BUS05_ALERTS">
+                        <context context="emergency"/>
+                        <context context="safety"/>
+                        <context context="vehicle_status"/>
+                        <context context="announcement"/>
+                    </device>
+                </group>
             </volumeGroups>
             <inputDevices>
                 <inputDevice address="BUS04_INPUT"/>
diff --git a/configs/msmnile_au/audio_effects.xml b/configs/msmnile_au/audio_effects.xml
index 3f8c540..bf720fc 100644
--- a/configs/msmnile_au/audio_effects.xml
+++ b/configs/msmnile_au/audio_effects.xml
@@ -38,7 +38,6 @@
         <library name="proxy" path="libeffectproxy.so"/>
         <library name="offload_bundle" path="libqcompostprocbundle.so"/>
         <library name="audio_pre_processing" path="libqcomvoiceprocessing.so"/>
-        <library name="volume_listener" path="libvolumelistener.so"/>
         <library name="audiosphere" path="libasphere.so"/>
         <library name="shoebox" path="libshoebox.so"/>
         <library name="audio_bmt" path="libqtiautobundle.so"/>
@@ -89,11 +88,6 @@
         <effect name="dynamics_processing" library="dynamics_processing" uuid="e0e6539b-1781-7261-676f-6d7573696340"/>
         <effect name="aec" library="audio_pre_processing" uuid="0f8d0d2a-59e5-45fe-b6e4-248c8a799109"/>
         <effect name="ns" library="audio_pre_processing" uuid="1d97bb0b-9e2f-4403-9ae3-58c2554306f8"/>
-        <effect name="music_helper" library="volume_listener" uuid="08b8b058-0590-11e5-ac71-0025b32654a0"/>
-        <effect name="ring_helper" library="volume_listener" uuid="0956df94-0590-11e5-bdbe-0025b32654a0"/>
-        <effect name="alarm_helper" library="volume_listener" uuid="09f303e2-0590-11e5-8fdb-0025b32654a0"/>
-        <effect name="voice_helper" library="volume_listener" uuid="0ace5c08-0590-11e5-ae9e-0025b32654a0"/>
-        <effect name="notification_helper" library="volume_listener" uuid="0b776dde-0590-11e5-81ba-0025b32654a0"/>
         <effect name="audiosphere" library="audiosphere" uuid="184e62ab-2d19-4364-9d1b-c0a40733866c"/>
         <effect name="shoebox" library="shoebox" uuid="1eab784c-1a36-4b2a-b7fc-e34c44cab89e"/>
         <effect name="audio_bmt" library="audio_bmt" uuid="e039757b-a367-44e9-9bbb-634af0c51cb7"/>
@@ -105,21 +99,6 @@
         <effect name="audio_synth" library="audio_synth" uuid="a124b54f-4026-4ed2-9316-4ba2d5effdb8"/>
     </effects>
     <postprocess>
-        <stream type="music">
-            <apply effect="music_helper"/>
-        </stream>
-        <stream type="ring">
-            <apply effect="ring_helper"/>
-        </stream>
-        <stream type="alarm">
-            <apply effect="alarm_helper"/>
-        </stream>
-        <stream type="voice_call">
-            <apply effect="voice_helper"/>
-        </stream>
-        <stream type="notification">
-            <apply effect="notification_helper"/>
-        </stream>
     </postprocess>
     <preprocess>
         <stream type="voice_communication">
diff --git a/configs/msmnile_au/audio_io_policy.conf b/configs/msmnile_au/audio_io_policy.conf
index fa01cf0..1959c14 100644
--- a/configs/msmnile_au/audio_io_policy.conf
+++ b/configs/msmnile_au/audio_io_policy.conf
@@ -102,6 +102,13 @@
     bit_width 16
     app_type 69936
   }
+  alerts {
+    flags AUDIO_OUTPUT_FLAG_ALERTS
+    formats AUDIO_FORMAT_PCM_16_BIT
+    sampling_rates 48000
+    bit_width 16
+    app_type 69937
+  }
   front_passenger {
     flags AUDIO_OUTPUT_FLAG_FRONT_PASSENGER
     formats AUDIO_FORMAT_PCM_16_BIT
diff --git a/configs/msmnile_au/audio_platform_info.xml b/configs/msmnile_au/audio_platform_info.xml
index cdb5248..9f53553 100755
--- a/configs/msmnile_au/audio_platform_info.xml
+++ b/configs/msmnile_au/audio_platform_info.xml
@@ -34,6 +34,7 @@
         <device name="SND_DEVICE_OUT_BUS_SYS" acdb_id="60"/>
         <device name="SND_DEVICE_OUT_BUS_NAV" acdb_id="14"/>
         <device name="SND_DEVICE_OUT_BUS_PHN" acdb_id="94"/>
+        <device name="SND_DEVICE_OUT_BUS_ALR" acdb_id="60"/>
         <device name="SND_DEVICE_OUT_BUS_PAX" acdb_id="60"/>
         <device name="SND_DEVICE_OUT_BUS_RSE" acdb_id="60"/>
         <device name="SND_DEVICE_OUT_BT_SCO" acdb_id="21"/>
@@ -107,6 +108,7 @@
         <usecase name="USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION" type="out" id="9"/>
         <usecase name="USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE" type="out" id="1"/>
         <usecase name="USECASE_AUDIO_PLAYBACK_PHONE" type="out" id="12"/>
+        <usecase name="USECASE_AUDIO_PLAYBACK_ALERTS" type="out" id="59"/>
         <usecase name="USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER" type="out" id="55"/>
         <usecase name="USECASE_AUDIO_PLAYBACK_REAR_SEAT" type="out" id="54"/>
         <usecase name="USECASE_VOICEMMODE1_CALL" type="in" id="2"/>
@@ -190,6 +192,7 @@
         <device name="SND_DEVICE_OUT_BUS_SYS" interface="TERT_TDM_RX_0"/>
         <device name="SND_DEVICE_OUT_BUS_NAV" interface="TERT_TDM_RX_1"/>
         <device name="SND_DEVICE_OUT_BUS_PHN" interface="TERT_TDM_RX_2"/>
+        <device name="SND_DEVICE_OUT_BUS_ALR" interface="TERT_TDM_RX_0"/>
         <device name="SND_DEVICE_OUT_BUS_PAX" interface="QUAT_TDM_RX_0"/>
         <device name="SND_DEVICE_OUT_BUS_RSE" interface="QUIN_TDM_RX_0"/>
         <device name="SND_DEVICE_OUT_ICC" interface="TERT_TDM_RX_0"/>
@@ -215,6 +218,7 @@
         <device name="SND_DEVICE_OUT_BUS_SYS" backend="sys-bus-out" interface="TERT_TDM_RX_0"/>
         <device name="SND_DEVICE_OUT_BUS_NAV" backend="nav-bus-out" interface="TERT_TDM_RX_1"/>
         <device name="SND_DEVICE_OUT_BUS_PHN" backend="phone-bus-out" interface="TERT_TDM_RX_2"/>
+        <device name="SND_DEVICE_OUT_BUS_ALR" backend="alerts-bus-out" interface="TERT_TDM_RX_0"/>
         <device name="SND_DEVICE_OUT_BUS_PAX" backend="pax-bus-out" interface="QUAT_TDM_RX_0"/>
         <device name="SND_DEVICE_OUT_BUS_RSE" backend="rse-bus-out" interface="QUIN_TDM_RX_0"/>
     </backend_names>
diff --git a/configs/msmnile_au/audio_policy_configuration.xml b/configs/msmnile_au/audio_policy_configuration.xml
index a8a0f95..c7bf080 100755
--- a/configs/msmnile_au/audio_policy_configuration.xml
+++ b/configs/msmnile_au/audio_policy_configuration.xml
@@ -57,6 +57,7 @@
                 <item>Sys Notification Bus</item>
                 <item>Nav Guidance Bus</item>
                 <item>Phone Bus</item>
+                <item>Alerts Bus</item>
                 <item>Front Passenger Bus</item>
                 <item>Rear Seat Bus</item>
                 <item>Built-In Mic</item>
@@ -106,6 +107,10 @@
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
                 </mixPort>
+                <mixPort name="alerts" role="source">
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+                </mixPort>
                 <mixPort name="front_passenger" role="source">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
@@ -303,6 +308,15 @@
                                 minValueMB="-6000" maxValueMB="600" defaultValueMB="0" stepValueMB="100"/>
                     </gains>
                 </devicePort>
+                <devicePort tagName="Alerts Bus" role="sink" type="AUDIO_DEVICE_OUT_BUS"
+                        address="BUS05_ALERTS">
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+                    <gains>
+                        <gain name="" mode="AUDIO_GAIN_MODE_JOINT"
+                                minValueMB="-6000" maxValueMB="600" defaultValueMB="0" stepValueMB="100"/>
+                    </gains>
+                </devicePort>
                 <devicePort tagName="Front Passenger Bus" role="sink" type="AUDIO_DEVICE_OUT_BUS"
                         address="BUS08_FRONT_PASSENGER">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
@@ -456,6 +470,8 @@
                        sources="nav_guidance,mmap_no_irq_out"/>
                 <route type="mix" sink="Phone Bus"
                        sources="phone,mmap_no_irq_out"/>
+                <route type="mix" sink="Alerts Bus"
+                       sources="alerts"/>
                 <route type="mix" sink="Front Passenger Bus"
                        sources="front_passenger,mmap_no_irq_out"/>
                 <route type="mix" sink="Rear Seat Bus"
diff --git a/configs/msmnile_au/mixer_paths_adp.xml b/configs/msmnile_au/mixer_paths_adp.xml
index f6266ec..b283151 100644
--- a/configs/msmnile_au/mixer_paths_adp.xml
+++ b/configs/msmnile_au/mixer_paths_adp.xml
@@ -295,6 +295,11 @@
         <ctl name="TERT_TDM_RX_2 Audio Mixer MultiMedia10" value="1" />
     </path>
 
+    <path name="alerts-playback alerts-bus-out">
+        <ctl name="TERT_TDM_RX_0 Channels" value="Six" />
+        <ctl name="TERT_TDM_RX_0 Audio Mixer MultiMedia31" value="1" />
+    </path>
+
     <path name="front-passenger-playback pax-bus-out">
         <ctl name="QUAT_TDM_RX_0 Channels" value="Eight" />
         <ctl name="QUAT_TDM_RX_0 Audio Mixer MultiMedia23" value="1" />
diff --git a/configs/msmnile_au/mixer_paths_custom.xml b/configs/msmnile_au/mixer_paths_custom.xml
index 0f6f6bb..c5ad307 100644
--- a/configs/msmnile_au/mixer_paths_custom.xml
+++ b/configs/msmnile_au/mixer_paths_custom.xml
@@ -1315,6 +1315,11 @@
         <ctl name="TERT_TDM_RX_2 Audio Mixer MultiMedia10" value="1" />
     </path>
 
+    <path name="alerts-playback">
+        <ctl name="TERT_TDM_RX_0 Channels" value="Six" />
+        <ctl name="TERT_TDM_RX_0 Audio Mixer MultiMedia31" value="1" />
+    </path>
+
     <path name="front-passenger-playback">
         <ctl name="QUAT_TDM_RX_0 Channels" value="Eight" />
         <ctl name="QUAT_TDM_RX_0 Audio Mixer MultiMedia23" value="1" />
diff --git a/configs/msmnile_au/msmnile_au.mk b/configs/msmnile_au/msmnile_au.mk
index 12d9b15..d14c49d 100644
--- a/configs/msmnile_au/msmnile_au.mk
+++ b/configs/msmnile_au/msmnile_au.mk
@@ -64,30 +64,30 @@
 AUDIO_FEATURE_ENABLED_GKI := true
 endif
 AUDIO_USE_DEEP_AS_PRIMARY_OUTPUT := false
-AUDIO_FEATURE_ENABLED_VBAT_MONITOR := true
+AUDIO_FEATURE_ENABLED_VBAT_MONITOR := false
 AUDIO_FEATURE_ENABLED_NT_PAUSE_TIMEOUT := true
-AUDIO_FEATURE_ENABLED_ANC_HEADSET := true
-AUDIO_FEATURE_ENABLED_CUSTOMSTEREO := true
+AUDIO_FEATURE_ENABLED_ANC_HEADSET := false
+AUDIO_FEATURE_ENABLED_CUSTOMSTEREO := false
 AUDIO_FEATURE_ENABLED_FLUENCE := true
-AUDIO_FEATURE_ENABLED_HDMI_EDID := true
-AUDIO_FEATURE_ENABLED_HDMI_PASSTHROUGH := true
+AUDIO_FEATURE_ENABLED_HDMI_EDID := false
+AUDIO_FEATURE_ENABLED_HDMI_PASSTHROUGH := false
 #AUDIO_FEATURE_ENABLED_KEEP_ALIVE := true
-AUDIO_FEATURE_ENABLED_DISPLAY_PORT := true
+AUDIO_FEATURE_ENABLED_DISPLAY_PORT := false
 AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := false
 AUDIO_FEATURE_ENABLED_HFP := true
 AUDIO_FEATURE_ENABLED_INCALL_MUSIC := false
-AUDIO_FEATURE_ENABLED_MULTI_VOICE_SESSIONS := true
+AUDIO_FEATURE_ENABLED_MULTI_VOICE_SESSIONS := false
 AUDIO_FEATURE_ENABLED_KPI_OPTIMIZE := true
-AUDIO_FEATURE_ENABLED_SPKR_PROTECTION := true
+AUDIO_FEATURE_ENABLED_SPKR_PROTECTION := false
 AUDIO_FEATURE_ENABLED_ACDB_LICENSE := false
 AUDIO_FEATURE_ENABLED_DEV_ARBI := false
 AUDIO_FEATURE_ENABLED_DYNAMIC_LOG := true
-MM_AUDIO_ENABLED_FTM := true
+MM_AUDIO_ENABLED_FTM := false
 TARGET_USES_QCOM_MM_AUDIO := true
-AUDIO_FEATURE_ENABLED_SOURCE_TRACKING := true
+AUDIO_FEATURE_ENABLED_SOURCE_TRACKING := false
 AUDIO_FEATURE_ENABLED_GEF_SUPPORT := true
 BOARD_SUPPORTS_QAHW := false
-AUDIO_FEATURE_ENABLED_RAS := true
+AUDIO_FEATURE_ENABLED_RAS := false
 AUDIO_FEATURE_ENABLED_DLKM := true
 AUDIO_FEATURE_ENABLED_USB_BURST_MODE := false
 AUDIO_FEATURE_ENABLED_SVA_MULTI_STAGE := true
@@ -136,7 +136,7 @@
 ifneq ( ,$(filter S 12, $(PLATFORM_VERSION)))
 AUDIO_FEATURE_ENABLED_POWER_POLICY := true
 endif
-ifeq ($(TARGET_BOARD_PLATFORM)$(TARGET_BOARD_SUFFIX), msmnile_gvmq)
+ifneq ( ,$(filter msmnile_gvmq msmnile_au, $(TARGET_BOARD_PLATFORM)$(TARGET_BOARD_SUFFIX)))
 AUDIO_FEATURE_ENABLED_AUDIO_PARSERS := true
 endif
 ##AUTOMOTIVE_AUDIO_FEATURE_FLAGS
diff --git a/configs/msmsteppe_au/audio_effects.xml b/configs/msmsteppe_au/audio_effects.xml
index deb15ff..8477250 100644
--- a/configs/msmsteppe_au/audio_effects.xml
+++ b/configs/msmsteppe_au/audio_effects.xml
@@ -38,7 +38,6 @@
         <library name="proxy" path="libeffectproxy.so"/>
         <library name="offload_bundle" path="libqcompostprocbundle.so"/>
         <library name="audio_pre_processing" path="libqcomvoiceprocessing.so"/>
-        <library name="volume_listener" path="libvolumelistener.so"/>
         <library name="audiosphere" path="libasphere.so"/>
         <library name="shoebox" path="libshoebox.so"/>
         <library name="audio_bmt" path="libqtiautobundle.so"/>
@@ -89,11 +88,6 @@
         <effect name="dynamics_processing" library="dynamics_processing" uuid="e0e6539b-1781-7261-676f-6d7573696340"/>
         <effect name="aec" library="audio_pre_processing" uuid="0f8d0d2a-59e5-45fe-b6e4-248c8a799109"/>
         <effect name="ns" library="audio_pre_processing" uuid="1d97bb0b-9e2f-4403-9ae3-58c2554306f8"/>
-        <effect name="music_helper" library="volume_listener" uuid="08b8b058-0590-11e5-ac71-0025b32654a0"/>
-        <effect name="ring_helper" library="volume_listener" uuid="0956df94-0590-11e5-bdbe-0025b32654a0"/>
-        <effect name="alarm_helper" library="volume_listener" uuid="09f303e2-0590-11e5-8fdb-0025b32654a0"/>
-        <effect name="voice_helper" library="volume_listener" uuid="0ace5c08-0590-11e5-ae9e-0025b32654a0"/>
-        <effect name="notification_helper" library="volume_listener" uuid="0b776dde-0590-11e5-81ba-0025b32654a0"/>
         <effect name="audiosphere" library="audiosphere" uuid="184e62ab-2d19-4364-9d1b-c0a40733866c"/>
         <effect name="shoebox" library="shoebox" uuid="1eab784c-1a36-4b2a-b7fc-e34c44cab89e"/>
         <effect name="audio_bmt" library="audio_bmt" uuid="e039757b-a367-44e9-9bbb-634af0c51cb7"/>
@@ -105,21 +99,6 @@
         <effect name="audio_synth" library="audio_synth" uuid="a124b54f-4026-4ed2-9316-4ba2d5effdb8"/>
     </effects>
     <postprocess>
-        <stream type="music">
-            <apply effect="music_helper"/>
-        </stream>
-        <stream type="ring">
-            <apply effect="ring_helper"/>
-        </stream>
-        <stream type="alarm">
-            <apply effect="alarm_helper"/>
-        </stream>
-        <stream type="voice_call">
-            <apply effect="voice_helper"/>
-        </stream>
-        <stream type="notification">
-            <apply effect="notification_helper"/>
-        </stream>
     </postprocess>
     <preprocess>
         <stream type="voice_communication">
diff --git a/configs/msmsteppe_au/audio_io_policy.conf b/configs/msmsteppe_au/audio_io_policy.conf
index 412c248..f7aa755 100644
--- a/configs/msmsteppe_au/audio_io_policy.conf
+++ b/configs/msmsteppe_au/audio_io_policy.conf
@@ -102,6 +102,13 @@
     bit_width 16
     app_type 69936
   }
+  alerts {
+    flags AUDIO_OUTPUT_FLAG_ALERTS
+    formats AUDIO_FORMAT_PCM_16_BIT
+    sampling_rates 48000
+    bit_width 16
+    app_type 69937
+  }
   front_passenger {
     flags AUDIO_OUTPUT_FLAG_FRONT_PASSENGER
     formats AUDIO_FORMAT_PCM_16_BIT
diff --git a/configs/msmsteppe_au/audio_platform_info.xml b/configs/msmsteppe_au/audio_platform_info.xml
index 15e865d..0960da2 100644
--- a/configs/msmsteppe_au/audio_platform_info.xml
+++ b/configs/msmsteppe_au/audio_platform_info.xml
@@ -34,6 +34,7 @@
         <device name="SND_DEVICE_OUT_BUS_SYS" acdb_id="60"/>
         <device name="SND_DEVICE_OUT_BUS_NAV" acdb_id="14"/>
         <device name="SND_DEVICE_OUT_BUS_PHN" acdb_id="94"/>
+        <device name="SND_DEVICE_OUT_BUS_ALR" acdb_id="60"/>
         <device name="SND_DEVICE_OUT_BUS_PAX" acdb_id="60"/>
         <device name="SND_DEVICE_OUT_BUS_RSE" acdb_id="60"/>
         <device name="SND_DEVICE_OUT_BT_SCO" acdb_id="21"/>
@@ -107,6 +108,7 @@
         <usecase name="USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION" type="out" id="9"/>
         <usecase name="USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE" type="out" id="1"/>
         <usecase name="USECASE_AUDIO_PLAYBACK_PHONE" type="out" id="12"/>
+        <usecase name="USECASE_AUDIO_PLAYBACK_ALERTS" type="out" id="59"/>
         <usecase name="USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER" type="out" id="55"/>
         <usecase name="USECASE_AUDIO_PLAYBACK_REAR_SEAT" type="out" id="54"/>
         <usecase name="USECASE_VOICEMMODE1_CALL" type="in" id="2"/>
@@ -184,6 +186,7 @@
         <device name="SND_DEVICE_OUT_BUS_SYS" interface="TERT_TDM_RX_0"/>
         <device name="SND_DEVICE_OUT_BUS_NAV" interface="TERT_TDM_RX_1"/>
         <device name="SND_DEVICE_OUT_BUS_PHN" interface="TERT_TDM_RX_2"/>
+        <device name="SND_DEVICE_OUT_BUS_ALR" interface="TERT_TDM_RX_0"/>
         <device name="SND_DEVICE_OUT_BUS_PAX" interface="QUAT_TDM_RX_0"/>
         <device name="SND_DEVICE_OUT_BUS_RSE" interface="QUAT_TDM_RX_1"/>
         <device name="SND_DEVICE_OUT_ICC" interface="TERT_TDM_RX_0"/>
@@ -209,6 +212,7 @@
         <device name="SND_DEVICE_OUT_BUS_SYS" backend="sys-bus-out" interface="TERT_TDM_RX_0"/>
         <device name="SND_DEVICE_OUT_BUS_NAV" backend="nav-bus-out" interface="TERT_TDM_RX_1"/>
         <device name="SND_DEVICE_OUT_BUS_PHN" backend="phone-bus-out" interface="TERT_TDM_RX_2"/>
+        <device name="SND_DEVICE_OUT_BUS_ALR" backend="alerts-bus-out" interface="TERT_TDM_RX_0"/>
         <device name="SND_DEVICE_OUT_BUS_PAX" backend="pax-bus-out" interface="QUAT_TDM_RX_0"/>
         <device name="SND_DEVICE_OUT_BUS_RSE" backend="rse-bus-out" interface="QUIN_TDM_RX_0"/>
     </backend_names>
diff --git a/configs/msmsteppe_au/audio_policy_configuration.xml b/configs/msmsteppe_au/audio_policy_configuration.xml
index a8a0f95..c7bf080 100644
--- a/configs/msmsteppe_au/audio_policy_configuration.xml
+++ b/configs/msmsteppe_au/audio_policy_configuration.xml
@@ -57,6 +57,7 @@
                 <item>Sys Notification Bus</item>
                 <item>Nav Guidance Bus</item>
                 <item>Phone Bus</item>
+                <item>Alerts Bus</item>
                 <item>Front Passenger Bus</item>
                 <item>Rear Seat Bus</item>
                 <item>Built-In Mic</item>
@@ -106,6 +107,10 @@
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
                 </mixPort>
+                <mixPort name="alerts" role="source">
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+                </mixPort>
                 <mixPort name="front_passenger" role="source">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
@@ -303,6 +308,15 @@
                                 minValueMB="-6000" maxValueMB="600" defaultValueMB="0" stepValueMB="100"/>
                     </gains>
                 </devicePort>
+                <devicePort tagName="Alerts Bus" role="sink" type="AUDIO_DEVICE_OUT_BUS"
+                        address="BUS05_ALERTS">
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+                    <gains>
+                        <gain name="" mode="AUDIO_GAIN_MODE_JOINT"
+                                minValueMB="-6000" maxValueMB="600" defaultValueMB="0" stepValueMB="100"/>
+                    </gains>
+                </devicePort>
                 <devicePort tagName="Front Passenger Bus" role="sink" type="AUDIO_DEVICE_OUT_BUS"
                         address="BUS08_FRONT_PASSENGER">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
@@ -456,6 +470,8 @@
                        sources="nav_guidance,mmap_no_irq_out"/>
                 <route type="mix" sink="Phone Bus"
                        sources="phone,mmap_no_irq_out"/>
+                <route type="mix" sink="Alerts Bus"
+                       sources="alerts"/>
                 <route type="mix" sink="Front Passenger Bus"
                        sources="front_passenger,mmap_no_irq_out"/>
                 <route type="mix" sink="Rear Seat Bus"
diff --git a/configs/msmsteppe_au/mixer_paths_adp.xml b/configs/msmsteppe_au/mixer_paths_adp.xml
index 1036498..760437b 100644
--- a/configs/msmsteppe_au/mixer_paths_adp.xml
+++ b/configs/msmsteppe_au/mixer_paths_adp.xml
@@ -282,6 +282,11 @@
         <ctl name="TERT_TDM_RX_2 Audio Mixer MultiMedia10" value="1" />
     </path>
 
+    <path name="alerts-playback alerts-bus-out">
+        <ctl name="TERT_TDM_RX_0 Channels" value="Six" />
+        <ctl name="TERT_TDM_RX_0 Audio Mixer MultiMedia31" value="1" />
+    </path>
+
     <path name="front-passenger-playback pax-bus-out">
         <ctl name="QUAT_TDM_RX_0 Channels" value="Eight" />
         <ctl name="QUAT_TDM_RX_0 Audio Mixer MultiMedia23" value="1" />
diff --git a/configs/msmsteppe_au/mixer_paths_custom.xml b/configs/msmsteppe_au/mixer_paths_custom.xml
index 3360fa7..1895b28 100644
--- a/configs/msmsteppe_au/mixer_paths_custom.xml
+++ b/configs/msmsteppe_au/mixer_paths_custom.xml
@@ -1152,6 +1152,11 @@
         <ctl name="TERT_TDM_RX_2 Audio Mixer MultiMedia10" value="1" />
     </path>
 
+    <path name="alerts-playback">
+        <ctl name="TERT_TDM_RX_0 Channels" value="Six" />
+        <ctl name="TERT_TDM_RX_0 Audio Mixer MultiMedia31" value="1" />
+    </path>
+
     <path name="front-passenger-playback">
         <ctl name="QUAT_TDM_RX_0 Channels" value="Eight" />
         <ctl name="QUAT_TDM_RX_0 Audio Mixer MultiMedia23" value="1" />
diff --git a/configs/msmsteppe_au/msmsteppe_au.mk b/configs/msmsteppe_au/msmsteppe_au.mk
old mode 100755
new mode 100644
index d313d98..e298e06
--- a/configs/msmsteppe_au/msmsteppe_au.mk
+++ b/configs/msmsteppe_au/msmsteppe_au.mk
@@ -113,6 +113,9 @@
 ifneq ( ,$(filter S 12, $(PLATFORM_VERSION)))
 AUDIO_FEATURE_ENABLED_POWER_POLICY := true
 endif
+ifeq ($(TARGET_BOARD_PLATFORM)$(TARGET_BOARD_SUFFIX), sm6150_au)
+AUDIO_FEATURE_ENABLED_AUDIO_PARSERS := true
+endif
 ##AUTOMOTIVE_AUDIO_FEATURE_FLAGS
 
 ifneq ($(strip $(TARGET_USES_RRO)), true)
diff --git a/configure.ac b/configure.ac
old mode 100755
new mode 100644
index d2692c7..8c318df
--- a/configure.ac
+++ b/configure.ac
@@ -114,7 +114,7 @@
 if (test x$TARGET_SUPPORT = xsdmsteppe); then
          AC_SUBST([TARGET_PLATFORM], ["msm8974"])
          TARGET_CFLAGS="-DPLATFORM_MSMSTEPPE"
-         TARGET_CFLAGS+=" -DMAX_TARGET_SPECIFIC_CHANNEL_CNT=\"4\""
+         TARGET_CFLAGS+=" -DMAX_TARGET_SPECIFIC_CHANNEL_CNT=\"16\""
          TARGET_CFLAGS+=" -DINCALL_STEREO_CAPTURE_ENABLED"
 fi
 if (test x$TARGET_SUPPORT = xqrbx210); then
diff --git a/hal/Android.mk b/hal/Android.mk
index 41867c9..cd67541 100755
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -8,6 +8,14 @@
 
 AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
 
+ifneq ($(TARGET_BOARD_AUTO),true)
+LIBRARY_TINYCOMPRESS := libtinycompress
+LIBRARY_TINYCOMPRESS_INC := external/tinycompress/include
+else
+LIBRARY_TINYCOMPRESS := libqti-tinycompress
+LIBRARY_TINYCOMPRESS_INC := $(TOP)/vendor/qcom/opensource/tinycompress/include
+endif
+
 ifneq ($(filter msm8974 msm8226 msm8084 msm8610 apq8084 msm8994 msm8992 msm8996 msm8998 apq8098_latv sdm845 sdm710 qcs605 sdmshrike msmnile kona lahaina holi sdm660 msm8937 msm8953 $(MSMSTEPPE) $(TRINKET) lito atoll bengal,$(TARGET_BOARD_PLATFORM)),)
   # B-family platform uses msm8974 code base
   AUDIO_PLATFORM = msm8974
@@ -166,7 +174,7 @@
     liblog \
     libcutils \
     libtinyalsa \
-    libtinycompress \
+    $(LIBRARY_TINYCOMPRESS) \
     libaudioroute \
     libdl \
     libaudioutils \
@@ -177,7 +185,7 @@
 
 LOCAL_C_INCLUDES += \
     external/tinyalsa/include \
-    external/tinycompress/include \
+    $(LIBRARY_TINYCOMPRESS_INC) \
     system/media/audio_utils/include \
     external/expat/lib \
     $(call include-path-for, audio-route) \
diff --git a/hal/audio_extn/Android.mk b/hal/audio_extn/Android.mk
index 437300e..1e13f86 100644
--- a/hal/audio_extn/Android.mk
+++ b/hal/audio_extn/Android.mk
@@ -7,6 +7,14 @@
   AUDIO_KERNEL_INC := $(TARGET_OUT_INTERMEDIATES)/vendor/qcom/opensource/audio-kernel/include
 endif # BOARD_OPENSOURCE_DIR
 
+ifneq ($(TARGET_BOARD_AUTO),true)
+LIBRARY_TINYCOMPRESS := libtinycompress
+LIBRARY_TINYCOMPRESS_INC := external/tinycompress/include
+else
+LIBRARY_TINYCOMPRESS := libqti-tinycompress
+LIBRARY_TINYCOMPRESS_INC := $(TOP)/vendor/qcom/opensource/tinycompress/include
+endif
+
 #--------------------------------------------
 #          Build SND_MONITOR LIB
 #--------------------------------------------
@@ -34,14 +42,14 @@
     libcutils \
     liblog \
     libtinyalsa \
-    libtinycompress \
+    $(LIBRARY_TINYCOMPRESS) \
     libaudioroute \
     libdl \
     libexpat
 
 LOCAL_C_INCLUDES := \
     external/tinyalsa/include \
-    external/tinycompress/include \
+    $(LIBRARY_TINYCOMPRESS_INC) \
     system/media/audio_utils/include \
     external/expat/lib \
     $(call include-path-for, audio-route) \
@@ -107,14 +115,14 @@
     libcutils \
     liblog \
     libtinyalsa \
-    libtinycompress \
+    $(LIBRARY_TINYCOMPRESS) \
     libaudioroute \
     libdl \
     libexpat
 
 LOCAL_C_INCLUDES := \
     external/tinyalsa/include \
-    external/tinycompress/include \
+    $(LIBRARY_TINYCOMPRESS_INC) \
     system/media/audio_utils/include \
     external/expat/lib \
     $(call include-path-for, audio-route) \
@@ -176,7 +184,7 @@
     libcutils \
     liblog \
     libtinyalsa \
-    libtinycompress \
+    $(LIBRARY_TINYCOMPRESS) \
     libaudioroute \
     libdl \
     libexpat \
@@ -186,7 +194,7 @@
     $(PRIMARY_HAL_PATH) \
     $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \
     external/tinyalsa/include \
-    external/tinycompress/include \
+    $(LIBRARY_TINYCOMPRESS_INC) \
     external/expat/lib \
     system/media/audio_utils/include \
     $(call include-path-for, audio-route) \
@@ -247,14 +255,14 @@
     libcutils \
     liblog \
     libtinyalsa \
-    libtinycompress \
+    $(LIBRARY_TINYCOMPRESS) \
     libaudioroute \
     libdl \
     libexpat
 
 LOCAL_C_INCLUDES := \
     external/tinyalsa/include \
-    external/tinycompress/include \
+    $(LIBRARY_TINYCOMPRESS_INC) \
     system/media/audio_utils/include \
     external/expat/lib \
     $(call include-path-for, audio-route) \
@@ -320,14 +328,14 @@
     libcutils \
     liblog \
     libtinyalsa \
-    libtinycompress \
+    $(LIBRARY_TINYCOMPRESS) \
     libaudioroute \
     libdl \
     libexpat
 
 LOCAL_C_INCLUDES := \
     external/tinyalsa/include \
-    external/tinycompress/include \
+    $(LIBRARY_TINYCOMPRESS_INC) \
     system/media/audio_utils/include \
     external/expat/lib \
     $(call include-path-for, audio-route) \
@@ -401,7 +409,7 @@
 
 LOCAL_C_INCLUDES := \
     external/tinyalsa/include \
-    external/tinycompress/include \
+    $(LIBRARY_TINYCOMPRESS_INC) \
     system/media/audio_utils/include \
     external/expat/lib \
     $(call include-path-for, audio-route) \
@@ -464,7 +472,7 @@
     libcutils \
     liblog \
     libtinyalsa \
-    libtinycompress \
+    $(LIBRARY_TINYCOMPRESS) \
     libaudioroute \
     libdl \
     libexpat
@@ -473,7 +481,7 @@
     $(PRIMARY_HAL_PATH) \
     $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \
     external/tinyalsa/include \
-    external/tinycompress/include \
+    $(LIBRARY_TINYCOMPRESS_INC) \
     external/expat/lib \
     system/media/audio_utils/include \
     $(call include-path-for, audio-route) \
@@ -545,13 +553,13 @@
     libexpat \
     liblog \
     libtinyalsa \
-    libtinycompress
+    $(LIBRARY_TINYCOMPRESS)
 
 LOCAL_C_INCLUDES := \
     $(PRIMARY_HAL_PATH) \
     $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \
     external/tinyalsa/include \
-    external/tinycompress/include \
+    $(LIBRARY_TINYCOMPRESS_INC) \
     external/expat/lib \
     system/media/audio_utils/include \
     $(call include-path-for, audio-route) \
@@ -616,13 +624,13 @@
     libexpat \
     liblog \
     libtinyalsa \
-    libtinycompress
+    $(LIBRARY_TINYCOMPRESS)
 
 LOCAL_C_INCLUDES := \
     $(PRIMARY_HAL_PATH) \
     $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \
     external/tinyalsa/include \
-    external/tinycompress/include \
+    $(LIBRARY_TINYCOMPRESS_INC) \
     external/expat/lib \
     system/media/audio_utils/include \
     $(call include-path-for, audio-route) \
@@ -693,13 +701,13 @@
     libexpat \
     liblog \
     libtinyalsa \
-    libtinycompress
+    $(LIBRARY_TINYCOMPRESS)
 
 LOCAL_C_INCLUDES := \
     $(PRIMARY_HAL_PATH) \
     $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \
     external/tinyalsa/include \
-    external/tinycompress/include \
+    $(LIBRARY_TINYCOMPRESS_INC) \
     external/expat/lib \
     system/media/audio_utils/include \
     $(call include-path-for, audio-route) \
@@ -764,13 +772,13 @@
     libexpat \
     liblog \
     libtinyalsa \
-    libtinycompress
+    $(LIBRARY_TINYCOMPRESS)
 
 LOCAL_C_INCLUDES := \
     $(PRIMARY_HAL_PATH) \
     $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \
     external/tinyalsa/include \
-    external/tinycompress/include \
+    $(LIBRARY_TINYCOMPRESS_INC) \
     external/expat/lib \
     system/media/audio_utils/include \
     $(call include-path-for, audio-route) \
@@ -833,13 +841,13 @@
     libexpat \
     liblog \
     libtinyalsa \
-    libtinycompress
+    $(LIBRARY_TINYCOMPRESS)
 
 LOCAL_C_INCLUDES := \
     $(PRIMARY_HAL_PATH) \
     $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \
     external/tinyalsa/include \
-    external/tinycompress/include \
+    $(LIBRARY_TINYCOMPRESS_INC) \
     external/expat/lib \
     system/media/audio_utils/include \
     $(TARGET_OUT_HEADERS)/mm-audio/audio-parsers \
@@ -917,7 +925,7 @@
     libhidlbase \
     liblog \
     libtinyalsa \
-    libtinycompress \
+    $(LIBRARY_TINYCOMPRESS) \
     libutils \
 
 LOCAL_STATIC_LIBRARIES := \
@@ -927,7 +935,7 @@
     $(PRIMARY_HAL_PATH) \
     $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \
     external/tinyalsa/include \
-    external/tinycompress/include \
+    $(LIBRARY_TINYCOMPRESS_INC) \
     external/expat/lib \
     system/media/audio_utils/include \
     $(call include-path-for, audio-route) \
@@ -982,13 +990,13 @@
     libexpat \
     liblog \
     libtinyalsa \
-    libtinycompress
+    $(LIBRARY_TINYCOMPRESS)
 
 LOCAL_C_INCLUDES := \
     $(PRIMARY_HAL_PATH) \
     $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \
     external/tinyalsa/include \
-    external/tinycompress/include \
+    $(LIBRARY_TINYCOMPRESS_INC) \
     external/expat/lib \
     system/media/audio_utils/include \
     $(call include-path-for, audio-route) \
@@ -1041,7 +1049,7 @@
     libcutils \
     liblog \
     libtinyalsa \
-    libtinycompress \
+    $(LIBRARY_TINYCOMPRESS) \
     libaudioroute \
     libdl \
     libexpat
@@ -1050,7 +1058,7 @@
     $(PRIMARY_HAL_PATH) \
     $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \
     external/tinyalsa/include \
-    external/tinycompress/include \
+    $(LIBRARY_TINYCOMPRESS_INC) \
     external/expat/lib \
     system/media/audio_utils/include \
     $(call include-path-for, audio-route) \
@@ -1107,7 +1115,7 @@
     libcutils \
     liblog \
     libtinyalsa \
-    libtinycompress \
+    $(LIBRARY_TINYCOMPRESS) \
     libaudioroute \
     libdl \
     libexpat
@@ -1116,7 +1124,7 @@
     $(PRIMARY_HAL_PATH) \
     $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \
     external/tinyalsa/include \
-    external/tinycompress/include \
+    $(LIBRARY_TINYCOMPRESS_INC) \
     external/expat/lib \
     system/media/audio_utils/include \
     $(call include-path-for, audio-route) \
@@ -1183,7 +1191,7 @@
     $(PRIMARY_HAL_PATH) \
     $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \
     external/tinyalsa/include \
-    external/tinycompress/include \
+    $(LIBRARY_TINYCOMPRESS_INC) \
     external/expat/lib \
     system/media/audio_utils/include \
     $(call include-path-for, audio-route) \
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index 81fdcc3..c4fa9ac 100644
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -479,7 +479,7 @@
         cust_ch_mixer_cfg[len++] = pinfo->ip_channels;
         cust_ch_mixer_cfg[len++] = pinfo->op_channels;
         for (i = 0; i < (int) (pinfo->op_channels * pinfo->ip_channels); i++) {
-            ALOGV("%s: coeff[%d] %d", __func__, i, params->coeffs[i]);
+            ALOGV("%s: coeff[%d] %lu", __func__, i, (unsigned long )params->coeffs[i]);
             cust_ch_mixer_cfg[len++] = params->coeffs[i];
         }
         err = mixer_ctl_set_array(ctl, cust_ch_mixer_cfg, len);
@@ -634,7 +634,7 @@
     struct mixer_ctl *ctl = NULL;
     char mixer_ctl_name[128] = {0};
     int ret = 0;
-    int channel_map[AUDIO_MAX_DSP_CHANNELS] = {0};
+    long channel_map[AUDIO_MAX_DSP_CHANNELS] = {0};
 
     ALOGV("%s channel_count %d", __func__, ch_count);
 
@@ -3790,7 +3790,8 @@
 
     int max_mic_count = platform_get_max_mic_count(adev->platform);
     /* validate input params. Avoid updated channel mask if loopback device */
-    if ((channel_count == 6) &&
+    /* validate input params. Avoid updated channel mask if HDMI or loopback device */
+    if ((channel_count > max_mic_count) &&
         (in->format == AUDIO_FORMAT_PCM_16_BIT) &&
         (!is_loopback_input_device(get_device_types(&in->device_list)))) {
         switch (max_mic_count) {
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index f2038d8..057d9a8 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -98,6 +98,14 @@
 #define AUDIO_OUTPUT_FLAG_INTERACTIVE 0x4000000
 #endif
 
+#ifndef AUDIO_DEVICE_IN_SPEAKER_MIC2
+#define AUDIO_DEVICE_IN_SPEAKER_MIC2 0x10000000
+#endif
+
+#ifndef AUDIO_DEVICE_IN_SPEAKER_MIC3
+#define AUDIO_DEVICE_IN_SPEAKER_MIC3 0x20000000
+#endif
+
 int audio_extn_parse_compress_metadata(struct stream_out *out,
                                        struct str_parms *parms);
 
@@ -1345,6 +1353,9 @@
 #ifndef AUDIO_OUTPUT_FLAG_PHONE
 #define AUDIO_OUTPUT_FLAG_PHONE 0x800000
 #endif
+#ifndef AUDIO_OUTPUT_FLAG_ALERTS
+#define AUDIO_OUTPUT_FLAG_ALERTS 0x4000000
+#endif
 #ifndef AUDIO_OUTPUT_FLAG_FRONT_PASSENGER
 #define AUDIO_OUTPUT_FLAG_FRONT_PASSENGER 0x1000000
 #endif
diff --git a/hal/audio_extn/auto_hal.c b/hal/audio_extn/auto_hal.c
index 6ee6859..903bc13 100644
--- a/hal/audio_extn/auto_hal.c
+++ b/hal/audio_extn/auto_hal.c
@@ -444,6 +444,13 @@
             out->flags |= AUDIO_OUTPUT_FLAG_PHONE;
         out->volume_l = out->volume_r = MAX_VOLUME_GAIN;
         break;
+    case CAR_AUDIO_STREAM_ALERTS:
+        out->usecase = USECASE_AUDIO_PLAYBACK_ALERTS;
+        out->config = pcm_config_system;
+        if (out->flags == AUDIO_OUTPUT_FLAG_NONE)
+            out->flags |= AUDIO_OUTPUT_FLAG_ALERTS;
+        out->volume_l = out->volume_r = MAX_VOLUME_GAIN;
+        break;
     case CAR_AUDIO_STREAM_FRONT_PASSENGER:
         out->usecase = USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER;
         out->config = pcm_config_system;
@@ -502,6 +509,9 @@
     case CAR_AUDIO_STREAM_PHONE:
         snd_device = SND_DEVICE_OUT_BUS_PHN;
         break;
+    case CAR_AUDIO_STREAM_ALERTS:
+        snd_device = SND_DEVICE_OUT_BUS_ALR;
+        break;
     case CAR_AUDIO_STREAM_FRONT_PASSENGER:
         snd_device = SND_DEVICE_OUT_BUS_PAX;
         break;
@@ -937,6 +947,9 @@
                     case CAR_AUDIO_STREAM_PHONE:
                         snd_device = SND_DEVICE_OUT_BUS_PHN;
                         break;
+                    case CAR_AUDIO_STREAM_ALERTS:
+                        snd_device = SND_DEVICE_OUT_BUS_ALR;
+                        break;
                     case CAR_AUDIO_STREAM_FRONT_PASSENGER:
                         snd_device = SND_DEVICE_OUT_BUS_PAX;
                         break;
@@ -959,6 +972,9 @@
         case USECASE_AUDIO_PLAYBACK_PHONE:
             snd_device = SND_DEVICE_OUT_BUS_PHN;
             break;
+        case USECASE_AUDIO_PLAYBACK_ALERTS:
+            snd_device = SND_DEVICE_OUT_BUS_ALR;
+            break;
         case USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER:
             snd_device = SND_DEVICE_OUT_BUS_PAX;
             break;
diff --git a/hal/audio_extn/auto_hal.h b/hal/audio_extn/auto_hal.h
index 374e2ec..dfe78f2 100644
--- a/hal/audio_extn/auto_hal.h
+++ b/hal/audio_extn/auto_hal.h
@@ -115,6 +115,7 @@
     USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION,
     USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE,
     USECASE_AUDIO_PLAYBACK_PHONE,
+    USECASE_AUDIO_PLAYBACK_ALERTS,
     USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER,
     USECASE_AUDIO_PLAYBACK_REAR_SEAT,
     USECASE_AUDIO_RECORD_BUS,
diff --git a/hal/audio_extn/spkr_protection.c b/hal/audio_extn/spkr_protection.c
index 418707b..571b4f3 100644
--- a/hal/audio_extn/spkr_protection.c
+++ b/hal/audio_extn/spkr_protection.c
@@ -1877,7 +1877,7 @@
     if (ioctl(cal_fd, AUDIO_SET_CALIBRATION, &cal_data))
         ALOGE("%s: failed to set TH VI V_VALI_CFG, errno = %d", __func__, errno);
 
-    if (cal_fd > 0)
+    if (cal_fd >= 0)
         close(cal_fd);
 done:
     return ret;
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index 9a4a848..6c97447 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -155,6 +155,7 @@
     STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_SYS_NOTIFICATION),
     STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_NAV_GUIDANCE),
     STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_PHONE),
+    STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_ALERTS),
     STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_FRONT_PASSENGER),
     STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_REAR_SEAT),
     STRING_TO_ENUM(AUDIO_INPUT_FLAG_NONE),
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index ef6bc40..05a33b4 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -148,6 +148,9 @@
 #define STR(x) #x
 #endif
 
+#define IS_USB_HIFI (MAX_HIFI_CHANNEL_COUNT >= MAX_CHANNEL_COUNT) ? \
+                     true : false
+
 #ifdef LINUX_ENABLED
 static inline int64_t audio_utils_ns_from_timespec(const struct timespec *ts)
 {
@@ -489,6 +492,7 @@
     [USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION] = "sys-notification-playback",
     [USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE] = "nav-guidance-playback",
     [USECASE_AUDIO_PLAYBACK_PHONE] = "phone-playback",
+    [USECASE_AUDIO_PLAYBACK_ALERTS] = "alerts-playback",
     [USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER] = "front-passenger-playback",
     [USECASE_AUDIO_PLAYBACK_REAR_SEAT] = "rear-seat-playback",
     [USECASE_AUDIO_FM_TUNER_EXT] = "fm-tuner-ext",
@@ -798,6 +802,17 @@
     return 0;
 }
 
+bool is_combo_audio_input_device(struct listnode *devices){
+
+    if (devices == NULL)
+        return false;
+
+    if(compare_device_type(devices, AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_SPEAKER_MIC2))
+        return true;
+    else
+        return false;
+}
+
 static inline void adjust_frames_for_device_delay(struct stream_out *out,
                                                   uint32_t *dsp_frames) {
     // Adjustment accounts for A2dp encoder latency with offload usecases
@@ -1443,7 +1458,11 @@
 
     if (usecase->type == PCM_CAPTURE) {
         in = usecase->stream.in;
-        if (in && is_loopback_input_device(get_device_types(&in->device_list))) {
+        if ((in && is_loopback_input_device(get_device_types(&in->device_list))) ||
+            (in && is_combo_audio_input_device(&in->device_list)) ||
+            (in && ((compare_device_type(&in->device_list, AUDIO_DEVICE_IN_BUILTIN_MIC) ||
+                     compare_device_type(&in->device_list, AUDIO_DEVICE_IN_LINE)) &&
+                    (snd_device == SND_DEVICE_IN_HANDSET_GENERIC_6MIC)))) {
             ALOGD("%s: set custom mtmx params v1", __func__);
             audio_extn_set_custom_mtmx_params_v1(adev, usecase, true);
         }
@@ -1538,7 +1557,11 @@
 
     if (usecase->type == PCM_CAPTURE) {
         in = usecase->stream.in;
-        if (in && is_loopback_input_device(get_device_types(&in->device_list))) {
+        if ((in && is_loopback_input_device(get_device_types(&in->device_list))) ||
+            (in && is_combo_audio_input_device(&in->device_list)) ||
+            (in && ((compare_device_type(&in->device_list, AUDIO_DEVICE_IN_BUILTIN_MIC) ||
+                    compare_device_type(&in->device_list, AUDIO_DEVICE_IN_LINE)) &&
+                    (snd_device == SND_DEVICE_IN_HANDSET_GENERIC_6MIC)))){
             ALOGD("%s: reset custom mtmx params v1", __func__);
             audio_extn_set_custom_mtmx_params_v1(adev, usecase, false);
         }
@@ -4707,9 +4730,10 @@
                                     int channel_count,
                                     bool is_low_latency)
 {
+    bool is_usb_hifi = IS_USB_HIFI;
     /* Don't know if USB HIFI in this context so use true to be conservative */
     if (check_input_parameters(sample_rate, format, channel_count,
-                               true /*is_usb_hifi */) != 0)
+                               is_usb_hifi) != 0)
         return 0;
 
     return get_stream_buffer_size(AUDIO_CAPTURE_PERIOD_DURATION_MSEC,
@@ -9592,11 +9616,12 @@
 static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev __unused,
                                          const struct audio_config *config)
 {
+    bool is_usb_hifi = IS_USB_HIFI;
     int channel_count = audio_channel_count_from_in_mask(config->channel_mask);
 
     /* Don't know if USB HIFI in this context so use true to be conservative */
     if (check_input_parameters(config->sample_rate, config->format, channel_count,
-                               true /*is_usb_hifi */) != 0)
+                              is_usb_hifi) != 0)
         return 0;
 
     return get_input_buffer_size(config->sample_rate, config->format, channel_count,
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index ecffc06..d24202c 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -302,6 +302,7 @@
     USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION,
     USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE,
     USECASE_AUDIO_PLAYBACK_PHONE,
+    USECASE_AUDIO_PLAYBACK_ALERTS,
     USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER,
     USECASE_AUDIO_PLAYBACK_REAR_SEAT,
     USECASE_AUDIO_RECORD_BUS,
@@ -403,6 +404,7 @@
     CAR_AUDIO_STREAM_NAV_GUIDANCE       = 0x4,
     CAR_AUDIO_STREAM_PHONE              = 0x8,
     CAR_AUDIO_STREAM_IN_PRIMARY         = 0x10,
+    CAR_AUDIO_STREAM_ALERTS             = 0x20,
     CAR_AUDIO_STREAM_FRONT_PASSENGER    = 0x100,
     CAR_AUDIO_STREAM_IN_FRONT_PASSENGER = 0x200,
     CAR_AUDIO_STREAM_REAR_SEAT          = 0x10000,
@@ -906,6 +908,7 @@
 #define CHECK(condition) LOG_ALWAYS_FATAL_IF(!(condition), "%s",\
             __FILE__ ":" LITERAL_TO_STRING(__LINE__)\
             " ASSERT_FATAL(" #condition ") failed.")
+bool is_combo_audio_input_device(struct listnode *devices);
 
 static inline bool is_loopback_input_device(audio_devices_t device) {
     if (!audio_is_output_device(device) &&
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
old mode 100755
new mode 100644
index 59c3c8f..52df55c
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -542,6 +542,8 @@
                                              NAV_GUIDANCE_PCM_DEVICE},
     [USECASE_AUDIO_PLAYBACK_PHONE] = {PHONE_PCM_DEVICE,
                                       PHONE_PCM_DEVICE},
+    [USECASE_AUDIO_PLAYBACK_ALERTS] = {ALERTS_PCM_DEVICE,
+                                      ALERTS_PCM_DEVICE},
     [USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER] = {FRONT_PASSENGER_PCM_DEVICE,
                                                 FRONT_PASSENGER_PCM_DEVICE},
     [USECASE_AUDIO_PLAYBACK_REAR_SEAT] = {REAR_SEAT_PCM_DEVICE,
@@ -661,6 +663,7 @@
     [SND_DEVICE_OUT_BUS_SYS] = "bus-speaker",
     [SND_DEVICE_OUT_BUS_NAV] = "bus-speaker",
     [SND_DEVICE_OUT_BUS_PHN] = "bus-speaker",
+    [SND_DEVICE_OUT_BUS_ALR] = "bus-speaker",
     [SND_DEVICE_OUT_BUS_PAX] = "bus-speaker",
     [SND_DEVICE_OUT_BUS_RSE] = "bus-speaker",
     [SND_DEVICE_OUT_CALL_PROXY] = "call-proxy",
@@ -821,6 +824,17 @@
     [SND_DEVICE_IN_ICC] = "speaker-mic",
     [SND_DEVICE_IN_SYNTH_MIC] = "speaker-mic",
     [SND_DEVICE_IN_ECHO_REFERENCE] = "echo-reference",
+    [SND_DEVICE_IN_HANDSET_GENERIC_DMIC] = "dmic-endfire",
+    [SND_DEVICE_IN_HANDSET_GENERIC_6MIC] = "handset-6mic",
+    [SND_DEVICE_IN_HANDSET_GENERIC_8MIC] = "handset-8mic",
+    [SND_DEVICE_IN_HANDSET_GENERIC_DMIC_AND_EC_REF_LOOPBACK] = "handset-dmic-and-ec-ref-loopback",
+    [SND_DEVICE_IN_HANDSET_GENERIC_QMIC_AND_EC_REF_LOOPBACK] = "handset-qmic-and-ec-ref-loopback",
+    [SND_DEVICE_IN_HANDSET_GENERIC_6MIC_AND_EC_REF_LOOPBACK] = "handset-6mic-and-ec-ref-loopback",
+    [SND_DEVICE_IN_HANDSET_GENERIC_8MIC_AND_EC_REF_LOOPBACK] = "handset-8mic-and-ec-ref-loopback",
+    [SND_DEVICE_IN_ECALL] = "handset-mic",
+    [SND_DEVICE_IN_SPEAKER_MIC2] = "speaker-mic2",
+    [SND_DEVICE_IN_SPEAKER_MIC3] = "speaker-mic3",
+    [SND_DEVICE_IN_HANDSET_GENERIC_6MIC_AND_SPEAKER_MIC2] = "handset-6mic-and-speaker-mic2",
 };
 
 // Platform specific backend bit width table
@@ -968,6 +982,7 @@
     [SND_DEVICE_OUT_BUS_SYS] = 60,
     [SND_DEVICE_OUT_BUS_NAV] = 14,
     [SND_DEVICE_OUT_BUS_PHN] = 94,
+    [SND_DEVICE_OUT_BUS_ALR] = 60,
     [SND_DEVICE_OUT_BUS_PAX] = 60,
     [SND_DEVICE_OUT_BUS_RSE] = 60,
     [SND_DEVICE_OUT_CALL_PROXY] = 32,
@@ -1118,6 +1133,8 @@
     [SND_DEVICE_IN_CALL_PROXY] = 33,
     [SND_DEVICE_IN_ICC] = 46,
     [SND_DEVICE_IN_SYNTH_MIC] = 11,
+    [SND_DEVICE_IN_SPEAKER_MIC2] = 11,
+    [SND_DEVICE_IN_SPEAKER_MIC3] = 11,
 };
 
 struct name_to_index {
@@ -1225,6 +1242,7 @@
     {TO_NAME_INDEX(SND_DEVICE_OUT_BUS_SYS)},
     {TO_NAME_INDEX(SND_DEVICE_OUT_BUS_NAV)},
     {TO_NAME_INDEX(SND_DEVICE_OUT_BUS_PHN)},
+    {TO_NAME_INDEX(SND_DEVICE_OUT_BUS_ALR)},
     {TO_NAME_INDEX(SND_DEVICE_OUT_BUS_PAX)},
     {TO_NAME_INDEX(SND_DEVICE_OUT_BUS_RSE)},
     {TO_NAME_INDEX(SND_DEVICE_OUT_CALL_PROXY)},
@@ -1383,6 +1401,16 @@
     {TO_NAME_INDEX(SND_DEVICE_OUT_ICC)},
     {TO_NAME_INDEX(SND_DEVICE_OUT_SYNTH_SPKR)},
     {TO_NAME_INDEX(SND_DEVICE_IN_SYNTH_MIC)},
+    {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_DMIC)},
+    {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_6MIC)},
+    {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_8MIC)},
+    {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_DMIC_AND_EC_REF_LOOPBACK)},
+    {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_QMIC_AND_EC_REF_LOOPBACK)},
+    {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_6MIC_AND_EC_REF_LOOPBACK)},
+    {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_8MIC_AND_EC_REF_LOOPBACK)},
+    {TO_NAME_INDEX(SND_DEVICE_IN_SPEAKER_MIC2)},
+    {TO_NAME_INDEX(SND_DEVICE_IN_SPEAKER_MIC3)},
+    {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_6MIC_AND_SPEAKER_MIC2)},
 };
 
 static char * backend_tag_table[SND_DEVICE_MAX] = {0};
@@ -1454,6 +1482,7 @@
     {TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION)},
     {TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_NAV_GUIDANCE)},
     {TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_PHONE)},
+    {TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_ALERTS)},
     {TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER)},
     {TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_REAR_SEAT)},
     {TO_NAME_INDEX(USECASE_AUDIO_RECORD_VOIP_LOW_LATENCY)},
@@ -2460,6 +2489,8 @@
     backend_tag_table[SND_DEVICE_OUT_CALL_PROXY] = strdup("call-proxy");
     backend_tag_table[SND_DEVICE_OUT_HAPTICS] = strdup("haptics");
     backend_tag_table[SND_DEVICE_IN_CALL_PROXY] = strdup("call-proxy-in");
+    backend_tag_table[SND_DEVICE_IN_SPEAKER_MIC2] = strdup("speaker-mic2");
+    backend_tag_table[SND_DEVICE_IN_SPEAKER_MIC3] = strdup("speaker-mic3");
 
     hw_interface_table[SND_DEVICE_OUT_HANDSET] = strdup("SLIMBUS_0_RX");
     hw_interface_table[SND_DEVICE_OUT_SPEAKER] = strdup("SLIMBUS_0_RX");
@@ -2560,6 +2591,7 @@
     hw_interface_table[SND_DEVICE_OUT_BUS_SYS] = strdup("TERT_TDM_RX_0");
     hw_interface_table[SND_DEVICE_OUT_BUS_NAV] = strdup("TERT_TDM_RX_1");
     hw_interface_table[SND_DEVICE_OUT_BUS_PHN] = strdup("TERT_TDM_RX_2");
+    hw_interface_table[SND_DEVICE_OUT_BUS_ALR] = strdup("TERT_TDM_RX_0");
     hw_interface_table[SND_DEVICE_OUT_BUS_PAX] = strdup("QUAT_TDM_RX_0");
     hw_interface_table[SND_DEVICE_OUT_BUS_RSE] = strdup("QUIN_TDM_RX_0");
     hw_interface_table[SND_DEVICE_OUT_CALL_PROXY] = strdup("CALL_PROXY_RX");
@@ -2709,6 +2741,8 @@
     hw_interface_table[SND_DEVICE_OUT_SYNTH_SPKR] = strdup("TERT_TDM_RX_0");
     hw_interface_table[SND_DEVICE_IN_SYNTH_MIC] = strdup("TERT_TDM_TX_0");
     hw_interface_table[SND_DEVICE_IN_ECHO_REFERENCE] = strdup("SEC_TDM_TX_0");
+    hw_interface_table[SND_DEVICE_IN_SPEAKER_MIC2] = strdup("QUAT_TDM_TX_0");
+    hw_interface_table[SND_DEVICE_IN_SPEAKER_MIC3] = strdup("SEN_TDM_TX_0");
     my_data->max_mic_count = PLATFORM_DEFAULT_MIC_COUNT;
 
      /*remove ALAC & APE from DSP decoder list based on software decoder availability*/
@@ -3084,6 +3118,10 @@
 {
     // support max to mono, example if max count is 3, usecase supports Three, dual and mono mic
     switch (my_data->max_mic_count) {
+        case 10:
+            my_data->source_mic_type |= SOURCE_DEC_MIC;
+        case 8:
+            my_data->source_mic_type |= SOURCE_OCT_MIC;
         case 6:
             my_data->source_mic_type |= SOURCE_HEX_MIC;
         case 4:
@@ -4064,6 +4102,31 @@
             strdup("QUAT_MI2S_TX Channels");
     }
 
+    my_data->current_backend_cfg[SEC_MI2S_RX_BACKEND].samplerate_mixer_ctl =
+        strdup("SEC_MI2S_RX SampleRate");
+    my_data->current_backend_cfg[SEC_MI2S_RX_BACKEND].channels_mixer_ctl =
+        strdup("SEC_MI2S_RX Channels");
+    my_data->current_backend_cfg[TERT_MI2S_RX_BACKEND].bitwidth_mixer_ctl =
+        strdup("TERT_MI2S_RX Format");
+    my_data->current_backend_cfg[TERT_MI2S_RX_BACKEND].samplerate_mixer_ctl =
+        strdup("TERT_MI2S_RX SampleRate");
+    my_data->current_backend_cfg[TERT_MI2S_RX_BACKEND].channels_mixer_ctl =
+        strdup("TERT_MI2S_RX Channels");
+
+    my_data->current_backend_cfg[TERT_MI2S_TX_BACKEND].bitwidth_mixer_ctl =
+        strdup("TERT_MI2S_TX Format");
+    my_data->current_backend_cfg[TERT_MI2S_TX_BACKEND].samplerate_mixer_ctl =
+        strdup("TERT_MI2S_TX SampleRate");
+    my_data->current_backend_cfg[TERT_MI2S_TX_BACKEND].channels_mixer_ctl =
+        strdup("TERT_MI2S_TX Channels");
+
+    my_data->current_backend_cfg[QUAT_MI2S_RX_BACKEND].bitwidth_mixer_ctl =
+        strdup("QUAT_MI2S_RX Format");
+    my_data->current_backend_cfg[QUAT_MI2S_RX_BACKEND].samplerate_mixer_ctl =
+        strdup("QUAT_MI2S_RX SampleRate");
+    my_data->current_backend_cfg[QUAT_MI2S_RX_BACKEND].channels_mixer_ctl =
+        strdup("QUAT_MI2S_RX Channels");
+
     my_data->current_backend_cfg[SPDIF_TX_BACKEND].bitwidth_mixer_ctl =
         strdup("PRIM_SPDIF_TX Format");
     my_data->current_backend_cfg[SPDIF_TX_BACKEND].samplerate_mixer_ctl =
@@ -5498,6 +5561,15 @@
                         port = HEADSET_TX_BACKEND;
                 else if (strcmp(backend_tag_table[snd_device], "call-proxy-in") == 0)
                         port = CALL_PROXY_TX_BACKEND;
+                else if (!strncmp(platform_get_snd_device_backend_interface(snd_device),
+                         "QUAT_TDM_TX_0", sizeof("QUAT_TDM_TX_0")))
+                         port = QUAT_TDM_TX_BACKEND;
+                else if (!strncmp(platform_get_snd_device_backend_interface(snd_device),
+                         "SEN_TDM_TX_0", sizeof("SEN_TDM_TX_0")))
+                        port = SEN_TDM_TX_BACKEND;
+                else if (!strncmp(platform_get_snd_device_backend_interface(snd_device),
+                         "TERT_MI2S_TX", sizeof("TERT_MI2S_TX")))
+                        port = TERT_MI2S_TX_BACKEND;
         }
     } else {
         ALOGW("%s:napb: Invalid device - %d ", __func__, snd_device);
@@ -6329,6 +6401,31 @@
         new_snd_devices[0] = SND_DEVICE_IN_HANDSET_8MIC;
         new_snd_devices[1] = SND_DEVICE_IN_EC_REF_LOOPBACK;
         ret = 0;
+    } else if (SND_DEVICE_IN_HANDSET_GENERIC_DMIC_AND_EC_REF_LOOPBACK == snd_device) {
+        *num_devices = 2;
+        new_snd_devices[0] = SND_DEVICE_IN_HANDSET_GENERIC_DMIC;
+        new_snd_devices[1] = SND_DEVICE_IN_EC_REF_LOOPBACK;
+        ret = 0;
+    } else if (SND_DEVICE_IN_HANDSET_GENERIC_QMIC_AND_EC_REF_LOOPBACK == snd_device) {
+        *num_devices = 2;
+        new_snd_devices[0] = SND_DEVICE_IN_HANDSET_GENERIC_QMIC;
+        new_snd_devices[1] = SND_DEVICE_IN_EC_REF_LOOPBACK;
+        ret = 0;
+    } else if (SND_DEVICE_IN_HANDSET_GENERIC_6MIC_AND_EC_REF_LOOPBACK == snd_device) {
+        *num_devices = 2;
+        new_snd_devices[0] = SND_DEVICE_IN_HANDSET_GENERIC_6MIC;
+        new_snd_devices[1] = SND_DEVICE_IN_EC_REF_LOOPBACK;
+        ret = 0;
+    } else if (SND_DEVICE_IN_HANDSET_GENERIC_8MIC_AND_EC_REF_LOOPBACK == snd_device) {
+        *num_devices = 2;
+        new_snd_devices[0] = SND_DEVICE_IN_HANDSET_GENERIC_8MIC;
+        new_snd_devices[1] = SND_DEVICE_IN_EC_REF_LOOPBACK;
+        ret = 0;
+    } else if (SND_DEVICE_IN_HANDSET_GENERIC_6MIC_AND_SPEAKER_MIC2 == snd_device) {
+        *num_devices = 2;
+        new_snd_devices[0] = SND_DEVICE_IN_HANDSET_GENERIC_6MIC;
+        new_snd_devices[1] = SND_DEVICE_IN_SPEAKER_MIC2;
+        ret = 0;
     }
 
 
@@ -6884,9 +6981,8 @@
             snd_device = SND_DEVICE_OUT_SPEAKER_VBAT;
           else if (my_data->is_wsa_speaker)
             snd_device = SND_DEVICE_OUT_SPEAKER_WSA;
-          else {
+          else
             snd_device = SND_DEVICE_OUT_SPEAKER;
-          }
     } else if (is_sco_out_device_type(&devices)) {
         if (adev->swb_speech_mode != SPEECH_MODE_INVALID)
                 snd_device = SND_DEVICE_OUT_BT_SCO_SWB;
@@ -7392,7 +7488,7 @@
                (my_data->source_mic_type & SOURCE_QUAD_MIC) &&  // AND 4mic is available
                (compare_device_type(&in_devices, AUDIO_DEVICE_IN_BUILTIN_MIC) ||    // AND device is buit-in mic or back mic
                 compare_device_type(&in_devices, AUDIO_DEVICE_IN_BACK_MIC)) &&
-               (my_data->fluence_in_audio_rec == true &&       //  AND fluencepro is enabled
+               (my_data->fluence_in_audio_rec == true &&  (channel_count == 4)  && //  AND fluencepro is enabled
                 my_data->fluence_type & FLUENCE_QUAD_MIC) &&
                (source == AUDIO_SOURCE_CAMCORDER ||           // AND source is cam/mic/unprocessed
                 source == AUDIO_SOURCE_UNPROCESSED ||
@@ -7400,36 +7496,55 @@
                 snd_device = SND_DEVICE_IN_HANDSET_GENERIC_QMIC;
                 platform_set_echo_reference(adev, true, out_devices);
     } else if (my_data->use_generic_handset == true &&          // System prop is enabled
-               (my_data->ambisonic_capture == true) &&          // Enable Ambisonic capture
-               (my_data->source_mic_type & SOURCE_QUAD_MIC) &&  // AND 4mic is available
-               (compare_device_type(&in_devices, AUDIO_DEVICE_IN_BUILTIN_MIC) ||    // AND device is Built-in
-                compare_device_type(&in_devices, AUDIO_DEVICE_IN_BACK_MIC)) &&       // OR Back-mic
+              (my_data->source_mic_type & SOURCE_QUAD_MIC) &&  // AND 4mic is available
+               (compare_device_type(&in_devices, AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_SPEAKER_MIC2) ||
+                compare_device_type(&in_devices, AUDIO_DEVICE_IN_BUILTIN_MIC) ||   // AND device is Built-in
+                compare_device_type(&in_devices, AUDIO_DEVICE_IN_BACK_MIC)) &&
+                     // OR Back-mic
                (source == AUDIO_SOURCE_MIC ||                   // AND source is MIC for 16bit
                 source == AUDIO_SOURCE_UNPROCESSED ||           // OR unprocessed for 24bit
-                source == AUDIO_SOURCE_CAMCORDER) &&            // OR camera usecase
-                ((int)channel_mask == (int)AUDIO_CHANNEL_INDEX_MASK_4) && // AND 4mic channel mask
-                (sample_rate == 48000)) {             // AND sample rate is 48Khz
+                source == AUDIO_SOURCE_CAMCORDER)) {            // OR camera usecase
+
+            if ( my_data->ambisonic_capture == true )
+            {
                 snd_device = SND_DEVICE_IN_HANDSET_GENERIC_QMIC;
                 /* Below check is true only in LA build to set
-                   ambisonic profile. In LE hal client will set profile
-                 */
+                ambisonic profile. In LE hal client will set profile
+                */
                 if (my_data->ambisonic_profile == true &&
                     in != NULL)
                     strlcpy(in->profile, "record_ambisonic",
                             sizeof(in->profile));
 
                 if (in != NULL && !strncmp(in->profile, "record_ambisonic",
-                                           strlen("record_ambisonic"))) {
+                                        strlen("record_ambisonic")))
+                {
                     /* Validate input stream configuration for
-                       Ambisonic capture.
-                     */
+                    Ambisonic capture.
+                    */
                     if (((int)channel_mask != (int)AUDIO_CHANNEL_INDEX_MASK_4) ||
-                         (sample_rate != 48000)) {
-                          snd_device = SND_DEVICE_NONE;
-                          ALOGW("Unsupported Input configuration for ambisonic capture");
-                          goto exit;
+                        (sample_rate != 48000))
+                    {
+                        snd_device = SND_DEVICE_NONE;
                     }
                 }
+            }
+            else if (my_data->source_mic_type & SOURCE_DEC_MIC) {
+                if(compare_device_type(&in_devices, AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_SPEAKER_MIC2))
+                    snd_device = SND_DEVICE_IN_HANDSET_GENERIC_6MIC_AND_SPEAKER_MIC2;
+                else if(channel_count == 6)
+                    snd_device = SND_DEVICE_IN_HANDSET_GENERIC_6MIC;
+            } else if (my_data->source_mic_type & SOURCE_OCT_MIC) {
+                   snd_device = SND_DEVICE_IN_HANDSET_GENERIC_8MIC;
+            } else if (my_data->source_mic_type & SOURCE_HEX_MIC) {
+                   snd_device = SND_DEVICE_IN_HANDSET_GENERIC_6MIC;
+            } else if (my_data->source_mic_type & SOURCE_QUAD_MIC) {
+                   snd_device = SND_DEVICE_IN_HANDSET_GENERIC_QMIC;
+            } else if (my_data->source_mic_type & SOURCE_DUAL_MIC) {
+                   snd_device = SND_DEVICE_IN_HANDSET_GENERIC_DMIC;
+            }  else
+                snd_device = SND_DEVICE_NONE;
+
     } else if (source == AUDIO_SOURCE_CAMCORDER) {
         if (compare_device_type(&in_devices, AUDIO_DEVICE_IN_BUILTIN_MIC) ||
             compare_device_type(&in_devices, AUDIO_DEVICE_IN_BACK_MIC)) {
@@ -9136,6 +9251,7 @@
         case USECASE_AUDIO_PLAYBACK_SYS_NOTIFICATION:
         case USECASE_AUDIO_PLAYBACK_FRONT_PASSENGER:
         case USECASE_AUDIO_PLAYBACK_PHONE:
+        case USECASE_AUDIO_PLAYBACK_ALERTS:
             delay = LOW_LATENCY_PLATFORM_DELAY;
             break;
         case USECASE_AUDIO_PLAYBACK_OFFLOAD:
@@ -10613,6 +10729,11 @@
     int backend_idx = platform_get_backend_index(snd_device);
     int ret = 0;
     struct audio_backend_cfg backend_cfg;
+    struct audio_custom_mtmx_in_params_info in_info = {0};
+    struct audio_custom_mtmx_in_params *in_params = NULL;
+    int new_snd_devices[SND_DEVICE_OUT_END] = {0};
+    int i, num_devices = 1;
+    struct platform_data *my_data = (struct platform_data *)adev->platform;
 
     backend_cfg.passthrough_enabled = false;
 
@@ -10651,12 +10772,46 @@
           backend_cfg.format,
           backend_idx, usecase->id,
           platform_get_snd_device_name(snd_device));
-    if (platform_check_capture_codec_backend_cfg(adev, backend_idx,
-                                                 &backend_cfg, snd_device)) {
-        ret = platform_set_codec_backend_cfg(adev, usecase, snd_device,
+
+    if (is_combo_audio_input_device(&usecase->stream.in->device_list) &&
+        platform_split_snd_device(my_data, snd_device, &num_devices,
+        new_snd_devices) == 0){
+
+        in_info.usecase_id[0] = usecase->id;
+        in_info.op_channels = backend_cfg.channels;
+        in_params = platform_get_custom_mtmx_in_params(adev->platform, &in_info);
+
+        for (i = 0; i < num_devices; i++) {
+            if (in_params) {
+                if(new_snd_devices[i] == SND_DEVICE_IN_SPEAKER_MIC2){
+                    backend_cfg.channels = in_params->i2s_ch;
+                    ALOGD("%s txbecf: set channels to %d from mtmx in params",__func__,in_params->i2s_ch);
+                } else {
+                    ALOGD("%s: txbecf: set channels to %d from mtmx in params",
+                       __func__, in_params->mic_ch);
+                    backend_cfg.channels = in_params->mic_ch;
+                }
+            }
+            if (platform_check_capture_codec_backend_cfg(adev, platform_get_backend_index(new_snd_devices[i]),
+                                                 &backend_cfg, new_snd_devices[i])) {
+                ret = platform_set_codec_backend_cfg(adev, usecase, new_snd_devices[i],
                                              backend_cfg);
-        if(!ret)
-            return true;
+                if(!ret)
+                    ret = true;
+                else
+                    ret = false;
+            }
+       }
+       return ret;
+
+    } else {
+        if (platform_check_capture_codec_backend_cfg(adev, backend_idx,
+                                                 &backend_cfg, snd_device)) {
+            ret = platform_set_codec_backend_cfg(adev, usecase, snd_device,
+                                             backend_cfg);
+            if(!ret)
+                return true;
+        }
     }
 
     return false;
diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h
old mode 100755
new mode 100644
index 25ebc08..1535940
--- a/hal/msm8974/platform.h
+++ b/hal/msm8974/platform.h
@@ -43,6 +43,8 @@
     SOURCE_THREE_MIC = 0x4,            /* Target contains 3 mics */
     SOURCE_QUAD_MIC  = 0x8,            /* Target contains 4 mics */
     SOURCE_HEX_MIC   = 0x16,           /* Target contains 6 mics */
+    SOURCE_OCT_MIC   = 0x20,           /* Target contains 8 mics */
+    SOURCE_DEC_MIC   = 0x40,
 };
 
 enum {
@@ -201,6 +203,7 @@
     SND_DEVICE_OUT_BUS_SYS,
     SND_DEVICE_OUT_BUS_NAV,
     SND_DEVICE_OUT_BUS_PHN,
+    SND_DEVICE_OUT_BUS_ALR,
     SND_DEVICE_OUT_BUS_PAX,
     SND_DEVICE_OUT_BUS_RSE,
     SND_DEVICE_OUT_CALL_PROXY,
@@ -365,6 +368,18 @@
     SND_DEVICE_IN_ICC,
     SND_DEVICE_IN_SYNTH_MIC,
     SND_DEVICE_IN_ECHO_REFERENCE,
+    SND_DEVICE_IN_HANDSET_GENERIC_DMIC,
+    SND_DEVICE_IN_HANDSET_GENERIC_6MIC,
+    SND_DEVICE_IN_HANDSET_GENERIC_8MIC,
+    SND_DEVICE_IN_HANDSET_GENERIC_DMIC_AND_EC_REF_LOOPBACK,
+    SND_DEVICE_IN_HANDSET_GENERIC_QMIC_AND_EC_REF_LOOPBACK,
+    SND_DEVICE_IN_HANDSET_GENERIC_6MIC_AND_EC_REF_LOOPBACK,
+    SND_DEVICE_IN_HANDSET_GENERIC_8MIC_AND_EC_REF_LOOPBACK,
+    SND_DEVICE_IN_HDMI_MIC_DSD,
+    SND_DEVICE_IN_ECALL,
+    SND_DEVICE_IN_SPEAKER_MIC2,
+    SND_DEVICE_IN_SPEAKER_MIC3,
+    SND_DEVICE_IN_HANDSET_GENERIC_6MIC_AND_SPEAKER_MIC2,
     SND_DEVICE_IN_END,
 
     SND_DEVICE_MAX = SND_DEVICE_IN_END,
@@ -404,6 +419,12 @@
     HDMI_ARC_TX_BACKEND,
     HEADSET_TX_BACKEND,
     CALL_PROXY_TX_BACKEND,
+    SEC_MI2S_RX_BACKEND,
+    TERT_MI2S_RX_BACKEND,
+    TERT_MI2S_TX_BACKEND,
+    QUAT_MI2S_RX_BACKEND,
+    QUAT_TDM_TX_BACKEND,
+    SEN_TDM_TX_BACKEND,
     MAX_CODEC_BACKENDS
 };
 
@@ -493,6 +514,7 @@
 #define MULTIMEDIA2_PCM_DEVICE 1
 #define MULTIMEDIA3_PCM_DEVICE 4
 #define MULTIMEDIA9_PCM_DEVICE 32
+#define MULTIMEDIA31_PCM_DEVICE 59
 #define FM_PLAYBACK_PCM_DEVICE 5
 #define FM_CAPTURE_PCM_DEVICE  6
 
@@ -731,6 +753,7 @@
 #define SYS_NOTIFICATION_PCM_DEVICE 9
 #define NAV_GUIDANCE_PCM_DEVICE MULTIMEDIA2_PCM_DEVICE
 #define PHONE_PCM_DEVICE 12
+#define ALERTS_PCM_DEVICE MULTIMEDIA31_PCM_DEVICE
 #define FRONT_PASSENGER_PCM_DEVICE 55
 #define REAR_SEAT_PCM_DEVICE 54
 
diff --git a/hal/platform_api.h b/hal/platform_api.h
index 805db2f..9663372 100755
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -9,7 +9,7 @@
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
- *
+
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -149,7 +149,7 @@
 struct audio_custom_mtmx_params {
     struct listnode list;
     struct audio_custom_mtmx_params_info info;
-    uint32_t coeffs[0];
+    uint64_t coeffs[0];
 };
 
 struct audio_custom_mtmx_in_params_info {
@@ -168,6 +168,7 @@
     struct audio_custom_mtmx_in_params_info in_info;
     uint32_t ip_channels;
     uint32_t mic_ch;
+    uint32_t i2s_ch;
     uint32_t ec_ref_ch;
     struct audio_custom_mtmx_params_in_ch_info in_ch_info[MAX_IN_CHANNELS];
 };
diff --git a/hal/platform_info.c b/hal/platform_info.c
old mode 100755
new mode 100644
index da11cae..de7f187
--- a/hal/platform_info.c
+++ b/hal/platform_info.c
@@ -1225,6 +1225,10 @@
               ENUM_TO_STRING(AUDIO_DEVICE_IN_LOOPBACK),
               sizeof(mtmx_in_params->in_ch_info[in_ch_idx].device)))
         mtmx_in_params->ec_ref_ch = mtmx_in_params->in_ch_info[in_ch_idx].ch_count;
+    else if (!strncmp(mtmx_in_params->in_ch_info[in_ch_idx].device,
+                 ENUM_TO_STRING(AUDIO_DEVICE_IN_SPEAKER_MIC2),
+                 sizeof(mtmx_in_params->in_ch_info[in_ch_idx].device)))
+        mtmx_in_params->i2s_ch = mtmx_in_params->in_ch_info[in_ch_idx].ch_count;
 
     mtmx_in_params->ip_channels += mtmx_in_params->in_ch_info[in_ch_idx].ch_count;
 }
@@ -1541,6 +1545,8 @@
                 return;
             }
             section = CUSTOM_MTMX_PARAM_IN_CH_INFO;
+            section_process_fn fn = section_table[section];
+            fn(attr);
         } else if (strcmp(tag_name, "audio_input_source_delay") == 0) {
             section = AUDIO_SOURCE_DELAY;
         } else if (strcmp(tag_name, "audio_source_delay") == 0) {
diff --git a/qahw/inc/qahw_defs.h b/qahw/inc/qahw_defs.h
index 4601a2b..87389b4 100644
--- a/qahw/inc/qahw_defs.h
+++ b/qahw/inc/qahw_defs.h
@@ -228,6 +228,9 @@
 #define QAHW_AUDIO_DEVICE_OUT_SPEAKER3 0x20000000
 #define QAHW_AUDIO_DEVICE_OUT_OPTICAL 0x40000
 
+#define QAHW_AUDIO_DEVICE_IN_SPEAKER_MIC2 0x10000000
+#define QAHW_AUDIO_DEVICE_IN_SPEAKER_MIC3 0x20000000
+
 #define QAHW_PCM_CUSTOM_CHANNEL_MAP_12  59
 #define QAHW_PCM_CUSTOM_CHANNEL_MAP_13  60
 #define QAHW_PCM_CUSTOM_CHANNEL_MAP_14  61
diff --git a/qahw_api/test/qahw_multi_record_test.c b/qahw_api/test/qahw_multi_record_test.c
index e033921..63f5e22 100644
--- a/qahw_api/test/qahw_multi_record_test.c
+++ b/qahw_api/test/qahw_multi_record_test.c
@@ -280,6 +280,9 @@
   case 4:
       params->config.channel_mask = AUDIO_CHANNEL_INDEX_MASK_4;
       break;
+  case 6:
+      params->config.channel_mask = AUDIO_CHANNEL_INDEX_MASK_6;
+      break;
   case 8:
       params->config.channel_mask = AUDIO_CHANNEL_INDEX_MASK_8;
       break;