Merge eb9255f5c0a7f923373c30f0918f7f53a5bf0640 on remote branch

Change-Id: I5ed5b1adee32bf8ddfec447d5d3228e90c9eaae6
diff --git a/configs/audio_vendor_product.mk b/configs/audio_vendor_product.mk
index e3be8a4..32fbcb4 100644
--- a/configs/audio_vendor_product.mk
+++ b/configs/audio_vendor_product.mk
@@ -5,6 +5,10 @@
 endif # TARGET_USES_QMAA_OVERRIDE_AUDIO
 endif # TARGET_USES_QMAA
 
+ifeq ($(TARGET_USES_AUDIOLITE),true)
+AUDIO_USE_STUB_HAL := true
+endif #ends TARGET_USES_AUDIOLITE
+
 #MM_AUDIO product packages
 MM_AUDIO += audiod
 MM_AUDIO += libacdbloader
diff --git a/configs/bengal/bengal.mk b/configs/bengal/bengal.mk
index e3bc4e4..c46d9eb 100644
--- a/configs/bengal/bengal.mk
+++ b/configs/bengal/bengal.mk
@@ -15,16 +15,92 @@
 USE_CUSTOM_AUDIO_POLICY := 1
 AUDIO_FEATURE_QSSI_COMPLIANCE := true
 AUDIO_FEATURE_ENABLED_COMPRESS_CAPTURE := false
-AUDIO_FEATURE_ENABLED_COMPRESS_INPUT := true
-AUDIO_FEATURE_ENABLED_CONCURRENT_CAPTURE := true
 AUDIO_FEATURE_ENABLED_COMPRESS_VOIP := false
 AUDIO_FEATURE_ENABLED_DYNAMIC_ECNS := true
 AUDIO_FEATURE_ENABLED_EXTN_FORMATS := true
+AUDIO_FEATURE_ENABLED_PCM_OFFLOAD := true
+AUDIO_FEATURE_ENABLED_DTS_EAGLE := false
+BOARD_USES_SRS_TRUEMEDIA := false
+DTS_CODEC_M_ := false
+AUDIO_FEATURE_ENABLED_HW_ACCELERATED_EFFECTS := false
+AUDIO_FEATURE_ENABLED_A2DP_OFFLOAD := true
+AUDIO_FEATURE_ENABLED_AHAL_EXT := false
+DOLBY_ENABLE := false
+endif
+
+AUDIO_FEATURE_ENABLED_DLKM := true
+BOARD_SUPPORTS_GCS := false
+AUDIO_FEATURE_ENABLED_INSTANCE_ID := true
+AUDIO_USE_DEEP_AS_PRIMARY_OUTPUT := false
+AUDIO_FEATURE_ENABLED_VBAT_MONITOR := true
+AUDIO_FEATURE_ENABLED_NT_PAUSE_TIMEOUT := true
+AUDIO_FEATURE_ENABLED_CUSTOMSTEREO := true
+AUDIO_FEATURE_ENABLED_FLUENCE := true
+#AUDIO_FEATURE_ENABLED_KEEP_ALIVE := true
+AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := false
+AUDIO_FEATURE_ENABLED_INCALL_MUSIC := true
+AUDIO_FEATURE_ENABLED_MULTI_VOICE_SESSIONS := true
+AUDIO_FEATURE_ENABLED_KPI_OPTIMIZE := true
+AUDIO_FEATURE_ENABLED_SPKR_PROTECTION := true
+AUDIO_FEATURE_ENABLED_ACDB_LICENSE := false
+AUDIO_FEATURE_ENABLED_DEV_ARBI := false
+MM_AUDIO_ENABLED_FTM := true
+TARGET_USES_QCOM_MM_AUDIO := true
+BOARD_SUPPORTS_QAHW := false
+AUDIO_FEATURE_ENABLED_RAS := true
+AUDIO_FEATURE_ENABLED_SND_MONITOR := true
+AUDIO_FEATURE_ENABLED_BATTERY_LISTENER := true
+##AUDIO_FEATURE_FLAGS
+
+ifeq ($(TARGET_1G_DDR_RAM), true)
+AUDIO_FEATURE_ENABLED_AUDIOSPHERE := false
+AUDIO_FEATURE_ENABLED_3D_AUDIO := false
+BOARD_SUPPORTS_SOUND_TRIGGER := false
+AUDIO_FEATURE_ENABLED_HFP := false
+AUDIO_FEATURE_ENABLED_SVA_MULTI_STAGE := false
+BOARD_SUPPORTS_OPENSOURCE_STHAL := false
+AUDIO_DO_NOT_USE_OMX_CODEC := true
+AUDIO_FEATURE_ENABLED_COMPRESS_INPUT := false
+AUDIO_FEATURE_ENABLED_CONCURRENT_CAPTURE := false
+AUDIO_FEATURE_ENABLED_EXTN_FLAC_DECODER := false
+AUDIO_FEATURE_ENABLED_EXTN_RESAMPLER := false
+AUDIO_FEATURE_ENABLED_FM_POWER_OPT := false
+AUDIO_FEATURE_ENABLED_HDMI_SPK := false
+AUDIO_FEATURE_ENABLED_PCM_OFFLOAD_24 := false
+AUDIO_FEATURE_ENABLED_FLAC_OFFLOAD := false
+AUDIO_FEATURE_ENABLED_VORBIS_OFFLOAD := false
+AUDIO_FEATURE_ENABLED_WMA_OFFLOAD := false
+AUDIO_FEATURE_ENABLED_ALAC_OFFLOAD := false
+AUDIO_FEATURE_ENABLED_APE_OFFLOAD := false
+AUDIO_FEATURE_ENABLED_AAC_ADTS_OFFLOAD := false
+AUDIO_FEATURE_ENABLED_MPEGH_SW_DECODER := false
+AUDIO_FEATURE_ENABLED_PROXY_DEVICE := false
+AUDIO_FEATURE_ENABLED_SSR := false
+MM_AUDIO_ENABLED_SAFX := false
+AUDIO_FEATURE_ENABLED_USB_TUNNEL := false
+AUDIO_FEATURE_ENABLED_EXTENDED_COMPRESS_FORMAT := false
+AUDIO_FEATURE_ENABLED_ANC_HEADSET := false
+AUDIO_FEATURE_ENABLED_HDMI_EDID := false
+AUDIO_FEATURE_ENABLED_HDMI_PASSTHROUGH := false
+AUDIO_FEATURE_ENABLED_DISPLAY_PORT := false
+AUDIO_FEATURE_ENABLED_DYNAMIC_LOG := false
+AUDIO_FEATURE_ENABLED_SOURCE_TRACKING := false
+AUDIO_FEATURE_ENABLED_GEF_SUPPORT := false
+AUDIO_FEATURE_ENABLED_USB_BURST_MODE := false
+PURGE_UNUSED_MEMORY := true
+else
+AUDIO_FEATURE_ENABLED_AUDIOSPHERE := true
+AUDIO_FEATURE_ENABLED_3D_AUDIO := true
+BOARD_SUPPORTS_SOUND_TRIGGER := true
+AUDIO_FEATURE_ENABLED_HFP := true
+AUDIO_FEATURE_ENABLED_SVA_MULTI_STAGE := true
+BOARD_SUPPORTS_OPENSOURCE_STHAL := true
+AUDIO_FEATURE_ENABLED_COMPRESS_INPUT := true
+AUDIO_FEATURE_ENABLED_CONCURRENT_CAPTURE := true
 AUDIO_FEATURE_ENABLED_EXTN_FLAC_DECODER := true
 AUDIO_FEATURE_ENABLED_EXTN_RESAMPLER := true
 AUDIO_FEATURE_ENABLED_FM_POWER_OPT := true
 AUDIO_FEATURE_ENABLED_HDMI_SPK := true
-AUDIO_FEATURE_ENABLED_PCM_OFFLOAD := true
 AUDIO_FEATURE_ENABLED_PCM_OFFLOAD_24 := true
 AUDIO_FEATURE_ENABLED_FLAC_OFFLOAD := true
 AUDIO_FEATURE_ENABLED_VORBIS_OFFLOAD := true
@@ -35,56 +111,18 @@
 AUDIO_FEATURE_ENABLED_MPEGH_SW_DECODER := true
 AUDIO_FEATURE_ENABLED_PROXY_DEVICE := true
 AUDIO_FEATURE_ENABLED_SSR := true
-AUDIO_FEATURE_ENABLED_DTS_EAGLE := false
-BOARD_USES_SRS_TRUEMEDIA := false
-DTS_CODEC_M_ := false
 MM_AUDIO_ENABLED_SAFX := true
-AUDIO_FEATURE_ENABLED_HW_ACCELERATED_EFFECTS := false
-AUDIO_FEATURE_ENABLED_AUDIOSPHERE := true
 AUDIO_FEATURE_ENABLED_USB_TUNNEL := true
-AUDIO_FEATURE_ENABLED_A2DP_OFFLOAD := true
-AUDIO_FEATURE_ENABLED_3D_AUDIO := true
-AUDIO_FEATURE_ENABLED_AHAL_EXT := false
 AUDIO_FEATURE_ENABLED_EXTENDED_COMPRESS_FORMAT := true
-DOLBY_ENABLE := false
-endif
-
-AUDIO_FEATURE_ENABLED_DLKM := true
-BOARD_SUPPORTS_SOUND_TRIGGER := true
-BOARD_SUPPORTS_GCS := false
-AUDIO_FEATURE_ENABLED_INSTANCE_ID := true
-AUDIO_USE_DEEP_AS_PRIMARY_OUTPUT := false
-AUDIO_FEATURE_ENABLED_VBAT_MONITOR := true
-AUDIO_FEATURE_ENABLED_NT_PAUSE_TIMEOUT := true
 AUDIO_FEATURE_ENABLED_ANC_HEADSET := true
-AUDIO_FEATURE_ENABLED_CUSTOMSTEREO := true
-AUDIO_FEATURE_ENABLED_FLUENCE := true
 AUDIO_FEATURE_ENABLED_HDMI_EDID := true
 AUDIO_FEATURE_ENABLED_HDMI_PASSTHROUGH := true
-#AUDIO_FEATURE_ENABLED_KEEP_ALIVE := true
 AUDIO_FEATURE_ENABLED_DISPLAY_PORT := true
-AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := false
-AUDIO_FEATURE_ENABLED_HFP := true
-AUDIO_FEATURE_ENABLED_INCALL_MUSIC := true
-AUDIO_FEATURE_ENABLED_MULTI_VOICE_SESSIONS := true
-AUDIO_FEATURE_ENABLED_KPI_OPTIMIZE := true
-AUDIO_FEATURE_ENABLED_SPKR_PROTECTION := true
-AUDIO_FEATURE_ENABLED_ACDB_LICENSE := false
-AUDIO_FEATURE_ENABLED_DEV_ARBI := false
 AUDIO_FEATURE_ENABLED_DYNAMIC_LOG := true
-MM_AUDIO_ENABLED_FTM := true
-TARGET_USES_QCOM_MM_AUDIO := true
 AUDIO_FEATURE_ENABLED_SOURCE_TRACKING := true
 AUDIO_FEATURE_ENABLED_GEF_SUPPORT := true
-BOARD_SUPPORTS_QAHW := false
-AUDIO_FEATURE_ENABLED_RAS := true
-AUDIO_FEATURE_ENABLED_SND_MONITOR := true
 AUDIO_FEATURE_ENABLED_USB_BURST_MODE := true
-AUDIO_FEATURE_ENABLED_SVA_MULTI_STAGE := true
-AUDIO_FEATURE_ENABLED_BATTERY_LISTENER := true
-##AUDIO_FEATURE_FLAGS
-
-BOARD_SUPPORTS_OPENSOURCE_STHAL := true
+endif
 
 AUDIO_HARDWARE := audio.a2dp.default
 AUDIO_HARDWARE += audio.usb.default
diff --git a/configs/lahaina/yupik_overlay/mixer_paths_yupikidprb3_overlay.xml b/configs/lahaina/yupik_overlay/mixer_paths_yupikidprb3_overlay.xml
index b63409d..9384cf4 100644
--- a/configs/lahaina/yupik_overlay/mixer_paths_yupikidprb3_overlay.xml
+++ b/configs/lahaina/yupik_overlay/mixer_paths_yupikidprb3_overlay.xml
@@ -27,7 +27,7 @@
 <!--- IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                             -->
 <!--                                                                        -->
 <!-- Changes from Qualcomm Innovation Center are provided under the following license:-->
-<!-- Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.-->
+<!-- Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.-->
 <!-- SPDX-License-Identifier: BSD-3-Clause-Clear                            -->
 <mixer>
     <ctl name="TX DEC0 MUX" value="MSM_DMIC"/>
@@ -67,6 +67,10 @@
     <path name="low-latency-playback hdmi">
         <ctl name="SEC_MI2S_RX Audio Mixer MultiMedia5" value="1" />
     </path>
+    <path name="low-latency-playback speaker-and-hdmi">
+        <path name="low-latency-playback hdmi" />
+        <path name="low-latency-playback" />
+    </path>
     <path name="compress-offload-playback hdmi">
         <ctl name="SEC_MI2S_RX Audio Mixer MultiMedia4" value="1" />
     </path>
diff --git a/configs/msm8937/msm8937.mk b/configs/msm8937/msm8937.mk
index 9f7c7aa..06b4064 100644
--- a/configs/msm8937/msm8937.mk
+++ b/configs/msm8937/msm8937.mk
@@ -7,47 +7,28 @@
 USE_CUSTOM_AUDIO_POLICY := 1
 AUDIO_FEATURE_QSSI_COMPLIANCE := true
 #AUDIO_FEATURE_ENABLED_VOICE_CONCURRENCY := true
-AUDIO_FEATURE_ENABLED_AAC_ADTS_OFFLOAD := true
 AUDIO_FEATURE_ENABLED_COMPRESS_CAPTURE := false
 AUDIO_FEATURE_ENABLED_COMPRESS_VOIP := false
 AUDIO_FEATURE_ENABLED_EXTN_FORMATS := true
-AUDIO_FEATURE_ENABLED_EXTN_FLAC_DECODER := true
 AUDIO_FEATURE_ENABLED_EXTN_RESAMPLER := true
-AUDIO_FEATURE_ENABLED_FM_POWER_OPT := true
-AUDIO_FEATURE_ENABLED_HDMI_SPK := true
 AUDIO_FEATURE_ENABLED_PCM_OFFLOAD := true
-AUDIO_FEATURE_ENABLED_PCM_OFFLOAD_24 := true
-AUDIO_FEATURE_ENABLED_FLAC_OFFLOAD := true
-AUDIO_FEATURE_ENABLED_VORBIS_OFFLOAD := true
-AUDIO_FEATURE_ENABLED_WMA_OFFLOAD := true
-AUDIO_FEATURE_ENABLED_ALAC_OFFLOAD := true
-AUDIO_FEATURE_ENABLED_APE_OFFLOAD := true
-AUDIO_FEATURE_ENABLED_PROXY_DEVICE := true
-AUDIO_FEATURE_ENABLED_SSR := true
 AUDIO_FEATURE_ENABLED_DTS_EAGLE := false
 BOARD_USES_SRS_TRUEMEDIA := false
 DTS_CODEC_M_ := true
-MM_AUDIO_ENABLED_SAFX := true
 AUDIO_FEATURE_ENABLED_HW_ACCELERATED_EFFECTS := false
 AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := false
-AUDIO_FEATURE_ENABLED_AUDIOSPHERE := true
 AUDIO_FEATURE_ENABLED_AHAL_EXT := false
-AUDIO_FEATURE_ENABLED_EXTENDED_COMPRESS_FORMAT := true
 DOLBY_ENABLE := false
 endif
 
 USE_XML_AUDIO_POLICY_CONF := 1
-BOARD_SUPPORTS_SOUND_TRIGGER := true
 AUDIO_USE_DEEP_AS_PRIMARY_OUTPUT := false
 AUDIO_FEATURE_ENABLED_HIFI_AUDIO := true
 AUDIO_FEATURE_ENABLED_VBAT_MONITOR := true
 AUDIO_FEATURE_ENABLED_NT_PAUSE_TIMEOUT := true
-AUDIO_FEATURE_ENABLED_ANC_HEADSET := true
 AUDIO_FEATURE_ENABLED_CUSTOMSTEREO := true
 AUDIO_FEATURE_ENABLED_FLUENCE := true
-AUDIO_FEATURE_ENABLED_HDMI_EDID := true
 AUDIO_FEATURE_ENABLED_EXT_HDMI := true
-AUDIO_FEATURE_ENABLED_HFP := true
 AUDIO_FEATURE_ENABLED_INCALL_MUSIC := true
 AUDIO_FEATURE_ENABLED_MULTI_VOICE_SESSIONS := true
 AUDIO_FEATURE_ENABLED_KPI_OPTIMIZE := true
@@ -56,11 +37,8 @@
 AUDIO_FEATURE_ENABLED_DEV_ARBI := false
 MM_AUDIO_ENABLED_FTM := true
 TARGET_USES_QCOM_MM_AUDIO := true
-AUDIO_FEATURE_ENABLED_SOURCE_TRACKING := true
 BOARD_SUPPORTS_QAHW := false
-AUDIO_FEATURE_ENABLED_DYNAMIC_LOG := true
 AUDIO_FEATURE_ENABLED_SND_MONITOR := true
-AUDIO_FEATURE_ENABLED_SVA_MULTI_STAGE := true
 ifeq ($(TARGET_KERNEL_VERSION), 3.18)
     AUDIO_FEATURE_ENABLED_DLKM := false
 else
@@ -71,6 +49,55 @@
 endif
 ##AUDIO_FEATURE_FLAGS
 
+ifeq ($(TARGET_1G_DDR_RAM), true)
+    AUDIO_FEATURE_ENABLED_AUDIOSPHERE := false
+    BOARD_SUPPORTS_SOUND_TRIGGER := false
+    AUDIO_FEATURE_ENABLED_HFP := false
+    AUDIO_FEATURE_ENABLED_SVA_MULTI_STAGE := false
+    AUDIO_FEATURE_ENABLED_EXTN_FLAC_DECODER := false
+    AUDIO_FEATURE_ENABLED_FM_POWER_OPT := false
+    AUDIO_FEATURE_ENABLED_HDMI_SPK := false
+    AUDIO_FEATURE_ENABLED_PCM_OFFLOAD_24 := false
+    AUDIO_FEATURE_ENABLED_FLAC_OFFLOAD := false
+    AUDIO_FEATURE_ENABLED_VORBIS_OFFLOAD := false
+    AUDIO_FEATURE_ENABLED_WMA_OFFLOAD := false
+    AUDIO_FEATURE_ENABLED_ALAC_OFFLOAD := false
+    AUDIO_FEATURE_ENABLED_APE_OFFLOAD := false
+    AUDIO_FEATURE_ENABLED_AAC_ADTS_OFFLOAD := false
+    AUDIO_FEATURE_ENABLED_PROXY_DEVICE := false
+    AUDIO_FEATURE_ENABLED_SSR := false
+    MM_AUDIO_ENABLED_SAFX := false
+    AUDIO_FEATURE_ENABLED_EXTENDED_COMPRESS_FORMAT := false
+    AUDIO_FEATURE_ENABLED_ANC_HEADSET := false
+    AUDIO_FEATURE_ENABLED_HDMI_EDID := false
+    AUDIO_FEATURE_ENABLED_DYNAMIC_LOG := false
+    AUDIO_FEATURE_ENABLED_SOURCE_TRACKING := false
+    PURGE_UNUSED_MEMORY := true
+else
+    AUDIO_FEATURE_ENABLED_AUDIOSPHERE := true
+    BOARD_SUPPORTS_SOUND_TRIGGER := true
+    AUDIO_FEATURE_ENABLED_HFP := true
+    AUDIO_FEATURE_ENABLED_SVA_MULTI_STAGE := true
+    AUDIO_FEATURE_ENABLED_EXTN_FLAC_DECODER := true
+    AUDIO_FEATURE_ENABLED_FM_POWER_OPT := true
+    AUDIO_FEATURE_ENABLED_HDMI_SPK := true
+    AUDIO_FEATURE_ENABLED_PCM_OFFLOAD_24 := true
+    AUDIO_FEATURE_ENABLED_FLAC_OFFLOAD := true
+    AUDIO_FEATURE_ENABLED_VORBIS_OFFLOAD := true
+    AUDIO_FEATURE_ENABLED_WMA_OFFLOAD := true
+    AUDIO_FEATURE_ENABLED_ALAC_OFFLOAD := true
+    AUDIO_FEATURE_ENABLED_APE_OFFLOAD := true
+    AUDIO_FEATURE_ENABLED_AAC_ADTS_OFFLOAD := true
+    AUDIO_FEATURE_ENABLED_PROXY_DEVICE := true
+    AUDIO_FEATURE_ENABLED_SSR := true
+    MM_AUDIO_ENABLED_SAFX := true
+    AUDIO_FEATURE_ENABLED_EXTENDED_COMPRESS_FORMAT := true
+    AUDIO_FEATURE_ENABLED_ANC_HEADSET := true
+    AUDIO_FEATURE_ENABLED_HDMI_EDID := true
+    AUDIO_FEATURE_ENABLED_DYNAMIC_LOG := true
+    AUDIO_FEATURE_ENABLED_SOURCE_TRACKING := true
+endif
+
 
 ifneq ($(BOARD_OPENSOURCE_DIR), )
   #Audio Specific device overlays
@@ -338,9 +365,7 @@
 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=false \
-vendor.audio.feature.hfp.enable=true \
 vendor.audio.feature.hifi_audio.enable=true \
 vendor.audio.feature.hwdep_cal.enable=false \
 vendor.audio.feature.incall_music.enable=true \
@@ -367,12 +392,21 @@
 PRODUCT_PROPERTY_OVERRIDES += \
 vendor.audio.feature.spkr_prot.enable=true
 endif
+
+ifeq ($(TARGET_1G_DDR_RAM), true)
+PRODUCT_PROPERTY_OVERRIDES += \
+vendor.audio.feature.hfp.enable=false \
+vendor.audio.feature.hdmi_edid.enable=false
+else
+PRODUCT_PROPERTY_OVERRIDES += \
+vendor.audio.feature.hfp.enable=true \
+vendor.audio.feature.hdmi_edid.enable=true
+endif
 # for HIDL related packages
 PRODUCT_PACKAGES += \
     android.hardware.audio@2.0-service \
     android.hardware.audio@2.0-impl \
     android.hardware.audio.effect@2.0-impl \
-    android.hardware.soundtrigger@2.1-impl \
     android.hardware.audio@4.0 \
     android.hardware.audio.common@4.0 \
     android.hardware.audio.common@4.0-util \
@@ -380,6 +414,11 @@
     android.hardware.audio.effect@4.0 \
     android.hardware.audio.effect@4.0-impl
 
+ifneq ($(TARGET_1G_DDR_RAM), true)
+    PRODUCT_PACKAGES += \
+         android.hardware.soundtrigger@2.1-impl
+endif
+
 # enable audio hidl hal 5.0 for sdk rev 29 and above
 ifeq ($(shell expr $(PLATFORM_SDK_VERSION) \>= 29), 1)
 PRODUCT_PACKAGES += \
diff --git a/configs/msmnile_au/audio_platform_info.xml b/configs/msmnile_au/audio_platform_info.xml
index 232b558..fdf4ee3 100644
--- a/configs/msmnile_au/audio_platform_info.xml
+++ b/configs/msmnile_au/audio_platform_info.xml
@@ -27,7 +27,7 @@
 <!-- IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                          -->
 <!--                                                                        -->
 <!-- Changes from Qualcomm Innovation Center are provided under the following license: -->
-<!-- Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. -->
+<!-- Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved. -->
 <!-- SPDX-License-Identifier: BSD-3-Clause-Clear                            -->
 
 <audio_platform_info>
@@ -170,7 +170,7 @@
         <param key="mono_speaker" value="right"/>
         <!-- In the below value string, first parameter indicates size -->
         <!-- followed by perf lock options                             -->
-        <param key="perf_lock_opts" value="4, 0x40400000, 0x1, 0x40C00000, 0x1"/>
+        <param key="perf_lock_opts" value="2, 0x40400000, 0x1"/>
         <param key="native_audio_mode" value="src"/>
         <param key="input_mic_max_count" value="4"/>
         <param key="true_32_bit" value="true"/>
diff --git a/configs/msmnile_au/modules.audio.ar.blocklist b/configs/msmnile_au/modules.audio.ar.blocklist
new file mode 100644
index 0000000..81e6e95
--- /dev/null
+++ b/configs/msmnile_au/modules.audio.ar.blocklist
@@ -0,0 +1,14 @@
+# Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause-Clear
+
+blocklist q6_notifier_dlkm_legacy
+blocklist apr_dlkm
+blocklist native_dlkm
+blocklist hdmi_dlkm
+blocklist q6_dlkm_legacy
+blocklist adsp_loader_dlkm_legacy
+blocklist snd_event_dlkm_legacy
+blocklist stub_dlkm_legacy
+blocklist machine_dlkm_legacy
+blocklist platform_dlkm
+blocklist msm_virtio_snd
diff --git a/configs/msmnile_au/modules.audio.legacy.blocklist b/configs/msmnile_au/modules.audio.legacy.blocklist
new file mode 100644
index 0000000..31dc1ea
--- /dev/null
+++ b/configs/msmnile_au/modules.audio.legacy.blocklist
@@ -0,0 +1,17 @@
+# Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause-Clear
+
+blocklist q6_notifier_dlkm
+blocklist spf_core_dlkm
+blocklist audpkt_ion_dlkm
+blocklist gpr_dlkm
+blocklist audio_pkt_dlkm
+blocklist q6_dlkm
+blocklist adsp_loader_dlkm
+blocklist snd_event_dlkm
+blocklist stub_dlkm
+blocklist machine_dlkm
+blocklist q6_pdr_dlkm
+blocklist audio_prm_dlkm
+blocklist coupled_ssr_dlkm
+blocklist msm_virtio_snd
diff --git a/configs/msmnile_au/msmnile_au.mk b/configs/msmnile_au/msmnile_au.mk
index faf0132..9cc5226 100644
--- a/configs/msmnile_au/msmnile_au.mk
+++ b/configs/msmnile_au/msmnile_au.mk
@@ -225,6 +225,13 @@
     $(TOPDIR)vendor/qcom/opensource/audio-hal/primary-hal/configs/common/bluetooth_qti_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/bluetooth_qti_audio_policy_configuration.xml \
     $(TOPDIR)vendor/qcom/opensource/audio-hal/primary-hal/configs/common_au/car_audio_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/car_audio_configuration.xml
 
+
+ifneq ( ,$(filter msmnile_gvmq msmnile_au msmnile_au_km4 msmnile_tb, $(TARGET_BOARD_PLATFORM)$(TARGET_BOARD_SUFFIX)$(TARGET_BOARD_DERIVATIVE_SUFFIX)))
+PRODUCT_COPY_FILES += \
+    vendor/qcom/opensource/audio-hal/primary-hal/configs/msmnile_au/modules.audio.ar.blocklist:$(TARGET_COPY_OUT_VENDOR_DLKM)/lib/modules/modules.audio.ar.blocklist \
+    vendor/qcom/opensource/audio-hal/primary-hal/configs/msmnile_au/modules.audio.legacy.blocklist:$(TARGET_COPY_OUT_VENDOR_DLKM)/lib/modules/modules.audio.legacy.blocklist
+endif
+
 # Listen configuration file
 PRODUCT_COPY_FILES += \
     vendor/qcom/opensource/audio-hal/primary-hal/configs/msmnile_au/listen_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/listen_platform_info.xml
diff --git a/configs/msmsteppe_au/audio_platform_info.xml b/configs/msmsteppe_au/audio_platform_info.xml
index d303e02..bef003f 100644
--- a/configs/msmsteppe_au/audio_platform_info.xml
+++ b/configs/msmsteppe_au/audio_platform_info.xml
@@ -27,7 +27,7 @@
 <!-- IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                          -->
 <!--                                                                        -->
 <!-- Changes from Qualcomm Innovation Center are provided under the following license: -->
-<!-- Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. -->
+<!-- Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved. -->
 <!-- SPDX-License-Identifier: BSD-3-Clause-Clear                            -->
 
 <audio_platform_info>
@@ -164,7 +164,7 @@
         <param key="mono_speaker" value="right"/>
         <!-- In the below value string, first parameter indicates size -->
         <!-- followed by perf lock options                             -->
-        <param key="perf_lock_opts" value="4, 0x40400000, 0x1, 0x40C00000, 0x1"/>
+        <param key="perf_lock_opts" value="2, 0x40400000, 0x1"/>
         <param key="native_audio_mode" value="src"/>
         <param key="input_mic_max_count" value="4"/>
         <param key="true_32_bit" value="true"/>
diff --git a/hal/Android.mk b/hal/Android.mk
index ba6c536..820749b 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -417,6 +417,11 @@
     LOCAL_SHARED_LIBRARIES += vendor.qti.hardware.audiohalext@1.0
 endif
 
+# Memory optimization specific feature
+ifeq ($(strip $(TARGET_1G_DDR_RAM)), true)
+    LOCAL_CFLAGS += -DPURGE_UNUSED_MEM
+endif
+
 LOCAL_CFLAGS += -D_GNU_SOURCE
 LOCAL_CFLAGS += -Wall -Werror
 
diff --git a/hal/acdb.c b/hal/acdb.c
index 4b1ef31..5284228 100644
--- a/hal/acdb.c
+++ b/hal/acdb.c
@@ -5,7 +5,7 @@
  * Copyright (C) 2013 The Android Open Source Project
  *
  * Changes from Qualcomm Innovation Center are provided under the following license:
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  * SPDX-License-Identifier: BSD-3-Clause-Clear
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -248,14 +248,14 @@
             free(key_info);
         }
 
+        if (my_data->acdb_init_data.snd_card_name)
+            free(my_data->acdb_init_data.snd_card_name);
+
         if (result < 0) {
 
             if (snd_card_name)
                 free((void *)snd_card_name);
 
-            if (my_data->acdb_init_data.snd_card_name)
-                free(my_data->acdb_init_data.snd_card_name);
-
             if (my_data)
                 platform_info_deinit();
         }
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index 61ccfcb..2c677d6 100644
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -92,6 +92,7 @@
 #include "platform_api.h"
 #include "edid.h"
 #include "sound/compress_params.h"
+#include <pthread.h>
 
 #ifdef AUDIO_GKI_ENABLED
 #include "sound/audio_compressed_formats.h"
diff --git a/hal/audio_extn/spkr_protection.c b/hal/audio_extn/spkr_protection.c
index c7f5726..31bf94c 100644
--- a/hal/audio_extn/spkr_protection.c
+++ b/hal/audio_extn/spkr_protection.c
@@ -30,7 +30,7 @@
 /*
 * Changes from Qualcomm Innovation Center are provided under the following license:
 *
-* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted (subject to the limitations in the
@@ -1370,8 +1370,8 @@
                         }
                        thermal_fd = open(wsa_path, O_RDONLY);
                        if (thermal_fd > 0) {
-                           if ((ret = read(thermal_fd, buf, sizeof(buf))) >= 0) {
-                               buf[ret-1] = '\0';
+                           if ((ret = read(thermal_fd, buf, sizeof(buf)-1)) >= 0) {
+                               buf[ret] = '\0';
                                t0_spk_1 = atoi(buf);
                            }
                            else
@@ -1406,8 +1406,8 @@
                         }
                         thermal_fd = open(wsa_path, O_RDONLY);
                         if (thermal_fd > 0) {
-                           if ((ret = read(thermal_fd, buf, sizeof(buf))) >= 0) {
-                               buf[ret-1] = '\0';
+                           if ((ret = read(thermal_fd, buf, sizeof(buf)-1)) >= 0) {
+                               buf[ret] = '\0';
                                t0_spk_2 = atoi(buf);
                            }
                            else
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index be20e12..55006d2 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -3315,7 +3315,7 @@
     return -EINVAL;
 }
 
-void audio_extn_utils_release_snd_device(snd_device_t snd_device)
+void audio_extn_utils_release_snd_device(snd_device_t snd_device __unused)
 {
     audio_extn_dev_arbi_release(snd_device);
     audio_extn_sound_trigger_update_device_status(snd_device,
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 8442a6b..860e38c 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -35,7 +35,7 @@
  * limitations under the License.
  *
  * Changes from Qualcomm Innovation Center are provided under the following license:
- * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  * SPDX-License-Identifier: BSD-3-Clause-Clear
  *
  */
@@ -3566,6 +3566,9 @@
     }
 
     enable_gcov();
+#ifdef PURGE_UNUSED_MEM
+    mallopt(M_PURGE, 0);
+#endif
     ALOGV("%s: exit: status(%d)", __func__, ret);
     return ret;
 }
@@ -4205,6 +4208,9 @@
 
     clear_devices(&uc_info->device_list);
     free(uc_info);
+#ifdef PURGE_UNUSED_MEM
+    mallopt(M_PURGE, 0);
+#endif
     ALOGV("%s: exit: status(%d)", __func__, ret);
     return ret;
 }
@@ -10811,8 +10817,13 @@
         s_info = hashmapGet(adev->io_streams_map, (void *) (intptr_t) io_handle);
         if (s_info == NULL) {
             ALOGE("%s: Failed to obtain stream info", __func__);
-            if (new_patch)
+            if (new_patch) {
+
+                if(p_info->patch)
+                    free(p_info->patch);
+
                 free(p_info);
+            }
             pthread_mutex_unlock(&adev->lock);
             ret = -EINVAL;
             goto done;
@@ -10833,8 +10844,13 @@
         if (ret < 0) {
             pthread_mutex_lock(&adev->lock);
             s_info->patch_handle = AUDIO_PATCH_HANDLE_NONE;
-            if (new_patch)
+            if (new_patch) {
+
+                if(p_info->patch)
+                    free(p_info->patch);
+
                 free(p_info);
+            }
             pthread_mutex_unlock(&adev->lock);
             ALOGE("%s: Stream routing failed for io_handle %d", __func__, io_handle);
             goto done;
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 1d8bb15..74e2914 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -110,14 +110,13 @@
 #endif
 
 #if LINUX_ENABLED
+#define ADM_LIBRARY_PATH "/usr/lib/libadm.so"
 #if defined(__LP64__)
 #define VISUALIZER_LIBRARY_PATH "/usr/lib64/libqcomvisualizer.so"
 #define OFFLOAD_EFFECTS_BUNDLE_LIBRARY_PATH "/usr/lib64/libqcompostprocbundle.so"
-#define ADM_LIBRARY_PATH "/usr/lib64/libadm.so"
 #else
 #define VISUALIZER_LIBRARY_PATH "/usr/lib/libqcomvisualizer.so"
 #define OFFLOAD_EFFECTS_BUNDLE_LIBRARY_PATH "/usr/lib/libqcompostprocbundle.so"
-#define ADM_LIBRARY_PATH "/usr/lib/libadm.so"
 #endif
 #else
 #if defined(__LP64__)
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index d71ad0f..9ff9533 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -17,7 +17,7 @@
  * limitations under the License.
  *
  * Changes from Qualcomm Innovation Center are provided under the following license:
- * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  * SPDX-License-Identifier: BSD-3-Clause-Clear
  */
 
@@ -7043,6 +7043,9 @@
                     snd_device = SND_DEVICE_OUT_DISPLAY_PORT +
                         ((controller * MAX_STREAMS_PER_CONTROLLER) + stream);
                     break;
+                case EXT_DISPLAY_TYPE_HDMI:
+                    snd_device = SND_DEVICE_OUT_HDMI;
+                    break;
                 default:
                     ALOGE("%s: Invalid disp_type %d", __func__,
                            my_data->ext_disp[controller][stream].type);
@@ -9251,7 +9254,8 @@
         if (adev->dp_allowed_for_voice) {
             for (i = 0; i < MAX_CONTROLLERS; ++i) {
                 for (j = 0; j < MAX_STREAMS_PER_CONTROLLER; ++j) {
-                    if (my_data->ext_disp[i][j].type == EXT_DISPLAY_TYPE_DP) {
+                    if (my_data->ext_disp[i][j].type == EXT_DISPLAY_TYPE_DP
+                         ||  my_data->ext_disp[i][j].type == EXT_DISPLAY_TYPE_HDMI) {
                         enabled = true;
                         break;
                     }