Merge "config: Add the property media.stagefright.audio.deep"
diff --git a/configs/kona/audio_configs.xml b/configs/kona/audio_configs.xml
index bcc617d..271023d 100644
--- a/configs/kona/audio_configs.xml
+++ b/configs/kona/audio_configs.xml
@@ -31,7 +31,7 @@
         <!-- APM Configs -->
         <property name="audio.deep_buffer.media" value="true"/>
         <property name="audio.offload.disable" value="false"/>
-        <property name="audio.offload.min.duration.secs" value="60"/>
+        <property name="audio.offload.min.duration.secs" value="30"/>
         <property name="audio.offload.video" value="true"/>
         <property name="persist.vendor.audio.sva.conc.enabled" value="false"/>
         <property name="persist.vendor.audio.va_concurrency_enabled" value="false"/>
diff --git a/configs/kona/audio_platform_info_qrd.xml b/configs/kona/audio_platform_info_qrd.xml
index 607f650..dfcbcf6 100644
--- a/configs/kona/audio_platform_info_qrd.xml
+++ b/configs/kona/audio_platform_info_qrd.xml
@@ -101,7 +101,7 @@
         <param key="true_32_bit" value="true"/>
         <param key="native_audio_mode" value="true"/>
         <param key="hfp_pcm_dev_id" value="39"/>
-        <param key="input_mic_max_count" value="2"/>
+        <param key="input_mic_max_count" value="4"/>
     </config_params>
     <acdb_ids>
         <device name="SND_DEVICE_OUT_SPEAKER" acdb_id="15"/>
diff --git a/configs/kona/audio_tuning_mixer.txt b/configs/kona/audio_tuning_mixer.txt
new file mode 100644
index 0000000..474f18b
--- /dev/null
+++ b/configs/kona/audio_tuning_mixer.txt
@@ -0,0 +1,67 @@
+# Copyright (c) 2019, 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
+# met:
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+#       copyright notice, this list of conditions and the following
+#       disclaimer in the documentation and/or other materials provided
+#       with the distribution.
+#     * Neither the name of The Linux Foundation nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#RAS_TEST_SPKR_PHONE_SPKR_STEREO
+acdb_dev_id:136
+!Playback
+Rxdevice:0
+
+enable
+WSA_CDC_DMA_RX_0 Channels:Two
+WSA RX0 MUX:AIF1_PB
+WSA RX1 MUX:AIF1_PB
+WSA_RX0 INP0:RX0
+WSA_RX1 INP0:RX1
+WSA_COMP1 Switch:1
+WSA_COMP2 Switch:1
+SpkrLeft COMP Switch:1
+SpkrRight COMP Switch:1
+SpkrLeft BOOST Switch:1
+SpkrRight BOOST Switch:1
+SpkrLeft VISENSE Switch:1
+SpkrRight VISENSE Switch:1
+SpkrLeft SWR DAC_Port Switch:1
+SpkrRight SWR DAC_Port Switch:1
+WSA_RX0 Digital Volume:62
+WSA_RX1 Digital Volume:62
+WSA_CDC_DMA_RX_0 Audio Mixer MultiMedia1:1
+
+disable
+WSA RX0 MUX:ZERO
+WSA RX1 MUX:ZERO
+WSA_RX0 INP0:ZERO
+WSA_RX1 INP0:ZERO
+WSA_COMP1 Switch:0
+WSA_COMP2 Switch:0
+SpkrLeft COMP Switch:0
+SpkrRight COMP Switch:0
+SpkrLeft BOOST Switch:0
+SpkrRight BOOST Switch:0
+SpkrLeft VISENSE Switch:0
+SpkrRight VISENSE Switch:0
+SpkrLeft SWR DAC_Port Switch:0
+SpkrRight SWR DAC_Port Switch:0
+WSA_CDC_DMA_RX_0 Audio Mixer MultiMedia1:0
+
diff --git a/configs/kona/kona.mk b/configs/kona/kona.mk
index 72fa5ba..2189a6c 100644
--- a/configs/kona/kona.mk
+++ b/configs/kona/kona.mk
@@ -100,6 +100,7 @@
     vendor/qcom/opensource/audio-hal/primary-hal/configs/kona/mixer_paths_qrd.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths_qrd.xml \
     vendor/qcom/opensource/audio-hal/primary-hal/configs/kona/audio_configs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_configs.xml \
     vendor/qcom/opensource/audio-hal/primary-hal/configs/kona/audio_configs_stock.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_configs_stock.xml \
+    vendor/qcom/opensource/audio-hal/primary-hal/configs/kona/audio_tuning_mixer.txt:$(TARGET_COPY_OUT_VENDOR)/etc/audio_tuning_mixer.txt \
     frameworks/native/data/etc/android.hardware.audio.pro.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.pro.xml
 
 #XML Audio configuration files
@@ -286,6 +287,51 @@
 PRODUCT_PROPERTY_OVERRIDES += \
 persist.vendor.bt.aac_frm_ctl.enabled=true
 
+#add dynamic feature flags here
+PRODUCT_PROPERTY_OVERRIDES += \
+vendor.audio.feature.a2dp_offload.enable=true \
+vendor.audio.feature.afe_proxy.enable=true \
+vendor.audio.feature.anc_headset.enable=true \
+vendor.audio.feature.audio_sphere.enable=true \
+vendor.audio.feature.battery_listener.enable=true \
+vendor.audio.feature.compr_cap.enable=false \
+vendor.audio.feature.compress_in.enable=true \
+vendor.audio.feature.compress_meta_data.enable=true \
+vendor.audio.feature.compr_voip.enable=false \
+vendor.audio.feature.concurrent_capture.enable=true \
+vendor.audio.feature.custom_stereo.enable=true \
+vendor.audio.feature.display_port.enable=true \
+vendor.audio.feature.dsm_feedback.enable=false \
+vendor.audio.feature.dynamic_ecns.enable=true \
+vendor.audio.feature.ext_hw_plugin.enable=true \
+vendor.audio.feature.external_dsp.enable=false \
+vendor.audio.feature.external_speaker.enable=false \
+vendor.audio.feature.external_speaker_tfa.enable=false \
+vendor.audio.feature.fluence.enable=true \
+vendor.audio.feature.fm.enable=true \
+vendor.audio.feature.hdmi_edid.enable=true \
+vendor.audio.feature.hdmi_passthrough.enable=true \
+vendor.audio.feature.hfp.enable=true \
+vendor.audio.feature.hifi_audio.enable=false \
+vendor.audio.feature.hwdep_cal.enable=false \
+vendor.audio.feature.incall_music.enable=true \
+vendor.audio.feature.keep_alive.enable=true \
+vendor.audio.feature.kpi_optimize.enable=true \
+vendor.audio.feature.maxx_audio.enable=false \
+vendor.audio.feature.ras.enable=true \
+vendor.audio.feature.record_play_concurency.enable=false \
+vendor.audio.feature.src_trkn.enable=true \
+vendor.audio.feature.spkr_prot.enable=true \
+vendor.audio.feature.ssrec.enable=true \
+vendor.audio.feature.usb_offload.enable=true \
+vendor.audio.feature.usb_offload_burst_mode.enable=true \
+vendor.audio.feature.usb_offload_sidetone_volume.enable=false \
+vendor.audio.feature.deepbuffer_as_primary.enable=false \
+vendor.audio.feature.vbat.enable=true \
+vendor.audio.feature.wsa.enable=false \
+vendor.audio.feature.audiozoom.enable=false \
+vendor.audio.feature.snd_mon.enable=true
+
 # for HIDL related packages
 PRODUCT_PACKAGES += \
     android.hardware.audio@2.0-service \
diff --git a/configs/kona/mixer_paths_qrd.xml b/configs/kona/mixer_paths_qrd.xml
index eec42d2..205ca95 100644
--- a/configs/kona/mixer_paths_qrd.xml
+++ b/configs/kona/mixer_paths_qrd.xml
@@ -2603,14 +2603,18 @@
          <ctl name="TX DMIC MUX1" value="DMIC1" />
          <ctl name="TX_AIF1_CAP Mixer DEC2" value="1" />
          <ctl name="TX DMIC MUX2" value="DMIC3" />
-         <ctl name="TX_AIF1_CAP Mixer DEC4" value="1" />
-         <ctl name="TX DMIC MUX2" value="DMIC3" />
+         <ctl name="TX_AIF1_CAP Mixer DEC3" value="1" />
+         <ctl name="TX DMIC MUX3" value="DMIC5" />
     </path>
 
     <path name="voice-speaker-qmic">
          <path name="speaker-qmic" />
     </path>
 
+    <path name="quad-mic">
+         <path name="speaker-qmic" />
+    </path>
+
     <path name="unprocessed-quad-mic">
         <path name="quad-mic" />
     </path>
diff --git a/configs/lito/audio_platform_info_qrd.xml b/configs/lito/audio_platform_info_qrd.xml
index 8f21698..6601e9f 100644
--- a/configs/lito/audio_platform_info_qrd.xml
+++ b/configs/lito/audio_platform_info_qrd.xml
@@ -71,7 +71,7 @@
         <!-- In the below value string, the value indicates default mono -->
         <!-- speaker. It can be set to either left or right              -->
         <param key="mono_speaker" value="right"/>
-        <param key="spkr_1_tz_name" value="wsatz.13"/>
+        <param key="spkr_2_tz_name" value="wsatz.14"/>
         <param key="true_32_bit" value="true"/>
         <param key="native_audio_mode" value="true"/>
         <param key="hfp_pcm_dev_id" value="39"/>
@@ -117,7 +117,7 @@
         <device name="SND_DEVICE_OUT_VOICE_LINE" backend="headphones" interface="RX_CDC_DMA_RX_0"/>
         <device name="SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES" backend="headphones" interface="RX_CDC_DMA_RX_0"/>
         <device name="SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES" backend="headphones" interface="RX_CDC_DMA_RX_0"/>
-        <device name="SND_DEVICE_OUT_HANDSET" interface="WSA_CDC_DMA_RX_0"/>
+        <device name="SND_DEVICE_OUT_HANDSET" backend="handset" interface="RX_CDC_DMA_RX_0"/>
         <device name="SND_DEVICE_OUT_SPEAKER" interface="WSA_CDC_DMA_RX_0"/>
         <device name="SND_DEVICE_OUT_SPEAKER_EXTERNAL_1" interface="WSA_CDC_DMA_RX_0"/>
         <device name="SND_DEVICE_OUT_SPEAKER_EXTERNAL_2" interface="WSA_CDC_DMA_RX_0"/>
@@ -125,7 +125,7 @@
         <device name="SND_DEVICE_OUT_SPEAKER_VBAT" interface="WSA_CDC_DMA_RX_0"/>
         <device name="SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1" interface="WSA_CDC_DMA_RX_0-and-RX_CDC_DMA_RX_0"/>
         <device name="SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_2" interface="WSA_CDC_DMA_RX_0-and-RX_CDC_DMA_RX_0"/>
-        <device name="SND_DEVICE_OUT_VOICE_HANDSET" interface="WSA_CDC_DMA_RX_0"/>
+        <device name="SND_DEVICE_OUT_VOICE_HANDSET" backend="handset" interface="RX_CDC_DMA_RX_0"/>
         <device name="SND_DEVICE_IN_HANDSET_GENERIC_QMIC" interface="TX_CDC_DMA_TX_3"/>
         <device name="SND_DEVICE_OUT_VOICE_SPEAKER" interface="WSA_CDC_DMA_RX_0"/>
         <device name="SND_DEVICE_OUT_VOICE_SPEAKER_VBAT" interface="WSA_CDC_DMA_RX_0"/>
@@ -134,7 +134,7 @@
         <device name="SND_DEVICE_OUT_SPEAKER_AND_HDMI" interface="WSA_CDC_DMA_RX_0-and-HDMI"/>
         <device name="SND_DEVICE_OUT_SPEAKER_AND_DISPLAY_PORT" interface="WSA_CDC_DMA_RX_0-and-DISPLAY_PORT"/>
         <device name="SND_DEVICE_OUT_SPEAKER_AND_BT_A2DP" interface="WSA_CDC_DMA_RX_0-and-SLIMBUS_7_RX"/>
-        <device name="SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET" interface="WSA_CDC_DMA_RX_0"/>
+        <device name="SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET" interface="RX_CDC_DMA_RX_0"/>
         <device name="SND_DEVICE_OUT_ANC_FB_HEADSET" interface="RX_CDC_DMA_RX_0"/>
         <device name="SND_DEVICE_OUT_VOICE_ANC_FB_HEADSET" interface="RX_CDC_DMA_RX_0"/>
         <device name="SND_DEVICE_OUT_ANC_HANDSET" interface="RX_CDC_DMA_RX_0"/>
diff --git a/configs/msm8909/audio_policy_configuration.xml b/configs/msm8909/audio_policy_configuration.xml
index 8abf817..d4dcd79 100644
--- a/configs/msm8909/audio_policy_configuration.xml
+++ b/configs/msm8909/audio_policy_configuration.xml
@@ -162,10 +162,6 @@
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
                 </devicePort>
-                <devicePort tagName="BT SCO All" type="AUDIO_DEVICE_OUT_ALL_SCO" role="sink">
-                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
-                             samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
-                </devicePort>
                 <devicePort tagName="Proxy" type="AUDIO_DEVICE_OUT_PROXY" role="sink">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="8000,11025,16000,22050,32000,44100,48000,64000,88200,96000,128000,176400,192000" channelMasks="dynamic"/>
@@ -221,7 +217,11 @@
                        sources="primary output,low_latency,compressed_offload"/>
                 <route type="mix" sink="FM"
                        sources="primary output"/>
-                <route type="mix" sink="BT SCO All"
+                <route type="mix" sink="BT SCO"
+                       sources="primary output,low_latency,compressed_offload,voip_rx"/>
+                <route type="mix" sink="BT SCO Headset"
+                       sources="primary output,low_latency,compressed_offload,voip_rx"/>
+                <route type="mix" sink="BT SCO Car Kit"
                        sources="primary output,low_latency,compressed_offload,voip_rx"/>
                 <route type="mix" sink="primary input"
                        sources="Built-In Mic,Wired Headset Mic,BT SCO Headset Mic,Built-In Back Mic,FM Tuner,In Call-Voice"/>
diff --git a/configs/msm8937/audio_policy_configuration.xml b/configs/msm8937/audio_policy_configuration.xml
index b4b0358..948ddba 100644
--- a/configs/msm8937/audio_policy_configuration.xml
+++ b/configs/msm8937/audio_policy_configuration.xml
@@ -187,10 +187,6 @@
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
                 </devicePort>
-                <devicePort tagName="BT SCO All" type="AUDIO_DEVICE_OUT_ALL_SCO" role="sink">
-                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
-                             samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
-                </devicePort>
                 <devicePort tagName="Telephony Tx" type="AUDIO_DEVICE_OUT_TELEPHONY_TX" role="sink">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
@@ -255,7 +251,11 @@
                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload"/>
                 <route type="mix" sink="FM"
                        sources="primary output"/>
-                <route type="mix" sink="BT SCO All"
+                <route type="mix" sink="BT SCO"
+                       sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
+                <route type="mix" sink="BT SCO Headset"
+                       sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
+                <route type="mix" sink="BT SCO Car Kit"
                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
                 <route type="mix" sink="Telephony Tx"
                        sources="voice_tx"/>
diff --git a/configs/msm8953/audio_policy_configuration.xml b/configs/msm8953/audio_policy_configuration.xml
index f54d6b4..9f6e7dc 100644
--- a/configs/msm8953/audio_policy_configuration.xml
+++ b/configs/msm8953/audio_policy_configuration.xml
@@ -198,10 +198,6 @@
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
                 </devicePort>
-                <devicePort tagName="BT SCO All" type="AUDIO_DEVICE_OUT_ALL_SCO" role="sink">
-                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
-                             samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
-                </devicePort>
                 <devicePort tagName="Telephony Tx" type="AUDIO_DEVICE_OUT_TELEPHONY_TX" role="sink">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
@@ -266,7 +262,11 @@
                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload"/>
                 <route type="mix" sink="FM"
                        sources="primary output"/>
-                <route type="mix" sink="BT SCO All"
+                <route type="mix" sink="BT SCO"
+                       sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
+                <route type="mix" sink="BT SCO Headset"
+                       sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
+                <route type="mix" sink="BT SCO Car Kit"
                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
                 <route type="mix" sink="Telephony Tx"
                        sources="voice_tx"/>
diff --git a/configs/msm8996/audio_policy_configuration.xml b/configs/msm8996/audio_policy_configuration.xml
index 9b0234b..0a70bba 100644
--- a/configs/msm8996/audio_policy_configuration.xml
+++ b/configs/msm8996/audio_policy_configuration.xml
@@ -198,10 +198,6 @@
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
                 </devicePort>
-                <devicePort tagName="BT SCO All" type="AUDIO_DEVICE_OUT_ALL_SCO" role="sink">
-                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
-                             samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
-                </devicePort>
                 <devicePort tagName="Telephony Tx" type="AUDIO_DEVICE_OUT_TELEPHONY_TX" role="sink">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
@@ -266,7 +262,11 @@
                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload"/>
                 <route type="mix" sink="FM"
                        sources="primary output"/>
-                <route type="mix" sink="BT SCO All"
+                <route type="mix" sink="BT SCO"
+                       sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
+                <route type="mix" sink="BT SCO Headset"
+                       sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
+                <route type="mix" sink="BT SCO Car Kit"
                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
                 <route type="mix" sink="Telephony Tx"
                        sources="voice_tx"/>
diff --git a/configs/msm8998/audio_policy_configuration.xml b/configs/msm8998/audio_policy_configuration.xml
index 88a27d3..505a205 100644
--- a/configs/msm8998/audio_policy_configuration.xml
+++ b/configs/msm8998/audio_policy_configuration.xml
@@ -229,10 +229,6 @@
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
                 </devicePort>
-                <devicePort tagName="BT SCO All" type="AUDIO_DEVICE_OUT_ALL_SCO" role="sink">
-                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
-                             samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
-                </devicePort>
                 <devicePort tagName="Telephony Tx" type="AUDIO_DEVICE_OUT_TELEPHONY_TX" role="sink">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
@@ -334,7 +330,11 @@
                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload"/>
                 <route type="mix" sink="FM"
                        sources="primary output"/>
-                <route type="mix" sink="BT SCO All"
+                <route type="mix" sink="BT SCO"
+                       sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out"/>
+                <route type="mix" sink="BT SCO Headset"
+                       sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out"/>
+                <route type="mix" sink="BT SCO Car Kit"
                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out"/>
                 <route type="mix" sink="USB Device Out"
                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out,hifi_playback"/>
diff --git a/configs/msmnile/audio_configs.xml b/configs/msmnile/audio_configs.xml
index 40d04d7..6217f0c 100644
--- a/configs/msmnile/audio_configs.xml
+++ b/configs/msmnile/audio_configs.xml
@@ -31,7 +31,7 @@
         <!-- APM Configs -->
         <property name="audio.deep_buffer.media" value="true"/>
         <property name="audio.offload.disable" value="false"/>
-        <property name="audio.offload.min.duration.secs" value="60"/>
+        <property name="audio.offload.min.duration.secs" value="30"/>
         <property name="audio.offload.video" value="true"/>
         <property name="persist.vendor.audio.sva.conc.enabled" value="false"/>
         <property name="persist.vendor.audio.va_concurrency_enabled" value="false"/>
diff --git a/configs/msmnile/audio_platform_info.xml b/configs/msmnile/audio_platform_info.xml
index 4e7c344..6bfadc8 100644
--- a/configs/msmnile/audio_platform_info.xml
+++ b/configs/msmnile/audio_platform_info.xml
@@ -138,6 +138,7 @@
         <device name="SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET" backend="speaker-and-headphones" interface="SLIMBUS_0_RX-and-SLIMBUS_6_RX"/>
         <device name="SND_DEVICE_OUT_SPEAKER_AND_ANC_FB_HEADSET" backend="speaker-and-headphones" interface="SLIMBUS_0_RX-and-SLIMBUS_6_RX"/>
         <device name="SND_DEVICE_OUT_VOICE_HEADPHONES" backend="headphones" interface="SLIMBUS_6_RX"/>
+        <device name="SND_DEVICE_OUT_VOICE_HEADSET" backend="headset" interface="SLIMBUS_6_RX"/>
         <device name="SND_DEVICE_OUT_VOICE_ANC_HEADSET" backend="headphones" interface="SLIMBUS_6_RX"/>
         <device name="SND_DEVICE_OUT_VOICE_ANC_FB_HEADSET" backend="headphones" interface="SLIMBUS_6_RX"/>
         <device name="SND_DEVICE_OUT_VOICE_LINE" backend="headphones" interface="SLIMBUS_6_RX"/>
diff --git a/configs/msmnile/mixer_paths_tavil.xml b/configs/msmnile/mixer_paths_tavil.xml
index c8e22e8..fd29629 100644
--- a/configs/msmnile/mixer_paths_tavil.xml
+++ b/configs/msmnile/mixer_paths_tavil.xml
@@ -568,6 +568,10 @@
         <ctl name="AUDIO_REF_EC_UL1 MUX" value="SLIM_6_RX" />
     </path>
 
+    <path name="echo-reference headset">
+        <path name="echo-reference headphones" />
+    </path>
+
     <path name="echo-reference display-port">
         <ctl name="AUDIO_REF_EC_UL1 MUX" value="DISPLAY_PORT" />
     </path>
@@ -583,6 +587,10 @@
         <ctl name="AUDIO_REF_EC_UL10 MUX" value="SLIM_6_RX" />
     </path>
 
+    <path name="echo-reference-voip headset">
+        <path name="echo-reference-voip headphones" />
+    </path>
+
     <path name="echo-reference-voip display-port">
         <ctl name="AUDIO_REF_EC_UL10 MUX" value="DISPLAY_PORT" />
     </path>
@@ -634,6 +642,10 @@
         <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia1" value="1" />
     </path>
 
+    <path name="deep-buffer-playback headset">
+        <path name="deep-buffer-playback headphones" />
+    </path>
+
     <path name="deep-buffer-playback speaker-and-headphones">
         <path name="deep-buffer-playback headphones" />
         <path name="deep-buffer-playback" />
@@ -696,6 +708,10 @@
         <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia5" value="1" />
     </path>
 
+    <path name="low-latency-playback headset">
+        <path name="low-latency-playback headphones" />
+    </path>
+
     <path name="low-latency-playback speaker-and-headphones">
         <path name="low-latency-playback headphones" />
         <path name="low-latency-playback" />
@@ -727,6 +743,10 @@
         <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia8" value="1" />
     </path>
 
+    <path name="audio-ull-playback headset">
+        <path name="audio-ull-playback headphones" />
+    </path>
+
     <path name="audio-ull-playback speaker-and-headphones">
         <path name="audio-ull-playback" />
         <path name="audio-ull-playback headphones" />
@@ -831,6 +851,10 @@
         <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia4" value="1" />
     </path>
 
+    <path name="compress-offload-playback headset">
+        <path name="compress-offload-playback headphones" />
+    </path>
+
     <path name="compress-offload-playback headphones-44.1">
         <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia4" value="1" />
     </path>
@@ -897,6 +921,10 @@
         <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia7" value="1" />
     </path>
 
+    <path name="compress-offload-playback2 headset">
+        <path name="compress-offload-playback2 headphones" />
+    </path>
+
     <path name="compress-offload-playback2 headphones-44.1">
         <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia7" value="1" />
     </path>
@@ -963,6 +991,10 @@
         <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia10" value="1" />
     </path>
 
+    <path name="compress-offload-playback3 headset">
+        <path name="compress-offload-playback3 headphones" />
+    </path>
+
     <path name="compress-offload-playback3 headphones-44.1">
         <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia10" value="1" />
     </path>
@@ -1030,6 +1062,10 @@
         <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia11" value="1" />
     </path>
 
+    <path name="compress-offload-playback4 headset">
+        <path name="compress-offload-playback4 headphones" />
+    </path>
+
     <path name="compress-offload-playback4 headphones-44.1">
         <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia11" value="1" />
     </path>
@@ -1096,6 +1132,10 @@
         <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia12" value="1" />
     </path>
 
+    <path name="compress-offload-playback5 headset">
+        <path name="compress-offload-playback5 headphones" />
+    </path>
+
     <path name="compress-offload-playback5 headphones-44.1">
         <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia12" value="1" />
     </path>
@@ -1162,6 +1202,10 @@
         <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia13" value="1" />
     </path>
 
+    <path name="compress-offload-playback6 headset">
+        <path name="compress-offload-playback6 headphones" />
+    </path>
+
     <path name="compress-offload-playback6 headphones-44.1">
         <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia13" value="1" />
     </path>
@@ -1228,6 +1272,10 @@
         <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia14" value="1" />
     </path>
 
+    <path name="compress-offload-playback7 headset">
+        <path name="compress-offload-playback7 headphones" />
+    </path>
+
     <path name="compress-offload-playback7 headphones-44.1">
         <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia14" value="1" />
     </path>
@@ -1294,6 +1342,10 @@
         <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia15" value="1" />
     </path>
 
+    <path name="compress-offload-playback8 headset">
+        <path name="compress-offload-playback8 headphones" />
+    </path>
+
     <path name="compress-offload-playback8 headphones-44.1">
         <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia15" value="1" />
     </path>
@@ -1360,6 +1412,10 @@
         <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia16" value="1" />
     </path>
 
+    <path name="compress-offload-playback9 headset">
+        <path name="compress-offload-playback9 headphones" />
+    </path>
+
     <path name="compress-offload-playback9 headphones-44.1">
         <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia16" value="1" />
     </path>
@@ -1491,6 +1547,10 @@
         <ctl name="SLIMBUS6_DL_HL Switch" value="1" />
     </path>
 
+    <path name="play-fm headset">
+        <path name="play-fm headphones" />
+    </path>
+
     <path name="incall-rec-uplink">
         <ctl name="MultiMedia1 Mixer VOC_REC_UL" value="1" />
     </path>
@@ -1643,6 +1703,10 @@
     <path name="hfp-sco headphones">
     </path>
 
+    <path name="hfp-sco headset">
+        <path name="hfp-sco headphones" />
+    </path>
+
    <path name="hfp-sco-wb">
         <path name="hfp-sco" />
    </path>
@@ -1651,6 +1715,10 @@
         <path name="hfp-sco headphones" />
     </path>
 
+    <path name="hfp-sco-wb headset">
+        <path name="hfp-sco headphones" />
+    </path>
+
     <path name="compress-voip-call">
         <ctl name="SLIM_0_RX_Voice Mixer Voip" value="1" />
         <ctl name="Voip_Tx Mixer SLIM_0_TX_Voip" value="1" />
@@ -1663,9 +1731,13 @@
 
     <path name="compress-voip-call headphones">
         <ctl name="SLIM_6_RX_Voice Mixer Voip" value="1" />
-        <ctl name="Voip_Tx Mixer SLIM_1_TX_Voip" value="1" />
+        <ctl name="Voip_Tx Mixer SLIM_0_TX_Voip" value="1" />
     </path>
 
+    <path name="compress-voip-call headset">
+        <ctl name="SLIM_6_RX_Voice Mixer Voip" value="1" />
+        <ctl name="Voip_Tx Mixer SLIM_1_TX_Voip" value="1" />
+    </path>
 
     <path name="compress-voip-call bt-sco">
         <ctl name="SLIM_7_RX_Voice Mixer Voip" value="1" />
@@ -1699,6 +1771,11 @@
 
     <path name="voicemmode1-call headphones">
         <ctl name="SLIM_6_RX_Voice Mixer VoiceMMode1" value="1" />
+        <ctl name="VoiceMMode1_Tx Mixer SLIM_0_TX_MMode1" value="1" />
+    </path>
+
+    <path name="voicemmode1-call headset">
+        <ctl name="SLIM_6_RX_Voice Mixer VoiceMMode1" value="1" />
         <ctl name="VoiceMMode1_Tx Mixer SLIM_1_TX_MMode1" value="1" />
     </path>
 
@@ -1744,6 +1821,11 @@
 
     <path name="voicemmode2-call headphones">
         <ctl name="SLIM_6_RX_Voice Mixer VoiceMMode2" value="1" />
+        <ctl name="VoiceMMode2_Tx Mixer SLIM_0_TX_MMode2" value="1" />
+    </path>
+
+    <path name="voicemmode2-call headset">
+        <ctl name="SLIM_6_RX_Voice Mixer VoiceMMode2" value="1" />
         <ctl name="VoiceMMode2_Tx Mixer SLIM_1_TX_MMode2" value="1" />
     </path>
 
@@ -1791,6 +1873,10 @@
         <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia10" value="1" />
     </path>
 
+    <path name="audio-playback-voip headset">
+        <path name="audio-playback-voip headphones" />
+    </path>
+
     <path name="audio-playback-voip bt-sco">
         <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia10" value="1" />
     </path>
@@ -2295,6 +2381,10 @@
         <path name="headphones" />
     </path>
 
+    <path name="voice-headset">
+        <path name="headphones" />
+    </path>
+
     <path name="voice-line">
         <path name="voice-headphones" />
     </path>
@@ -2986,6 +3076,10 @@
         <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia16" value="1" />
     </path>
 
+    <path name="mmap-playback headset">
+        <path name="mmap-playback headphones" />
+    </path>
+
     <path name="mmap-playback speaker-and-headphones">
         <path name="mmap-playback" />
         <path name="mmap-playback headphones" />
diff --git a/configs/msmnile/msmnile.mk b/configs/msmnile/msmnile.mk
index 3f87f77..4662113 100644
--- a/configs/msmnile/msmnile.mk
+++ b/configs/msmnile/msmnile.mk
@@ -371,6 +371,99 @@
 PRODUCT_PROPERTY_OVERRIDES += \
 persist.audio.fluence.voicecomm=true
 
+#add dynamic feature flags here
+ifeq ($(GENERIC_ODM_IMAGE),true)
+# Generic ODM varient related
+PRODUCT_ODM_PROPERTIES += \
+vendor.audio.feature.a2dp_offload.enable=true \
+vendor.audio.feature.afe_proxy.enable=false \
+vendor.audio.feature.anc_headset.enable=false \
+vendor.audio.feature.audio_sphere.enable=false \
+vendor.audio.feature.battery_listener.enable=false \
+vendor.audio.feature.compr_cap.enable=false \
+vendor.audio.feature.compress_in.enable=false \
+vendor.audio.feature.compress_meta_data.enable=false \
+vendor.audio.feature.compr_voip.enable=false \
+vendor.audio.feature.concurrent_capture.enable=true  \
+vendor.audio.feature.custom_stereo.enable=false \
+vendor.audio.feature.display_port.enable=false \
+vendor.audio.feature.dsm_feedback.enable=false \
+vendor.audio.feature.dynamic_ecns.enable=false \
+vendor.audio.feature.ext_hw_plugin.enable=false \
+vendor.audio.feature.external_dsp.enable=true  \
+vendor.audio.feature.external_speaker.enable=true  \
+vendor.audio.feature.external_speaker_tfa.enable=false \
+vendor.audio.feature.fluence.enable=false \
+vendor.audio.feature.fm.enable=false \
+vendor.audio.feature.hdmi_edid.enable=false \
+vendor.audio.feature.hdmi_passthrough.enable=false \
+vendor.audio.feature.hfp.enable=true  \
+vendor.audio.feature.hifi_audio.enable=false \
+vendor.audio.feature.hwdep_cal.enable=true  \
+vendor.audio.feature.incall_music.enable=true  \
+vendor.audio.feature.keep_alive.enable=false \
+vendor.audio.feature.kpi_optimize.enable=false \
+vendor.audio.feature.maxx_audio.enable=true  \
+vendor.audio.feature.ras.enable=false \
+vendor.audio.feature.record_play_concurency.enable=false \
+vendor.audio.feature.src_trkn.enable=false \
+vendor.audio.feature.spkr_prot.enable=true  \
+vendor.audio.feature.ssrec.enable=false \
+vendor.audio.feature.usb_offload.enable=true \
+vendor.audio.feature.usb_offload_burst_mode.enable=false  \
+vendor.audio.feature.usb_offload_sidetone_volume.enable=false \
+vendor.audio.feature.deepbuffer_as_primary.enable=false \
+vendor.audio.feature.vbat.enable=false \
+vendor.audio.feature.wsa.enable=false \
+vendor.audio.feature.audiozoom.enable=true \
+vendor.audio.feature.snd_mon.enable=true
+else
+# Non-Generic ODM varient related
+PRODUCT_ODM_PROPERTIES += \
+vendor.audio.feature.a2dp_offload.enable=true \
+vendor.audio.feature.afe_proxy.enable=true \
+vendor.audio.feature.anc_headset.enable=true \
+vendor.audio.feature.audio_sphere.enable=true \
+vendor.audio.feature.battery_listener.enable=true \
+vendor.audio.feature.compr_cap.enable=false \
+vendor.audio.feature.compress_in.enable=true \
+vendor.audio.feature.compress_meta_data.enable=true \
+vendor.audio.feature.compr_voip.enable=false \
+vendor.audio.feature.concurrent_capture.enable=true \
+vendor.audio.feature.custom_stereo.enable=true \
+vendor.audio.feature.display_port.enable=true \
+vendor.audio.feature.dsm_feedback.enable=false \
+vendor.audio.feature.dynamic_ecns.enable=true \
+vendor.audio.feature.ext_hw_plugin.enable=true \
+vendor.audio.feature.external_dsp.enable=false \
+vendor.audio.feature.external_speaker.enable=false \
+vendor.audio.feature.external_speaker_tfa.enable=false \
+vendor.audio.feature.fluence.enable=true \
+vendor.audio.feature.fm.enable=true \
+vendor.audio.feature.hdmi_edid.enable=true \
+vendor.audio.feature.hdmi_passthrough.enable=true \
+vendor.audio.feature.hfp.enable=true \
+vendor.audio.feature.hifi_audio.enable=false \
+vendor.audio.feature.hwdep_cal.enable=false \
+vendor.audio.feature.incall_music.enable=true \
+vendor.audio.feature.keep_alive.enable=true \
+vendor.audio.feature.kpi_optimize.enable=true \
+vendor.audio.feature.maxx_audio.enable=false \
+vendor.audio.feature.ras.enable=true \
+vendor.audio.feature.record_play_concurency.enable=false \
+vendor.audio.feature.src_trkn.enable=true \
+vendor.audio.feature.spkr_prot.enable=true \
+vendor.audio.feature.ssrec.enable=true \
+vendor.audio.feature.usb_offload.enable=true \
+vendor.audio.feature.usb_offload_burst_mode.enable=true \
+vendor.audio.feature.usb_offload_sidetone_volume.enable=false \
+vendor.audio.feature.deepbuffer_as_primary.enable=false \
+vendor.audio.feature.vbat.enable=true \
+vendor.audio.feature.wsa.enable=false \
+vendor.audio.feature.audiozoom.enable=false \
+vendor.audio.feature.snd_mon.enable=true
+endif
+
 # for HIDL related packages
 PRODUCT_PACKAGES += \
     android.hardware.audio@2.0-service \
diff --git a/configs/qssi/qssi.mk b/configs/qssi/qssi.mk
index c87b443..3a644e2 100644
--- a/configs/qssi/qssi.mk
+++ b/configs/qssi/qssi.mk
@@ -23,6 +23,7 @@
 AUDIO_FEATURE_ENABLED_PROXY_DEVICE := true
 AUDIO_FEATURE_ENABLED_AUDIOSPHERE := true
 AUDIO_FEATURE_ENABLED_3D_AUDIO := true
+AUDIO_FEATURE_ENABLED_AHAL_EXT := true
 DOLBY_ENABLE := false
 endif
 
diff --git a/configs/sdm660/audio_policy_configuration.xml b/configs/sdm660/audio_policy_configuration.xml
index b1cf4b9..662764f 100644
--- a/configs/sdm660/audio_policy_configuration.xml
+++ b/configs/sdm660/audio_policy_configuration.xml
@@ -220,10 +220,6 @@
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
                 </devicePort>
-                <devicePort tagName="BT SCO All" type="AUDIO_DEVICE_OUT_ALL_SCO" role="sink">
-                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
-                             samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
-                </devicePort>
                 <devicePort tagName="Telephony Tx" type="AUDIO_DEVICE_OUT_TELEPHONY_TX" role="sink">
                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
                              samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
@@ -325,7 +321,11 @@
                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload"/>
                 <route type="mix" sink="FM"
                        sources="primary output"/>
-                <route type="mix" sink="BT SCO All"
+                <route type="mix" sink="BT SCO"
+                       sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
+                <route type="mix" sink="BT SCO Headset"
+                       sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
+                <route type="mix" sink="BT SCO Car Kit"
                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
                 <route type="mix" sink="USB Device Out"
                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx,hifi_playback"/>
diff --git a/configs/sdm845/audio_configs.xml b/configs/sdm845/audio_configs.xml
index 4b0159d..307f9a3 100644
--- a/configs/sdm845/audio_configs.xml
+++ b/configs/sdm845/audio_configs.xml
@@ -31,7 +31,7 @@
         <!-- APM Configs -->
         <property name="audio.deep_buffer.media" value="true"/>
         <property name="audio.offload.disable" value="false"/>
-        <property name="audio.offload.min.duration.secs" value="60"/>
+        <property name="audio.offload.min.duration.secs" value="30"/>
         <property name="audio.offload.video" value="true"/>
         <property name="persist.vendor.audio.sva.conc.enabled" value="false"/>
         <property name="persist.vendor.audio.va_concurrency_enabled" value="false"/>
diff --git a/hal/Android.mk b/hal/Android.mk
index a6bd9bc..1477e0a 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -105,7 +105,6 @@
 LOCAL_HEADER_LIBRARIES := libhardware_headers
 
 LOCAL_SRC_FILES := \
-    ahal_config_helper.cpp \
     audio_hw.c \
     acdb.c \
     platform_info.c \
@@ -113,7 +112,6 @@
     voice.c
 
 LOCAL_SRC_FILES += audio_extn/audio_extn.c \
-                   audio_extn/audio_feature_manager.c \
                    audio_extn/audio_hidl.cpp \
                    audio_extn/compress_in.c \
                    audio_extn/fm.c \
diff --git a/hal/audio_extn/a2dp.c b/hal/audio_extn/a2dp.c
index fa3af6e..b76b5ec 100644
--- a/hal/audio_extn/a2dp.c
+++ b/hal/audio_extn/a2dp.c
@@ -1182,20 +1182,21 @@
                     rate_str = SPEECH_TX_SAMPLE_RATE;
                 else
                     rate_str = ABR_TX_SAMPLE_RATE;
-            }
-            ALOGD("%s: set backend tx sample rate = %s", __func__, rate_str);
-            ctl_sample_rate = mixer_get_ctl_by_name(a2dp.adev->mixer,
-                                            MIXER_SOURCE_SAMPLE_RATE_TX);
-            if (!ctl_sample_rate) {
-                ALOGE("%s: ERROR backend sample rate mixer control not identifed", __func__);
-                is_configured = false;
-                goto fail;
-            }
 
-            if (mixer_ctl_set_enum_by_string(ctl_sample_rate, rate_str) != 0) {
-                ALOGE("%s: Failed to set backend sample rate = %s", __func__, rate_str);
-                is_configured = false;
-                goto fail;
+                ALOGD("%s: set backend tx sample rate = %s", __func__, rate_str);
+                ctl_sample_rate = mixer_get_ctl_by_name(a2dp.adev->mixer,
+                                                MIXER_SOURCE_SAMPLE_RATE_TX);
+                if (!ctl_sample_rate) {
+                    ALOGE("%s: ERROR backend sample rate mixer control not identifed", __func__);
+                    is_configured = false;
+                    goto fail;
+                }
+
+                if (mixer_ctl_set_enum_by_string(ctl_sample_rate, rate_str) != 0) {
+                    ALOGE("%s: Failed to set backend sample rate = %s", __func__, rate_str);
+                    is_configured = false;
+                    goto fail;
+                }
             }
         }
     } else {
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index 3d6cd4a..11b96e7 100644
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -55,7 +55,6 @@
 #include "platform.h"
 #include "platform_api.h"
 #include "edid.h"
-#include "audio_feature_manager.h"
 #include "sound/compress_params.h"
 
 #ifdef DYNAMIC_LOG_ENABLED
@@ -69,7 +68,7 @@
 #define MAX_NUM_CHANNELS 8
 #define Q14_GAIN_UNITY 0x4000
 
-static int is_running_vendor_enhanced_fwk = 1;
+static int is_running_vendor_enhanced_fwk = 0;
 static bool is_compress_meta_data_enabled = false;
 
 struct snd_card_split cur_snd_card_split = {
@@ -932,7 +931,7 @@
     struct mixer_ctl *ctl = NULL;
     const char *mixer_ctl_name = "PROXY_RX Channels";
 
-    if (!audio_feature_manager_is_feature_enabled(AFE_PROXY)) {
+    if (!property_get_bool("vendor.audio.feature.afe_proxy.enable", false)) {
         ALOGW("%s: AFE_PROXY is disabled", __func__);
         return -ENOSYS;
     }
@@ -1013,7 +1012,8 @@
     int ret = 0;
     int channels = aextnmod.proxy_channel_num;
 
-    if (!audio_feature_manager_is_feature_enabled(AFE_PROXY)) {
+    if (!property_get_bool("vendor.audio.feature.afe_proxy.enable",
+                            false)) {
         ALOGW("%s: AFE_PROXY is disabled", __func__);
         return -ENOSYS;
     }
@@ -1043,7 +1043,8 @@
 int32_t audio_extn_get_afe_proxy_channel_count()
 {
 
-    if (!audio_feature_manager_is_feature_enabled(AFE_PROXY)) {
+    if (!property_get_bool("vendor.audio.feature.afe_proxy.enable",
+                            false)) {
         ALOGW("%s: AFE_PROXY is disabled", __func__);
         return -ENOSYS;
     }
@@ -4989,123 +4990,121 @@
 }
 // END: MAXX_AUDIO =====================================================================
 
-void audio_extn_feature_init(int is_running_with_enhanced_fwk)
+void audio_extn_feature_init()
 {
-    is_running_vendor_enhanced_fwk = is_running_with_enhanced_fwk;
-    for(int index = 0; index < VOICE_START; index++)
-    {
-        bool enable = audio_feature_manager_is_feature_enabled(index);
-        switch (index) {
-            case SND_MONITOR:
-                snd_mon_feature_init(enable);
-                break;
-            case COMPRESS_CAPTURE:
-                compr_cap_feature_init(enable);
-                break;
-            case DSM_FEEDBACK:
-                dsm_feedback_feature_init(enable);
-                break;
-            case SSREC:
-                ssrec_feature_init(enable);
-                break;
-            case SOURCE_TRACK:
-                src_trkn_feature_init(enable);
-            case HDMI_EDID:
-                hdmi_edid_feature_init(enable);
-                break;
-            case KEEP_ALIVE:
-                keep_alive_feature_init(enable);
-                break;
-            case HIFI_AUDIO:
-                hifi_audio_feature_init(enable);
-                break;
-            case RECEIVER_AIDED_STEREO:
-                ras_feature_init(enable);
-                break;
-            case KPI_OPTIMIZE:
-                kpi_optimize_feature_init(enable);
-                break;
-            case USB_OFFLOAD:
-                usb_offload_feature_init(enable);
-                break;
-            case USB_OFFLOAD_BURST_MODE:
-                usb_offload_burst_mode_feature_init(enable);
-                break;
-            case USB_OFFLOAD_SIDETONE_VOLM:
-                usb_offload_sidetone_volume_feature_init(enable);
-                break;
-            case A2DP_OFFLOAD:
-                a2dp_offload_feature_init(enable);
-                break;
-            case WSA:
-                 wsa_feature_init(enable);
-                 break;
-            case COMPRESS_METADATA_NEEDED:
-                compress_meta_data_feature_init(enable);
-                break;
-            case VBAT:
-                vbat_feature_init(enable);
-                break;
-            case DISPLAY_PORT:
-                display_port_feature_init(enable);
-                break;
-            case FLUENCE:
-                fluence_feature_init(enable);
-                break;
-             case CUSTOM_STEREO:
-                custom_stereo_feature_init(enable);
-                break;
-            case ANC_HEADSET:
-                anc_headset_feature_init(enable);
-                break;
-            case SPKR_PROT:
-                spkr_prot_feature_init(enable);
-                break;
-            case FM_POWER_OPT_FEATURE:
-                fm_feature_init(enable);
-                break;
-            case EXTERNAL_QDSP:
-                external_qdsp_feature_init(enable);
-                break;
-            case EXTERNAL_SPEAKER:
-                external_speaker_feature_init(enable);
-                break;
-            case EXTERNAL_SPEAKER_TFA:
-                external_speaker_tfa_feature_init(enable);
-                break;
-            case HWDEP_CAL:
-                hwdep_cal_feature_init(enable);
-                break;
-            case HFP:
-                hfp_feature_init(enable);
-                break;
-            case EXT_HW_PLUGIN:
-                ext_hw_plugin_feature_init(enable);
-                break;
-            case RECORD_PLAY_CONCURRENCY:
-                record_play_concurency_feature_init(enable);
-                break;
-            case HDMI_PASSTHROUGH:
-                hdmi_passthrough_feature_init(enable);
-                break;
-            case CONCURRENT_CAPTURE:
-                concurrent_capture_feature_init(enable);
-                break;
-            case COMPRESS_IN_CAPTURE:
-                compress_in_feature_init(enable);
-                break;
-            case BATTERY_LISTENER:
-                battery_listener_feature_init(enable);
-                break;
-            case MAXX_AUDIO:
-                maxx_audio_feature_init(enable);
-                break;
-            case AUDIO_ZOOM:
-                audiozoom_feature_init(enable);
-            default:
-                break;
-        }
-    }
+    is_running_vendor_enhanced_fwk = audio_extn_utils_is_vendor_enhanced_fwk();
+
+    // register feature init functions here
+    // each feature needs a vendor property
+    // default value added is for GSI (non vendor modified images)
+    snd_mon_feature_init(
+        property_get_bool("vendor.audio.feature.snd_mon.enable",
+                           true));
+    compr_cap_feature_init(
+        property_get_bool("vendor.audio.feature.compr_cap.enable",
+                           false));
+    dsm_feedback_feature_init(
+        property_get_bool("vendor.audio.feature.dsm_feedback.enable",
+                           false));
+    ssrec_feature_init(
+        property_get_bool("vendor.audio.feature.ssrec.enable",
+                           false));
+    src_trkn_feature_init(
+        property_get_bool("vendor.audio.feature.src_trkn.enable",
+                           false));
+    hdmi_edid_feature_init(
+        property_get_bool("vendor.audio.feature.hdmi_edid.enable",
+                           false));
+    keep_alive_feature_init(
+        property_get_bool("vendor.audio.feature.keep_alive.enable",
+                           false));
+    hifi_audio_feature_init(
+        property_get_bool("vendor.audio.feature.hifi_audio.enable",
+                           false));
+    ras_feature_init(
+        property_get_bool("vendor.audio.feature.ras.enable",
+                           false));
+    kpi_optimize_feature_init(
+        property_get_bool("vendor.audio.feature.kpi_optimize.enable",
+                           false));
+    usb_offload_feature_init(
+        property_get_bool("vendor.audio.feature.usb_offload.enable",
+                           true));
+    usb_offload_burst_mode_feature_init(
+        property_get_bool("vendor.audio.feature.usb_offload_burst_mode.enable",
+                           false));
+    usb_offload_sidetone_volume_feature_init(
+        property_get_bool("vendor.audio.feature.usb_offload_sidetone_volume.enable",
+                           false));
+    a2dp_offload_feature_init(
+        property_get_bool("vendor.audio.feature.a2dp_offload.enable",
+                           false));
+    wsa_feature_init(
+        property_get_bool("vendor.audio.feature.wsa.enable",
+                           false));
+    compress_meta_data_feature_init(
+        property_get_bool("vendor.audio.feature.compress_meta_data.enable",
+                           false));
+    vbat_feature_init(
+        property_get_bool("vendor.audio.feature.vbat.enable",
+                           false));
+    display_port_feature_init(
+        property_get_bool("vendor.audio.feature.display_port.enable",
+                           false));
+    fluence_feature_init(
+        property_get_bool("vendor.audio.feature.fluence.enable",
+                           false));
+    custom_stereo_feature_init(
+        property_get_bool("vendor.audio.feature.custom_stereo.enable",
+                           false));
+    anc_headset_feature_init(
+        property_get_bool("vendor.audio.feature.anc_headset.enable",
+                           false));
+    spkr_prot_feature_init(
+        property_get_bool("vendor.audio.feature.spkr_prot.enable",
+                           true));
+    fm_feature_init(
+        property_get_bool("vendor.audio.feature.fm.enable",
+                           false));
+    external_qdsp_feature_init(
+        property_get_bool("vendor.audio.feature.external_dsp.enable",
+                           true));
+    external_speaker_feature_init(
+        property_get_bool("vendor.audio.feature.external_speaker.enable",
+                           true));
+    external_speaker_tfa_feature_init(
+        property_get_bool("vendor.audio.feature.external_speaker_tfa.enable",
+                           false));
+    hwdep_cal_feature_init(
+        property_get_bool("vendor.audio.feature.hwdep_cal.enable",
+                           true));
+    hfp_feature_init(
+        property_get_bool("vendor.audio.feature.hfp.enable",
+                           true));
+    ext_hw_plugin_feature_init(
+        property_get_bool("vendor.audio.feature.ext_hw_plugin.enable",
+                           false));
+    record_play_concurency_feature_init(
+        property_get_bool("vendor.audio.feature.record_play_concurency.enable",
+                           false));
+    hdmi_passthrough_feature_init(
+        property_get_bool("vendor.audio.feature.hdmi_passthrough.enable",
+                           false));
+    concurrent_capture_feature_init(
+        property_get_bool("vendor.audio.feature.concurrent_capture.enable",
+                           true));
+    compress_in_feature_init(
+        property_get_bool("vendor.audio.feature.compress_in.enable",
+                           false));
+    battery_listener_feature_init(
+        property_get_bool("vendor.audio.feature.battery_listener.enable",
+                           false));
+    maxx_audio_feature_init(
+        property_get_bool("vendor.audio.feature.maxx_audio.enable",
+                           true));
+    audiozoom_feature_init(
+        property_get_bool("vendor.audio.feature.audiozoom.enable",
+                           true));
 }
 
 void audio_extn_set_parameters(struct audio_device *adev,
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index 043ce48..facf590 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -192,7 +192,7 @@
 
 // call at adev init
 void audio_extn_init(struct audio_device *adev);
-void audio_extn_feature_init(int is_running_with_enhanced_fwk);
+void audio_extn_feature_init();
 //START: SND_MONITOR_FEATURE ===========================================
 void snd_mon_feature_init (bool is_feature_enabled);
 typedef void (* snd_mon_cb)(void * stream, struct str_parms * parms);
@@ -800,6 +800,7 @@
 int audio_extn_utils_get_sample_rate_from_string(const char *);
 int audio_extn_utils_get_channels_from_string(const char *);
 void audio_extn_utils_release_snd_device(snd_device_t snd_device);
+int audio_extn_utils_is_vendor_enhanced_fwk();
 
 #ifdef DS2_DOLBY_DAP_ENABLED
 #define LIB_DS2_DAP_HAL "vendor/lib/libhwdaphal.so"
diff --git a/hal/audio_extn/audio_feature_manager.c b/hal/audio_extn/audio_feature_manager.c
index 2de5af3..441071d 100644
--- a/hal/audio_extn/audio_feature_manager.c
+++ b/hal/audio_extn/audio_feature_manager.c
@@ -42,47 +42,17 @@
 #include "voice_extn.h"
 #include "audio_feature_manager.h"
 
-#ifdef __LP64__
-#define VNDK_FWK_LIB_PATH "/vendor/lib64/libqti_vndfwk_detect.so"
-#else
-#define VNDK_FWK_LIB_PATH "/vendor/lib/libqti_vndfwk_detect.so"
-#endif
-
 AHalValues* confValues = NULL;
-static void *vndk_fwk_lib_handle = NULL;
-
-typedef int (*vndk_fwk_isVendorEnhancedFwk_t)();
-static vndk_fwk_isVendorEnhancedFwk_t vndk_fwk_isVendorEnhancedFwk;
 
 void audio_feature_manager_init()
 {
     ALOGD("%s: Enter", __func__);
-    int is_running_with_enhanced_fwk = 0;
 
-    //dlopen lib
-    vndk_fwk_lib_handle = dlopen(VNDK_FWK_LIB_PATH, RTLD_NOW);
-    if (vndk_fwk_lib_handle != NULL) {
-        vndk_fwk_isVendorEnhancedFwk = (vndk_fwk_isVendorEnhancedFwk_t)
-                    dlsym(vndk_fwk_lib_handle, "isRunningWithVendorEnhancedFramework");
-        if (vndk_fwk_isVendorEnhancedFwk == NULL) {
-            ALOGW("%s: VNDK_FWK_LIB not found, defaulting to enhanced_fwk configuration",
-                                                                            __func__);
-            is_running_with_enhanced_fwk = 1;
-        } else {
-            is_running_with_enhanced_fwk = vndk_fwk_isVendorEnhancedFwk();
-        }
-    }
-
-    ALOGD("%s: vndk_fwk_isVendorEnhancedFwk=%d", __func__, is_running_with_enhanced_fwk);
+    int is_running_with_enhanced_fwk = audio_extn_utils_is_vendor_enhanced_fwk();
     audio_extn_ahal_config_helper_init(is_running_with_enhanced_fwk);
     audio_extn_get_feature_values(&confValues);
     audio_extn_feature_init(is_running_with_enhanced_fwk);
     voice_extn_feature_init(is_running_with_enhanced_fwk);
-
-    if (vndk_fwk_lib_handle != NULL) {
-        dlclose(vndk_fwk_lib_handle);
-        vndk_fwk_lib_handle = NULL;
-    }
 }
 
 bool audio_feature_manager_is_feature_enabled(audio_ext_feature feature)
diff --git a/hal/audio_extn/dev_arbi.c b/hal/audio_extn/dev_arbi.c
index d83d6bd..4eb5dee 100644
--- a/hal/audio_extn/dev_arbi.c
+++ b/hal/audio_extn/dev_arbi.c
@@ -142,6 +142,7 @@
         {SND_DEVICE_OUT_VOICE_HEADPHONES, AUDIO_DEVICE_OUT_WIRED_HEADPHONE},
         {SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
             AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_WIRED_HEADPHONE}
+        {SND_DEVICE_OUT_VOICE_HEADSET, AUDIO_DEVICE_OUT_WIRED_HEADSET},
     };
 
     audio_devices_t aud_device = AUDIO_DEVICE_NONE;
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index b06276e..af89a8a 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -108,6 +108,16 @@
 #define MAX_CHANNELS_SUPPORTED 8
 #endif
 
+#ifdef __LP64__
+#define VNDK_FWK_LIB_PATH "/vendor/lib64/libqti_vndfwk_detect.so"
+#else
+#define VNDK_FWK_LIB_PATH "/vendor/lib/libqti_vndfwk_detect.so"
+#endif
+
+static void *vndk_fwk_lib_handle = NULL;
+typedef int (*vndk_fwk_isVendorEnhancedFwk_t)();
+static vndk_fwk_isVendorEnhancedFwk_t vndk_fwk_isVendorEnhancedFwk;
+
 typedef struct {
     const char *id_string;
     const int value;
@@ -2752,3 +2762,31 @@
     return mixer_ctl_set_array(ctl, gain_cfg,
                                sizeof(gain_cfg)/sizeof(gain_cfg[0]));
 }
+
+int audio_extn_utils_is_vendor_enhanced_fwk()
+{
+    static int is_running_with_enhanced_fwk = -EINVAL;
+
+    if (is_running_with_enhanced_fwk == -EINVAL) {
+        vndk_fwk_lib_handle = dlopen(VNDK_FWK_LIB_PATH, RTLD_NOW);
+        if (vndk_fwk_lib_handle != NULL) {
+            vndk_fwk_isVendorEnhancedFwk = (vndk_fwk_isVendorEnhancedFwk_t)
+                        dlsym(vndk_fwk_lib_handle, "isRunningWithVendorEnhancedFramework");
+            if (vndk_fwk_isVendorEnhancedFwk == NULL) {
+                ALOGW("%s: dlsym failed, defaulting to enhanced_fwk configuration",
+                       __func__);
+                is_running_with_enhanced_fwk = 1;
+            } else {
+                is_running_with_enhanced_fwk = vndk_fwk_isVendorEnhancedFwk();
+            }
+            dlclose(vndk_fwk_lib_handle);
+            vndk_fwk_lib_handle = NULL;
+        } else {
+            ALOGW("%s: VNDK_FWK_LIB not found, setting stock configuration", __func__);
+            is_running_with_enhanced_fwk = 0;
+        }
+        ALOGV("%s: vndk_fwk_isVendorEnhancedFwk=%d", __func__, is_running_with_enhanced_fwk);
+    }
+
+    return is_running_with_enhanced_fwk;
+}
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 2343603..068adf1 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -74,7 +74,6 @@
 #include "audio_extn.h"
 #include "voice_extn.h"
 #include "ip_hdlr_intf.h"
-#include "audio_feature_manager.h"
 
 #include "sound/compress_params.h"
 #include "sound/asound.h"
@@ -5288,7 +5287,9 @@
                      __func__, frames, frame_size, bytes_to_write);
 
             if (out->usecase == USECASE_INCALL_MUSIC_UPLINK ||
-                out->usecase == USECASE_INCALL_MUSIC_UPLINK2) {
+                out->usecase == USECASE_INCALL_MUSIC_UPLINK2 ||
+                (out->usecase == USECASE_AUDIO_PLAYBACK_VOIP &&
+                 !audio_extn_utils_is_vendor_enhanced_fwk())) {
                 size_t channel_count = audio_channel_count_from_out_mask(out->channel_mask);
                 int16_t *src = (int16_t *)buffer;
                 int16_t *dst = (int16_t *)buffer;
@@ -6787,7 +6788,8 @@
                       (devices != AUDIO_DEVICE_OUT_USB_ACCESSORY);
     bool direct_dev = is_hdmi || is_usb_dev;
     bool use_db_as_primary =
-           audio_feature_manager_is_feature_enabled(USE_DEEP_BUFFER_AS_PRIMARY_OUTPUT);
+         property_get_bool("vendor.audio.feature.deepbuffer_as_primary.enable",
+                            false);
     bool force_haptic_path =
             property_get_bool("vendor.audio.test_haptic", false);
     bool is_voip_rx = flags & AUDIO_OUTPUT_FLAG_VOIP_RX;
@@ -6933,7 +6935,8 @@
         if (!voice_extn_is_compress_voip_supported()) {
             if (out->sample_rate == 8000 || out->sample_rate == 16000 ||
              out->sample_rate == 32000 || out->sample_rate == 48000) {
-                out->channel_mask = AUDIO_CHANNEL_OUT_MONO;
+                out->channel_mask = audio_extn_utils_is_vendor_enhanced_fwk() ?
+                                        AUDIO_CHANNEL_OUT_MONO : AUDIO_CHANNEL_OUT_STEREO;
                 out->usecase = USECASE_AUDIO_PLAYBACK_VOIP;
                 out->format = AUDIO_FORMAT_PCM_16_BIT;
 
@@ -9099,8 +9102,9 @@
     adev->bt_sco_on = false;
     /* adev->cur_hdmi_channels = 0;  by calloc() */
     adev->snd_dev_ref_cnt = calloc(SND_DEVICE_MAX, sizeof(int));
-    /* Init audio feature manager */
-    audio_feature_manager_init();
+    /* Init audio and voice feature */
+    audio_extn_feature_init();
+    voice_extn_feature_init();
     voice_init(adev);
     list_init(&adev->usecase_list);
     list_init(&adev->active_inputs_list);
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 6437009..9c2e990 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -503,6 +503,7 @@
     [SND_DEVICE_OUT_VOICE_SPEAKER_2_WSA] = "wsa-voice-speaker-2",
     [SND_DEVICE_OUT_VOICE_SPEAKER_2_VBAT] = "voice-speaker-2-vbat",
     [SND_DEVICE_OUT_VOICE_HEADPHONES] = "voice-headphones",
+    [SND_DEVICE_OUT_VOICE_HEADSET] = "voice-headset",
     [SND_DEVICE_OUT_VOICE_LINE] = "voice-line",
     [SND_DEVICE_OUT_HDMI] = "hdmi",
     [SND_DEVICE_OUT_SPEAKER_AND_HDMI] = "speaker-and-hdmi",
@@ -762,6 +763,7 @@
     [SND_DEVICE_OUT_VOICE_SPEAKER_2_VBAT] = 14,
     [SND_DEVICE_OUT_VOICE_HAC_HANDSET] = 53,
     [SND_DEVICE_OUT_VOICE_HEADPHONES] = 10,
+    [SND_DEVICE_OUT_VOICE_HEADSET] = 10,
     [SND_DEVICE_OUT_VOICE_LINE] = 10,
     [SND_DEVICE_OUT_VOICE_SPEAKER_AND_VOICE_HEADPHONES] = 10,
     [SND_DEVICE_OUT_VOICE_SPEAKER_AND_VOICE_ANC_HEADSET] = 10,
@@ -982,6 +984,7 @@
     {TO_NAME_INDEX(SND_DEVICE_OUT_VOICE_SPEAKER_2_WSA)},
     {TO_NAME_INDEX(SND_DEVICE_OUT_VOICE_SPEAKER_2_VBAT)},
     {TO_NAME_INDEX(SND_DEVICE_OUT_VOICE_HEADPHONES)},
+    {TO_NAME_INDEX(SND_DEVICE_OUT_VOICE_HEADSET)},
     {TO_NAME_INDEX(SND_DEVICE_OUT_VOICE_LINE)},
     {TO_NAME_INDEX(SND_DEVICE_OUT_HDMI)},
     {TO_NAME_INDEX(SND_DEVICE_OUT_SPEAKER_AND_HDMI)},
@@ -2089,6 +2092,7 @@
     hw_interface_table[SND_DEVICE_OUT_VOICE_SPEAKER_2] = strdup("SLIMBUS_0_RX");
     hw_interface_table[SND_DEVICE_OUT_VOICE_SPEAKER_2_VBAT] = strdup("SLIMBUS_0_RX");
     hw_interface_table[SND_DEVICE_OUT_VOICE_HEADPHONES] = strdup("SLIMBUS_6_RX");
+    hw_interface_table[SND_DEVICE_OUT_VOICE_HEADSET] = strdup("SLIMBUS_6_RX");
     hw_interface_table[SND_DEVICE_OUT_VOICE_MUSIC_TX] = strdup("VOICE_PLAYBACK_TX");
     hw_interface_table[SND_DEVICE_OUT_VOICE_LINE] = strdup("SLIMBUS_6_RX");
     hw_interface_table[SND_DEVICE_OUT_HDMI] = strdup("HDMI");
@@ -3467,14 +3471,14 @@
                 strdup("SLIM_6_RX SampleRate");
         }
 
-        //TODO: enable CONCURRENT_CAPTURE_ENABLED flag only if separate backend is defined
+        //NOTE: enable CONCURRENT_CAPTURE_ENABLED flag only if separate backend is defined
         //for headset-mic. This is to capture separate data from headset-mic and handset-mic.
-        if(audio_extn_is_concurrent_capture_enabled())
+        if(audio_extn_is_concurrent_capture_enabled()) {
             my_data->current_backend_cfg[HEADSET_TX_BACKEND].bitwidth_mixer_ctl =
-                                                            strdup("SLIM_1_TX Format");
-        else
+                strdup("SLIM_1_TX Format");
             my_data->current_backend_cfg[HEADSET_TX_BACKEND].samplerate_mixer_ctl =
-                                                            strdup("SLIM_1_TX SampleRate");
+                strdup("SLIM_1_TX SampleRate");
+        }
     }
 
     my_data->current_backend_cfg[USB_AUDIO_TX_BACKEND].bitwidth_mixer_ctl =
@@ -5577,6 +5581,10 @@
                     snd_device = SND_DEVICE_OUT_VOICE_ANC_FB_HEADSET;
                 else
                     snd_device = SND_DEVICE_OUT_VOICE_ANC_HEADSET;
+            } else if (audio_extn_is_concurrent_capture_enabled() &&
+                        (devices & AUDIO_DEVICE_OUT_WIRED_HEADSET)) {
+                //Separate backend is added for headset-mic as part of concurrent capture
+                snd_device = SND_DEVICE_OUT_VOICE_HEADSET;
             } else {
                 snd_device = SND_DEVICE_OUT_VOICE_HEADPHONES;
             }
diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h
index c23ea6d..fba1077 100644
--- a/hal/msm8974/platform.h
+++ b/hal/msm8974/platform.h
@@ -106,6 +106,7 @@
     SND_DEVICE_OUT_VOICE_SPEAKER_2,
     SND_DEVICE_OUT_VOICE_SPEAKER_2_VBAT,
     SND_DEVICE_OUT_VOICE_HEADPHONES,
+    SND_DEVICE_OUT_VOICE_HEADSET,
     SND_DEVICE_OUT_VOICE_LINE,
     SND_DEVICE_OUT_HDMI,
     SND_DEVICE_OUT_SPEAKER_AND_HDMI,
diff --git a/hal/voice.c b/hal/voice.c
index b0b75e5..729ab27 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -73,6 +73,7 @@
         strlcpy(mixer_path, "sidetone-handset", MIXER_PATH_MAX_LENGTH);
         break;
     case SND_DEVICE_OUT_VOICE_HEADPHONES:
+    case SND_DEVICE_OUT_VOICE_HEADSET:
     case SND_DEVICE_OUT_VOICE_ANC_HEADSET:
     case SND_DEVICE_OUT_VOICE_ANC_FB_HEADSET:
         is_sidetone_dev = true;
diff --git a/hal/voice_extn/voice_extn.c b/hal/voice_extn/voice_extn.c
index f08c73c..473edc2 100644
--- a/hal/voice_extn/voice_extn.c
+++ b/hal/voice_extn/voice_extn.c
@@ -26,6 +26,7 @@
 #include <math.h>
 #include <log/log.h>
 #include <cutils/str_parms.h>
+#include <cutils/properties.h>
 #include <sys/ioctl.h>
 #include <time.h>
 #include <sound/voice_params.h>
@@ -35,7 +36,6 @@
 #include "platform.h"
 #include "platform_api.h"
 #include "voice_extn.h"
-#include "audio_feature_manager.h"
 
 #ifdef DYNAMIC_LOG_ENABLED
 #include <log_xml_parser.h>
@@ -86,7 +86,6 @@
 
 static bool voice_extn_compress_voip_enabled = false;
 static bool voice_extn_dynamic_ecns_feature_enabled = false;
-static int voice_extn_is_running_vendor_enhanced_fwk = 1;
 static bool voice_extn_incall_music_enabled = false;
 
 int voice_extn_is_call_state_active(struct audio_device *adev, bool *is_call_active);
@@ -396,43 +395,48 @@
 {
     voice_extn_dynamic_ecns_feature_enabled = is_feature_enabled;
     ALOGD(":: %s: ---- Feature DYNAMIC_ECNS is %s ----", __func__,
-                            is_feature_enabled? "ENABLED": " NOT ENABLED");
+                            is_feature_enabled ? "ENABLED" : "NOT ENABLED");
 }
 
-// START: INCALL_MUSIC ===================================================================
-void incall_music_feature_init(bool is_feature_enabled)
-{
-   voice_extn_incall_music_enabled = is_feature_enabled;
-    ALOGD("%s: ---- Feature INCALL_MUSIC is %s----", __func__,
-                                is_feature_enabled? "ENABLED": "NOT ENABLED");
-}
-// END: INCALL_MUSIC ===================================================================
-
 bool voice_extn_is_dynamic_ecns_enabled()
 {
     return voice_extn_dynamic_ecns_feature_enabled;
 }
 
-void voice_extn_feature_init(int is_running_with_enhanced_fwk)
+// START: INCALL_MUSIC ===================================================================
+void incall_music_feature_init(bool is_feature_enabled)
 {
-    voice_extn_is_running_vendor_enhanced_fwk = is_running_with_enhanced_fwk;
-    for(int index = VOICE_START; index < MAX_SUPPORTED_FEATURE; index++)
-    {
-        bool enable = audio_feature_manager_is_feature_enabled(index);
-        switch (index) {
-            case COMPRESS_VOIP:
-                compr_voip_feature_init(enable);
-                break;
-            case DYNAMIC_ECNS:
-                dynamic_ecns_feature_init(enable);
-                break;
-            case INCALL_MUSIC:
-                incall_music_feature_init(enable);
-                break;
-            default:
-                break;
-        }
-    }
+    voice_extn_incall_music_enabled = is_feature_enabled;
+    ALOGV("%s: ---- Feature INCALL_MUSIC is %s----", __func__,
+                                is_feature_enabled ? "ENABLED" : "NOT ENABLED");
+}
+// END: INCALL_MUSIC ===================================================================
+
+void compr_voip_feature_init(bool is_feature_enabled)
+{
+    voice_extn_compress_voip_enabled = is_feature_enabled;
+    ALOGV("%s:: ---- Feature COMPRESS_VOIP is %s ----", __func__,
+                                is_feature_enabled ? "ENABLED" : "NOT ENABLED");
+}
+
+bool voice_extn_is_compress_voip_supported()
+{
+    return voice_extn_compress_voip_enabled;
+}
+
+void voice_extn_feature_init()
+{
+    // Register feature function here
+    // every feature should have a feature flag
+    compr_voip_feature_init(
+       property_get_bool("vendor.audio.feature.compr_voip.enable",
+                          false));
+    dynamic_ecns_feature_init(
+       property_get_bool("vendor.audio.feature.dynamic_ecns.enable",
+                          false));
+    incall_music_feature_init(
+       property_get_bool("vendor.audio.feature.incall_music.enable",
+                          true));
 }
 
 void voice_extn_init(struct audio_device *adev)
@@ -446,17 +450,6 @@
     adev->voice.session[MMODE2_SESS_IDX].vsid = VOICEMMODE2_VSID;
 }
 
-void compr_voip_feature_init(bool is_feature_enabled)
-{
-    voice_extn_compress_voip_enabled = is_feature_enabled;
-    ALOGD("%s:: ---- Feature COMPRESS_VOIP is %s ----", __func__, is_feature_enabled?"ENABLED":"NOT ENABLED");
-}
-
-bool voice_extn_is_compress_voip_supported()
-{
-    return voice_extn_compress_voip_enabled;
-}
-
 int voice_extn_get_session_from_use_case(struct audio_device *adev,
                                          const audio_usecase_t usecase_id,
                                          struct voice_session **session)
diff --git a/hal/voice_extn/voice_extn.h b/hal/voice_extn/voice_extn.h
index 7a3b8cd..c4f0d49 100644
--- a/hal/voice_extn/voice_extn.h
+++ b/hal/voice_extn/voice_extn.h
@@ -77,7 +77,7 @@
 bool voice_extn_compress_voip_is_format_supported(audio_format_t format);
 bool voice_extn_compress_voip_is_config_supported(struct audio_config *config);
 bool voice_extn_compress_voip_is_started(struct audio_device *adev);
-void voice_extn_feature_init(int is_running_with_enhanced_fwk);
+void voice_extn_feature_init();
 void compr_voip_feature_init(bool is_feature_enabled);
 bool voice_extn_is_compress_voip_supported();
 void dynamic_ecns_feature_init(bool is_feature_enabled);
diff --git a/post_proc/asphere.c b/post_proc/asphere.c
index 7b35a77..efe07c6 100644
--- a/post_proc/asphere.c
+++ b/post_proc/asphere.c
@@ -33,7 +33,6 @@
 #include <fcntl.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <dlfcn.h>
 #include <stdbool.h>
 #include <sys/stat.h>
 #include <log/log.h>
@@ -42,7 +41,6 @@
 #include <cutils/properties.h>
 #include <hardware/audio_effect.h>
 #include <pthread.h>
-#include <audio_feature_manager.h>
 #include "bundle.h"
 #include "equalizer.h"
 #include "bass_boost.h"
@@ -58,10 +56,6 @@
 
 #define AUDIO_ASPHERE_EVENT_NODE "/data/misc/audio_pp/event_node"
 
-#define PRIMARY_HAL_PATH XSTR(LIB_AUDIO_HAL)
-#define XSTR(x) STR(x)
-#define STR(x) #x
-
 enum {
     ASPHERE_ACTIVE = 0,
     ASPHERE_SUSPENDED,
@@ -90,7 +84,6 @@
 
 static struct asphere_module asphere;
 pthread_once_t asphere_once = PTHREAD_ONCE_INIT;
-static bool (*is_feature_enabled)(audio_ext_feature);
 
 static int asphere_create_app_notification_node(void)
 {
@@ -170,23 +163,14 @@
     ALOGD("%s", __func__);
     pthread_mutex_init(&asphere.lock, NULL);
 
-    if (access(PRIMARY_HAL_PATH, R_OK) == 0) {
-        void *hal_lib_pointer = dlopen(PRIMARY_HAL_PATH, RTLD_NOW);
-        if (hal_lib_pointer == NULL)
-            ALOGE("%s: DLOPEN failed for %s", __func__, PRIMARY_HAL_PATH);
-        else if ((is_feature_enabled = (bool (*)(audio_ext_feature))dlsym(hal_lib_pointer,
-                                     "audio_feature_manager_is_feature_enabled")) != NULL) {
-            if (is_feature_enabled(AUDIOSPHERE)) {
-                asphere.init_status = 1;
-                asphere_get_values_from_mixer();
-                asphere_create_app_notification_node();
-                return;
-            } else
-                ALOGW("%s: asphere feature not enabled", __func__);
-        } else
-            ALOGE("%s: dlsym failed", __func__);
-    } else
-        ALOGE("%s: not able to acces lib %s ", __func__, PRIMARY_HAL_PATH);
+    if (property_get_bool("vendor.audio.feature.audio_sphere.enable", false)) {
+        asphere.init_status = 1;
+        asphere_get_values_from_mixer();
+        asphere_create_app_notification_node();
+        return;
+    } else {
+        ALOGW("%s: asphere feature not enabled", __func__);
+    }
 
     asphere.init_status = 0;
 }
diff --git a/post_proc/virtualizer.c b/post_proc/virtualizer.c
index 0199a51..6c08bd7 100644
--- a/post_proc/virtualizer.c
+++ b/post_proc/virtualizer.c
@@ -21,25 +21,17 @@
 //#define LOG_NDEBUG 0
 
 #include <cutils/list.h>
+#include <cutils/properties.h>
 #include <log/log.h>
 #include <tinyalsa/asoundlib.h>
 #include <sound/audio_effects.h>
 #include <audio_effects/effect_virtualizer.h>
-#include <audio_feature_manager.h>
-#include <dlfcn.h>
-#include <unistd.h>
 
 #include "effect_api.h"
 #include "virtualizer.h"
 
 #define VIRUALIZER_MAX_LATENCY 30
 
-#define PRIMARY_HAL_PATH XSTR(LIB_AUDIO_HAL)
-#define XSTR(x) STR(x)
-#define STR(x) #x
-
-static bool (*is_feature_enabled)(audio_ext_feature);
-
 #ifdef AUDIO_FEATURE_ENABLED_GCOV
 extern void  __gcov_flush();
 static void enable_gcov()
@@ -113,11 +105,9 @@
  *  true      device is applicable for effect
  */
 bool virtualizer_is_device_supported(audio_devices_t device) {
-    if (is_feature_enabled != NULL &&
-        is_feature_enabled(AFE_PROXY)) {
-        if (device == AUDIO_DEVICE_OUT_PROXY)
-            return false;
-    }
+    if ((property_get_bool("vendor.audio.feature.afe_proxy.enable", false)) &&
+        (device == AUDIO_DEVICE_OUT_PROXY))
+           return false;
 
     switch (device) {
     case AUDIO_DEVICE_OUT_SPEAKER:
@@ -482,20 +472,6 @@
     ALOGV("%s: ctxt %p", __func__, context);
     virtualizer_context_t *virt_ctxt = (virtualizer_context_t *)context;
 
-    if (access(PRIMARY_HAL_PATH, R_OK) == 0) {
-        void *hal_lib_pointer = dlopen(PRIMARY_HAL_PATH, RTLD_NOW);
-        if (hal_lib_pointer == NULL)
-            ALOGE("%s: DLOPEN failed for %s", __func__, PRIMARY_HAL_PATH);
-        else {
-            is_feature_enabled =
-                     (bool (*)(audio_ext_feature))dlsym(hal_lib_pointer,
-                               "audio_feature_manager_is_feature_enabled");
-            if (is_feature_enabled == NULL)
-                ALOGE("%s: dlsym failed", __func__);
-        }
-    } else
-        ALOGE("%s: not able to acces lib %s ", __func__, PRIMARY_HAL_PATH);
-
     context->config.inputCfg.accessMode = EFFECT_BUFFER_ACCESS_READ;
     context->config.inputCfg.channels = AUDIO_CHANNEL_OUT_STEREO;
     context->config.inputCfg.format = AUDIO_FORMAT_PCM_16_BIT;