Merge "PAL: add additional CKVs for devicePP"
diff --git a/Android.mk b/Android.mk
index ae1e35d..c7670ca 100644
--- a/Android.mk
+++ b/Android.mk
@@ -50,6 +50,10 @@
 LOCAL_CFLAGS += -DEC_REF_CAPTURE_ENABLED
 endif
 
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DYNAMIC_SR)),true)
+LOCAL_CFLAGS += -DDYNAMIC_SR_ENABLED
+endif
+
 LOCAL_C_INCLUDES              += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
 LOCAL_C_INCLUDES              += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/techpack/audio/include
 LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
diff --git a/PalDefs.h b/PalDefs.h
index c557428..50935dd 100644
--- a/PalDefs.h
+++ b/PalDefs.h
@@ -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 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
  */
 
@@ -1132,7 +1132,7 @@
  * Description : Used by PAL client to customize
  *               the device related information.
 */
-#define PAL_MAX_CUSTOM_KEY_SIZE 128
+#define PAL_MAX_CUSTOM_KEY_SIZE 256
 typedef struct pal_device_custom_config {
     char custom_key[PAL_MAX_CUSTOM_KEY_SIZE];
 } pal_device_custom_config_t;
diff --git a/configs/parrot/resourcemanager_ravelin_idp_wsahac.xml b/configs/parrot/resourcemanager_ravelin_idp_wsahac.xml
index 4c0780a..973a7f0 100644
--- a/configs/parrot/resourcemanager_ravelin_idp_wsahac.xml
+++ b/configs/parrot/resourcemanager_ravelin_idp_wsahac.xml
@@ -28,7 +28,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.             -->
 <!-- SPDX-License-Identifier: BSD-3-Clause-Clear                                          -->
 <resource_manager_info>
     <config_params>
@@ -110,10 +110,51 @@
             </usecase>
             <usecase>
                 <name>PAL_STREAM_DEEP_BUFFER</name>
+                <priority>3</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
+            </usecase>
+            <usecase>
+                <name>PAL_STREAM_VOICE_RECOGNITION</name>
+                <priority>3</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
             </usecase>
             <usecase>
                 <name>PAL_STREAM_VOIP_TX</name>
                 <priority>2</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
             </usecase>
             <usecase>
                 <name>PAL_STREAM_VOICE_CALL</name>
@@ -169,10 +210,51 @@
             </usecase>
             <usecase>
                 <name>PAL_STREAM_DEEP_BUFFER</name>
+                <priority>3</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
+            </usecase>
+            <usecase>
+                <name>PAL_STREAM_VOICE_RECOGNITION</name>
+                <priority>3</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
             </usecase>
             <usecase>
                 <name>PAL_STREAM_VOIP_TX</name>
                 <priority>2</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
             </usecase>
             <usecase>
                 <name>PAL_STREAM_VOICE_CALL</name>
@@ -196,6 +278,7 @@
             </usecase>
             <ec_rx_device>
                 <id>PAL_DEVICE_OUT_SPEAKER</id>
+                <id>PAL_DEVICE_OUT_HANDSET</id>
             </ec_rx_device>
         </in-device>
         <in-device>
@@ -209,11 +292,52 @@
             </usecase>
             <usecase>
                 <name>PAL_STREAM_DEEP_BUFFER</name>
+                <priority>3</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
+            </usecase>
+            <usecase>
+                <name>PAL_STREAM_VOICE_RECOGNITION</name>
+                <priority>3</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
             </usecase>
             <usecase>
                 <name>PAL_STREAM_VOIP_TX</name>
-                <samplerate>48000</samplerate>
+                <priority>2</priority>
                 <bit_width>16</bit_width>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
             </usecase>
             <usecase>
                 <name>PAL_STREAM_VOICE_CALL</name>
@@ -311,6 +435,10 @@
             <usecase>
                 <name>PAL_STREAM_ULTRA_LOW_LATENCY</name>
             </usecase>
+            <ec_rx_device>
+                <id>PAL_DEVICE_OUT_USB_DEVICE</id>
+                <id>PAL_DEVICE_OUT_USB_HEADSET</id>
+            </ec_rx_device>
         </in-device>
         <in-device>
             <id>PAL_DEVICE_IN_FM_TUNER</id>
@@ -429,6 +557,66 @@
             <usecase>
                 <name>PAL_STREAM_VOIP_RX</name>
                 <priority>3</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
+            </usecase>
+            <usecase>
+                <name>PAL_STREAM_DEEP_BUFFER</name>
+                <priority>3</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
+            </usecase>
+            <usecase>
+                <name>PAL_STREAM_PCM_OFFLOAD</name>
+                <priority>3</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
+            </usecase>
+            <usecase>
+                <name>PAL_STREAM_COMPRESSED</name>
+                <priority>3</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
             </usecase>
             <usecase>
                 <name>PAL_STREAM_ULTRASOUND</name>
@@ -463,6 +651,18 @@
                  <snd_device_name>voice-handset-hac</snd_device_name> <!-- override sound device name with HAC handset -->
               </custom-config>
               <priority>3</priority>
+              <custom-config key="8K">
+                  <samplerate>8000</samplerate>
+              </custom-config>
+              <custom-config key="16K">
+                  <samplerate>16000</samplerate>
+              </custom-config>
+              <custom-config key="32K">
+                  <samplerate>32000</samplerate>
+              </custom-config>
+              <custom-config key="48K">
+                  <samplerate>48000</samplerate>
+              </custom-config>
           </usecase>
           <usecase>
               <name>PAL_STREAM_ULTRASOUND</name>
@@ -506,8 +706,67 @@
            <usecase>
                <name>PAL_STREAM_VOIP_RX</name>
                <priority>2</priority>
-               <samplerate>48000</samplerate>
                <bit_width>16</bit_width>
+               <custom-config key="8K">
+                   <samplerate>8000</samplerate>
+               </custom-config>
+               <custom-config key="16K">
+                   <samplerate>16000</samplerate>
+               </custom-config>
+               <custom-config key="32K">
+                   <samplerate>32000</samplerate>
+               </custom-config>
+               <custom-config key="48K">
+                   <samplerate>48000</samplerate>
+               </custom-config>
+           </usecase>
+           <usecase>
+               <name>PAL_STREAM_DEEP_BUFFER</name>
+               <priority>3</priority>
+               <custom-config key="8K">
+                   <samplerate>8000</samplerate>
+               </custom-config>
+               <custom-config key="16K">
+                   <samplerate>16000</samplerate>
+               </custom-config>
+               <custom-config key="32K">
+                   <samplerate>32000</samplerate>
+               </custom-config>
+               <custom-config key="48K">
+                   <samplerate>48000</samplerate>
+               </custom-config>
+           </usecase>
+           <usecase>
+               <name>PAL_STREAM_PCM_OFFLOAD</name>
+               <priority>3</priority>
+               <custom-config key="8K">
+                   <samplerate>8000</samplerate>
+               </custom-config>
+               <custom-config key="16K">
+                   <samplerate>16000</samplerate>
+               </custom-config>
+               <custom-config key="32K">
+                   <samplerate>32000</samplerate>
+               </custom-config>
+               <custom-config key="48K">
+                   <samplerate>48000</samplerate>
+               </custom-config>
+           </usecase>
+           <usecase>
+               <name>PAL_STREAM_COMPRESSED</name>
+               <priority>3</priority>
+               <custom-config key="8K">
+                   <samplerate>8000</samplerate>
+               </custom-config>
+               <custom-config key="16K">
+                   <samplerate>16000</samplerate>
+               </custom-config>
+               <custom-config key="32K">
+                   <samplerate>32000</samplerate>
+               </custom-config>
+               <custom-config key="48K">
+                   <samplerate>48000</samplerate>
+               </custom-config>
            </usecase>
         </out-device>
         <out-device>
@@ -546,8 +805,51 @@
            <usecase>
                <name>PAL_STREAM_VOIP_RX</name>
                <priority>2</priority>
-               <samplerate>48000</samplerate>
                <bit_width>16</bit_width>
+               <custom-config key="8K">
+                   <samplerate>8000</samplerate>
+               </custom-config>
+               <custom-config key="16K">
+                   <samplerate>16000</samplerate>
+               </custom-config>
+               <custom-config key="32K">
+                   <samplerate>32000</samplerate>
+               </custom-config>
+               <custom-config key="48K">
+                   <samplerate>48000</samplerate>
+               </custom-config>
+           </usecase>
+           <usecase>
+               <name>PAL_STREAM_PCM_OFFLOAD</name>
+               <priority>3</priority>
+               <custom-config key="8K">
+                   <samplerate>8000</samplerate>
+               </custom-config>
+               <custom-config key="16K">
+                   <samplerate>16000</samplerate>
+               </custom-config>
+               <custom-config key="32K">
+                   <samplerate>32000</samplerate>
+               </custom-config>
+               <custom-config key="48K">
+                   <samplerate>48000</samplerate>
+               </custom-config>
+           </usecase>
+           <usecase>
+               <name>PAL_STREAM_COMPRESSED</name>
+               <priority>3</priority>
+               <custom-config key="8K">
+                   <samplerate>8000</samplerate>
+               </custom-config>
+               <custom-config key="16K">
+                   <samplerate>16000</samplerate>
+               </custom-config>
+               <custom-config key="32K">
+                   <samplerate>32000</samplerate>
+               </custom-config>
+               <custom-config key="48K">
+                   <samplerate>48000</samplerate>
+               </custom-config>
            </usecase>
          </out-device>
         <out-device>
@@ -611,6 +913,169 @@
                 <name>PAL_STREAM_VOICE_CALL</name>
                 <priority>1</priority>
             </usecase>
+            <usecase>
+                <name>PAL_STREAM_VOIP_RX</name>
+                <priority>3</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
+            </usecase>
+            <usecase>
+                <name>PAL_STREAM_DEEP_BUFFER</name>
+                <priority>3</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="11K">
+                    <samplerate>11025</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="22K">
+                    <samplerate>22050</samplerate>
+                </custom-config>
+                <custom-config key="24K">
+                    <samplerate>24000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="44.1K">
+                    <samplerate>44100</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
+                <custom-config key="64K">
+                    <samplerate>64000</samplerate>
+                </custom-config>
+                <custom-config key="88.2K">
+                    <samplerate>88200</samplerate>
+                </custom-config>
+                <custom-config key="96K">
+                    <samplerate>96000</samplerate>
+                </custom-config>
+                <custom-config key="176.4K">
+                    <samplerate>176400</samplerate>
+                </custom-config>
+                <custom-config key="192K">
+                    <samplerate>192000</samplerate>
+                </custom-config>
+                <custom-config key="352.8K">
+                    <samplerate>352800</samplerate>
+                </custom-config>
+                <custom-config key="384K">
+                    <samplerate>384000</samplerate>
+                </custom-config>
+            </usecase>
+            <usecase>
+                <name>PAL_STREAM_PCM_OFFLOAD</name>
+                <priority>3</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="11K">
+                    <samplerate>11025</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="22K">
+                    <samplerate>22050</samplerate>
+                </custom-config>
+                <custom-config key="24K">
+                    <samplerate>24000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="44.1K">
+                    <samplerate>44100</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
+                <custom-config key="64K">
+                    <samplerate>64000</samplerate>
+                </custom-config>
+                <custom-config key="88.2K">
+                    <samplerate>88200</samplerate>
+                </custom-config>
+                <custom-config key="96K">
+                    <samplerate>96000</samplerate>
+                </custom-config>
+                <custom-config key="176.4K">
+                    <samplerate>176400</samplerate>
+                </custom-config>
+                <custom-config key="192K">
+                    <samplerate>192000</samplerate>
+                </custom-config>
+                <custom-config key="352.8K">
+                    <samplerate>352800</samplerate>
+                </custom-config>
+                <custom-config key="384K">
+                    <samplerate>384000</samplerate>
+                </custom-config>
+            </usecase>
+            <usecase>
+                <name>PAL_STREAM_COMPRESSED</name>
+                <priority>3</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="11K">
+                    <samplerate>11025</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="22K">
+                    <samplerate>22050</samplerate>
+                </custom-config>
+                <custom-config key="24K">
+                    <samplerate>24000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="44.1K">
+                    <samplerate>44100</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
+                <custom-config key="64K">
+                    <samplerate>64000</samplerate>
+                </custom-config>
+                <custom-config key="88.2K">
+                    <samplerate>88200</samplerate>
+                </custom-config>
+                <custom-config key="96K">
+                    <samplerate>96000</samplerate>
+                </custom-config>
+                <custom-config key="176.4K">
+                    <samplerate>176400</samplerate>
+                </custom-config>
+                <custom-config key="192K">
+                    <samplerate>192000</samplerate>
+                </custom-config>
+                <custom-config key="352.8K">
+                    <samplerate>352800</samplerate>
+                </custom-config>
+                <custom-config key="384K">
+                    <samplerate>384000</samplerate>
+                </custom-config>
+            </usecase>
         </out-device>
         <out-device>
             <id>PAL_DEVICE_OUT_USB_HEADSET</id>
@@ -623,6 +1088,169 @@
                 <name>PAL_STREAM_VOICE_CALL</name>
                 <priority>1</priority>
             </usecase>
+            <usecase>
+                <name>PAL_STREAM_VOIP_RX</name>
+                <priority>3</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
+            </usecase>
+            <usecase>
+                <name>PAL_STREAM_DEEP_BUFFER</name>
+                <priority>3</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="11K">
+                    <samplerate>11025</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="22K">
+                    <samplerate>22050</samplerate>
+                </custom-config>
+                <custom-config key="24K">
+                    <samplerate>24000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="44.1K">
+                    <samplerate>44100</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
+                <custom-config key="64K">
+                    <samplerate>64000</samplerate>
+                </custom-config>
+                <custom-config key="88.2K">
+                    <samplerate>88200</samplerate>
+                </custom-config>
+                <custom-config key="96K">
+                    <samplerate>96000</samplerate>
+                </custom-config>
+                <custom-config key="176.4K">
+                    <samplerate>176400</samplerate>
+                </custom-config>
+                <custom-config key="192K">
+                    <samplerate>192000</samplerate>
+                </custom-config>
+                <custom-config key="352.8K">
+                    <samplerate>352800</samplerate>
+                </custom-config>
+                <custom-config key="384K">
+                    <samplerate>384000</samplerate>
+                </custom-config>
+            </usecase>
+            <usecase>
+                <name>PAL_STREAM_PCM_OFFLOAD</name>
+                <priority>3</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="11K">
+                    <samplerate>11025</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="22K">
+                    <samplerate>22050</samplerate>
+                </custom-config>
+                <custom-config key="24K">
+                    <samplerate>24000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="44.1K">
+                    <samplerate>44100</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
+                <custom-config key="64K">
+                    <samplerate>64000</samplerate>
+                </custom-config>
+                <custom-config key="88.2K">
+                    <samplerate>88200</samplerate>
+                </custom-config>
+                <custom-config key="96K">
+                    <samplerate>96000</samplerate>
+                </custom-config>
+                <custom-config key="176.4K">
+                    <samplerate>176400</samplerate>
+                </custom-config>
+                <custom-config key="192K">
+                    <samplerate>192000</samplerate>
+                </custom-config>
+                <custom-config key="352.8K">
+                    <samplerate>352800</samplerate>
+                </custom-config>
+                <custom-config key="384K">
+                    <samplerate>384000</samplerate>
+                </custom-config>
+            </usecase>
+            <usecase>
+                <name>PAL_STREAM_COMPRESSED</name>
+                <priority>3</priority>
+                <custom-config key="8K">
+                    <samplerate>8000</samplerate>
+                </custom-config>
+                <custom-config key="11K">
+                    <samplerate>11025</samplerate>
+                </custom-config>
+                <custom-config key="16K">
+                    <samplerate>16000</samplerate>
+                </custom-config>
+                <custom-config key="22K">
+                    <samplerate>22050</samplerate>
+                </custom-config>
+                <custom-config key="24K">
+                    <samplerate>24000</samplerate>
+                </custom-config>
+                <custom-config key="32K">
+                    <samplerate>32000</samplerate>
+                </custom-config>
+                <custom-config key="44.1K">
+                    <samplerate>44100</samplerate>
+                </custom-config>
+                <custom-config key="48K">
+                    <samplerate>48000</samplerate>
+                </custom-config>
+                <custom-config key="64K">
+                    <samplerate>64000</samplerate>
+                </custom-config>
+                <custom-config key="88.2K">
+                    <samplerate>88200</samplerate>
+                </custom-config>
+                <custom-config key="96K">
+                    <samplerate>96000</samplerate>
+                </custom-config>
+                <custom-config key="176.4K">
+                    <samplerate>176400</samplerate>
+                </custom-config>
+                <custom-config key="192K">
+                    <samplerate>192000</samplerate>
+                </custom-config>
+                <custom-config key="352.8K">
+                    <samplerate>352800</samplerate>
+                </custom-config>
+                <custom-config key="384K">
+                    <samplerate>384000</samplerate>
+                </custom-config>
+            </usecase>
         </out-device>
         <out-device>
             <id>PAL_DEVICE_OUT_AUX_DIGITAL_1</id>
diff --git a/resource_manager/src/ResourceManager.cpp b/resource_manager/src/ResourceManager.cpp
index a1686dd..239591b 100644
--- a/resource_manager/src/ResourceManager.cpp
+++ b/resource_manager/src/ResourceManager.cpp
@@ -1635,9 +1635,11 @@
     return ecref_status;
 }
 
-void ResourceManager::getDeviceInfo(pal_device_id_t deviceId, pal_stream_type_t type, std::string key, struct pal_device_info *devinfo)
+void ResourceManager::getDeviceInfo(pal_device_id_t deviceId, pal_stream_type_t type, std::string customKey, struct pal_device_info *devinfo)
 {
     bool found = false;
+    std::istringstream keys(customKey);
+    std::string key;
 
     for (int32_t i = 0; i < deviceInfo.size(); i++) {
         if (deviceId == deviceInfo[i].deviceId) {
@@ -1695,57 +1697,59 @@
                                 type,
                                 deviceNameLUT.at(deviceId).c_str());
                     }
-                    /*parse custom config if there*/
-                    for (int32_t k = 0; k < deviceInfo[i].usecase[j].config.size(); k++) {
-                        if (!deviceInfo[i].usecase[j].config[k].key.compare(key)) {
-                            /*overwrite the channels if needed*/
-                            if (deviceInfo[i].usecase[j].config[k].channel) {
-                                devinfo->channels = deviceInfo[i].usecase[j].config[k].channel;
-                                devinfo->channels_overwrite = true;
-                                PAL_VERBOSE(LOG_TAG, "got overwritten channels %d for custom key %s usecase %d for dev %s",
-                                        devinfo->channels,
-                                        key.c_str(),
-                                        type,
-                                        deviceNameLUT.at(deviceId).c_str());
+                    while (std::getline(keys, key, ';')) {
+                        /*parse custom config if there*/
+                        for (int32_t k = 0; k < deviceInfo[i].usecase[j].config.size(); k++) {
+                            if (!deviceInfo[i].usecase[j].config[k].key.compare(key)) {
+                                /*overwrite the channels if needed*/
+                                if (deviceInfo[i].usecase[j].config[k].channel) {
+                                    devinfo->channels = deviceInfo[i].usecase[j].config[k].channel;
+                                    devinfo->channels_overwrite = true;
+                                    PAL_VERBOSE(LOG_TAG, "got overwritten channels %d for custom key %s usecase %d for dev %s",
+                                            devinfo->channels,
+                                            key.c_str(),
+                                            type,
+                                            deviceNameLUT.at(deviceId).c_str());
+                                }
+                                if (deviceInfo[i].usecase[j].config[k].samplerate) {
+                                    devinfo->samplerate = deviceInfo[i].usecase[j].config[k].samplerate;
+                                    devinfo->samplerate_overwrite = true;
+                                    PAL_VERBOSE(LOG_TAG, "got overwritten samplerate %d for custom key %s usecase %d for dev %s",
+                                            devinfo->samplerate,
+                                            key.c_str(),
+                                            type,
+                                            deviceNameLUT.at(deviceId).c_str());
+                                }
+                                if (!(deviceInfo[i].usecase[j].config[k].sndDevName).empty()) {
+                                    devinfo->sndDevName = deviceInfo[i].usecase[j].config[k].sndDevName;
+                                    devinfo->sndDevName_overwrite = true;
+                                    PAL_VERBOSE(LOG_TAG, "got overwitten snd dev %s for custom key %s usecase %d for dev %s",
+                                            devinfo->sndDevName.c_str(),
+                                            key.c_str(),
+                                            type,
+                                            deviceNameLUT.at(deviceId).c_str());
+                                }
+                                if (deviceInfo[i].usecase[j].config[k].priority &&
+                                    deviceInfo[i].usecase[j].config[k].priority != MIN_USECASE_PRIORITY) {
+                                    devinfo->priority = deviceInfo[i].usecase[j].config[k].priority;
+                                    PAL_VERBOSE(LOG_TAG, "got priority %d for custom key %s usecase %d for dev %s",
+                                            devinfo->priority,
+                                            key.c_str(),
+                                            type,
+                                            deviceNameLUT.at(deviceId).c_str());
+                                }
+                                if (deviceInfo[i].usecase[j].config[k].bit_width) {
+                                    devinfo->bit_width = deviceInfo[i].usecase[j].config[k].bit_width;
+                                    devinfo->bit_width_overwrite = true;
+                                    PAL_VERBOSE(LOG_TAG, "got overwritten bit width %d for custom key %s usecase %d for dev %s",
+                                            devinfo->bit_width,
+                                            key.c_str(),
+                                            type,
+                                            deviceNameLUT.at(deviceId).c_str());
+                                }
+                                found = true;
+                                break;
                             }
-                            if (deviceInfo[i].usecase[j].config[k].samplerate) {
-                                devinfo->samplerate = deviceInfo[i].usecase[j].config[k].samplerate;
-                                devinfo->samplerate_overwrite = true;
-                                PAL_VERBOSE(LOG_TAG, "got overwritten samplerate %d for custom key %s usecase %d for dev %s",
-                                        devinfo->samplerate,
-                                        key.c_str(),
-                                        type,
-                                        deviceNameLUT.at(deviceId).c_str());
-                            }
-                            if (!(deviceInfo[i].usecase[j].config[k].sndDevName).empty()) {
-                                devinfo->sndDevName = deviceInfo[i].usecase[j].config[k].sndDevName;
-                                devinfo->sndDevName_overwrite = true;
-                                PAL_VERBOSE(LOG_TAG, "got overwitten snd dev %s for custom key %s usecase %d for dev %s",
-                                        devinfo->sndDevName.c_str(),
-                                        key.c_str(),
-                                        type,
-                                        deviceNameLUT.at(deviceId).c_str());
-                            }
-                            if (deviceInfo[i].usecase[j].config[k].priority &&
-                                deviceInfo[i].usecase[j].config[k].priority != MIN_USECASE_PRIORITY) {
-                                devinfo->priority = deviceInfo[i].usecase[j].config[k].priority;
-                                PAL_VERBOSE(LOG_TAG, "got priority %d for custom key %s usecase %d for dev %s",
-                                        devinfo->priority,
-                                        key.c_str(),
-                                        type,
-                                        deviceNameLUT.at(deviceId).c_str());
-                            }
-                            if (deviceInfo[i].usecase[j].config[k].bit_width) {
-                                devinfo->bit_width = deviceInfo[i].usecase[j].config[k].bit_width;
-                                devinfo->bit_width_overwrite = true;
-                                PAL_VERBOSE(LOG_TAG, "got overwritten bit width %d for custom key %s usecase %d for dev %s",
-                                        devinfo->bit_width,
-                                        key.c_str(),
-                                        type,
-                                        deviceNameLUT.at(deviceId).c_str());
-                            }
-                            found = true;
-                            break;
                         }
                     }
                 }
@@ -2357,8 +2361,14 @@
         return result;
     }
     if (cur_sessions == max_sessions && type != PAL_STREAM_VOICE_CALL) {
-        PAL_ERR(LOG_TAG, "no new session allowed for stream %d", type);
-        return result;
+        if (type == PAL_STREAM_VOICE_RECOGNITION &&
+            active_streams_db.size() < MAX_SESSIONS_DEEP_BUFFER) {
+                attributes->type = PAL_STREAM_DEEP_BUFFER;
+                type = PAL_STREAM_DEEP_BUFFER;
+        } else {
+            PAL_ERR(LOG_TAG, "no new session allowed for stream %d", type);
+            return result;
+        }
     }
 
     // check if param supported by audio configruation
diff --git a/session/inc/PayloadBuilder.h b/session/inc/PayloadBuilder.h
index c7ae4b3..4d62194 100644
--- a/session/inc/PayloadBuilder.h
+++ b/session/inc/PayloadBuilder.h
@@ -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
  */
 
@@ -190,6 +190,8 @@
     void payloadDpAudioConfig(uint8_t** payload, size_t* size,
                            uint32_t miid,
                            struct dpAudioConfig *data);
+    void payloadVolumeCtrlRamp(uint8_t** payload, size_t* size,
+         uint32_t miid, uint32_t ramp_period_ms);
     void payloadMFCConfig(uint8_t** payload, size_t* size,
                            uint32_t miid,
                            struct sessionToPayloadParam* data);
diff --git a/session/inc/Session.h b/session/inc/Session.h
index e62e259..bb6b2bc 100644
--- a/session/inc/Session.h
+++ b/session/inc/Session.h
@@ -26,8 +26,8 @@
  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  * 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.
+ * Changes from Qualcomm Innovation Center, Inc. are provided under the following license:
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  * SPDX-License-Identifier: BSD-3-Clause-Clear
  */
 
@@ -73,6 +73,9 @@
 
 #define EVENT_ID_SOFT_PAUSE_PAUSE_COMPLETE 0x0800103F
 
+#define MSPP_SOFT_PAUSE_DELAY 150
+#define DEFAULT_RAMP_PERIOD 0x28
+
 class Stream;
 class ResourceManager;
 class Session
@@ -99,6 +102,7 @@
     static int extECRefCnt;
     static std::mutex extECMutex;
     bool frontEndIdAllocated = false;
+    int32_t setInitialVolume();
 public:
     bool isMixerEventCbRegd;
     bool isPauseRegistrationDone;
diff --git a/session/inc/SessionAlsaPcm.h b/session/inc/SessionAlsaPcm.h
index d6ef587..d6ee164 100644
--- a/session/inc/SessionAlsaPcm.h
+++ b/session/inc/SessionAlsaPcm.h
@@ -1,6 +1,5 @@
 /*
  * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -26,6 +25,10 @@
  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Changes from Qualcomm Innovation Center, Inc. are provided under the following license:
+ * Copyright (c) 2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause-Clear
  */
 
 #ifndef SESSION_ALSAPCM_H
@@ -121,6 +124,7 @@
     int register_asps_event(uint32_t reg);
     int getTagsWithModuleInfo(Stream *s, size_t *size __unused, uint8_t *payload);
     void retryOpenWithoutEC(Stream *s, unsigned int pcm_flags, struct pcm_config *config);
+    int populateECMFCPayload(Stream *s, size_t *payloadSize, uint8_t **payload);
 };
 
 #endif //SESSION_ALSAPCM_H
diff --git a/session/src/PayloadBuilder.cpp b/session/src/PayloadBuilder.cpp
index 1308512..63b347e 100644
--- a/session/src/PayloadBuilder.cpp
+++ b/session/src/PayloadBuilder.cpp
@@ -82,6 +82,17 @@
 /* Structure type def for above payload. */
 typedef struct volume_ctrl_master_gain_t volume_ctrl_master_gain_t;
 
+#define PARAM_ID_VOL_CTRL_GAIN_RAMP_PARAMETERS 0x08001037
+#define PARAM_VOL_CTRL_RAMPINGCURVE_LINEAR 0
+
+/* Structure for holding soft stepping volume parameters. */
+struct volume_ctrl_gain_ramp_params_t
+{
+   uint32_t period_ms;
+   uint32_t step_us;
+   uint32_t ramping_curve;
+};
+
 /* ID of the Output Media Format parameters used by MODULE_ID_MFC */
 #define PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT            0x08001024
 #include "spf_begin_pack.h"
@@ -392,6 +403,40 @@
      PAL_DBG(LOG_TAG, "payload %pK size %zu", *payload, *size);
 }
 
+void PayloadBuilder::payloadVolumeCtrlRamp(uint8_t** payload, size_t* size,
+        uint32_t miid, uint32_t ramp_period_ms)
+{
+    struct apm_module_param_data_t* header = NULL;
+    struct volume_ctrl_gain_ramp_params_t *rampParams;
+    uint8_t* payloadInfo = NULL;
+    size_t payloadSize = 0, padBytes = 0;
+
+    payloadSize = sizeof(struct apm_module_param_data_t) +
+                  sizeof(struct volume_ctrl_gain_ramp_params_t);
+    padBytes = PAL_PADDING_8BYTE_ALIGN(payloadSize);
+    payloadInfo = new uint8_t[payloadSize + padBytes]();
+    if (!payloadInfo) {
+        PAL_ERR(LOG_TAG, "payloadInfo malloc failed %s", strerror(errno));
+        return;
+    }
+    header = (struct apm_module_param_data_t*)payloadInfo;
+    header->module_instance_id = miid;
+    header->param_id = PARAM_ID_VOL_CTRL_GAIN_RAMP_PARAMETERS;
+    header->error_code = 0x0;
+    header->param_size = payloadSize -  sizeof(struct apm_module_param_data_t);
+    rampParams = (struct volume_ctrl_gain_ramp_params_t*) (payloadInfo + sizeof(struct apm_module_param_data_t));
+    rampParams->period_ms = ramp_period_ms;
+    rampParams->step_us = 0;
+    rampParams->ramping_curve = PARAM_VOL_CTRL_RAMPINGCURVE_LINEAR;
+    PAL_VERBOSE(LOG_TAG, "header params IID:%x param_id:%x error_code:%d param_size:%d",
+                  header->module_instance_id, header->param_id,
+                  header->error_code, header->param_size);
+    *size = payloadSize + padBytes;;
+    *payload = payloadInfo;
+    PAL_DBG(LOG_TAG, "payload %pK size %zu", *payload, *size);
+
+}
+
 void PayloadBuilder::payloadMFCConfig(uint8_t** payload, size_t* size,
         uint32_t miid, struct sessionToPayloadParam* data)
 {
diff --git a/session/src/Session.cpp b/session/src/Session.cpp
index bc11648..6013128 100644
--- a/session/src/Session.cpp
+++ b/session/src/Session.cpp
@@ -26,8 +26,8 @@
  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  * 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.
+ * Changes from Qualcomm Innovation Center, Inc. are provided under the following license:
+ * Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  * SPDX-License-Identifier: BSD-3-Clause-Clear
  */
 
@@ -900,6 +900,83 @@
     PAL_DBG(LOG_TAG, "Exit.");
     return status;
 }
+int32_t Session::setInitialVolume() {
+    int32_t status = 0;
+    struct volume_set_param_info vol_set_param_info = {};
+    uint16_t volSize = 0;
+    uint8_t *volPayload = nullptr;
+    struct pal_stream_attributes sAttr = {};
+    bool isStreamAvail = false;
+    struct pal_vol_ctrl_ramp_param ramp_param = {};
+    Session *session = NULL;
+
+    PAL_DBG(LOG_TAG, "Enter status: %d", status);
+
+    if (!streamHandle) {
+        PAL_ERR(LOG_TAG, "streamHandle is invalid");
+        goto exit;
+    }
+    status = streamHandle->getStreamAttributes(&sAttr);
+    if (status != 0) {
+        PAL_ERR(LOG_TAG, "stream get attributes failed");
+        goto exit;
+    }
+
+    memset(&vol_set_param_info, 0, sizeof(struct volume_set_param_info));
+    rm->getVolumeSetParamInfo(&vol_set_param_info);
+    isStreamAvail = (find(vol_set_param_info.streams_.begin(),
+                vol_set_param_info.streams_.end(), sAttr.type) !=
+                vol_set_param_info.streams_.end());
+    if (isStreamAvail && vol_set_param_info.isVolumeUsingSetParam) {
+        if (sAttr.direction == PAL_AUDIO_OUTPUT) {
+           /* DSP default volume is highest value, non-0 rampping period
+            * brings volume burst from highest amplitude to new volume
+            * at the begining, that makes pop noise heard.
+            * set ramp period to 0 ms before pcm_start only for output,
+            * so desired volume can take effect instantly at the begining.
+            */
+            ramp_param.ramp_period_ms = 0;
+            status = setParameters(streamHandle, TAG_STREAM_VOLUME,
+                                   PAL_PARAM_ID_VOLUME_CTRL_RAMP, &ramp_param);
+        }
+        // apply if there is any cached volume
+        if (streamHandle->mVolumeData) {
+            volSize = (sizeof(struct pal_volume_data) +
+                      (sizeof(struct pal_channel_vol_kv) *
+                      (streamHandle->mVolumeData->no_of_volpair)));
+            volPayload = new uint8_t[sizeof(pal_param_payload) +
+                volSize]();
+            pal_param_payload *pld = (pal_param_payload *)volPayload;
+            pld->payload_size = sizeof(struct pal_volume_data);
+            memcpy(pld->payload, streamHandle->mVolumeData, volSize);
+            status = setParameters(streamHandle, TAG_STREAM_VOLUME,
+                    PAL_PARAM_ID_VOLUME_USING_SET_PARAM, (void *)pld);
+            delete[] volPayload;
+        }
+        if (sAttr.direction == PAL_AUDIO_OUTPUT) {
+            //set ramp period back to default.
+            ramp_param.ramp_period_ms = DEFAULT_RAMP_PERIOD;
+            status = setParameters(streamHandle, TAG_STREAM_VOLUME,
+                                   PAL_PARAM_ID_VOLUME_CTRL_RAMP, &ramp_param);
+        }
+    } else {
+        // Setting the volume as in stream open, no default volume is set.
+        if (sAttr.type != PAL_STREAM_ACD &&
+            sAttr.type != PAL_STREAM_VOICE_UI &&
+            sAttr.type != PAL_STREAM_ULTRASOUND &&
+            sAttr.type != PAL_STREAM_SENSOR_PCM_DATA &&
+            sAttr.type != PAL_STREAM_HAPTICS) {
+
+            if (setConfig(streamHandle, CALIBRATION, TAG_STREAM_VOLUME) != 0) {
+                PAL_ERR(LOG_TAG,"Setting volume failed");
+            }
+        }
+    }
+
+exit:
+    PAL_DBG(LOG_TAG, "Exit status: %d", status);
+    return status;
+}
 
 #if 0
 int setConfig(Stream * s, pal_stream_type_t sType, configType type, uint32_t tag1,
diff --git a/session/src/SessionAlsaCompress.cpp b/session/src/SessionAlsaCompress.cpp
index 3cf92c3..1198fb3 100644
--- a/session/src/SessionAlsaCompress.cpp
+++ b/session/src/SessionAlsaCompress.cpp
@@ -25,6 +25,10 @@
  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *Changes from Qualcomm Innovation Center, Inc. are provided under the following license:
+ *Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ *SPDX-License-Identifier: BSD-3-Clause-Clear
  */
 
 #define LOG_TAG "PAL: SessionAlsaCompress"
@@ -1426,30 +1430,9 @@
         default:
             break;
     }
-    memset(&vol_set_param_info, 0, sizeof(struct volume_set_param_info));
-    rm->getVolumeSetParamInfo(&vol_set_param_info);
-    isStreamAvail = (find(vol_set_param_info.streams_.begin(),
-                vol_set_param_info.streams_.end(), sAttr.type) !=
-                vol_set_param_info.streams_.end());
-    if (isStreamAvail && vol_set_param_info.isVolumeUsingSetParam) {
-        // apply if there is any cached volume
-        if (s->mVolumeData) {
-            volSize = (sizeof(struct pal_volume_data) +
-                    (sizeof(struct pal_channel_vol_kv) * (s->mVolumeData->no_of_volpair)));
-            volPayload = new uint8_t[sizeof(pal_param_payload) +
-                volSize]();
-            pal_param_payload *pld = (pal_param_payload *)volPayload;
-            pld->payload_size = sizeof(struct pal_volume_data);
-            memcpy(pld->payload, s->mVolumeData, volSize);
-            status = setParameters(s, TAG_STREAM_VOLUME,
-                    PAL_PARAM_ID_VOLUME_USING_SET_PARAM, (void *)pld);
-            delete[] volPayload;
-        }
-    } else {
-        // Setting the volume as no default volume is set now in stream open
-        if (setConfig(s, CALIBRATION, TAG_STREAM_VOLUME) != 0) {
-            PAL_ERR(LOG_TAG,"Setting volume failed");
-        }
+    status = setInitialVolume();
+    if (status != 0) {
+        PAL_ERR(LOG_TAG, "setVolume failed");
     }
 
 exit:
@@ -1962,6 +1945,21 @@
                 PAL_INFO(LOG_TAG, "mixer set volume config status=%d\n", status);
                 freeCustomPayload(&alsaParamData, &alsaPayloadSize);
             }
+        }
+        break;
+        case PAL_PARAM_ID_VOLUME_CTRL_RAMP:
+        {
+            struct pal_vol_ctrl_ramp_param *rampParam = (struct pal_vol_ctrl_ramp_param *)payload;
+            status = SessionAlsaUtils::getModuleInstanceId(mixer, device,
+                               rxAifBackEnds[0].second.data(), tagId, &miid);
+            builder->payloadVolumeCtrlRamp(&alsaParamData, &alsaPayloadSize,
+                 miid, rampParam->ramp_period_ms);
+            if (alsaPayloadSize) {
+                status = SessionAlsaUtils::setMixerParameter(mixer, device,
+                                               alsaParamData, alsaPayloadSize);
+                PAL_INFO(LOG_TAG, "mixer set vol ctrl ramp status=%d\n", status);
+                freeCustomPayload(&alsaParamData, &alsaPayloadSize);
+            }
             break;
         }
         default:
@@ -2166,4 +2164,3 @@
     PAL_DBG(LOG_TAG, "Exit, status: %d", status);
     return status;
 }
-
diff --git a/session/src/SessionAlsaPcm.cpp b/session/src/SessionAlsaPcm.cpp
index 2575b30..51f6d68 100644
--- a/session/src/SessionAlsaPcm.cpp
+++ b/session/src/SessionAlsaPcm.cpp
@@ -1,6 +1,5 @@
 /*
  * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -27,9 +26,9 @@
  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * Changes from Qualcomm Innovation Center are provided under the following license:
+ * Changes from Qualcomm Innovation Center, Inc. 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.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted (subject to the limitations in the
@@ -792,6 +791,61 @@
         rm->admAbandonFocusFn(rm->admData, static_cast<void *>(s));
 }
 
+int SessionAlsaPcm::populateECMFCPayload(Stream *s, size_t *payloadSize, uint8_t **payload)
+{
+    int status = 0;
+    uint32_t miid;
+    std::vector<std::shared_ptr<Device>> associatedDevices;
+    struct pal_device dAttr = {};
+    struct sessionToPayloadParam streamData = {};
+
+    status = SessionAlsaUtils::getModuleInstanceId(mixer, pcmDevIds.at(0),
+                                txAifBackEnds[0].second.data(), TAG_DEVICEPP_EC_MFC, &miid);
+    if (status != 0) {
+        PAL_ERR(LOG_TAG,"getModuleInstanceId failed\n");
+        /* Returning success status, as usecase will fail if tagged module is not present in ACDB */
+        status = 0;
+        goto exit;
+    }
+
+    PAL_INFO(LOG_TAG, "miid : %x id = %d\n", miid, pcmDevIds.at(0));
+    status = s->getAssociatedDevices(associatedDevices);
+    if (0 != status) {
+        PAL_ERR(LOG_TAG,"getAssociatedDevices Failed\n");
+        goto exit;
+    }
+
+    for (int i = 0; i < associatedDevices.size();i++) {
+        status = associatedDevices[i]->getDeviceAttributes(&dAttr);
+        if (0 != status) {
+            PAL_ERR(LOG_TAG,"get Device Attributes Failed\n");
+            goto exit;
+        }
+
+        if ((dAttr.id == PAL_DEVICE_IN_BLUETOOTH_A2DP) ||
+                (dAttr.id == PAL_DEVICE_IN_BLUETOOTH_SCO_HEADSET)) {
+            struct pal_media_config codecConfig;
+            status = associatedDevices[i]->getCodecConfig(&codecConfig);
+            if (0 != status) {
+                PAL_ERR(LOG_TAG, "getCodecConfig Failed \n");
+                goto exit;
+            }
+            streamData.sampleRate = codecConfig.sample_rate;
+            streamData.bitWidth   = AUDIO_BIT_WIDTH_DEFAULT_16;
+            streamData.numChannel = 0xFFFF;
+        } else {
+            streamData.sampleRate = dAttr.config.sample_rate;
+            streamData.bitWidth   = AUDIO_BIT_WIDTH_DEFAULT_16;
+            streamData.numChannel = 0xFFFF;
+        }
+
+        builder->payloadMFCConfig(payload, payloadSize, miid, &streamData);
+    }
+
+exit:
+    return status;
+}
+
 int SessionAlsaPcm::start(Stream * s)
 {
     struct pcm_config config;
@@ -1053,52 +1107,22 @@
                     }
                 }
 
-                if (sAttr.type == PAL_STREAM_VOIP_TX) {
-                    status = SessionAlsaUtils::getModuleInstanceId(mixer, pcmDevIds.at(0),
-                                                txAifBackEnds[0].second.data(), TAG_DEVICEPP_EC_MFC, &miid);
+                if ((sAttr.type == PAL_STREAM_VOIP_TX) ||
+                    ((sAttr.type == PAL_STREAM_DEEP_BUFFER) &&
+                     (sAttr.direction == PAL_AUDIO_INPUT))) {
+                    status = populateECMFCPayload(s, &payloadSize, &payload);
                     if (status != 0) {
-                        PAL_ERR(LOG_TAG,"getModuleInstanceId failed\n");
+                        PAL_ERR(LOG_TAG, "populate EC MFC payload failed");
                         goto set_mixer;
                     }
-                    PAL_INFO(LOG_TAG, "miid : %x id = %d\n", miid, pcmDevIds.at(0));
-                    status = s->getAssociatedDevices(associatedDevices);
-                    if (0 != status) {
-                        PAL_ERR(LOG_TAG,"getAssociatedDevices Failed\n");
-                        goto set_mixer;
-                    }
-                    for (int i = 0; i < associatedDevices.size();i++) {
-                        status = associatedDevices[i]->getDeviceAttributes(&dAttr);
+
+                    if (payloadSize && payload) {
+                        status = updateCustomPayload(payload, payloadSize);
+                        freeCustomPayload(&payload, &payloadSize);
                         if (0 != status) {
-                            PAL_ERR(LOG_TAG,"get Device Attributes Failed\n");
+                            PAL_ERR(LOG_TAG,"updateCustomPayload Failed\n");
                             goto set_mixer;
                         }
-
-                        if ((dAttr.id == PAL_DEVICE_IN_BLUETOOTH_A2DP) ||
-                                (dAttr.id == PAL_DEVICE_IN_BLUETOOTH_SCO_HEADSET)) {
-                            struct pal_media_config codecConfig;
-                            status = associatedDevices[i]->getCodecConfig(&codecConfig);
-                            if (0 != status) {
-                                PAL_ERR(LOG_TAG, "getCodecConfig Failed \n");
-                                goto set_mixer;
-                            }
-                            streamData.sampleRate = codecConfig.sample_rate;
-                            streamData.bitWidth   = AUDIO_BIT_WIDTH_DEFAULT_16;
-                            streamData.numChannel = 0xFFFF;
-                        } else {
-                            streamData.sampleRate = dAttr.config.sample_rate;
-                            streamData.bitWidth   = AUDIO_BIT_WIDTH_DEFAULT_16;
-                            streamData.numChannel = 0xFFFF;
-                        }
-
-                        builder->payloadMFCConfig(&payload, &payloadSize, miid, &streamData);
-                        if (payloadSize && payload) {
-                            status = updateCustomPayload(payload, payloadSize);
-                            freeCustomPayload(&payload, &payloadSize);
-                            if (0 != status) {
-                                PAL_ERR(LOG_TAG,"updateCustomPayload Failed\n");
-                                goto set_mixer;
-                            }
-                        }
                     }
                 }
 
@@ -1257,8 +1281,11 @@
                     }
                 }
             }
-
 pcm_start:
+            status = setInitialVolume();
+            if (status != 0) {
+                PAL_ERR(LOG_TAG, "setVolume failed");
+            }
             memset(&lpm_info, 0, sizeof(struct disable_lpm_info));
             rm->getDisableLpmInfo(&lpm_info);
             isStreamAvail = (find(lpm_info.streams_.begin(),
@@ -1365,37 +1392,8 @@
             }
            break;
     }
-    memset(&vol_set_param_info, 0, sizeof(struct volume_set_param_info));
-    rm->getVolumeSetParamInfo(&vol_set_param_info);
-    isStreamAvail = (find(vol_set_param_info.streams_.begin(),
-                vol_set_param_info.streams_.end(), sAttr.type) !=
-                vol_set_param_info.streams_.end());
-    if (isStreamAvail && vol_set_param_info.isVolumeUsingSetParam) {
-        // apply if there is any cached volume
-        if (s->mVolumeData) {
-            volSize = (sizeof(struct pal_volume_data) +
-                    (sizeof(struct pal_channel_vol_kv) * (s->mVolumeData->no_of_volpair)));
-            volPayload = new uint8_t[sizeof(pal_param_payload) +
-                volSize]();
-            pal_param_payload *pld = (pal_param_payload *)volPayload;
-            pld->payload_size = sizeof(struct pal_volume_data);
-            memcpy(pld->payload, s->mVolumeData, volSize);
-            status = setParameters(s, TAG_STREAM_VOLUME,
-                    PAL_PARAM_ID_VOLUME_USING_SET_PARAM, (void *)pld);
-            delete[] volPayload;
-        }
-    } else {
-        // Setting the volume as in stream open, no default volume is set.
-        if (sAttr.type != PAL_STREAM_ACD &&
-            sAttr.type != PAL_STREAM_VOICE_UI &&
-            sAttr.type != PAL_STREAM_CONTEXT_PROXY &&
-            sAttr.type != PAL_STREAM_ULTRASOUND &&
-            sAttr.type != PAL_STREAM_SENSOR_PCM_DATA &&
-            sAttr.type != PAL_STREAM_HAPTICS) {
-            if (setConfig(s, CALIBRATION, TAG_STREAM_VOLUME) != 0) {
-                PAL_ERR(LOG_TAG,"Setting volume failed");
-            }
-        }
+    if (sAttr.direction != PAL_AUDIO_OUTPUT) {
+        status = setInitialVolume();
     }
 
     mState = SESSION_STARTED;
@@ -1842,6 +1840,9 @@
     std::vector<std::pair<int32_t, std::string>> rxAifBackEndsToConnect;
     std::vector<std::pair<int32_t, std::string>> txAifBackEndsToConnect;
     int32_t status = 0;
+    uint8_t *payload = NULL;
+    size_t payloadSize = 0;
+    struct pal_stream_attributes sAttr;
 
     deviceList.push_back(deviceToConnect);
     rm->getBackEndNames(deviceList, rxAifBackEndsToConnect,
@@ -1883,6 +1884,34 @@
         }
     }
 
+    status = streamHandle->getStreamAttributes(&sAttr);
+    if (status != 0) {
+        PAL_ERR(LOG_TAG, "stream get attributes failed");
+        goto exit;
+    }
+
+    if ((streamType == PAL_STREAM_VOIP_TX) ||
+        ((streamType == PAL_STREAM_DEEP_BUFFER) &&
+         (sAttr.direction == PAL_AUDIO_INPUT))) {
+        status = populateECMFCPayload(streamHandle, &payloadSize, &payload);
+        if (status != 0) {
+            PAL_ERR(LOG_TAG, "Failed to populate EC MFC Payload");
+            status = 0;
+            goto exit;
+        }
+
+        if (payloadSize && payload) {
+          status = SessionAlsaUtils::setMixerParameter(mixer, pcmDevIds.at(0), payload, payloadSize);
+            freeCustomPayload(&payload, &payloadSize);
+            if (status != 0) {
+                PAL_ERR(LOG_TAG, "Failed to set ecref mfc payload");
+                status = 0;
+                goto exit;
+            }
+        }
+    }
+
+exit:
     return status;
 }
 
@@ -2294,6 +2323,26 @@
             return 0;
 
         }
+
+        case PAL_PARAM_ID_VOLUME_CTRL_RAMP:
+        {
+            struct pal_vol_ctrl_ramp_param *rampParam = (struct pal_vol_ctrl_ramp_param *)payload;
+            status = SessionAlsaUtils::getModuleInstanceId(mixer, device,
+                               rxAifBackEnds[0].second.data(), tagId, &miid);
+            if (0 != status) {
+                PAL_ERR(LOG_TAG, "Failed to get tag info %x, status = %d", tagId, status);
+                return status;
+            }
+            builder->payloadVolumeCtrlRamp(&paramData, &paramSize,
+                 miid, rampParam->ramp_period_ms);
+            if (paramSize) {
+                status = SessionAlsaUtils::setMixerParameter(mixer, device,
+                                               paramData, paramSize);
+                PAL_INFO(LOG_TAG, "mixer set vol ctrl ramp status=%d\n", status);
+                freeCustomPayload(&paramData, &paramSize);
+            }
+            return 0;
+        }
         default:
             status = -EINVAL;
             PAL_ERR(LOG_TAG, "Unsupported param id %u status %d", param_id, status);
@@ -3107,3 +3156,4 @@
     PAL_DBG(LOG_TAG, "Exit status: %d", status);
     return status;
 }
+
diff --git a/stream/inc/Stream.h b/stream/inc/Stream.h
index 8daac4c..765afe2 100644
--- a/stream/inc/Stream.h
+++ b/stream/inc/Stream.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 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 provided that the following conditions are
@@ -132,7 +132,8 @@
 /*
  * The sleep is required for mute to ramp down.
  */
-#define MUTE_RAMP_PERIOD (30*1000)
+#define MUTE_RAMP_PERIOD (40*1000)
+#define DEFAULT_RAMP_PERIOD 0x28 //40ms
 
 class Device;
 class ResourceManager;
diff --git a/stream/inc/StreamCompress.h b/stream/inc/StreamCompress.h
index b152414..409b454 100644
--- a/stream/inc/StreamCompress.h
+++ b/stream/inc/StreamCompress.h
@@ -25,6 +25,10 @@
  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *Changes from Qualcomm Innovation Center, Inc. are provided under the following license:
+ *Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ *SPDX-License-Identifier: BSD-3-Clause-Clear
  */
 
 #ifndef STREAMCOMPRESS_H_
diff --git a/stream/inc/StreamPCM.h b/stream/inc/StreamPCM.h
index d192c07..b847cbc 100644
--- a/stream/inc/StreamPCM.h
+++ b/stream/inc/StreamPCM.h
@@ -25,6 +25,10 @@
  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 
+ *Changes from Qualcomm Innovation Center, Inc. are provided under the following license:
+ *Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ *SPDX-License-Identifier: BSD-3-Clause-Clear
  */
 
 #ifndef STREAMPCM_H_
diff --git a/stream/src/StreamCompress.cpp b/stream/src/StreamCompress.cpp
index 24be80a..3cf0dc8 100644
--- a/stream/src/StreamCompress.cpp
+++ b/stream/src/StreamCompress.cpp
@@ -804,7 +804,7 @@
     memset(&vol_set_param_info, 0, sizeof(struct volume_set_param_info));
     rm->getVolumeSetParamInfo(&vol_set_param_info);
     if (rm->cardState == CARD_STATUS_ONLINE && currentState != STREAM_IDLE
-        && currentState != STREAM_INIT) {
+        && currentState != STREAM_INIT && !isPaused) {
         bool isStreamAvail = (find(vol_set_param_info.streams_.begin(),
                     vol_set_param_info.streams_.end(), mStreamAttr->type) !=
                     vol_set_param_info.streams_.end());
@@ -816,6 +816,7 @@
             status = session->setParameters(this, TAG_STREAM_VOLUME,
                     PAL_PARAM_ID_VOLUME_USING_SET_PARAM, (void *)pld);
             delete[] volPayload;
+            PAL_DBG(LOG_TAG, "set volume by parameter, status: %d", status);
         } else {
             status = session->setConfig(this, CALIBRATION, TAG_STREAM_VOLUME);
         }
@@ -863,7 +864,6 @@
     struct pal_volume_data *voldata = NULL;
     struct pal_volume_data *volume = NULL;
     std::unique_lock<std::mutex> pauseLock(pauseMutex);
-
     //AF will try to pause the stream during SSR.
     if (rm->cardState == CARD_STATUS_OFFLINE) {
         status = -EINVAL;
@@ -878,9 +878,27 @@
     if (isPaused) {
         PAL_INFO(LOG_TAG, "Stream is already paused");
     } else {
+        status = session->setConfig(this, MODULE, PAUSE_TAG);
+        if (0 != status) {
+            PAL_ERR(LOG_TAG,"session setConfig for pause failed with status %d",status);
+            return status;
+        }
+        if (session->isPauseRegistrationDone) {
+            PAL_DBG(LOG_TAG, "Waiting for Pause to complete from ADSP");
+            cvPause.wait_for(pauseLock, std::chrono::microseconds(VOLUME_RAMP_PERIOD));
+        } else {
+            PAL_DBG(LOG_TAG, "Pause event registration not done, sleeping for %d",
+                    VOLUME_RAMP_PERIOD);
+            usleep(VOLUME_RAMP_PERIOD);
+        }
+        PAL_VERBOSE(LOG_TAG,"session pause successful, state %d", currentState);
+
         //caching the volume before setting it to 0
-        voldata = (struct pal_volume_data *)calloc(1, (sizeof(uint32_t) +
-                          (sizeof(struct pal_channel_vol_kv) * (0xFFFF))));
+        if (mVolumeData) {
+            voldata = (struct pal_volume_data *)calloc(1, (sizeof(uint32_t) +
+                          (sizeof(struct pal_channel_vol_kv) *
+                                 (mVolumeData->no_of_volpair))));
+        }
         if (!voldata) {
             status = -ENOMEM;
             goto exit;
@@ -891,15 +909,26 @@
             PAL_ERR(LOG_TAG,"getVolumeData Failed \n");
             goto exit;
         }
-        /* set ramp period to 0 */
+        /* set ramp period to 0 to make volume be changed to 0 instantly.
+         * ramp down is already done in soft pause, ramp down twice both
+         * in volume module and pause with non-0 period, the curve of
+         * final ramp down becomes not smooth.
+         */
         ramp_param.ramp_period_ms = 0;
-        status = session->setParameters(this, TAG_STREAM_VOLUME, PAL_PARAM_ID_VOLUME_CTRL_RAMP, &ramp_param);
-        if (0 != status)
-            PAL_ERR(LOG_TAG, "session setParam for vol ctrl ramp failed with status %d", status);
+        status = session->setParameters(this,
+                                        TAG_STREAM_VOLUME,
+                                        PAL_PARAM_ID_VOLUME_CTRL_RAMP,
+                                        &ramp_param);
+        if (0 != status) {
+            PAL_ERR(LOG_TAG, "setParam for vol ctrl ramp failed status %d", status);
+            status = 0; //non-fatal
+        }
 
-        volSize = sizeof(uint32_t) + (sizeof(struct pal_channel_vol_kv) * (voldata->no_of_volpair));
-        status = 0; /* not fatal , reset status to 0 */
-        /* set volume to 0 */
+        volSize = sizeof(uint32_t) + (sizeof(struct pal_channel_vol_kv) *
+                                            (voldata->no_of_volpair));
+        /* set volume to 0 to avoid the secerio of doing ramping up
+         * from higher volume to lower volume in coming resume.
+         */
         volume = (struct pal_volume_data *)calloc(1, volSize);
         if (!volume) {
             PAL_ERR(LOG_TAG, "Failed to allocate mem for volume");
@@ -917,22 +946,21 @@
         volume = NULL;
         voldata = NULL;
 
-        status = session->setConfig(this, MODULE, PAUSE_TAG);
+        /* set ramp period to default */
+        ramp_param.ramp_period_ms = DEFAULT_RAMP_PERIOD;
+        status = session->setParameters(this,
+                                        TAG_STREAM_VOLUME,
+                                        PAL_PARAM_ID_VOLUME_CTRL_RAMP,
+                                        &ramp_param);
         if (0 != status) {
-            PAL_ERR(LOG_TAG,"session setConfig for pause failed with status %d",status);
-            goto exit;
+            PAL_ERR(LOG_TAG, "setParam for vol ctrl failed status %d", status);
+            status = 0; //non-fatal
         }
-        PAL_DBG(LOG_TAG, "Waiting for Pause to complete");
-        if (session->isPauseRegistrationDone)
-            cvPause.wait_for(pauseLock, std::chrono::microseconds(VOLUME_RAMP_PERIOD));
-        else
-            usleep(VOLUME_RAMP_PERIOD);
-        isPaused = true;
-        currentState = STREAM_PAUSED;
-        PAL_VERBOSE(LOG_TAG,"session pause successful, state %d", currentState);
     }
 
 exit:
+    isPaused = true;
+    currentState = STREAM_PAUSED;
     PAL_DBG(LOG_TAG,"Exit status: %d", status);
     return status;
 }
@@ -950,6 +978,8 @@
 int32_t StreamCompress::resume_l()
 {
     int32_t status = 0;
+    struct pal_vol_ctrl_ramp_param ramp_param;
+    struct pal_volume_data *voldata = NULL;
 
     if (rm->cardState == CARD_STATUS_OFFLINE) {
         status = -EINVAL;
@@ -967,6 +997,22 @@
     }
 
     isPaused = false;
+
+    //since we set the volume to 0 in pause, in resume we need to set vol back to default
+    voldata = (struct pal_volume_data *)calloc(1, (sizeof(uint32_t) +
+                      (sizeof(struct pal_channel_vol_kv) * (0xFFFF))));
+    if (!voldata) {
+        status = -ENOMEM;
+        goto exit;
+    }
+
+    status = this->getVolumeData(voldata);
+    if (0 != status) {
+        PAL_ERR(LOG_TAG,"getVolumeData Failed \n");
+        goto exit;
+    }
+    setVolume(voldata);
+    free(voldata);
     PAL_VERBOSE(LOG_TAG,"session resume successful, state %d", currentState);
 
 exit:
diff --git a/stream/src/StreamPCM.cpp b/stream/src/StreamPCM.cpp
index 4cfb876..b259c12 100644
--- a/stream/src/StreamPCM.cpp
+++ b/stream/src/StreamPCM.cpp
@@ -838,7 +838,7 @@
     memset(&vol_set_param_info, 0, sizeof(struct volume_set_param_info));
     rm->getVolumeSetParamInfo(&vol_set_param_info);
     if ((rm->cardState == CARD_STATUS_ONLINE) && (currentState != STREAM_IDLE)
-            && (currentState != STREAM_INIT)) {
+            && (currentState != STREAM_INIT) && (!isPaused)) {
         bool isStreamAvail = (find(vol_set_param_info.streams_.begin(),
                     vol_set_param_info.streams_.end(), mStreamAttr->type) !=
                     vol_set_param_info.streams_.end());
@@ -850,6 +850,7 @@
             status = session->setParameters(this, TAG_STREAM_VOLUME,
                     PAL_PARAM_ID_VOLUME_USING_SET_PARAM, (void *)pld);
             delete[] volPayload;
+            PAL_DBG(LOG_TAG, "set volume by parameter, status: %d", status);
         } else {
             status = session->setConfig(this, CALIBRATION, TAG_STREAM_VOLUME);
         }
@@ -1190,6 +1191,7 @@
     struct pal_volume_data *voldata = NULL;
     struct pal_volume_data *volume = NULL;
     std::unique_lock<std::mutex> pauseLock(pauseMutex);
+
     PAL_DBG(LOG_TAG, "Enter. session handle - %pK", session);
     if (rm->cardState == CARD_STATUS_OFFLINE) {
         cachedState = STREAM_PAUSED;
@@ -1201,9 +1203,28 @@
     if (isPaused) {
         PAL_INFO(LOG_TAG, "Stream is already paused");
     } else {
+        status = session->setConfig(this, MODULE, PAUSE_TAG);
+        if (0 != status) {
+           PAL_ERR(LOG_TAG, "session setConfig for pause failed with status %d",
+                    status);
+           return status;
+        }
+        if (session->isPauseRegistrationDone) {
+            PAL_DBG(LOG_TAG, "Waiting for Pause to complete from ADSP");
+            pauseCV.wait_for(pauseLock, std::chrono::microseconds(VOLUME_RAMP_PERIOD));
+        } else {
+            PAL_DBG(LOG_TAG, "Pause event registration not done, sleeping for %d",
+                    VOLUME_RAMP_PERIOD);
+            usleep(VOLUME_RAMP_PERIOD);
+        }
+        PAL_DBG(LOG_TAG, "session setConfig successful");
+
         //caching the volume before setting it to 0
-        voldata = (struct pal_volume_data *)calloc(1, (sizeof(uint32_t) +
-                          (sizeof(struct pal_channel_vol_kv) * (0xFFFF))));
+        if (mVolumeData) {
+            voldata = (struct pal_volume_data *)calloc(1, (sizeof(uint32_t) +
+                        (sizeof(struct pal_channel_vol_kv) *
+                        (mVolumeData->no_of_volpair))));
+        }
         if (!voldata) {
             status = -ENOMEM;
             goto exit;
@@ -1214,15 +1235,26 @@
             PAL_ERR(LOG_TAG,"getVolumeData Failed \n");
             goto exit;
         }
-        /* set ramp period to 0 */
+        /* set ramp period to 0 to make volume be changed to 0 instantly.
+         * ramp down is already done in soft pause, ramp down twice both
+         * in volume module and pause with non-0 period, the curve of
+         * final ramp down becomes not smooth.
+         */
         ramp_param.ramp_period_ms = 0;
-        status = session->setParameters(this, TAG_STREAM_VOLUME, PAL_PARAM_ID_VOLUME_CTRL_RAMP, &ramp_param);
-        if (0 != status)
-            PAL_ERR(LOG_TAG, "session setParam for vol ctrl ramp failed with status %d", status);
+        status = session->setParameters(this,
+                                        TAG_STREAM_VOLUME,
+                                        PAL_PARAM_ID_VOLUME_CTRL_RAMP,
+                                        &ramp_param);
+        if (0 != status) {
+            PAL_ERR(LOG_TAG, "setParam for vol ctrl failed, status %d", status);
+            status = 0; //non-fatal
+        }
 
-        volSize = sizeof(uint32_t) + (sizeof(struct pal_channel_vol_kv) * (voldata->no_of_volpair));
-        status = 0; /* not fatal , reset status to 0 */
-        /* set volume to 0 */
+        volSize = sizeof(uint32_t) + (sizeof(struct pal_channel_vol_kv) *
+                                            (voldata->no_of_volpair));
+        /* set volume to 0 to avoid the secerio of doing ramping up
+         * from higher volume to lower volume in coming resume.
+         */
         volume = (struct pal_volume_data *)calloc(1, volSize);
         if (!volume) {
             PAL_ERR(LOG_TAG, "Failed to allocate mem for volume");
@@ -1240,22 +1272,20 @@
         volume = NULL;
         voldata = NULL;
 
-        status = session->setConfig(this, MODULE, PAUSE_TAG);
+         /* set ramp period to default */
+        ramp_param.ramp_period_ms = DEFAULT_RAMP_PERIOD;
+        status = session->setParameters(this,
+                                        TAG_STREAM_VOLUME,
+                                        PAL_PARAM_ID_VOLUME_CTRL_RAMP,
+                                        &ramp_param);
         if (0 != status) {
-           PAL_ERR(LOG_TAG, "session setConfig for pause failed with status %d",
-                    status);
-           goto exit;
+            PAL_ERR(LOG_TAG,"setParam for vol ctrl failed, status %d", status);
+            status = 0; //non-fatal
         }
-        PAL_DBG(LOG_TAG, "Waiting for Pause to complete");
-        if (session->isPauseRegistrationDone)
-            pauseCV.wait_for(pauseLock, std::chrono::microseconds(VOLUME_RAMP_PERIOD));
-        else
-            usleep(VOLUME_RAMP_PERIOD);
-        isPaused = true;
-        currentState = STREAM_PAUSED;
-        PAL_DBG(LOG_TAG, "session setConfig successful");
     }
 exit:
+    isPaused = true;
+    currentState = STREAM_PAUSED;
     PAL_DBG(LOG_TAG, "Exit status: %d", status);
     return status;
 }
@@ -1274,6 +1304,8 @@
 int32_t StreamPCM::resume_l()
 {
     int32_t status = 0;
+    struct pal_vol_ctrl_ramp_param ramp_param;
+    struct pal_volume_data *voldata = NULL;
     PAL_DBG(LOG_TAG, "Enter. session handle - %pK", session);
     if (rm->cardState == CARD_STATUS_OFFLINE) {
         cachedState = STREAM_STARTED;
@@ -1289,6 +1321,23 @@
     }
 
     isPaused = false;
+
+    //since we set the volume to 0 in pause, in resume we need to set vol back to default
+    voldata = (struct pal_volume_data *)calloc(1, (sizeof(uint32_t) +
+                      (sizeof(struct pal_channel_vol_kv) * (0xFFFF))));
+    if (!voldata) {
+        status = -ENOMEM;
+        goto exit;
+    }
+
+    status = this->getVolumeData(voldata);
+    if (0 != status) {
+        PAL_ERR(LOG_TAG,"getVolumeData Failed \n");
+        goto exit;
+    }
+
+    setVolume(voldata);
+    free(voldata);
     PAL_DBG(LOG_TAG, "session setConfig successful");
 exit:
     PAL_DBG(LOG_TAG, "Exit status: %d", status);