Merge 9a83d0ca646a0889e8cd47a9866bea40f1438845 on remote branch
Change-Id: Ia19fd522b0d9b795fb06b6ddad5f1e92387928c5
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.xml b/configs/parrot/resourcemanager_ravelin_idp.xml
index f368509..2d46588 100644
--- a/configs/parrot/resourcemanager_ravelin_idp.xml
+++ b/configs/parrot/resourcemanager_ravelin_idp.xml
@@ -28,7 +28,7 @@
<!-- 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 -->
<resource_manager_info>
<config_params>
@@ -104,10 +104,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>
@@ -163,10 +204,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>
@@ -190,6 +272,7 @@
</usecase>
<ec_rx_device>
<id>PAL_DEVICE_OUT_SPEAKER</id>
+ <id>PAL_DEVICE_OUT_HANDSET</id>
</ec_rx_device>
</in-device>
<in-device>
@@ -203,11 +286,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>
@@ -305,6 +429,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>
@@ -426,6 +554,66 @@
<priority>3</priority>
<channels>1</channels>
<snd_device_name>speaker-mono-2</snd_device_name>
+ <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>
@@ -444,22 +632,34 @@
<bit_width>16</bit_width>
<fractional_sr>0</fractional_sr>
<snd_device_name>handset</snd_device_name>
- <usecase>
- <name>PAL_STREAM_VOICE_CALL</name>
- <priority>2</priority>
- <custom-config key="HAC">
- <snd_device_name>voice-handset-hac</snd_device_name> <!-- override sound device name with HAC handset -->
- </custom-config>
- </usecase>
- <usecase>
- <name>PAL_STREAM_VOIP_RX</name>
- <priority>3</priority>
- </usecase>
- <usecase>
- <name>PAL_STREAM_ULTRASOUND</name>
- <priority>1</priority>
- <samplerate>96000</samplerate>
- </usecase>
+ <usecase>
+ <name>PAL_STREAM_VOICE_CALL</name>
+ <priority>2</priority>
+ <custom-config key="HAC">
+ <snd_device_name>voice-handset-hac</snd_device_name> <!-- override sound device name with HAC handset -->
+ </custom-config>
+ </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_ULTRASOUND</name>
+ <priority>1</priority>
+ <samplerate>96000</samplerate>
+ </usecase>
</out-device>
<out-device>
<id>PAL_DEVICE_OUT_WIRED_HEADPHONE</id>
@@ -497,8 +697,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>
@@ -537,8 +796,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>
@@ -602,6 +904,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>
@@ -614,6 +1079,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/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/device/src/Headphone.cpp b/device/src/Headphone.cpp
index 7f8a9cf..7c5a64f 100644
--- a/device/src/Headphone.cpp
+++ b/device/src/Headphone.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 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: Headphone"
@@ -74,6 +78,11 @@
return rc;
switch (sampleRate) {
+#ifdef DYNAMIC_SR_ENABLED
+ case SAMPLINGRATE_8K:
+ case SAMPLINGRATE_16K:
+ case SAMPLINGRATE_32K:
+#endif
case SAMPLINGRATE_44K:
case SAMPLINGRATE_48K:
case SAMPLINGRATE_96K:
@@ -145,7 +154,16 @@
if ((*sampleRate % SAMPLINGRATE_44K == 0) &&
(NATIVE_AUDIO_MODE_MULTIPLE_MIX_IN_DSP == ResourceManager::getNativeAudioSupport())) {
PAL_DBG(LOG_TAG, "napb: setting sampling rate to %d", *sampleRate);
- } else if (*sampleRate <= SAMPLINGRATE_48K)
+ }
+#ifdef DYNAMIC_SR_ENABLED
+ else if (*sampleRate == SAMPLINGRATE_8K)
+ *sampleRate = SAMPLINGRATE_8K;
+ else if (*sampleRate == SAMPLINGRATE_16K)
+ *sampleRate = SAMPLINGRATE_16K;
+ else if (*sampleRate == SAMPLINGRATE_32K)
+ *sampleRate = SAMPLINGRATE_32K;
+#endif
+ else if (*sampleRate <= SAMPLINGRATE_48K)
*sampleRate = SAMPLINGRATE_48K;
else if (*sampleRate > SAMPLINGRATE_48K && *sampleRate <= SAMPLINGRATE_96K)
*sampleRate = SAMPLINGRATE_96K;
diff --git a/device/src/HeadsetMic.cpp b/device/src/HeadsetMic.cpp
index 29cca0a..30b532f 100644
--- a/device/src/HeadsetMic.cpp
+++ b/device/src/HeadsetMic.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: HeadsetMic"
@@ -71,6 +75,11 @@
PAL_DBG(LOG_TAG, "sampleRate %u", sampleRate);
switch (sampleRate) {\
//check what all need to be added
+#ifdef DYNAMIC_SR_ENABLED
+ case SAMPLINGRATE_8K:
+ case SAMPLINGRATE_16K:
+ case SAMPLINGRATE_32K:
+#endif
case SAMPLINGRATE_48K:
case SAMPLINGRATE_96K:
break;
@@ -136,8 +145,19 @@
int32_t rc = 0;
/* TODO: support native 44.1 later */
+#ifdef DYNAMIC_SR_ENABLED
+ if (*sampleRate == SAMPLINGRATE_8K)
+ *sampleRate = SAMPLINGRATE_8K;
+ else if (*sampleRate == SAMPLINGRATE_16K)
+ *sampleRate = SAMPLINGRATE_16K;
+ else if (*sampleRate == SAMPLINGRATE_32K)
+ *sampleRate = SAMPLINGRATE_32K;
+ else if (*sampleRate <= SAMPLINGRATE_48K)
+ *sampleRate = SAMPLINGRATE_48K;
+#else
if (*sampleRate < SAMPLINGRATE_48K)
*sampleRate = SAMPLINGRATE_48K;
+#endif
else if (*sampleRate > SAMPLINGRATE_48K && *sampleRate < SAMPLINGRATE_96K)
*sampleRate = SAMPLINGRATE_96K;
else if (*sampleRate > SAMPLINGRATE_96K && *sampleRate < SAMPLINGRATE_192K)
diff --git a/device/src/SpeakerProtection.cpp b/device/src/SpeakerProtection.cpp
index ae9199d..0aa0838 100644
--- a/device/src/SpeakerProtection.cpp
+++ b/device/src/SpeakerProtection.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
- * 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 provided that the following conditions are
@@ -2414,8 +2414,8 @@
keyVector.clear();
calVector.clear();
+ this->Device::getDeviceAttributes(&dattr);
if (mDeviceAttr.id == PAL_DEVICE_OUT_HANDSET) {
- this->Device::getDeviceAttributes(&dattr);
spDevInfo.dev_vi_device.channels = dattr.config.ch_info.channels;
spDevInfo.numChannels = dattr.config.ch_info.channels;
}
@@ -2437,6 +2437,7 @@
break;
}
+ spDevInfo.dev_vi_device.samplerate = dattr.config.sample_rate;
device.config.ch_info = ch_info;
device.config.sample_rate = spDevInfo.dev_vi_device.samplerate;
device.config.bit_width = spDevInfo.dev_vi_device.bit_width;
@@ -3042,6 +3043,7 @@
param_id_sp_vi_channel_map_cfg_t viChannelMapConfg;
param_id_sp_ex_vi_mode_cfg_t viExModeConfg;
PayloadBuilder* builder = new PayloadBuilder();
+ struct pal_device rxDevAttr;
PAL_DBG(LOG_TAG, "Enter: %s", __func__);
rm = ResourceManager::getInstance();
@@ -3086,6 +3088,8 @@
ch_info.ch_map[0] = PAL_CHMAP_CHANNEL_FL;
+ this->Device::getDeviceAttributes(&rxDevAttr);
+ vi_device.samplerate = rxDevAttr.config.sample_rate;
device.config.ch_info = ch_info;
device.config.sample_rate = vi_device.samplerate;
device.config.bit_width = vi_device.bit_width;
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/inc/SessionAlsaVoice.h b/session/inc/SessionAlsaVoice.h
index 575813d..f412861 100644
--- a/session/inc/SessionAlsaVoice.h
+++ b/session/inc/SessionAlsaVoice.h
@@ -29,7 +29,7 @@
/*
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.
Redistribution and use in source and binary forms, with or without
modification, are permitted (subject to the limitations in the
@@ -124,6 +124,8 @@
int setECRef(Stream *s, std::shared_ptr<Device> rx_dev, bool is_enable) {return 0;};
private:
int payloadCalKeys(Stream * s, uint8_t **payload, size_t *size);
+ int payloadCKVs(uint8_t **payload, size_t *size, uint32_t channels);
+ int setVoiceCKVS(Stream * s);
int payloadTaged(Stream * s, configType type, int tag, int device, int dir);
int payloadSetVSID(Stream* s);
int payloadSetChannelInfo(Stream * s, uint8_t **payload, size_t *size);
diff --git a/session/src/PayloadBuilder.cpp b/session/src/PayloadBuilder.cpp
index 7752b08..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"
@@ -171,6 +182,8 @@
std::vector<allKVs> PayloadBuilder::all_devices;
std::vector<allKVs> PayloadBuilder::all_devicepps;
+uint32_t getSamplerateKv(uint32_t samplerate);
+
template <typename T>
void PayloadBuilder::populateChannelMap(T pcmChannel, uint8_t numChannel)
{
@@ -390,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)
{
@@ -2884,6 +2931,61 @@
return status;
}
+uint32_t getSamplerateKv(uint32_t samplerate)
+{
+ uint32_t value = 0;
+
+ switch (samplerate)
+ {
+ case 8000:
+ value = SAMPLINGRATE_8K;
+ break;
+ case 11025:
+ value = SAMPLINGRATE_11K;
+ break;
+ case 16000:
+ value = SAMPLINGRATE_16K;
+ break;
+ case 22050:
+ value = SAMPLINGRATE_22K;
+ break;
+ case 32000:
+ value = SAMPLINGRATE_32K;
+ break;
+ case 44100:
+ value = SAMPLINGRATE_44K;
+ break;
+ case 48000:
+ value = SAMPLINGRATE_48K;
+ break;
+ case 64000:
+ value = SAMPLINGRATE_64K;
+ break;
+ case 88200:
+ value = SAMPLINGRATE_88K;
+ break;
+ case 96000:
+ value = SAMPLINGRATE_96K;
+ break;
+ case 176400:
+ value = SAMPLINGRATE_176K;
+ break;
+ case 192000:
+ value = SAMPLINGRATE_192K;
+ break;
+ case 352800:
+ value = SAMPLINGRATE_352K;
+ break;
+ case 384000:
+ value = SAMPLINGRATE_384K;
+ break;
+ default:
+ break;
+ }
+ return value;
+}
+
+
int PayloadBuilder::populateDevicePPCkv(Stream *s, std::vector <std::pair<int,int>> &keyVector)
{
int status = 0;
@@ -2891,6 +2993,7 @@
std::vector<std::shared_ptr<Device>> associatedDevices;
struct pal_device dAttr;
std::shared_ptr<ResourceManager> rm = ResourceManager::getInstance();
+ uint32_t sampleRateKv = 0;
PAL_DBG(LOG_TAG,"Enter");
sattr = new struct pal_stream_attributes;
@@ -2962,10 +3065,50 @@
keyVector.push_back(std::make_pair(GAIN, GAIN_0));
}
+ if ((dAttr.id == PAL_DEVICE_OUT_SPEAKER) ||
+ (dAttr.id == PAL_DEVICE_OUT_HANDSET) ||
+ (dAttr.id == PAL_DEVICE_OUT_WIRED_HEADSET) ||
+ (dAttr.id == PAL_DEVICE_OUT_WIRED_HEADPHONE) ||
+ (dAttr.id == PAL_DEVICE_OUT_USB_HEADSET) ||
+ (dAttr.id == PAL_DEVICE_OUT_USB_DEVICE) ||
+ (dAttr.id == PAL_DEVICE_IN_SPEAKER_MIC) ||
+ (dAttr.id == PAL_DEVICE_IN_HANDSET_MIC) ||
+ (dAttr.id == PAL_DEVICE_IN_WIRED_HEADSET) ||
+ (dAttr.id == PAL_DEVICE_IN_USB_HEADSET)) {
+ if ((sampleRateKv = getSamplerateKv(dAttr.config.sample_rate)) != 0)
+ keyVector.push_back(std::make_pair(SAMPLINGRATE, sampleRateKv));
+ PAL_DBG(LOG_TAG,"stream type %d Sample Rate[%d]\n", sattr->type, dAttr.config.sample_rate);
+ }
+
/* TBD: Push Channels for these types once Channels are added */
//keyVector.push_back(std::make_pair(CHANNELS,
// dAttr.config.ch_info.channels));
break;
+ case PAL_STREAM_VOIP_RX:
+ if ((dAttr.id != PAL_DEVICE_OUT_SPEAKER) &&
+ (dAttr.id != PAL_DEVICE_OUT_HANDSET) &&
+ (dAttr.id != PAL_DEVICE_OUT_WIRED_HEADSET) &&
+ (dAttr.id != PAL_DEVICE_OUT_WIRED_HEADPHONE) &&
+ (dAttr.id != PAL_DEVICE_OUT_USB_HEADSET) &&
+ (dAttr.id != PAL_DEVICE_OUT_USB_DEVICE))
+ break;
+
+ PAL_DBG(LOG_TAG,"VoiP_RX Sample Rate[%d]\n", dAttr.config.sample_rate);
+ if ((sampleRateKv = getSamplerateKv(dAttr.config.sample_rate)) != 0)
+ keyVector.push_back(std::make_pair(SAMPLINGRATE, sampleRateKv));
+ break;
+ case PAL_STREAM_VOIP_TX:
+ case PAL_STREAM_VOICE_RECOGNITION:
+ if ((dAttr.id != PAL_DEVICE_IN_SPEAKER_MIC) &&
+ (dAttr.id != PAL_DEVICE_IN_HANDSET_MIC) &&
+ (dAttr.id != PAL_DEVICE_IN_WIRED_HEADSET) &&
+ (dAttr.id != PAL_DEVICE_IN_USB_HEADSET))
+ break;
+
+ PAL_DBG(LOG_TAG,"stream type %d Sample Rate[%d]\n", sattr->type, dAttr.config.sample_rate);
+ if ((sampleRateKv = getSamplerateKv(dAttr.config.sample_rate)) != 0)
+ keyVector.push_back(std::make_pair(SAMPLINGRATE, sampleRateKv));
+ break;
default:
PAL_VERBOSE(LOG_TAG,"stream type %d doesn't support DevicePP CKV ", sattr->type);
goto free_sattr;
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(¶mData, ¶mSize,
+ 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(¶mData, ¶mSize);
+ }
+ 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/session/src/SessionAlsaVoice.cpp b/session/src/SessionAlsaVoice.cpp
index 58a5cbd..46bd0b1 100644
--- a/session/src/SessionAlsaVoice.cpp
+++ b/session/src/SessionAlsaVoice.cpp
@@ -29,7 +29,7 @@
/*
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.
Redistribution and use in source and binary forms, with or without
modification, are permitted (subject to the limitations in the
@@ -651,6 +651,72 @@
return status;
}
+int SessionAlsaVoice::setVoiceCKVS(Stream * s)
+{
+ int status = 0;
+ struct pal_device dAttr;
+ std::vector<std::shared_ptr<Device>> associatedDevices;
+ int dev_id = 0;
+ int idx = 0;
+ uint8_t* paramData = NULL;
+ size_t paramSize = 0;
+
+ memset(&dAttr, 0, sizeof(struct pal_device));
+ status = s->getAssociatedDevices(associatedDevices);
+ if ((0 != status) || (associatedDevices.size() == 0)) {
+ PAL_ERR(LOG_TAG, "getAssociatedDevices fails or empty associated devices");
+ return status;
+ }
+
+ for (idx = 0; idx < associatedDevices.size(); idx++) {
+ dev_id = associatedDevices[idx]->getSndDeviceId();
+ if (rm->isOutputDevId(dev_id)) {
+ status = associatedDevices[idx]->getDeviceAttributes(&dAttr);
+ break;
+ }
+ }
+ if (dAttr.id == 0) {
+ PAL_ERR(LOG_TAG, "Failed to get device attributes");
+ status = -EINVAL;
+ return status;
+ }
+
+ PAL_INFO(LOG_TAG, "fire ckv for number of channels");
+
+ if (dAttr.id == PAL_DEVICE_OUT_HANDSET || dAttr.id == PAL_DEVICE_OUT_SPEAKER) {
+
+ if (dAttr.config.ch_info.channels == 2) {
+ /* fire ckv for 2 channels */
+ PAL_DBG(LOG_TAG,"Set %d channels and fire %d ckv to support dual channels for voice call", dAttr.config.ch_info.channels, NUM_CHAN_2);
+ status = payloadCKVs(¶mData, ¶mSize, NUM_CHAN_2);
+ } else {
+ /* fire ckv for 1 channel */
+ PAL_DBG(LOG_TAG,"Set %d channels and fire %d ckv to support mono channel for voice call", dAttr.config.ch_info.channels, NUM_CHAN_1);
+ status = payloadCKVs(¶mData, ¶mSize, NUM_CHAN_1);
+ }
+
+ if (!paramData) {
+ status = -ENOMEM;
+ PAL_ERR(LOG_TAG, "failed to get payload status %d", status);
+ goto exit;
+ }
+
+ status = setVoiceMixerParameter(streamHandle, mixer, paramData, paramSize,
+ RX_HOSTLESS);
+
+ if (status) {
+ PAL_ERR(LOG_TAG, "Failed to set voice params status = %d",
+ status);
+ }
+ }
+
+exit:
+if (paramData) {
+ free(paramData);
+}
+ return status;
+}
+
int SessionAlsaVoice::start(Stream * s)
{
struct pcm_config config;
@@ -797,6 +863,13 @@
goto err_pcm_open;
}
+ /* set CKV's to configure voice call*/
+ status = setVoiceCKVS(s);
+ if (status != 0) {
+ PAL_ERR(LOG_TAG,"setVoiceCKVS failed");
+ goto err_pcm_open;
+ }
+
if (ResourceManager::isLpiLoggingEnabled()) {
status = payloadTaged(s, MODULE, LPI_LOGGING_ON, pcmDevTxIds.at(0), TX_HOSTLESS);
if (status)
@@ -1497,6 +1570,53 @@
return status;
}
+int SessionAlsaVoice::payloadCKVs(uint8_t **payload, size_t *size, uint32_t channels)
+{
+ int status = 0;
+ apm_module_param_data_t* header;
+ uint8_t* payloadInfo = NULL;
+ size_t payloadSize = 0, padBytes = 0;
+ uint8_t *ch_pl;
+ vcpm_param_cal_keys_payload_t cal_keys;
+ vcpm_ckv_pair_t cal_key_pair[1];
+
+ payloadSize = sizeof(apm_module_param_data_t) +
+ sizeof(vcpm_param_cal_keys_payload_t) +
+ sizeof(vcpm_ckv_pair_t)*1;
+ 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 -EINVAL;
+ }
+ header = (apm_module_param_data_t*)payloadInfo;
+ header->module_instance_id = VCPM_MODULE_INSTANCE_ID;
+ header->param_id = VCPM_PARAM_ID_CAL_KEYS;
+ header->error_code = 0x0;
+ header->param_size = payloadSize - sizeof(struct apm_module_param_data_t);
+ cal_keys.vsid = vsid;
+ cal_keys.num_ckv_pairs = 1;
+
+ /*cal key for number of channels*/
+ cal_key_pair[0].cal_key_id = VCPM_CAL_KEY_ID_NUM_CHANNELS;
+ cal_key_pair[0].value = channels;
+
+ ch_pl = (uint8_t*)payloadInfo + sizeof(apm_module_param_data_t);
+ ar_mem_cpy(ch_pl, sizeof(vcpm_param_cal_keys_payload_t),
+ &cal_keys, sizeof(vcpm_param_cal_keys_payload_t));
+
+ ch_pl += sizeof(vcpm_param_cal_keys_payload_t);
+ ar_mem_cpy(ch_pl, sizeof(vcpm_ckv_pair_t)*1,
+ &cal_key_pair, sizeof(vcpm_ckv_pair_t)*1);
+
+ *size = payloadSize + padBytes;
+ *payload = payloadInfo;
+ PAL_DBG(LOG_TAG, "Number of channels: %d", channels);
+
+ return status;
+}
+
int SessionAlsaVoice::payloadSetTTYMode(uint8_t **payload, size_t *size, uint32_t mode){
int status = 0;
apm_module_param_data_t* header;
@@ -1758,6 +1878,11 @@
}
}
}
+ /* set and fire CKV's to configure voice call in device switch*/
+ status = setVoiceCKVS(streamHandle);
+ if (status != 0) {
+ PAL_ERR(LOG_TAG,"setVoiceCKVS failed in connectsession");
+ }
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);