Merge "configs: Update sound trigger mixer controls"
diff --git a/Android.mk b/Android.mk
index 273c9cb..42f202b 100644
--- a/Android.mk
+++ b/Android.mk
@@ -16,6 +16,7 @@
include $(MY_LOCAL_PATH)/visualizer/Android.mk
include $(MY_LOCAL_PATH)/audiod/Android.mk
include $(MY_LOCAL_PATH)/post_proc/Android.mk
+include $(MY_LOCAL_PATH)/qahw_api/Android.mk
endif
endif
diff --git a/configs/msm8937/msm8937.mk b/configs/msm8937/msm8937.mk
index 7e5c90f..b7a7a39 100644
--- a/configs/msm8937/msm8937.mk
+++ b/configs/msm8937/msm8937.mk
@@ -46,7 +46,7 @@
MM_AUDIO_ENABLED_SAFX := true
TARGET_USES_QCOM_MM_AUDIO := true
AUDIO_FEATURE_ENABLED_HW_ACCELERATED_EFFECTS := false
-#AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true
+AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true
AUDIO_FEATURE_ENABLED_SOURCE_TRACKING := true
AUDIO_FEATURE_ENABLED_AUDIOSPHERE := true
##AUDIO_FEATURE_FLAGS
diff --git a/configs/msm8953/msm8953.mk b/configs/msm8953/msm8953.mk
index 2917f9d..3106942 100644
--- a/configs/msm8953/msm8953.mk
+++ b/configs/msm8953/msm8953.mk
@@ -46,7 +46,8 @@
MM_AUDIO_ENABLED_SAFX := true
TARGET_USES_QCOM_MM_AUDIO := true
AUDIO_FEATURE_ENABLED_HW_ACCELERATED_EFFECTS := false
-#AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true
+AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true
+
AUDIO_FEATURE_ENABLED_SOURCE_TRACKING := true
AUDIO_FEATURE_ENABLED_AUDIOSPHERE := true
diff --git a/configs/msm8996/msm8996.mk b/configs/msm8996/msm8996.mk
index 306fa97..5b240e9 100644
--- a/configs/msm8996/msm8996.mk
+++ b/configs/msm8996/msm8996.mk
@@ -46,8 +46,8 @@
MM_AUDIO_ENABLED_SAFX := true
TARGET_USES_QCOM_MM_AUDIO := true
AUDIO_FEATURE_ENABLED_HW_ACCELERATED_EFFECTS := false
-#AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true
-#DOLBY_DDP := true
+AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true
+
AUDIO_FEATURE_ENABLED_SOURCE_TRACKING := true
AUDIO_FEATURE_ENABLED_AUDIOSPHERE := true
AUDIO_FEATURE_ENABLED_GEF_SUPPORT := true
diff --git a/configs/msmcobalt/audio_output_policy.conf b/configs/msmcobalt/audio_output_policy.conf
index e60c664..8213f92 100644
--- a/configs/msmcobalt/audio_output_policy.conf
+++ b/configs/msmcobalt/audio_output_policy.conf
@@ -34,18 +34,25 @@
}
direct_pcm_16 {
flags AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_DIRECT_PCM
- formats AUDIO_FORMAT_PCM_16_BIT|AUDIO_FORMAT_PCM_24_BIT_PACKED|AUDIO_FORMAT_PCM_8_24_BIT
+ formats AUDIO_FORMAT_PCM_16_BIT|AUDIO_FORMAT_PCM_24_BIT_PACKED|AUDIO_FORMAT_PCM_8_24_BIT|AUDIO_FORMAT_PCM_32_BIT
sampling_rates 44100|48000|96000|192000
bit_width 16
app_type 69936
}
direct_pcm_24 {
flags AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_DIRECT_PCM
- formats AUDIO_FORMAT_PCM_24_BIT_PACKED|AUDIO_FORMAT_PCM_8_24_BIT
- sampling_rates 44100|48000|96000|176400|192000|352800
+ formats AUDIO_FORMAT_PCM_24_BIT_PACKED|AUDIO_FORMAT_PCM_8_24_BIT|AUDIO_FORMAT_PCM_32_BIT
+ sampling_rates 44100|48000|96000|176400|192000|352800|384000
bit_width 24
app_type 69940
}
+ direct_pcm_32 {
+ flags AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_DIRECT_PCM
+ formats AUDIO_FORMAT_PCM_32_BIT
+ sampling_rates 44100|48000|96000|176400|192000|352800|384000
+ bit_width 32
+ app_type 69942
+ }
compress_passthrough_16 {
flags AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING|AUDIO_OUTPUT_FLAG_COMPRESS_PASSTHROUGH
formats AUDIO_FORMAT_AC3|AUDIO_FORMAT_E_AC3|AUDIO_FORMAT_E_AC3_JOC|AUDIO_FORMAT_DTS|AUDIO_FORMAT_DTS_HD|AUDIO_FORMAT_DSD
diff --git a/configs/msmcobalt/audio_platform_info.xml b/configs/msmcobalt/audio_platform_info.xml
index 07839fd..a1bd9a1 100644
--- a/configs/msmcobalt/audio_platform_info.xml
+++ b/configs/msmcobalt/audio_platform_info.xml
@@ -67,6 +67,7 @@
<param key="perf_lock_opts" value="4, 0x101, 0x704, 0x20F, 0x1E01"/>
<param key="native_audio_mode" value="src"/>
<param key="input_mic_max_count" value="4"/>
+ <param key="true_32_bit" value="true"/>
<!-- In the below value string, the value indicates sidetone gain in dB -->
<param key="usb_sidetone_gain" value="35"/>
</config_params>
diff --git a/configs/msmcobalt/audio_policy.conf b/configs/msmcobalt/audio_policy.conf
index 70ab311..8fb5676 100644
--- a/configs/msmcobalt/audio_policy.conf
+++ b/configs/msmcobalt/audio_policy.conf
@@ -58,9 +58,9 @@
flags AUDIO_OUTPUT_FLAG_DIRECT
}
direct_pcm {
- sampling_rates 8000|11025|12000|16000|22050|24000|32000|44100|48000|64000|88200|96000|176400|192000|352800
+ sampling_rates 8000|11025|12000|16000|22050|24000|32000|44100|48000|64000|88200|96000|176400|192000|352800|384000
channel_masks AUDIO_CHANNEL_OUT_MONO|AUDIO_CHANNEL_OUT_STEREO|AUDIO_CHANNEL_OUT_2POINT1|AUDIO_CHANNEL_OUT_QUAD|AUDIO_CHANNEL_OUT_PENTA|AUDIO_CHANNEL_OUT_5POINT1|AUDIO_CHANNEL_OUT_6POINT1|AUDIO_CHANNEL_OUT_7POINT1
- formats AUDIO_FORMAT_PCM_16_BIT|AUDIO_FORMAT_PCM_24_BIT_PACKED|AUDIO_FORMAT_PCM_8_24_BIT
+ formats AUDIO_FORMAT_PCM_16_BIT|AUDIO_FORMAT_PCM_24_BIT_PACKED|AUDIO_FORMAT_PCM_8_24_BIT|AUDIO_FORMAT_PCM_32_BIT
devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_LINE|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_PROXY|AUDIO_DEVICE_OUT_USB_DEVICE|AUDIO_DEVICE_OUT_BLUETOOTH_A2DP|AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES|AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER
flags AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_DIRECT_PCM
}
@@ -102,7 +102,7 @@
}
surround_sound {
sampling_rates 8000|11025|12000|16000|22050|24000|32000|44100|48000
- channel_masks AUDIO_CHANNEL_IN_5POINT1|AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_STEREO|AUDIO_CHANNEL_IN_FRONT_BACK|AUDIO_CHANNEL_INDEX_MASK_3|AUDIO_CHANNEL_INDEX_MASK_4
+ channel_masks AUDIO_CHANNEL_IN_5POINT1|AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_STEREO|AUDIO_CHANNEL_IN_FRONT_BACK|AUDIO_CHANNEL_INDEX_MASK_3|AUDIO_CHANNEL_INDEX_MASK_4|AUDIO_CHANNEL_INDEX_MASK_6
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_BACK_MIC
}
diff --git a/configs/msmcobalt/audio_policy_configuration.xml b/configs/msmcobalt/audio_policy_configuration.xml
index 66b7d17..b6d2490 100644
--- a/configs/msmcobalt/audio_policy_configuration.xml
+++ b/configs/msmcobalt/audio_policy_configuration.xml
@@ -89,10 +89,13 @@
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
<profile name="" format="AUDIO_FORMAT_PCM_8_24_BIT"
- samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800"
+ samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
<profile name="" format="AUDIO_FORMAT_PCM_24_BIT_PACKED"
- samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800"
+ samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000"
+ channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
+ <profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
+ samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
</mixPort>
<mixPort name="compressed_offload" role="source"
@@ -176,7 +179,7 @@
<mixPort name="surround_sound" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
- channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3,AUDIO_CHANNEL_INDEX_MASK_4,AUDIO_CHANNEL_IN_5POINT1"/>
+ channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3,AUDIO_CHANNEL_INDEX_MASK_4,AUDIO_CHANNEL_IN_5POINT1,AUDIO_CHANNEL_INDEX_MASK_6"/>
</mixPort>
<mixPort name="record_24" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_24_BIT_PACKED"
diff --git a/configs/msmcobalt/mixer_paths_skuk.xml b/configs/msmcobalt/mixer_paths_skuk.xml
new file mode 100644
index 0000000..24499b9
--- /dev/null
+++ b/configs/msmcobalt/mixer_paths_skuk.xml
@@ -0,0 +1,2415 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!-- Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. -->
+<!-- -->
+<!-- Redistribution and use in source and binary forms, with or without -->
+<!-- modification, are permitted provided that the following conditions are -->
+<!-- met: -->
+<!-- * Redistributions of source code must retain the above copyright -->
+<!-- notice, this list of conditions and the following disclaimer. -->
+<!-- * Redistributions in binary form must reproduce the above -->
+<!-- copyright notice, this list of conditions and the following -->
+<!-- disclaimer in the documentation and/or other materials provided -->
+<!-- with the distribution. -->
+<!-- * Neither the name of The Linux Foundation nor the names of its -->
+<!-- contributors may be used to endorse or promote products derived -->
+<!-- from this software without specific prior written permission. -->
+<!-- -->
+<!-- THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED -->
+<!-- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -->
+<!-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT -->
+<!-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -->
+<!-- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -->
+<!-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -->
+<!-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -->
+<!-- BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -->
+<!-- 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. -->
+<mixer>
+ <!-- These are the initial mixer settings -->
+ <ctl name="Voice Rx Device Mute" id="0" value="0" />
+ <ctl name="Voice Rx Device Mute" id="1" value="-1" />
+ <ctl name="Voice Rx Device Mute" id="2" value="20" />
+ <ctl name="Voice Tx Mute" id="0" value="0" />
+ <ctl name="Voice Tx Mute" id="1" value="-1" />
+ <ctl name="Voice Tx Mute" id="2" value="500" />
+ <ctl name="Voice Rx Gain" id="0" value="0" />
+ <ctl name="Voice Rx Gain" id="1" value="-1" />
+ <ctl name="Voice Rx Gain" id="2" value="20" />
+ <ctl name="Voip Tx Mute" id="0" value="0" />
+ <ctl name="Voip Tx Mute" id="1" value="500" />
+ <ctl name="Voip Rx Gain" id="0" value="0" />
+ <ctl name="Voip Rx Gain" id="1" value="20" />
+ <ctl name="Voip Mode Config" value="12" />
+ <ctl name="Voip Rate Config" value="0" />
+ <ctl name="Voip Evrc Min Max Rate Config" id="0" value="1" />
+ <ctl name="Voip Evrc Min Max Rate Config" id="1" value="4" />
+ <ctl name="Voip Dtx Mode" value="0" />
+ <ctl name="TTY Mode" value="OFF" />
+ <ctl name="SLIMBUS_0_RX Port Mixer SLIM_0_TX" value="0" />
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia1" value="0" />
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia4" value="0" />
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia5" value="0" />
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia7" value="0" />
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia8" value="0" />
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia10" value="0" />
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia11" value="0" />
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia12" value="0" />
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia13" value="0" />
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia14" value="0" />
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia15" value="0" />
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia16" value="0" />
+ <ctl name="SLIMBUS_6_RX Port Mixer SLIM_0_TX" value="0" />
+ <ctl name="SLIMBUS_4_RX Audio Mixer MultiMedia1" value="0" />
+ <ctl name="SLIMBUS_4_RX Audio Mixer MultiMedia2" value="0" />
+ <ctl name="MultiMedia5 Mixer SLIM_0_TX" value="0" />
+ <ctl name="MultiMedia5 Mixer AFE_PCM_TX" value="0" />
+ <ctl name="MultiMedia5 Mixer SLIM_8_TX" value="0" />
+ <ctl name="MultiMedia5 Mixer SLIM_7_TX" value="0" />
+ <ctl name="MultiMedia1 Mixer SLIM_0_TX" value="0" />
+ <ctl name="MultiMedia1 Mixer SLIM_4_TX" value="0" />
+ <ctl name="MultiMedia1 Mixer SLIM_7_TX" value="0" />
+ <ctl name="MultiMedia8 Mixer SLIM_0_TX" value="0" />
+ <ctl name="MultiMedia8 Mixer SLIM_4_TX" value="0" />
+ <ctl name="MultiMedia8 Mixer SLIM_7_TX" value="0" />
+ <ctl name="HDMI Mixer MultiMedia1" value="0" />
+ <ctl name="HDMI Mixer MultiMedia2" value="0" />
+ <ctl name="HDMI Mixer MultiMedia3" value="0" />
+ <ctl name="HDMI Mixer MultiMedia4" value="0" />
+ <ctl name="HDMI Mixer MultiMedia5" value="0" />
+ <ctl name="HDMI Mixer MultiMedia7" value="0" />
+ <ctl name="HDMI Mixer MultiMedia9" value="0" />
+ <ctl name="HDMI Mixer MultiMedia10" value="0" />
+ <ctl name="HDMI Mixer MultiMedia11" value="0" />
+ <ctl name="HDMI Mixer MultiMedia12" value="0" />
+ <ctl name="HDMI Mixer MultiMedia13" value="0" />
+ <ctl name="HDMI Mixer MultiMedia14" value="0" />
+ <ctl name="HDMI Mixer MultiMedia15" value="0" />
+ <ctl name="HDMI Mixer MultiMedia16" value="0" />
+ <ctl name="DISPLAY_PORT Mixer MultiMedia1" value="0" />
+ <ctl name="DISPLAY_PORT Mixer MultiMedia2" value="0" />
+ <ctl name="DISPLAY_PORT Mixer MultiMedia3" value="0" />
+ <ctl name="DISPLAY_PORT Mixer MultiMedia4" value="0" />
+ <ctl name="DISPLAY_PORT Mixer MultiMedia5" value="0" />
+ <ctl name="DISPLAY_PORT Mixer MultiMedia6" value="0" />
+ <ctl name="DISPLAY_PORT Mixer MultiMedia7" value="0" />
+ <ctl name="DISPLAY_PORT Mixer MultiMedia8" value="0" />
+ <ctl name="DISPLAY_PORT Mixer MultiMedia9" value="0" />
+ <ctl name="DISPLAY_PORT Mixer MultiMedia10" value="0" />
+ <ctl name="DISPLAY_PORT Mixer MultiMedia11" value="0" />
+ <ctl name="DISPLAY_PORT Mixer MultiMedia12" value="0" />
+ <ctl name="DISPLAY_PORT Mixer MultiMedia13" value="0" />
+ <ctl name="DISPLAY_PORT Mixer MultiMedia14" value="0" />
+ <ctl name="DISPLAY_PORT Mixer MultiMedia15" value="0" />
+ <ctl name="DISPLAY_PORT Mixer MultiMedia16" value="0" />
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia1" value="0" />
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia1" value="0" />
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia2" value="0" />
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia2" value="0" />
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia3" value="0" />
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia3" value="0" />
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia4" value="0" />
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia4" value="0" />
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia4" value="0" />
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia4" value="0" />
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia5" value="0" />
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia5" value="0" />
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia5" value="0" />
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia7" value="0" />
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia7" value="0" />
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia7" value="0" />
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia7" value="0" />
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia8" value="0" />
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia8" value="0" />
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia8" value="0" />
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia10" value="0" />
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia10" value="0" />
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia10" value="0" />
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia10" value="0" />
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia11" value="0" />
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia11" value="0" />
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia11" value="0" />
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia11" value="0" />
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia12" value="0" />
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia12" value="0" />
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia12" value="0" />
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia12" value="0" />
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia13" value="0" />
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia13" value="0" />
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia13" value="0" />
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia13" value="0" />
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia14" value="0" />
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia14" value="0" />
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia14" value="0" />
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia14" value="0" />
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia15" value="0" />
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia15" value="0" />
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia15" value="0" />
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia15" value="0" />
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia16" value="0" />
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia16" value="0" />
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia16" value="0" />
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia16" value="0" />
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia1" value="0" />
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia2" value="0" />
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia3" value="0" />
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia4" value="0" />
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia5" value="0" />
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia7" value="0" />
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia8" value="0" />
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia10" value="0" />
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia11" value="0" />
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia12" value="0" />
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia13" value="0" />
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia14" value="0" />
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia15" value="0" />
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia16" value="0" />
+ <ctl name="MultiMedia1 Mixer USB_AUDIO_TX" value="0" />
+ <ctl name="MultiMedia5 Mixer USB_AUDIO_TX" value="0" />
+ <ctl name="MultiMedia8 Mixer USB_AUDIO_TX" value="0" />
+ <ctl name="USB_AUDIO_RX Channels" value="One" />
+ <ctl name="USB_AUDIO_RX SampleRate" value="KHZ_48" />
+ <ctl name="USB_AUDIO_RX Format" value="S16_LE" />
+ <ctl name="USB_AUDIO_TX Channels" value="One" />
+ <ctl name="USB_AUDIO_TX SampleRate" value="KHZ_48" />
+ <ctl name="USB_AUDIO_TX Format" value="S16_LE" />
+ <ctl name="MultiMedia6 Mixer SLIM_0_TX" value="0" />
+ <ctl name="SLIM_2_RX Format" value="UNPACKED" />
+ <ctl name="SLIM_2_RX SampleRate" value="KHZ_48" />
+ <ctl name="SLIM_5_RX SampleRate" value="KHZ_44P1" />
+ <ctl name="SLIM_0_RX Channels" value="One" />
+ <ctl name="SLIM_5_RX Channels" value="One" />
+ <ctl name="SLIM_6_RX Channels" value="One" />
+ <ctl name="SLIM_2_RX Channels" value="One" />
+ <ctl name="SLIM_0_TX Channels" value="One" />
+ <ctl name="SLIM_1_TX Channels" value="One" />
+ <ctl name="AIF1_CAP Mixer SLIM TX9" value="0"/>
+ <ctl name="AIF1_CAP Mixer SLIM TX8" value="0"/>
+ <ctl name="AIF1_CAP Mixer SLIM TX7" value="0" />
+ <ctl name="AIF1_CAP Mixer SLIM TX6" value="0" />
+ <ctl name="AIF1_CAP Mixer SLIM TX5" value="0"/>
+ <ctl name="AIF1_CAP Mixer SLIM TX4" value="0" />
+ <ctl name="AIF1_CAP Mixer SLIM TX3" value="0"/>
+ <ctl name="AIF1_CAP Mixer SLIM TX2" value="0" />
+ <ctl name="AIF1_CAP Mixer SLIM TX1" value="0"/>
+ <ctl name="AIF1_CAP Mixer SLIM TX0" value="0"/>
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia4" value="0" />
+ <ctl name="HDMI Mixer MultiMedia4" value="0" />
+ <ctl name="SLIM0_RX_VI_FB_LCH_MUX" value="ZERO" />
+ <ctl name="SLIM0_RX_VI_FB_RCH_MUX" value="ZERO" />
+ <ctl name="VI_FEED_TX Channels" value="Two" />
+ <ctl name="AIF4_VI Mixer SPKR_VI_1" value="0" />
+ <ctl name="AIF4_VI Mixer SPKR_VI_2" value="0" />
+ <ctl name="SLIM_4_TX Format" value="UNPACKED" />
+ <ctl name="AANC_SLIM_0_RX MUX" value="ZERO" />
+ <!-- HFP start -->
+ <ctl name="HFP_PRI_AUX_UL_HL Switch" value="0" />
+ <ctl name="SLIMBUS_0_RX Port Mixer SLIM_7_TX" value="0" />
+ <!-- HFP end -->
+ <!-- echo reference -->
+ <ctl name="AUDIO_REF_EC_UL1 MUX" value="None" />
+ <!-- usb headset -->
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia1" value="0" />
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia4" value="0" />
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia7" value="0" />
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia10" value="0" />
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia11" value="0" />
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia12" value="0" />
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia13" value="0" />
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia14" value="0" />
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia15" value="0" />
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia16" value="0" />
+ <ctl name="MultiMedia1 Mixer AFE_PCM_TX" value="0" />
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia5" value="0" />
+ <!-- usb headset end -->
+ <!-- fm -->
+ <ctl name="SLIMBUS_8 LOOPBACK Volume" value="0" />
+ <ctl name="SLIMBUS_0_RX Port Mixer SLIM_8_TX" value="0" />
+ <ctl name="SLIMBUS_DL_HL Switch" value="0" />
+ <ctl name="SLIMBUS_6_RX Port Mixer SLIM_8_TX" value="0" />
+ <ctl name="SLIMBUS6_DL_HL Switch" value="0" />
+ <ctl name="MultiMedia1 Mixer SLIM_8_TX" value="0" />
+ <ctl name="MultiMedia2 Mixer SLIM_8_TX" value="0" />
+ <!-- fm end -->
+
+ <!-- Multimode Voice1 -->
+ <ctl name="SLIM_0_RX_Voice Mixer VoiceMMode1" value="0" />
+ <ctl name="SLIM_6_RX_Voice Mixer VoiceMMode1" value="0" />
+ <ctl name="VoiceMMode1_Tx Mixer SLIM_0_TX_MMode1" value="0" />
+ <!-- Multimode Voice1 HDMI -->
+ <ctl name="HDMI_RX_Voice Mixer VoiceMMode1" value="0" />
+ <!-- Multimode Voice1 BTSCO -->
+ <ctl name="SLIM_7_RX_Voice Mixer VoiceMMode1" value="0" />
+ <ctl name="VoiceMMode1_Tx Mixer SLIM_7_TX_MMode1" value="0" />
+ <!-- Multimode Voice1 USB headset -->
+ <ctl name="AFE_PCM_RX_Voice Mixer VoiceMMode1" value="0" />
+ <ctl name="VoiceMMode1_Tx Mixer AFE_PCM_TX_MMode1" value="0" />
+ <ctl name="USB_AUDIO_RX_Voice Mixer VoiceMMode1" value="0" />
+ <ctl name="VoiceMMode1_Tx Mixer USB_AUDIO_TX_MMode1" value="0" />
+ <!-- Miltimode Voice1 end-->
+
+ <!-- Multimode Voice2 -->
+ <ctl name="SLIM_0_RX_Voice Mixer VoiceMMode2" value="0" />
+ <ctl name="SLIM_6_RX_Voice Mixer VoiceMMode2" value="0" />
+ <ctl name="VoiceMMode2_Tx Mixer SLIM_0_TX_MMode2" value="0" />
+ <!-- Multimode Voice2 HDMI -->
+ <ctl name="HDMI_RX_Voice Mixer VoiceMMode2" value="0" />
+ <!-- Multimode Voice2 BTSCO -->
+ <ctl name="SLIM_7_RX_Voice Mixer VoiceMMode2" value="0" />
+ <ctl name="VoiceMMode2_Tx Mixer SLIM_7_TX_MMode2" value="0" />
+ <!-- Multimode Voice2 USB headset -->
+ <ctl name="AFE_PCM_RX_Voice Mixer VoiceMMode2" value="0" />
+ <ctl name="VoiceMMode2_Tx Mixer AFE_PCM_TX_MMode2" value="0" />
+ <ctl name="USB_AUDIO_RX_Voice Mixer VoiceMMode2" value="0" />
+ <ctl name="VoiceMMode2_Tx Mixer USB_AUDIO_TX_MMode2" value="0" />
+ <!-- Multimode Voice2 end-->
+
+ <!-- Voice external ec. reference -->
+ <ctl name="VOC_EXT_EC MUX" value="NONE" />
+ <ctl name="AIF3_CAP Mixer SLIM TX1" value="0" />
+ <ctl name="AIF3_CAP Mixer SLIM TX2" value="0" />
+ <!-- Voice external ec. reference end -->
+
+ <!-- RT Proxy Cal -->
+ <ctl name="RT_PROXY_1_RX SetCalMode" value="CAL_MODE_NONE" />
+ <ctl name="RT_PROXY_1_TX SetCalMode" value="CAL_MODE_NONE" />
+ <!-- RT Proxy Cal end -->
+
+ <!-- Incall Recording -->
+ <ctl name="MultiMedia1 Mixer VOC_REC_UL" value="0" />
+ <ctl name="MultiMedia1 Mixer VOC_REC_DL" value="0" />
+ <ctl name="MultiMedia8 Mixer VOC_REC_UL" value="0" />
+ <ctl name="MultiMedia8 Mixer VOC_REC_DL" value="0" />
+ <!-- Incall Recording End -->
+
+ <!-- Incall Music -->
+ <ctl name="Incall_Music Audio Mixer MultiMedia2" value="0" />
+ <!-- Incall Music End -->
+
+ <!-- compress-voip-call start -->
+ <ctl name="SLIM_0_RX_Voice Mixer Voip" value="0" />
+ <ctl name="SLIM_6_RX_Voice Mixer Voip" value="0" />
+ <ctl name="Voip_Tx Mixer SLIM_0_TX_Voip" value="0" />
+ <ctl name="SLIM_7_RX_Voice Mixer Voip" value="0" />
+ <ctl name="Voip_Tx Mixer SLIM_7_TX_Voip" value="0" />
+ <ctl name="AFE_PCM_RX_Voice Mixer Voip" value="0" />
+ <ctl name="Voip_Tx Mixer AFE_PCM_TX_Voip" value="0" />
+ <ctl name="USB_AUDIO_RX_Voice Mixer Voip" value="0" />
+ <ctl name="Voip_Tx Mixer USB_AUDIO_TX_Voip" value="0" />
+ <!-- compress-voip-call end-->
+
+ <!-- Audio BTSCO -->
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia1" value="0" />
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia4" value="0" />
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia5" value="0" />
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia6" value="0" />
+ <ctl name="MultiMedia1 Mixer SLIM_7_TX" value="0" />
+ <!-- audio record compress-->
+ <ctl name="MultiMedia8 Mixer SLIM_0_TX" value="0" />
+ <ctl name="MultiMedia8 Mixer SLIM_7_TX" value="0" />
+ <ctl name="MultiMedia8 Mixer AFE_PCM_TX" value="0" />
+ <!-- audio record compress end-->
+
+ <!-- split a2dp -->
+ <ctl name="BT SampleRate" value="KHZ_8" />
+ <ctl name="AFE Input Channels" value="Zero" />
+ <ctl name="SLIM7_RX ADM Channels" value="Zero" />
+ <!-- split a2dp end-->
+
+ <!-- ADSP testfwk -->
+ <ctl name="SLIMBUS_DL_HL Switch" value="0" />
+ <ctl name="SLIMBUS6_DL_HL Switch" value="0" />
+ <!-- ADSP testfwk end-->
+
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia3" value="0" />
+
+ <!-- Codec controls -->
+ <!-- WSA controls -->
+ <ctl name="SpkrLeft COMP Switch" value="0" />
+ <ctl name="SpkrRight COMP Switch" value="0" />
+ <ctl name="SpkrLeft BOOST Switch" value="0" />
+ <ctl name="SpkrRight BOOST Switch" value="0" />
+ <ctl name="SpkrLeft VISENSE Switch" value="0" />
+ <ctl name="SpkrRight VISENSE Switch" value="0" />
+ <ctl name="SpkrLeft SWR DAC_Port Switch" value="0" />
+ <ctl name="SpkrRight SWR DAC_Port Switch" value="0" />
+ <ctl name="SpkrLeft WSA PA Gain" value="G_0_DB" />
+
+ <!-- Volume controls -->
+ <ctl name="LINEOUT1 Volume" value="13" />
+ <ctl name="LINEOUT2 Volume" value="13" />
+ <ctl name="HPHL Volume" value="20" />
+ <ctl name="HPHR Volume" value="20" />
+ <ctl name="EAR PA Gain" value="G_6_DB" />
+ <ctl name="EAR SPKR PA Gain" value="G_DEFAULT" />
+
+ <ctl name="RX0 Digital Volume" value="84" />
+ <ctl name="RX1 Digital Volume" value="84" />
+ <ctl name="RX2 Digital Volume" value="84" />
+ <ctl name="RX3 Digital Volume" value="84" />
+ <ctl name="RX4 Digital Volume" value="84" />
+ <ctl name="RX5 Digital Volume" value="84" />
+ <ctl name="RX6 Digital Volume" value="84" />
+ <ctl name="RX7 Digital Volume" value="84" />
+ <ctl name="ADC1 Volume" value="12" />
+ <ctl name="ADC2 Volume" value="12" />
+ <ctl name="ADC3 Volume" value="12" />
+ <ctl name="ADC4 Volume" value="12" />
+ <ctl name="DEC0 Volume" value="84" />
+ <ctl name="DEC1 Volume" value="84" />
+ <ctl name="DEC2 Volume" value="84" />
+ <ctl name="DEC3 Volume" value="84" />
+ <ctl name="DEC4 Volume" value="84" />
+ <ctl name="DEC5 Volume" value="84" />
+ <ctl name="DEC6 Volume" value="84" />
+ <ctl name="DEC7 Volume" value="84" />
+ <ctl name="DEC8 Volume" value="84" />
+
+ <!-- Compander controls -->
+ <ctl name="COMP1 Switch" value="1" />
+ <ctl name="COMP2 Switch" value="1" />
+ <ctl name="COMP7 Switch" value="0" />
+ <ctl name="COMP8 Switch" value="0" />
+
+ <!-- ADC, DMIC and AMIC controls -->
+ <ctl name="ADC MUX0" value="AMIC" />
+ <ctl name="ADC MUX1" value="AMIC" />
+ <ctl name="ADC MUX2" value="AMIC" />
+ <ctl name="ADC MUX3" value="AMIC" />
+ <ctl name="ADC MUX4" value="AMIC" />
+ <ctl name="ADC MUX5" value="AMIC" />
+ <ctl name="ADC MUX6" value="AMIC" />
+ <ctl name="ADC MUX7" value="AMIC" />
+ <ctl name="ADC MUX8" value="AMIC" />
+ <ctl name="ADC MUX10" value="AMIC" />
+ <ctl name="ADC MUX11" value="AMIC" />
+ <ctl name="ADC MUX12" value="AMIC" />
+ <ctl name="ADC MUX13" value="AMIC" />
+ <ctl name="DMIC MUX0" value="ZERO" />
+ <ctl name="DMIC MUX1" value="ZERO" />
+ <ctl name="DMIC MUX2" value="ZERO" />
+ <ctl name="DMIC MUX3" value="ZERO" />
+ <ctl name="DMIC MUX4" value="ZERO" />
+ <ctl name="DMIC MUX5" value="ZERO" />
+ <ctl name="DMIC MUX6" value="ZERO" />
+ <ctl name="DMIC MUX7" value="ZERO" />
+ <ctl name="DMIC MUX8" value="ZERO" />
+ <ctl name="DMIC MUX10" value="ZERO" />
+ <ctl name="DMIC MUX11" value="ZERO" />
+ <ctl name="DMIC MUX12" value="ZERO" />
+ <ctl name="DMIC MUX13" value="ZERO" />
+ <ctl name="AMIC MUX0" value="ZERO" />
+ <ctl name="AMIC MUX1" value="ZERO" />
+ <ctl name="AMIC MUX2" value="ZERO" />
+ <ctl name="AMIC MUX3" value="ZERO" />
+ <ctl name="AMIC MUX4" value="ZERO" />
+ <ctl name="AMIC MUX5" value="ZERO" />
+ <ctl name="AMIC MUX6" value="ZERO" />
+ <ctl name="AMIC MUX7" value="ZERO" />
+ <ctl name="AMIC MUX8" value="ZERO" />
+ <ctl name="AMIC MUX10" value="ZERO" />
+ <ctl name="AMIC MUX11" value="ZERO" />
+ <ctl name="AMIC MUX12" value="ZERO" />
+ <ctl name="AMIC MUX13" value="ZERO" />
+
+ <!-- CDC_IF and SLIM controls -->
+ <ctl name="SLIM RX0 MUX" value="ZERO" />
+ <ctl name="SLIM RX1 MUX" value="ZERO" />
+ <ctl name="SLIM RX2 MUX" value="ZERO" />
+ <ctl name="SLIM RX3 MUX" value="ZERO" />
+ <ctl name="SLIM RX4 MUX" value="ZERO" />
+ <ctl name="SLIM RX5 MUX" value="ZERO" />
+ <ctl name="SLIM RX6 MUX" value="ZERO" />
+ <ctl name="SLIM RX7 MUX" value="ZERO" />
+ <ctl name="CDC_IF RX0 MUX" value="SLIM RX0" />
+ <ctl name="CDC_IF RX1 MUX" value="SLIM RX1" />
+ <ctl name="CDC_IF RX2 MUX" value="SLIM RX2" />
+ <ctl name="CDC_IF RX3 MUX" value="SLIM RX3" />
+ <ctl name="CDC_IF RX4 MUX" value="SLIM RX4" />
+ <ctl name="CDC_IF RX5 MUX" value="SLIM RX5" />
+ <ctl name="CDC_IF RX6 MUX" value="SLIM RX6" />
+ <ctl name="CDC_IF RX7 MUX" value="SLIM RX7" />
+ <ctl name="CDC_IF TX0 MUX" value="ZERO" />
+ <ctl name="CDC_IF TX1 MUX" value="ZERO" />
+ <ctl name="CDC_IF TX2 MUX" value="ZERO" />
+ <ctl name="CDC_IF TX3 MUX" value="ZERO" />
+ <ctl name="CDC_IF TX4 MUX" value="ZERO" />
+ <ctl name="CDC_IF TX5 MUX" value="ZERO" />
+ <ctl name="CDC_IF TX6 MUX" value="ZERO" />
+ <ctl name="CDC_IF TX7 MUX" value="ZERO" />
+ <ctl name="CDC_IF TX8 MUX" value="ZERO" />
+ <ctl name="CDC_IF TX9 MUX" value="ZERO" />
+ <ctl name="CDC_IF TX10 MUX" value="ZERO" />
+ <ctl name="CDC_IF TX13 MUX" value="ZERO" />
+
+ <!-- Interpolator chain controls -->
+ <ctl name="RX INT0_1 MIX1 INP0" value="ZERO" />
+ <ctl name="RX INT0_1 MIX1 INP1" value="ZERO" />
+ <ctl name="RX INT0_1 MIX1 INP2" value="ZERO" />
+ <ctl name="RX INT1_1 MIX1 INP0" value="ZERO" />
+ <ctl name="RX INT1_1 MIX1 INP1" value="ZERO" />
+ <ctl name="RX INT1_1 MIX1 INP2" value="ZERO" />
+ <ctl name="RX INT2_1 MIX1 INP0" value="ZERO" />
+ <ctl name="RX INT2_1 MIX1 INP1" value="ZERO" />
+ <ctl name="RX INT2_1 MIX1 INP2" value="ZERO" />
+ <ctl name="RX INT7_1 MIX1 INP0" value="ZERO" />
+ <ctl name="RX INT7_1 MIX1 INP1" value="ZERO" />
+ <ctl name="RX INT7_1 MIX1 INP2" value="ZERO" />
+ <ctl name="RX INT8_1 MIX1 INP0" value="ZERO" />
+ <ctl name="RX INT8_1 MIX1 INP1" value="ZERO" />
+ <ctl name="RX INT8_1 MIX1 INP2" value="ZERO" />
+ <ctl name="RX INT0_2 MUX" value="ZERO" />
+ <ctl name="RX INT1_2 MUX" value="ZERO" />
+ <ctl name="RX INT2_2 MUX" value="ZERO" />
+ <ctl name="RX INT7_2 MUX" value="ZERO" />
+ <ctl name="RX INT8_2 MUX" value="ZERO" />
+ <ctl name="RX INT1_1 NATIVE MUX" value="OFF" />
+ <ctl name="RX INT2_1 NATIVE MUX" value="OFF" />
+ <ctl name="RX INT1_2 NATIVE MUX" value="OFF" />
+ <ctl name="RX INT2_2 NATIVE MUX" value="OFF" />
+ <ctl name="ASRC0 MUX" value="ZERO" />
+ <ctl name="ASRC1 MUX" value="ZERO" />
+ <ctl name="RX INT1 SEC MIX HPHL Switch" value="0" />
+ <ctl name="RX INT2 SEC MIX HPHR Switch" value="0" />
+ <ctl name="DSD_L IF MUX" value="ZERO" />
+ <ctl name="DSD_R IF MUX" value="ZERO" />
+ <ctl name="RX INT1 MIX3 DSD HPHL Switch" value="0" />
+ <ctl name="RX INT2 MIX3 DSD HPHR Switch" value="0" />
+ <ctl name="RX INT0 DEM MUX" value="CLSH_DSM_OUT" />
+ <ctl name="RX INT1 DEM MUX" value="CLSH_DSM_OUT" />
+ <ctl name="RX INT2 DEM MUX" value="CLSH_DSM_OUT" />
+
+ <!-- Headphone Default mode - uLP -->
+ <ctl name="RX HPH Mode" value="CLS_H_ULP" />
+
+ <!-- IIR/voice anc -->
+ <ctl name="IIR0 Band1" id ="0" value="268435456" />
+ <ctl name="IIR0 Band1" id ="1" value="0" />
+ <ctl name="IIR0 Band1" id ="2" value="0" />
+ <ctl name="IIR0 Band1" id ="3" value="0" />
+ <ctl name="IIR0 Band1" id ="4" value="0" />
+ <ctl name="IIR0 Band2" id ="0" value="268435456" />
+ <ctl name="IIR0 Band2" id ="1" value="0" />
+ <ctl name="IIR0 Band2" id ="2" value="0" />
+ <ctl name="IIR0 Band2" id ="3" value="0" />
+ <ctl name="IIR0 Band2" id ="4" value="0" />
+ <ctl name="IIR0 Band3" id ="0" value="268435456" />
+ <ctl name="IIR0 Band3" id ="1" value="0" />
+ <ctl name="IIR0 Band3" id ="2" value="0" />
+ <ctl name="IIR0 Band3" id ="3" value="0" />
+ <ctl name="IIR0 Band3" id ="4" value="0" />
+ <ctl name="IIR0 Band4" id ="0" value="268435456" />
+ <ctl name="IIR0 Band4" id ="1" value="0" />
+ <ctl name="IIR0 Band4" id ="2" value="0" />
+ <ctl name="IIR0 Band4" id ="3" value="0" />
+ <ctl name="IIR0 Band4" id ="4" value="0" />
+ <ctl name="IIR0 Band5" id ="0" value="268435456" />
+ <ctl name="IIR0 Band5" id ="1" value="0" />
+ <ctl name="IIR0 Band5" id ="2" value="0" />
+ <ctl name="IIR0 Band5" id ="3" value="0" />
+ <ctl name="IIR0 Band5" id ="4" value="0" />
+ <ctl name="IIR0 Enable Band1" value="0" />
+ <ctl name="IIR0 Enable Band2" value="0" />
+ <ctl name="IIR0 Enable Band3" value="0" />
+ <ctl name="IIR0 Enable Band4" value="0" />
+ <ctl name="IIR0 Enable Band5" value="0" />
+ <ctl name="IIR0 INP0 Volume" value="54" />
+ <ctl name="IIR0 INP0 MUX" value="ZERO" />
+ <ctl name="IIR0 INP1 MUX" value="ZERO" />
+ <ctl name="IIR0 INP2 MUX" value="ZERO" />
+ <ctl name="IIR1 INP0 MUX" value="ZERO" />
+ <ctl name="IIR1 INP1 MUX" value="ZERO" />
+ <ctl name="IIR1 INP2 MUX" value="ZERO" />
+
+ <!-- anc related -->
+ <ctl name="ANC Slot" value="0" />
+ <ctl name="ANC Function" value="OFF" />
+ <ctl name="ANC0 FB MUX" value="ZERO" />
+ <ctl name="ANC1 FB MUX" value="ZERO" />
+ <ctl name="ANC OUT EAR Enable Switch" value="0" />
+ <ctl name="ANC OUT EAR SPKR Enable Switch" value="0" />
+ <ctl name="ANC SPKR PA Enable Switch" value="0" />
+
+ <!-- vbat related data -->
+ <!-- vbat related data end -->
+
+ <!-- Codec controls end -->
+
+ <!-- These are audio route (FE to BE) specific mixer settings -->
+ <path name="gsm-mode">
+ <ctl name="GSM mode Enable" value="ON" />
+ </path>
+
+ <path name="echo-reference speaker-vbat-mono">
+ </path>
+
+ <path name="echo-reference speaker-vbat">
+ </path>
+
+ <path name="echo-reference">
+ <ctl name="AUDIO_REF_EC_UL1 MUX" value="SLIM_RX" />
+ </path>
+
+ <path name="echo-reference headphones">
+ <ctl name="AUDIO_REF_EC_UL1 MUX" value="SLIM_6_RX" />
+ </path>
+
+ <path name="echo-reference headphones-44.1">
+ </path>
+
+ <path name="deep-buffer-playback">
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia1" value="1" />
+ </path>
+
+ <path name="deep-buffer-playback speaker-protected">
+ <path name="deep-buffer-playback" />
+ </path>
+
+ <path name="deep-buffer-playback hdmi">
+ <ctl name="HDMI Mixer MultiMedia1" value="1" />
+ </path>
+
+ <path name="deep-buffer-playback display-port">
+ <ctl name="DISPLAY_PORT Mixer MultiMedia1" value="1" />
+ </path>
+
+ <path name="deep-buffer-playback speaker-and-hdmi">
+ <path name="deep-buffer-playback hdmi" />
+ <path name="deep-buffer-playback" />
+ </path>
+
+ <path name="deep-buffer-playback speaker-and-display-port">
+ <path name="deep-buffer-playback display-port" />
+ <path name="deep-buffer-playback" />
+ </path>
+
+ <path name="deep-buffer-playback bt-sco">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia1" value="1" />
+ </path>
+
+ <path name="deep-buffer-playback bt-sco-wb">
+ <ctl name="BT SampleRate" value="KHZ_16" />
+ <path name="deep-buffer-playback bt-sco" />
+ </path>
+
+ <path name="deep-buffer-playback afe-proxy">
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia1" value="1" />
+ </path>
+
+ <path name="deep-buffer-playback usb-headphones">
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia1" value="1" />
+ </path>
+
+ <path name="deep-buffer-playback speaker-and-usb-headphones">
+ <path name="deep-buffer-playback usb-headphones" />
+ <path name="deep-buffer-playback" />
+ </path>
+
+ <path name="deep-buffer-playback headphones">
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia1" value="1" />
+ </path>
+
+ <path name="deep-buffer-playback speaker-and-headphones">
+ <path name="deep-buffer-playback headphones" />
+ <path name="deep-buffer-playback" />
+ </path>
+
+ <path name="low-latency-playback">
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia5" value="1" />
+ </path>
+
+ <path name="low-latency-playback speaker-protected">
+ <path name="low-latency-playback" />
+ </path>
+
+ <path name="low-latency-playback hdmi">
+ <ctl name="HDMI Mixer MultiMedia5" value="1" />
+ </path>
+
+ <path name="low-latency-playback display-port">
+ <ctl name="DISPLAY_PORT Mixer MultiMedia5" value="1" />
+ </path>
+
+ <path name="low-latency-playback bt-sco">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia5" value="1" />
+ </path>
+
+ <path name="low-latency-playback bt-sco-wb">
+ <ctl name="BT SampleRate" value="KHZ_16" />
+ <path name="low-latency-playback bt-sco" />
+ </path>
+
+ <path name="low-latency-playback speaker-and-hdmi">
+ <path name="low-latency-playback hdmi" />
+ <path name="low-latency-playback" />
+ </path>
+
+ <path name="low-latency-playback speaker-and-display-port">
+ <path name="low-latency-playback display-port" />
+ <path name="low-latency-playback" />
+ </path>
+
+ <path name="low-latency-playback afe-proxy">
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia5" value="1" />
+ </path>
+
+ <path name="low-latency-playback usb-headphones">
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia5" value="1" />
+ </path>
+
+ <path name="low-latency-playback speaker-and-usb-headphones">
+ <path name="low-latency-playback usb-headphones" />
+ <path name="low-latency-playback" />
+ </path>
+
+ <path name="low-latency-playback headphones">
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia5" value="1" />
+ </path>
+
+ <path name="low-latency-playback speaker-and-headphones">
+ <path name="low-latency-playback headphones" />
+ <path name="low-latency-playback" />
+ </path>
+
+ <path name="audio-ull-playback">
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia8" value="1" />
+ </path>
+
+ <path name="audio-ull-playback speaker-protected">
+ <path name="audio-ull-playback" />
+ </path>
+
+ <path name="audio-ull-playback headphones">
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia8" value="1" />
+ </path>
+
+ <path name="audio-ull-playback speaker-and-headphones">
+ <path name="audio-ull-playback" />
+ <path name="audio-ull-playback headphones" />
+ </path>
+
+ <path name="audio-ull-playback hdmi">
+ <ctl name="HDMI Mixer MultiMedia8" value="1" />
+ </path>
+
+ <path name="audio-ull-playback display-port">
+ <ctl name="DISPLAY_PORT Mixer MultiMedia3" value="1" />
+ </path>
+
+ <path name="audio-ull-playback bt-sco">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia8" value="1" />
+ </path>
+
+ <path name="audio-ull-playback bt-sco-wb">
+ <ctl name="BT SampleRate" value="KHZ_16" />
+ <path name="audio-ull-playback bt-sco" />
+ </path>
+
+ <path name="audio-ull-playback speaker-and-hdmi">
+ <path name="audio-ull-playback hdmi" />
+ <path name="audio-ull-playback" />
+ </path>
+
+ <path name="audio-ull-playback speaker-and-display-port">
+ <path name="audio-ull-playback display-port" />
+ <path name="audio-ull-playback" />
+ </path>
+
+ <path name="audio-ull-playback afe-proxy">
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia8" value="1" />
+ </path>
+
+ <path name="audio-ull-playback usb-headphones">
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia8" value="1" />
+ </path>
+
+ <path name="multi-channel-playback hdmi">
+ <ctl name="HDMI Mixer MultiMedia2" value="1" />
+ </path>
+
+ <path name="multi-channel-playback display-port">
+ <ctl name="DISPLAY_PORT Mixer MultiMedia2" value="1" />
+ </path>
+
+ <path name="multi-channel-playback afe-proxy">
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia2" value="1" />
+ </path>
+
+ <path name="compress-offload-playback">
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia4" value="1" />
+ </path>
+
+ <path name="compress-offload-playback speaker-protected">
+ <path name="compress-offload-playback" />
+ </path>
+
+ <path name="compress-offload-playback hdmi">
+ <ctl name="HDMI Mixer MultiMedia4" value="1" />
+ </path>
+
+ <path name="silence-playback hdmi">
+ <ctl name="HDMI Mixer MultiMedia9" value="1" />
+ </path>
+
+ <path name="compress-offload-playback display-port">
+ <ctl name="DISPLAY_PORT Mixer MultiMedia4" value="1" />
+ </path>
+
+ <path name="silence-playback display-port">
+ <ctl name="DISPLAY_PORT Mixer MultiMedia9" value="1" />
+ </path>
+
+ <path name="compress-offload-playback bt-sco">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia4" value="1" />
+ </path>
+
+ <path name="compress-offload-playback bt-sco-wb">
+ <ctl name="BT SampleRate" value="KHZ_16" />
+ <path name="compress-offload-playback bt-sco" />
+ </path>
+
+ <path name="compress-offload-playback speaker-and-hdmi">
+ <path name="compress-offload-playback hdmi" />
+ <path name="compress-offload-playback" />
+ </path>
+
+ <path name="compress-offload-playback speaker-and-display-port">
+ <path name="compress-offload-playback display-port" />
+ <path name="compress-offload-playback" />
+ </path>
+
+ <path name="compress-offload-playback afe-proxy">
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia4" value="1" />
+ </path>
+
+ <path name="compress-offload-playback usb-headphones">
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia4" value="1" />
+ </path>
+
+ <path name="compress-offload-playback speaker-and-usb-headphones">
+ <path name="compress-offload-playback usb-headphones" />
+ <path name="compress-offload-playback" />
+ </path>
+
+ <path name="compress-offload-playback headphones">
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia4" value="1" />
+ </path>
+
+ <path name="compress-offload-playback headphones-44.1">
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia4" value="1" />
+ </path>
+
+ <path name="compress-offload-playback headphones-dsd">
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia4" value="1" />
+ </path>
+
+ <path name="compress-offload-playback speaker-and-headphones">
+ <path name="compress-offload-playback headphones" />
+ <path name="compress-offload-playback" />
+ </path>
+
+ <path name="compress-offload-playback2">
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia7" value="1" />
+ </path>
+
+ <path name="compress-offload-playback2 hdmi">
+ <ctl name="HDMI Mixer MultiMedia7" value="1" />
+ </path>
+
+ <path name="compress-offload-playback2 display-port">
+ <ctl name="DISPLAY_PORT Mixer MultiMedia7" value="1" />
+ </path>
+
+ <path name="compress-offload-playback2 bt-sco">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia7" value="1" />
+ </path>
+
+ <path name="compress-offload-playback2 bt-sco-wb">
+ <ctl name="BT SampleRate" value="KHZ_16" />
+ <path name="compress-offload-playback2 bt-sco" />
+ </path>
+
+ <path name="compress-offload-playback2 speaker-and-hdmi">
+ <path name="compress-offload-playback2 hdmi" />
+ <path name="compress-offload-playback2" />
+ </path>
+
+ <path name="compress-offload-playback2 speaker-and-display-port">
+ <path name="compress-offload-playback2 display-port" />
+ <path name="compress-offload-playback2" />
+ </path>
+
+ <path name="compress-offload-playback2 afe-proxy">
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia7" value="1" />
+ </path>
+
+ <path name="compress-offload-playback2 usb-headphones">
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia7" value="1" />
+ </path>
+
+ <path name="compress-offload-playback2 speaker-and-usb-headphones">
+ <path name="compress-offload-playback2 usb-headphones" />
+ <path name="compress-offload-playback2" />
+ </path>
+
+ <path name="compress-offload-playback2 headphones">
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia7" value="1" />
+ </path>
+
+ <path name="compress-offload-playback2 headphones-44.1">
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia7" value="1" />
+ </path>
+
+ <path name="compress-offload-playback2 headphones-dsd">
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia7" value="1" />
+ </path>
+
+ <path name="compress-offload-playback2 speaker-and-headphones">
+ <path name="compress-offload-playback2 headphones" />
+ <path name="compress-offload-playback2" />
+ </path>
+
+ <path name="compress-offload-playback3">
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia10" value="1" />
+ </path>
+
+ <path name="compress-offload-playback3 hdmi">
+ <ctl name="HDMI Mixer MultiMedia10" value="1" />
+ </path>
+
+ <path name="compress-offload-playback3 display-port">
+ <ctl name="DISPLAY_PORT Mixer MultiMedia10" value="1" />
+ </path>
+
+ <path name="compress-offload-playback3 bt-sco">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia10" value="1" />
+ </path>
+
+ <path name="compress-offload-playback3 bt-sco-wb">
+ <ctl name="BT SampleRate" value="KHZ_16" />
+ <path name="compress-offload-playback3 bt-sco" />
+ </path>
+
+ <path name="compress-offload-playback3 speaker-and-hdmi">
+ <path name="compress-offload-playback3 hdmi" />
+ <path name="compress-offload-playback3" />
+ </path>
+
+ <path name="compress-offload-playback3 speaker-and-display-port">
+ <path name="compress-offload-playback3 display-port" />
+ <path name="compress-offload-playback3" />
+ </path>
+
+ <path name="compress-offload-playback3 afe-proxy">
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia10" value="1" />
+ </path>
+
+ <path name="compress-offload-playback3 usb-headphones">
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia10" value="1" />
+ </path>
+
+ <path name="compress-offload-playback3 speaker-and-usb-headphones">
+ <path name="compress-offload-playback3 usb-headphones" />
+ <path name="compress-offload-playback3" />
+ </path>
+
+ <path name="compress-offload-playback3 headphones">
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia10" value="1" />
+ </path>
+
+ <path name="compress-offload-playback3 headphones-44.1">
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia10" value="1" />
+ </path>
+
+ <path name="compress-offload-playback3 headphones-dsd">
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia10" value="1" />
+ </path>
+
+ <path name="compress-offload-playback3 speaker-and-headphones">
+ <path name="compress-offload-playback3 headphones" />
+ <path name="compress-offload-playback3" />
+ </path>
+
+ <path name="compress-offload-playback4">
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia11" value="1" />
+ </path>
+
+ <path name="compress-offload-playback4 hdmi">
+ <ctl name="HDMI Mixer MultiMedia11" value="1" />
+ </path>
+
+ <path name="compress-offload-playback4 display-port">
+ <ctl name="DISPLAY_PORT Mixer MultiMedia11" value="1" />
+ </path>
+
+ <path name="compress-offload-playback4 bt-sco">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia11" value="1" />
+ </path>
+
+ <path name="compress-offload-playback4 bt-sco-wb">
+ <ctl name="BT SampleRate" value="KHZ_16" />
+ <path name="compress-offload-playback4 bt-sco" />
+ </path>
+
+ <path name="compress-offload-playback4 speaker-and-hdmi">
+ <path name="compress-offload-playback4 hdmi" />
+ <path name="compress-offload-playback4" />
+ </path>
+
+ <path name="compress-offload-playback4 speaker-and-display-port">
+ <path name="compress-offload-playback4 display-port" />
+ <path name="compress-offload-playback4" />
+ </path>
+
+
+ <path name="compress-offload-playback4 afe-proxy">
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia11" value="1" />
+ </path>
+
+ <path name="compress-offload-playback4 usb-headphones">
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia11" value="1" />
+ </path>
+
+ <path name="compress-offload-playback4 speaker-and-usb-headphones">
+ <path name="compress-offload-playback4 usb-headphones" />
+ <path name="compress-offload-playback4" />
+ </path>
+
+ <path name="compress-offload-playback4 headphones">
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia11" value="1" />
+ </path>
+
+ <path name="compress-offload-playback4 headphones-44.1">
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia11" value="1" />
+ </path>
+
+ <path name="compress-offload-playback4 headphones-dsd">
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia11" value="1" />
+ </path>
+
+ <path name="compress-offload-playback4 speaker-and-headphones">
+ <path name="compress-offload-playback4 headphones" />
+ <path name="compress-offload-playback4" />
+ </path>
+
+ <path name="compress-offload-playback5">
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia12" value="1" />
+ </path>
+
+ <path name="compress-offload-playback5 hdmi">
+ <ctl name="HDMI Mixer MultiMedia12" value="1" />
+ </path>
+
+ <path name="compress-offload-playback5 display-port">
+ <ctl name="DISPLAY_PORT Mixer MultiMedia12" value="1" />
+ </path>
+
+ <path name="compress-offload-playback5 bt-sco">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia12" value="1" />
+ </path>
+
+ <path name="compress-offload-playback5 bt-sco-wb">
+ <ctl name="BT SampleRate" value="KHZ_16" />
+ <path name="compress-offload-playback5 bt-sco" />
+ </path>
+
+ <path name="compress-offload-playback5 speaker-and-hdmi">
+ <path name="compress-offload-playback5 hdmi" />
+ <path name="compress-offload-playback5" />
+ </path>
+
+ <path name="compress-offload-playback5 speaker-and-display-port">
+ <path name="compress-offload-playback5 display-port" />
+ <path name="compress-offload-playback5" />
+ </path>
+
+ <path name="compress-offload-playback5 afe-proxy">
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia12" value="1" />
+ </path>
+
+ <path name="compress-offload-playback5 usb-headphones">
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia12" value="1" />
+ </path>
+
+ <path name="compress-offload-playback5 speaker-and-usb-headphones">
+ <path name="compress-offload-playback5 usb-headphones" />
+ <path name="compress-offload-playback5" />
+ </path>
+
+ <path name="compress-offload-playback5 headphones">
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia12" value="1" />
+ </path>
+
+ <path name="compress-offload-playback5 headphones-44.1">
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia12" value="1" />
+ </path>
+
+ <path name="compress-offload-playback5 headphones-dsd">
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia12" value="1" />
+ </path>
+
+ <path name="compress-offload-playback5 speaker-and-headphones">
+ <path name="compress-offload-playback5 headphones" />
+ <path name="compress-offload-playback5" />
+ </path>
+
+ <path name="compress-offload-playback6">
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia13" value="1" />
+ </path>
+
+ <path name="compress-offload-playback6 hdmi">
+ <ctl name="HDMI Mixer MultiMedia13" value="1" />
+ </path>
+
+ <path name="compress-offload-playback6 display-port">
+ <ctl name="DISPLAY_PORT Mixer MultiMedia13" value="1" />
+ </path>
+
+ <path name="compress-offload-playback6 bt-sco">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia13" value="1" />
+ </path>
+
+ <path name="compress-offload-playback6 bt-sco-wb">
+ <ctl name="BT SampleRate" value="KHZ_16" />
+ <path name="compress-offload-playback6 bt-sco" />
+ </path>
+
+ <path name="compress-offload-playback6 speaker-and-hdmi">
+ <path name="compress-offload-playback6 hdmi" />
+ <path name="compress-offload-playback6" />
+ </path>
+
+ <path name="compress-offload-playback6 speaker-and-display-port">
+ <path name="compress-offload-playback6 display-port" />
+ <path name="compress-offload-playback6" />
+ </path>
+
+ <path name="compress-offload-playback6 afe-proxy">
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia13" value="1" />
+ </path>
+
+ <path name="compress-offload-playback6 usb-headphones">
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia13" value="1" />
+ </path>
+
+ <path name="compress-offload-playback6 speaker-and-usb-headphones">
+ <path name="compress-offload-playback6 usb-headphones" />
+ <path name="compress-offload-playback6" />
+ </path>
+
+ <path name="compress-offload-playback6 headphones">
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia13" value="1" />
+ </path>
+
+ <path name="compress-offload-playback6 headphones-44.1">
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia13" value="1" />
+ </path>
+
+ <path name="compress-offload-playback6 headphones-dsd">
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia13" value="1" />
+ </path>
+
+ <path name="compress-offload-playback6 speaker-and-headphones">
+ <path name="compress-offload-playback6 headphones" />
+ <path name="compress-offload-playback6" />
+ </path>
+
+ <path name="compress-offload-playback7">
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia14" value="1" />
+ </path>
+
+ <path name="compress-offload-playback7 hdmi">
+ <ctl name="HDMI Mixer MultiMedia14" value="1" />
+ </path>
+
+ <path name="compress-offload-playback7 display-port">
+ <ctl name="DISPLAY_PORT Mixer MultiMedia14" value="1" />
+ </path>
+
+ <path name="compress-offload-playback7 bt-sco">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia14" value="1" />
+ </path>
+
+ <path name="compress-offload-playback7 bt-sco-wb">
+ <ctl name="BT SampleRate" value="KHZ_16" />
+ <path name="compress-offload-playback7 bt-sco" />
+ </path>
+
+ <path name="compress-offload-playback7 speaker-and-hdmi">
+ <path name="compress-offload-playback7 hdmi" />
+ <path name="compress-offload-playback7" />
+ </path>
+
+ <path name="compress-offload-playback7 speaker-and-display-port">
+ <path name="compress-offload-playback7 display-port" />
+ <path name="compress-offload-playback7" />
+ </path>
+
+ <path name="compress-offload-playback7 afe-proxy">
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia14" value="1" />
+ </path>
+
+ <path name="compress-offload-playback7 usb-headphones">
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia14" value="1" />
+ </path>
+
+ <path name="compress-offload-playback7 speaker-and-usb-headphones">
+ <path name="compress-offload-playback7 usb-headphones" />
+ <path name="compress-offload-playback7" />
+ </path>
+
+ <path name="compress-offload-playback7 headphones">
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia14" value="1" />
+ </path>
+
+ <path name="compress-offload-playback7 headphones-44.1">
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia14" value="1" />
+ </path>
+
+ <path name="compress-offload-playback7 headphones-dsd">
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia14" value="1" />
+ </path>
+
+ <path name="compress-offload-playback7 speaker-and-headphones">
+ <path name="compress-offload-playback7 headphones" />
+ <path name="compress-offload-playback7" />
+ </path>
+
+ <path name="compress-offload-playback8">
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia15" value="1" />
+ </path>
+
+ <path name="compress-offload-playback8 hdmi">
+ <ctl name="HDMI Mixer MultiMedia15" value="1" />
+ </path>
+
+ <path name="compress-offload-playback8 display-port">
+ <ctl name="DISPLAY_PORT Mixer MultiMedia15" value="1" />
+ </path>
+
+ <path name="compress-offload-playback8 bt-sco">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia15" value="1" />
+ </path>
+
+ <path name="compress-offload-playback8 bt-sco-wb">
+ <ctl name="BT SampleRate" value="KHZ_16" />
+ <path name="compress-offload-playback8 bt-sco" />
+ </path>
+
+ <path name="compress-offload-playback8 speaker-and-hdmi">
+ <path name="compress-offload-playback8 hdmi" />
+ <path name="compress-offload-playback8" />
+ </path>
+
+ <path name="compress-offload-playback8 speaker-and-display-port">
+ <path name="compress-offload-playback8 display-port" />
+ <path name="compress-offload-playback8" />
+ </path>
+
+ <path name="compress-offload-playback8 afe-proxy">
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia15" value="1" />
+ </path>
+
+ <path name="compress-offload-playback8 usb-headphones">
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia15" value="1" />
+ </path>
+
+ <path name="compress-offload-playback8 speaker-and-usb-headphones">
+ <path name="compress-offload-playback8 usb-headphones" />
+ <path name="compress-offload-playback8" />
+ </path>
+
+ <path name="compress-offload-playback8 headphones">
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia15" value="1" />
+ </path>
+
+ <path name="compress-offload-playback8 headphones-44.1">
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia15" value="1" />
+ </path>
+
+ <path name="compress-offload-playback8 headphones-dsd">
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia15" value="1" />
+ </path>
+
+ <path name="compress-offload-playback8 speaker-and-headphones">
+ <path name="compress-offload-playback8 headphones" />
+ <path name="compress-offload-playback8" />
+ </path>
+
+ <path name="compress-offload-playback9">
+ <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia16" value="1" />
+ </path>
+
+ <path name="compress-offload-playback9 hdmi">
+ <ctl name="HDMI Mixer MultiMedia16" value="1" />
+ </path>
+
+ <path name="compress-offload-playback9 display-port">
+ <ctl name="DISPLAY_PORT Mixer MultiMedia16" value="1" />
+ </path>
+
+ <path name="compress-offload-playback9 bt-sco">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia16" value="1" />
+ </path>
+
+ <path name="compress-offload-playback9 bt-sco-wb">
+ <ctl name="BT SampleRate" value="KHZ_16" />
+ <path name="compress-offload-playback9 bt-sco" />
+ </path>
+
+ <path name="compress-offload-playback9 speaker-and-hdmi">
+ <path name="compress-offload-playback9 hdmi" />
+ <path name="compress-offload-playback9" />
+ </path>
+
+ <path name="compress-offload-playback9 speaker-and-display-port">
+ <path name="compress-offload-playback9 display-port" />
+ <path name="compress-offload-playback9" />
+ </path>
+
+ <path name="compress-offload-playback9 afe-proxy">
+ <ctl name="AFE_PCM_RX Audio Mixer MultiMedia16" value="1" />
+ </path>
+
+ <path name="compress-offload-playback9 usb-headphones">
+ <ctl name="USB_AUDIO_RX Audio Mixer MultiMedia16" value="1" />
+ </path>
+
+ <path name="compress-offload-playback9 speaker-and-usb-headphones">
+ <path name="compress-offload-playback9 usb-headphones" />
+ <path name="compress-offload-playback9" />
+ </path>
+
+ <path name="compress-offload-playback9 headphones">
+ <ctl name="SLIMBUS_6_RX Audio Mixer MultiMedia16" value="1" />
+ </path>
+
+ <path name="compress-offload-playback9 headphones-44.1">
+ <ctl name="SLIMBUS_5_RX Audio Mixer MultiMedia16" value="1" />
+ </path>
+
+ <path name="compress-offload-playback9 headphones-dsd">
+ <ctl name="SLIMBUS_2_RX Audio Mixer MultiMedia16" value="1" />
+ </path>
+
+ <path name="compress-offload-playback9 speaker-and-headphones">
+ <path name="compress-offload-playback9 headphones" />
+ <path name="compress-offload-playback9" />
+ </path>
+
+ <path name="audio-record">
+ <ctl name="MultiMedia1 Mixer SLIM_0_TX" value="1" />
+ </path>
+
+ <path name="audio-record usb-headset-mic">
+ <ctl name="MultiMedia1 Mixer USB_AUDIO_TX" value="1" />
+ </path>
+
+ <path name="audio-record bt-sco">
+ <ctl name="MultiMedia1 Mixer SLIM_7_TX" value="1" />
+ </path>
+
+ <path name="audio-record bt-sco-wb">
+ <ctl name="BT SampleRate" value="KHZ_16" />
+ <path name="audio-record bt-sco" />
+ </path>
+
+ <path name="audio-record capture-fm">
+ <ctl name="MultiMedia1 Mixer SLIM_8_TX" value="1" />
+ </path>
+
+ <path name="audio-record-compress">
+ <ctl name="MultiMedia8 Mixer SLIM_0_TX" value="1" />
+ </path>
+
+ <path name="audio-record-compress bt-sco">
+ <ctl name="MultiMedia8 Mixer SLIM_7_TX" value="1" />
+ </path>
+
+ <path name="audio-record-compress bt-sco-wb">
+ <ctl name="BT SampleRate" value="KHZ_16" />
+ <path name="audio-record-compress bt-sco" />
+ </path>
+
+ <path name="audio-record-compress usb-headset-mic">
+ <ctl name="MultiMedia8 Mixer USB_AUDIO_TX" value="1" />
+ </path>
+
+ <path name="low-latency-record">
+ <ctl name="MultiMedia8 Mixer SLIM_0_TX" value="1" />
+ </path>
+
+ <path name="low-latency-record bt-sco">
+ <ctl name="MultiMedia8 Mixer SLIM_7_TX" value="1" />
+ </path>
+
+ <path name="low-latency-record bt-sco-wb">
+ <ctl name="BT SampleRate" value="KHZ_16" />
+ <path name="low-latency-record bt-sco" />
+ </path>
+
+ <path name="low-latency-record usb-headset-mic">
+ <ctl name="MultiMedia8 Mixer USB_AUDIO_TX" value="1" />
+ </path>
+
+ <path name="low-latency-record capture-fm">
+ <ctl name="MultiMedia8 Mixer SLIM_8_TX" value="1" />
+ </path>
+
+ <path name="fm-virtual-record capture-fm">
+ <ctl name="MultiMedia2 Mixer SLIM_8_TX" value="1" />
+ </path>
+
+ <path name="play-fm">
+ <ctl name="SLIMBUS_8 LOOPBACK Volume" value="1" />
+ <ctl name="SLIMBUS_0_RX Port Mixer SLIM_8_TX" value="1" />
+ <ctl name="SLIMBUS_DL_HL Switch" value="1" />
+ </path>
+
+ <path name="play-fm headphones">
+ <ctl name="SLIMBUS_8 LOOPBACK Volume" value="1" />
+ <ctl name="SLIMBUS_6_RX Port Mixer SLIM_8_TX" value="1" />
+ <ctl name="SLIMBUS6_DL_HL Switch" value="1" />
+ </path>
+
+ <path name="incall-rec-uplink">
+ <ctl name="MultiMedia1 Mixer VOC_REC_UL" value="1" />
+ </path>
+
+ <path name="incall-rec-uplink bt-sco">
+ <path name="incall-rec-uplink" />
+ </path>
+
+ <path name="incall-rec-uplink bt-sco-wb">
+ <path name="incall-rec-uplink" />
+ </path>
+
+ <path name="incall-rec-uplink usb-headset-mic">
+ <path name="incall-rec-uplink" />
+ </path>
+
+ <path name="incall-rec-uplink afe-proxy">
+ <path name="incall-rec-uplink" />
+ </path>
+
+ <path name="incall-rec-uplink-compress">
+ <ctl name="MultiMedia8 Mixer VOC_REC_UL" value="1" />
+ </path>
+
+ <path name="incall-rec-uplink-compress bt-sco">
+ <path name="incall-rec-uplink-compress" />
+ </path>
+
+ <path name="incall-rec-uplink-compress bt-sco-wb">
+ <path name="incall-rec-uplink-compress" />
+ </path>
+
+ <path name="incall-rec-uplink-compress usb-headset-mic">
+ <path name="incall-rec-uplink-compress" />
+ </path>
+
+ <path name="incall-rec-uplink-compress afe-proxy">
+ <path name="incall-rec-uplink-compress" />
+ </path>
+
+ <path name="incall-rec-downlink">
+ <ctl name="MultiMedia1 Mixer VOC_REC_DL" value="1" />
+ </path>
+
+ <path name="incall-rec-downlink bt-sco">
+ <path name="incall-rec-downlink" />
+ </path>
+
+ <path name="incall-rec-downlink bt-sco-wb">
+ <path name="incall-rec-downlink" />
+ </path>
+
+ <path name="incall-rec-downlink usb-headset-mic">
+ <path name="incall-rec-downlink" />
+ </path>
+
+ <path name="incall-rec-downlink afe-proxy">
+ <path name="incall-rec-downlink" />
+ </path>
+
+ <path name="incall-rec-downlink-compress">
+ <ctl name="MultiMedia8 Mixer VOC_REC_DL" value="1" />
+ </path>
+
+ <path name="incall-rec-downlink-compress bt-sco">
+ <path name="incall-rec-downlink-compress" />
+ </path>
+
+ <path name="incall-rec-downlink-compress bt-sco-wb">
+ <path name="incall-rec-downlink-compress" />
+ </path>
+
+ <path name="incall-rec-downlink-compress usb-headset-mic">
+ <path name="incall-rec-downlink-compress" />
+ </path>
+
+ <path name="incall-rec-downlink-compress afe-proxy">
+ <path name="incall-rec-downlink-compress" />
+ </path>
+
+ <path name="incall-rec-uplink-and-downlink">
+ <path name="incall-rec-uplink" />
+ <path name="incall-rec-downlink" />
+ </path>
+
+ <path name="incall-rec-uplink-and-downlink bt-sco">
+ <path name="incall-rec-uplink-and-downlink" />
+ </path>
+
+ <path name="incall-rec-uplink-and-downlink bt-sco-wb">
+ <path name="incall-rec-uplink-and-downlink" />
+ </path>
+
+ <path name="incall-rec-uplink-and-downlink usb-headset-mic">
+ <path name="incall-rec-uplink-and-downlink" />
+ </path>
+
+ <path name="incall-rec-uplink-and-downlink afe-proxy">
+ <path name="incall-rec-uplink-and-downlink" />
+ </path>
+
+ <path name="incall-rec-uplink-and-downlink-compress">
+ <path name="incall-rec-uplink-compress" />
+ <path name="incall-rec-downlink-compress" />
+ </path>
+
+ <path name="incall-rec-uplink-and-downlink-compress bt-sco">
+ <path name="incall-rec-uplink-and-downlink-compress" />
+ </path>
+
+ <path name="incall-rec-uplink-and-downlink-compress bt-sco-wb">
+ <path name="incall-rec-uplink-and-downlink-compress" />
+ </path>
+
+ <path name="incall-rec-uplink-and-downlink-compress usb-headset-mic">
+ <path name="incall-rec-uplink-and-downlink-compress" />
+ </path>
+
+ <path name="incall-rec-uplink-and-downlink-compress afe-proxy">
+ <path name="incall-rec-uplink-and-downlink-compress" />
+ </path>
+
+ <path name="hfp-sco">
+ </path>
+
+ <path name="hfp-sco headphones">
+ </path>
+
+ <path name="hfp-sco-wb">
+ <path name="hfp-sco" />
+ </path>
+
+ <path name="hfp-sco-wb headphones">
+ <path name="hfp-sco headphones" />
+ </path>
+
+ <path name="compress-voip-call">
+ <ctl name="SLIM_0_RX_Voice Mixer Voip" value="1" />
+ <ctl name="Voip_Tx Mixer SLIM_0_TX_Voip" value="1" />
+ </path>
+
+ <path name="compress-voip-call headphones">
+ <ctl name="SLIM_6_RX_Voice Mixer Voip" value="1" />
+ <ctl name="Voip_Tx Mixer SLIM_0_TX_Voip" value="1" />
+ </path>
+
+
+ <path name="compress-voip-call bt-sco">
+ <ctl name="SLIM_7_RX_Voice Mixer Voip" value="1" />
+ <ctl name="Voip_Tx Mixer SLIM_7_TX_Voip" value="1" />
+ </path>
+
+ <path name="compress-voip-call bt-sco-wb">
+ <ctl name="BT SampleRate" value="KHZ_16" />
+ <path name="compress-voip-call bt-sco" />
+ </path>
+
+ <path name="compress-voip-call afe-proxy">
+ <ctl name="AFE_PCM_RX_Voice Mixer Voip" value="1" />
+ <ctl name="Voip_Tx Mixer AFE_PCM_TX_Voip" value="1" />
+ </path>
+
+ <path name="compress-voip-call usb-headphones">
+ <ctl name="USB_AUDIO_RX_Voice Mixer Voip" value="1" />
+ <ctl name="Voip_Tx Mixer USB_AUDIO_TX_Voip" value="1" />
+ </path>
+
+ <path name="compress-voip-call voice-speaker-vbat">
+ <path name="echo-reference speaker-vbat-mono" />
+ <path name="compress-voip-call"/>
+ </path>
+
+ <path name="voicemmode1-call">
+ <ctl name="SLIM_0_RX_Voice Mixer VoiceMMode1" value="1" />
+ <ctl name="VoiceMMode1_Tx Mixer SLIM_0_TX_MMode1" value="1" />
+ </path>
+
+ <path name="voicemmode1-call headphones">
+ <ctl name="SLIM_6_RX_Voice Mixer VoiceMMode1" value="1" />
+ <ctl name="VoiceMMode1_Tx Mixer SLIM_0_TX_MMode1" value="1" />
+ </path>
+
+ <path name="voicemmode1-call hdmi">
+ <ctl name="HDMI_RX_Voice Mixer VoiceMMode1" value="1" />
+ <ctl name="VoiceMMode1_Tx Mixer SLIM_0_TX_MMode1" value="1" />
+ </path>
+
+ <path name="voicemmode1-call bt-sco">
+ <ctl name="SLIM_7_RX_Voice Mixer VoiceMMode1" value="1" />
+ <ctl name="VoiceMMode1_Tx Mixer SLIM_7_TX_MMode1" value="1" />
+ </path>
+
+ <path name="voicemmode1-call bt-sco-wb">
+ <ctl name="BT SampleRate" value="KHZ_16" />
+ <path name="voicemmode1-call bt-sco" />
+ </path>
+
+ <path name="voicemmode1-call afe-proxy">
+ <ctl name="AFE_PCM_RX_Voice Mixer VoiceMMode1" value="1" />
+ <ctl name="VoiceMMode1_Tx Mixer AFE_PCM_TX_MMode1" value="1" />
+ </path>
+
+ <path name="voicemmode1-call usb-headphones">
+ <ctl name="USB_AUDIO_RX_Voice Mixer VoiceMMode1" value="1" />
+ <ctl name="VoiceMMode1_Tx Mixer USB_AUDIO_TX_MMode1" value="1" />
+ </path>
+
+ <path name="voicemmode1-call voice-speaker-vbat">
+ <path name="echo-reference speaker-vbat-mono" />
+ <path name="voicemmode1-call"/>
+ </path>
+
+ <path name="voicemmode2-call">
+ <ctl name="SLIM_0_RX_Voice Mixer VoiceMMode2" value="1" />
+ <ctl name="VoiceMMode2_Tx Mixer SLIM_0_TX_MMode2" value="1" />
+ </path>
+
+ <path name="voicemmode2-call headphones">
+ <ctl name="SLIM_6_RX_Voice Mixer VoiceMMode2" value="1" />
+ <ctl name="VoiceMMode2_Tx Mixer SLIM_0_TX_MMode2" value="1" />
+ </path>
+
+ <path name="voicemmode2-call hdmi">
+ <ctl name="HDMI_RX_Voice Mixer VoiceMMode2" value="1" />
+ <ctl name="VoiceMMode2_Tx Mixer SLIM_0_TX_MMode2" value="1" />
+ </path>
+
+ <path name="voicemmode2-call bt-sco">
+ <ctl name="SLIM_7_RX_Voice Mixer VoiceMMode2" value="1" />
+ <ctl name="VoiceMMode2_Tx Mixer SLIM_7_TX_MMode2" value="1" />
+ </path>
+
+ <path name="voicemmode2-call bt-sco-wb">
+ <ctl name="BT SampleRate" value="KHZ_16" />
+ <path name="voicemmode2-call bt-sco" />
+ </path>
+
+ <path name="voicemmode2-call afe-proxy">
+ <ctl name="AFE_PCM_RX_Voice Mixer VoiceMMode2" value="1" />
+ <ctl name="VoiceMMode2_Tx Mixer AFE_PCM_TX_MMode2" value="1" />
+ </path>
+
+ <path name="voicemmode2-call usb-headphones">
+ <ctl name="USB_AUDIO_RX_Voice Mixer VoiceMMode2" value="1" />
+ <ctl name="VoiceMMode2_Tx Mixer USB_AUDIO_TX_MMode2" value="1" />
+ </path>
+
+ <path name="voicemmode2-call voice-speaker-vbat">
+ <path name="echo-reference speaker-vbat-mono" />
+ <path name="voicemmode2-call"/>
+ </path>
+
+ <path name="spkr-rx-calib">
+ <ctl name="SLIMBUS_DL_HL Switch" value="1" />
+ </path>
+
+ <path name="spkr-vi-record">
+ </path>
+
+ <!-- These are actual sound device specific mixer settings -->
+ <path name="amic1">
+ <ctl name="AIF1_CAP Mixer SLIM TX6" value="1"/>
+ <ctl name="SLIM_0_TX Channels" value="One" />
+ <ctl name="CDC_IF TX6 MUX" value="DEC6" />
+ <ctl name="ADC MUX6" value="AMIC" />
+ <ctl name="AMIC MUX6" value="ADC1" />
+ <ctl name="IIR0 INP0 MUX" value="DEC6" />
+ </path>
+
+ <path name="amic2">
+ <ctl name="AIF1_CAP Mixer SLIM TX0" value="1"/>
+ <ctl name="SLIM_0_TX Channels" value="One" />
+ <ctl name="CDC_IF TX0 MUX" value="DEC0" />
+ <ctl name="ADC MUX0" value="AMIC" />
+ <ctl name="AMIC MUX0" value="ADC2" />
+ <ctl name="IIR0 INP0 MUX" value="DEC0" />
+ </path>
+
+ <!-- For Tavil, DMIC numbered from 0 to 5 -->
+ <path name="dmic1">
+ <ctl name="AIF1_CAP Mixer SLIM TX7" value="1" />
+ <ctl name="CDC_IF TX7 MUX" value="DEC7" />
+ <ctl name="SLIM_0_TX Channels" value="One" />
+ <ctl name="ADC MUX7" value="DMIC" />
+ <ctl name="DMIC MUX7" value="DMIC0" />
+ <ctl name="IIR0 INP0 MUX" value="DEC7" />
+ </path>
+
+ <path name="dmic2">
+ <ctl name="AIF1_CAP Mixer SLIM TX7" value="1"/>
+ <ctl name="CDC_IF TX7 MUX" value="DEC7" />
+ <ctl name="SLIM_0_TX Channels" value="One" />
+ <ctl name="ADC MUX7" value="DMIC" />
+ <ctl name="DMIC MUX7" value="DMIC1" />
+ <ctl name="IIR0 INP0 MUX" value="DEC7" />
+ </path>
+
+ <path name="dmic3">
+ <ctl name="AIF1_CAP Mixer SLIM TX7" value="1" />
+ <ctl name="CDC_IF TX7 MUX" value="DEC7" />
+ <ctl name="SLIM_0_TX Channels" value="One" />
+ <ctl name="ADC MUX7" value="DMIC" />
+ <ctl name="DMIC MUX7" value="DMIC2" />
+ <ctl name="IIR0 INP0 MUX" value="DEC7" />
+ </path>
+
+ <path name="dmic4">
+ <ctl name="AIF1_CAP Mixer SLIM TX7" value="1" />
+ <ctl name="CDC_IF TX7 MUX" value="DEC7" />
+ <ctl name="SLIM_0_TX Channels" value="One" />
+ <ctl name="ADC MUX7" value="DMIC" />
+ <ctl name="DMIC MUX7" value="DMIC3" />
+ <ctl name="IIR0 INP0 MUX" value="DEC7" />
+ </path>
+
+ <path name="dmic5">
+ <ctl name="AIF1_CAP Mixer SLIM TX7" value="1" />
+ <ctl name="CDC_IF TX7 MUX" value="DEC7" />
+ <ctl name="SLIM_0_TX Channels" value="One" />
+ <ctl name="ADC MUX7" value="DMIC" />
+ <ctl name="DMIC MUX7" value="DMIC4" />
+ <ctl name="IIR0 INP0 MUX" value="DEC7" />
+ </path>
+
+ <path name="dmic6">
+ <ctl name="AIF1_CAP Mixer SLIM TX7" value="1" />
+ <ctl name="CDC_IF TX7 MUX" value="DEC7" />
+ <ctl name="SLIM_0_TX Channels" value="One" />
+ <ctl name="ADC MUX7" value="DMIC" />
+ <ctl name="DMIC MUX7" value="DMIC5" />
+ <ctl name="IIR0 INP0 MUX" value="DEC7" />
+ </path>
+
+ <path name="speaker">
+ <ctl name="SLIM RX0 MUX" value="AIF1_PB" />
+ <ctl name="CDC_IF RX0 MUX" value="SLIM RX0" />
+ <ctl name="SLIM_0_RX Channels" value="One" />
+ <ctl name="RX INT7_1 MIX1 INP0" value="RX0" />
+ <ctl name="COMP7 Switch" value="1" />
+ <ctl name="SpkrLeft COMP Switch" value="1" />
+ <ctl name="SpkrLeft BOOST Switch" value="1" />
+ <ctl name="SpkrLeft VISENSE Switch" value="1" />
+ <ctl name="SpkrLeft SWR DAC_Port Switch" value="1" />
+ </path>
+
+ <path name="speaker-mono">
+ <ctl name="SLIM RX0 MUX" value="AIF1_PB" />
+ <ctl name="CDC_IF RX0 MUX" value="SLIM RX0" />
+ <ctl name="SLIM_0_RX Channels" value="One" />
+ <ctl name="RX INT7_1 MIX1 INP0" value="RX0" />
+ <ctl name="COMP7 Switch" value="1" />
+ <ctl name="SpkrLeft COMP Switch" value="1" />
+ <ctl name="SpkrLeft BOOST Switch" value="1" />
+ <ctl name="SpkrLeft VISENSE Switch" value="1" />
+ <ctl name="SpkrLeft SWR DAC_Port Switch" value="1" />
+ </path>
+
+ <path name="speaker-fluid">
+ <path name="speaker-mono" />
+ </path>
+
+ <path name="speaker-liquid">
+ <path name="speaker" />
+ </path>
+
+ <path name="speaker-vbat-mono">
+ <path name="speaker-mono" />
+ </path>
+
+ <path name="speaker-vbat">
+ <path name="speaker" />
+ </path>
+
+ <path name="sidetone-iir">
+ <ctl name="IIR0 Enable Band1" value="1" />
+ <ctl name="IIR0 Enable Band2" value="1" />
+ <ctl name="IIR0 Enable Band3" value="1" />
+ <ctl name="IIR0 Enable Band4" value="1" />
+ <ctl name="IIR0 Enable Band5" value="1" />
+ </path>
+
+ <path name="sidetone-headphones">
+ <path name="sidetone-iir" />
+ <ctl name="IIR0 INP0 Volume" value="54" />
+ <ctl name="RX INT1 MIX2 INP" value="SRC0" />
+ <ctl name="RX INT2 MIX2 INP" value="SRC0" />
+ </path>
+
+ <path name="sidetone-handset">
+ <path name="sidetone-iir" />
+ <ctl name="IIR0 INP0 Volume" value="54" />
+ <ctl name="RX INT7 MIX2 INP" value="SRC0" />
+ </path>
+
+ <path name="speaker-mic">
+ <path name="dmic3" />
+ </path>
+
+ <path name="speaker-mic-liquid">
+ <path name="dmic3" />
+ </path>
+
+ <path name="speaker-mic-sbc">
+ </path>
+
+ <path name="speaker-protected">
+ <ctl name="AIF4_VI Mixer SPKR_VI_1" value="1" />
+ <ctl name="SLIM_4_TX Format" value="PACKED_16B" />
+ <path name="speaker" />
+ <ctl name="VI_FEED_TX Channels" value="One" />
+ <ctl name="SLIM0_RX_VI_FB_LCH_MUX" value="SLIM4_TX" />
+ </path>
+
+ <path name="voice-speaker-protected">
+ <ctl name="AIF4_VI Mixer SPKR_VI_1" value="1" />
+ <ctl name="SLIM_4_TX Format" value="PACKED_16B" />
+ <path name="speaker-mono" />
+ <ctl name="VI_FEED_TX Channels" value="One" />
+ <ctl name="SLIM0_RX_VI_FB_LCH_MUX" value="SLIM4_TX" />
+ </path>
+
+ <path name="vi-feedback">
+ </path>
+
+ <path name="speaker-protected-vbat">
+ <path name="speaker-protected" />
+ </path>
+
+ <path name="voice-speaker-protected-vbat">
+ <path name="voice-speaker-protected" />
+ </path>
+
+ <path name="handset">
+ <ctl name="SLIM RX0 MUX" value="AIF1_PB" />
+ <ctl name="CDC_IF RX0 MUX" value="SLIM RX0" />
+ <ctl name="SLIM_0_RX Channels" value="One" />
+ <ctl name="RX INT0_1 MIX1 INP0" value="RX0" />
+ <ctl name="RX INT0 DEM MUX" value="CLSH_DSM_OUT" />
+ <ctl name="EAR PA Gain" value="G_6_DB" />
+ </path>
+
+ <path name="handset-mic">
+ <path name="dmic1" />
+ </path>
+
+ <path name="handset-mic-db">
+ </path>
+
+ <path name="handset-mic-cdp">
+ <path name="amic1" />
+ </path>
+
+ <path name="handset-mic-sbc">
+ </path>
+
+ <path name="three-mic">
+ <ctl name="AIF1_CAP Mixer SLIM TX0" value="1" />
+ <ctl name="AIF1_CAP Mixer SLIM TX1" value="1" />
+ <ctl name="AIF1_CAP Mixer SLIM TX2" value="1" />
+ <ctl name="SLIM_0_TX Channels" value="Three" />
+ <ctl name="CDC_IF TX0 MUX" value="DEC0" />
+ <ctl name="ADC MUX0" value="DMIC" />
+ <ctl name="DMIC MUX" value="DMIC0" />
+ <ctl name="CDC_IF TX1 MUX" value="DEC1" />
+ <ctl name="ADC MUX1" value="DMIC" />
+ <ctl name="DMIC MUX1" value="DMIC1" />
+ <ctl name="CDC_IF TX2 MUX" value="DEC2" />
+ <ctl name="ADC MUX2" value="DMIC" />
+ <ctl name="DMIC MUX2" value="DMIC2" />
+ </path>
+
+ <path name="anc-handset">
+ <ctl name="ANC Function" value="ON" />
+ <ctl name="ANC Slot" value="6" />
+ <ctl name="SLIM RX0 MUX" value="AIF1_PB" />
+ <ctl name="CDC_IF RX0 MUX" value="SLIM RX0" />
+ <ctl name="SLIM_0_RX Channels" value="One" />
+ <ctl name="RX INT7_1 MIX1 INP0" value="RX0" />
+ <ctl name="SpkrLeft SWR DAC_Port Switch" value="1" />
+ <ctl name="ANC OUT EAR SPKR Enable Switch" value="1" />
+ <ctl name="ANC SPKR PA Enable Switch" value="1" />
+ <ctl name="SpkrLeft WSA PA Gain" value="G_6_DB" />
+ </path>
+
+ <path name="headphones">
+ <ctl name="SLIM RX2 MUX" value="AIF4_PB" />
+ <ctl name="SLIM RX3 MUX" value="AIF4_PB" />
+ <ctl name="SLIM_6_RX Channels" value="Two" />
+ <ctl name="RX INT1_2 MUX" value="RX2" />
+ <ctl name="RX INT2_2 MUX" value="RX3" />
+ </path>
+
+ <path name="headphones-44.1">
+ <ctl name="SLIM RX4 MUX" value="AIF3_PB" />
+ <ctl name="SLIM RX5 MUX" value="AIF3_PB" />
+ <ctl name="SLIM_5_RX Channels" value="Two" />
+ <ctl name="CDC_IF RX4 MUX" value="SLIM RX4" />
+ <ctl name="CDC_IF RX5 MUX" value="SLIM RX5" />
+ <ctl name="RX INT1_1 MIX1 INP0" value="RX4" />
+ <ctl name="RX INT2_1 MIX1 INP0" value="RX5" />
+ <ctl name="RX INT1_1 NATIVE MUX" value="ON" />
+ <ctl name="RX INT2_1 NATIVE MUX" value="ON" />
+ <ctl name="SLIM_5_RX SampleRate" value="KHZ_44P1" />
+ <ctl name="RX INT1 DEM MUX" value="CLSH_DSM_OUT" />
+ <ctl name="RX INT2 DEM MUX" value="CLSH_DSM_OUT" />
+ </path>
+
+ <path name="asrc-mode">
+ <ctl name="RX INT1_2 NATIVE MUX" value="ON" />
+ <ctl name="RX INT2_2 NATIVE MUX" value="ON" />
+ <ctl name="ASRC0 MUX" value="ASRC_IN_HPHL" />
+ <ctl name="RX INT1 SEC MIX HPHL Switch" value="1" />
+ <ctl name="ASRC1 MUX" value="ASRC_IN_HPHR" />
+ <ctl name="RX INT2 SEC MIX HPHR Switch" value="1" />
+ </path>
+
+ <path name="headphones-dsd">
+ <ctl name="SLIM RX6 MUX" value="AIF2_PB" />
+ <ctl name="SLIM RX7 MUX" value="AIF2_PB" />
+ <ctl name="SLIM_2_RX Channels" value="Two" />
+ <ctl name="DSD_L IF MUX" value="RX6" />
+ <ctl name="DSD_R IF MUX" value="RX7" />
+ <ctl name="RX INT1 MIX3 DSD HPHL Switch" value="1" />
+ <ctl name="RX INT2 MIX3 DSD HPHR Switch" value="1" />
+ <ctl name="SLIM_2_RX Format" value="DSD_DOP" />
+ </path>
+
+ <path name="hph-highquality-mode">
+ <ctl name="RX HPH Mode" value="CLS_H_LOHIFI" />
+ </path>
+
+ <path name="hph-lowpower-mode">
+ <ctl name="RX HPH Mode" value="CLS_H_ULP" />
+ </path>
+
+ <path name="true-native-mode">
+ <ctl name="SLIM RX2 MUX" value="AIF3_PB" />
+ <ctl name="SLIM RX3 MUX" value="AIF3_PB" />
+ <ctl name="CDC_IF RX2 MUX" value="SLIM RX2" />
+ <ctl name="CDC_IF RX3 MUX" value="SLIM RX3" />
+ <ctl name="RX INT1 NATIVE MUX" value="ON" />
+ <ctl name="RX INT2 NATIVE MUX" value="ON" />
+ <ctl name="SLIM_5_RX Channels" value="Two" />
+ <ctl name="RX INT1_1 MIX1 INP0" value="RX2" />
+ <ctl name="RX INT2_1 MIX1 INP1" value="RX3" />
+ <ctl name="SLIM_5_RX SampleRate" value="KHZ_44P1" />
+ <ctl name="RX INT1 DEM MUX" value="CLSH_DSM_OUT" />
+ <ctl name="RX INT2 DEM MUX" value="CLSH_DSM_OUT" />
+ <ctl name="COMP1" value="1" />
+ <ctl name="COMP2" value="1" />
+ </path>
+
+ <path name="line">
+ <path name="headphones" />
+ </path>
+
+ <path name="headset-mic">
+ <path name="amic2" />
+ </path>
+
+ <path name="headset-mic-liquid">
+ <path name="amic2" />
+ </path>
+
+ <path name="voice-handset">
+ <path name="handset" />
+ </path>
+
+ <path name="voice-handset-tmus">
+ <path name="handset" />
+ </path>
+
+ <path name="voice-speaker">
+ <path name="speaker-mono" />
+ </path>
+
+ <path name="voice-speaker-fluid">
+ <path name="speaker-fluid" />
+ </path>
+
+ <path name="voice-speaker-mic">
+ <path name="speaker-mic" />
+ </path>
+
+ <path name="voice-speaker-vbat">
+ <path name="speaker-vbat-mono" />
+ </path>
+
+ <path name="voice-headphones">
+ <path name="headphones" />
+ </path>
+
+ <path name="voice-line">
+ <path name="voice-headphones" />
+ </path>
+
+ <path name="voice-headset-mic">
+ <path name="headset-mic" />
+ </path>
+
+ <path name="speaker-and-headphones">
+ <path name="headphones" />
+ <path name="speaker" />
+ </path>
+
+ <path name="speaker-and-line">
+ <path name="speaker-and-headphones" />
+ </path>
+
+ <path name="speaker-and-headphones-liquid">
+ <path name="headphones" />
+ <path name="speaker" />
+ </path>
+
+ <path name="speaker-and-line-liquid">
+ <path name="speaker-and-headphones-liquid" />
+ </path>
+
+ <path name="usb-headphones">
+ </path>
+
+ <path name="afe-proxy">
+ </path>
+
+ <path name="anc-headphones">
+ <path name="headphones" />
+ </path>
+
+ <path name="speaker-and-anc-headphones">
+ <path name="anc-headphones" />
+ <path name="speaker" />
+ </path>
+
+ <path name="anc-fb-headphones">
+ <path name="anc-headphones" />
+ </path>
+
+ <path name="speaker-and-anc-fb-headphones">
+ <path name="anc-fb-headphones" />
+ <path name="speaker" />
+ </path>
+
+ <path name="voice-anc-headphones">
+ <path name="voice-headphones" />
+ </path>
+
+ <path name="voice-anc-fb-headphones">
+ <path name="voice-headphones" />
+ </path>
+
+ <path name="speaker-and-anc-headphones-liquid">
+ <path name="anc-headphones" />
+ </path>
+
+ <path name="hdmi">
+ </path>
+
+ <path name="display-port">
+ </path>
+
+ <path name="speaker-and-usb-headphones">
+ <path name="speaker" />
+ <path name="usb-headphones" />
+ </path>
+
+ <path name="speaker-and-hdmi">
+ <path name="speaker" />
+ <path name="hdmi" />
+ </path>
+
+ <path name="speaker-and-display-port">
+ <path name="speaker" />
+ <path name="display-port" />
+ </path>
+
+ <path name="voice-rec-mic">
+ <path name="handset-mic" />
+ </path>
+
+ <path name="camcorder-mic">
+ <path name="handset-mic" />
+ </path>
+
+ <path name="hdmi-tx">
+ <path name="handset-mic" />
+ </path>
+
+ <path name="bt-sco-headset">
+ </path>
+
+ <path name="bt-sco-mic">
+ </path>
+
+ <path name="bt-sco-headset-wb">
+ </path>
+
+ <path name="bt-sco-mic-wb">
+ </path>
+
+ <path name="usb-headset-mic">
+ </path>
+
+ <path name="capture-fm">
+ </path>
+
+ <path name="aanc-handset-mic">
+ <ctl name="AIF1_CAP Mixer SLIM TX6" value="1" />
+ <ctl name="AIF1_CAP Mixer SLIM TX8" value="1" />
+ <ctl name="AIF1_CAP Mixer SLIM TX9" value="1" />
+ <ctl name="SLIM_0_TX Channels" value="Three" />
+ <ctl name="AANC_SLIM_0_RX MUX" value="SLIMBUS_0_TX" />
+ <ctl name="CDC_IF TX6 MUX" value="DEC6" />
+ <ctl name="ADC MUX6" value="DMIC" />
+ <ctl name="DMIC MUX6" value="DMIC2" />
+ <ctl name="CDC_IF TX8 MUX" value="DEC8" />
+ <ctl name="ADC MUX8" value="DMIC" />
+ <ctl name="DMIC MUX8" value="DMIC4" />
+ <ctl name="CDC_IF TX9 MUX" value="DEC7" />
+ <ctl name="ADC MUX7" value="DMIC" />
+ <ctl name="DMIC MUX7" value="DMIC0" />
+ <ctl name="IIR0 INP0 MUX" value="DEC6" />
+ <ctl name="ADC MUX10" value="DMIC" />
+ <ctl name="DMIC MUX10" value="DMIC4" />
+ <ctl name="ANC0 FB MUX" value="ANC_IN_EAR_SPKR" />
+ </path>
+
+ <!-- Dual MIC devices -->
+ <path name="handset-dmic-endfire">
+ <ctl name="AIF1_CAP Mixer SLIM TX7" value="1" />
+ <ctl name="AIF1_CAP Mixer SLIM TX8" value="1" />
+ <ctl name="CDC_IF TX7 MUX" value="DEC7" />
+ <ctl name="ADC MUX7" value="DMIC" />
+ <ctl name="DMIC MUX7" value="DMIC2" />
+ <ctl name="CDC_IF TX8 MUX" value="DEC8" />
+ <ctl name="ADC MUX8" value="DMIC" />
+ <ctl name="DMIC MUX8" value="DMIC4" />
+ <ctl name="SLIM_0_TX Channels" value="Two" />
+ </path>
+
+ <path name="speaker-dmic-endfire">
+ <ctl name="AIF1_CAP Mixer SLIM TX7" value="1" />
+ <ctl name="AIF1_CAP Mixer SLIM TX8" value="1" />
+ <ctl name="CDC_IF TX7 MUX" value="DEC7" />
+ <ctl name="ADC MUX7" value="DMIC" />
+ <ctl name="DMIC MUX7" value="DMIC1" />
+ <ctl name="CDC_IF TX8 MUX" value="DEC8" />
+ <ctl name="ADC MUX8" value="DMIC" />
+ <ctl name="DMIC MUX8" value="DMIC4" />
+ <ctl name="SLIM_0_TX Channels" value="Two" />
+ </path>
+
+ <path name="dmic-endfire">
+ <path name="handset-dmic-endfire" />
+ <ctl name="IIR0 INP0 MUX" value="DEC7" />
+ </path>
+
+ <path name="dmic-endfire-liquid">
+ <path name="handset-dmic-endfire" />
+ <ctl name="IIR0 INP0 MUX" value="DEC7" />
+ </path>
+
+ <path name="handset-stereo-dmic-ef">
+ <path name="handset-dmic-endfire" />
+ </path>
+
+ <path name="speaker-stereo-dmic-ef">
+ <path name="speaker-dmic-endfire" />
+ </path>
+
+ <path name="voice-dmic-ef-tmus">
+ <path name="dmic-endfire" />
+ </path>
+
+ <path name="voice-dmic-ef">
+ <path name="dmic-endfire" />
+ </path>
+
+ <path name="voice-speaker-dmic-ef">
+ <path name="speaker-dmic-endfire" />
+ </path>
+
+ <path name="voice-rec-dmic-ef">
+ <path name="dmic-endfire" />
+ </path>
+
+ <path name="voice-rec-dmic-ef-fluence">
+ <path name="dmic-endfire" />
+ </path>
+
+ <path name="handset-stereo-dmic-ef-liquid">
+ <path name="handset-dmic-endfire" />
+ </path>
+
+ <path name="speaker-stereo-dmic-ef-liquid">
+ <path name="speaker-dmic-endfire" />
+ </path>
+
+ <path name="voice-dmic-ef-liquid-liquid">
+ <path name="dmic-endfire-liquid" />
+ </path>
+
+ <path name="voice-speaker-dmic-ef-liquid">
+ <path name="dmic-endfire-liquid" />
+ </path>
+
+ <path name="voice-rec-dmic-ef-liquid">
+ <path name="dmic-endfire-liquid" />
+ </path>
+
+ <path name="voice-rec-dmic-ef-fluence-liquid">
+ <path name="dmic-endfire-liquid" />
+ </path>
+
+ <path name="speaker-dmic-broadside">
+ <ctl name="AIF1_CAP Mixer SLIM TX7" value="1" />
+ <ctl name="AIF1_CAP Mixer SLIM TX8" value="1" />
+ <ctl name="SLIM_0_TX Channels" value="Two" />
+ <ctl name="CDC_IF TX7 MUX" value="DEC7" />
+ <ctl name="ADC MUX7" value="DMIC" />
+ <ctl name="DMIC MUX7" value="DMIC1" />
+ <ctl name="CDC_IF TX8 MUX" value="DEC8" />
+ <ctl name="ADC MUX8" value="DMIC" />
+ <ctl name="DMIC MUX8" value="DMIC2" />
+ </path>
+
+ <path name="dmic-broadside">
+ <path name="speaker-dmic-broadside" />
+ <ctl name="IIR0 INP0 MUX" value="DEC7" />
+ </path>
+
+ <path name="voice-speaker-dmic-broadside">
+ <path name="dmic-broadside" />
+ </path>
+
+ <!-- Quad MIC devices -->
+ <path name="speaker-qmic">
+ <ctl name="AIF1_CAP Mixer SLIM TX5" value="1" />
+ <ctl name="AIF1_CAP Mixer SLIM TX6" value="1" />
+ <ctl name="AIF1_CAP Mixer SLIM TX7" value="1" />
+ <ctl name="AIF1_CAP Mixer SLIM TX8" value="1" />
+ <ctl name="SLIM_0_TX Channels" value="Four" />
+ <ctl name="CDC_IF TX5 MUX" value="DEC5" />
+ <ctl name="ADC MUX5" value="DMIC" />
+ <ctl name="DMIC MUX5" value="DMIC1" />
+ <ctl name="CDC_IF TX6 MUX" value="DEC6" />
+ <ctl name="ADC MUX6" value="DMIC" />
+ <ctl name="DMIC MUX6" value="DMIC0" />
+ <ctl name="CDC_IF TX7 MUX" value="DEC7" />
+ <ctl name="ADC MUX7" value="DMIC" />
+ <ctl name="DMIC MUX7" value="DMIC2" />
+ <ctl name="CDC_IF TX8 MUX" value="DEC8" />
+ <ctl name="ADC MUX8" value="DMIC" />
+ <ctl name="DMIC MUX8" value="DMIC4" />
+ </path>
+
+ <path name="speaker-qmic-liquid">
+ </path>
+
+ <path name="voice-speaker-qmic">
+ <path name="speaker-qmic" />
+ </path>
+
+ <path name="quad-mic">
+ <path name="speaker-qmic" />
+ </path>
+
+ <path name="voice-speaker-qmic-liquid">
+ <path name="speaker-qmic-liquid" />
+ </path>
+
+ <path name="quad-mic-liquid">
+ <path name="speaker-qmic-liquid" />
+ </path>
+
+ <!-- TTY devices -->
+
+ <path name="tty-headphones">
+ <ctl name="SLIM RX2 MUX" value="AIF4_PB" />
+ <ctl name="SLIM_6_RX Channels" value="One" />
+ <ctl name="RX INT1_2 MUX" value="RX2" />
+ </path>
+
+ <path name="voice-tty-full-headphones">
+ <ctl name="TTY Mode" value="FULL" />
+ <path name="tty-headphones" />
+ </path>
+
+ <path name="voice-tty-vco-headphones">
+ <ctl name="TTY Mode" value="VCO" />
+ <path name="tty-headphones" />
+ </path>
+
+ <path name="voice-tty-hco-handset">
+ <ctl name="TTY Mode" value="HCO" />
+ <path name="handset" />
+ </path>
+
+ <path name="voice-tty-full-headset-mic">
+ <path name="amic2" />
+ </path>
+
+ <path name="voice-tty-hco-headset-mic">
+ <path name="voice-tty-full-headset-mic" />
+ </path>
+
+ <path name="voice-tty-vco-handset-mic">
+ <path name="dmic1" />
+ </path>
+
+ <path name="unprocessed-handset-mic">
+ <path name="handset-mic" />
+ </path>
+
+ <path name="unprocessed-mic">
+ <path name="unprocessed-handset-mic" />
+ </path>
+
+ <!-- Added for ADSP testfwk -->
+ <path name="ADSP testfwk">
+ <ctl name="SLIMBUS_DL_HL Switch" value="1" />
+ </path>
+
+ <path name="bt-a2dp">
+ <ctl name="BT SampleRate" value="KHZ_48" />
+ <ctl name="AFE Input Channels" value="Two" />
+ <ctl name="SLIM7_RX ADM Channels" value="Two" />
+ </path>
+
+ <path name="speaker-and-bt-a2dp">
+ <path name="speaker" />
+ <path name="bt-a2dp" />
+ </path>
+
+ <path name="deep-buffer-playback bt-a2dp">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia1" value="1" />
+ </path>
+
+ <path name="low-latency-playback bt-a2dp">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia5" value="1" />
+ </path>
+
+ <path name="compress-offload-playback bt-a2dp">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia4" value="1" />
+ </path>
+
+ <path name="compress-offload-playback2 bt-a2dp">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia7" value="1" />
+ </path>
+
+ <path name="compress-offload-playback3 bt-a2dp">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia10" value="1" />
+ </path>
+
+ <path name="compress-offload-playback4 bt-a2dp">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia11" value="1" />
+ </path>
+
+ <path name="compress-offload-playback5 bt-a2dp">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia12" value="1" />
+ </path>
+
+ <path name="compress-offload-playback6 bt-a2dp">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia13" value="1" />
+ </path>
+
+ <path name="compress-offload-playback7 bt-a2dp">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia14" value="1" />
+ </path>
+
+ <path name="compress-offload-playback8 bt-a2dp">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia15" value="1" />
+ </path>
+
+ <path name="compress-offload-playback9 bt-a2dp">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia16" value="1" />
+ </path>
+
+ <path name="audio-ull-playback bt-a2dp">
+ <ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia3" value="1" />
+ </path>
+
+ <path name="deep-buffer-playback speaker-and-bt-a2dp">
+ <path name="deep-buffer-playback bt-a2dp" />
+ <path name="deep-buffer-playback" />
+ </path>
+
+ <path name="compress-offload-playback speaker-and-bt-a2dp">
+ <path name="compress-offload-playback bt-a2dp" />
+ <path name="compress-offload-playback" />
+ </path>
+
+ <path name="low-latency-playback speaker-and-bt-a2dp">
+ <path name="low-latency-playback bt-a2dp" />
+ <path name="low-latency-playback" />
+ </path>
+
+ <path name="compress-offload-playback2 speaker-and-bt-a2dp">
+ <path name="compress-offload-playback2 bt-a2dp" />
+ <path name="compress-offload-playback2" />
+ </path>
+
+ <path name="compress-offload-playback3 speaker-and-bt-a2dp">
+ <path name="compress-offload-playback3 bt-a2dp" />
+ <path name="compress-offload-playback3" />
+ </path>
+
+ <path name="compress-offload-playback4 speaker-and-bt-a2dp">
+ <path name="compress-offload-playback4 bt-a2dp" />
+ <path name="compress-offload-playback4" />
+ </path>
+
+ <path name="compress-offload-playback5 speaker-and-bt-a2dp">
+ <path name="compress-offload-playback5 bt-a2dp" />
+ <path name="compress-offload-playback5" />
+ </path>
+
+ <path name="compress-offload-playback6 speaker-and-bt-a2dp">
+ <path name="compress-offload-playback6 bt-a2dp" />
+ <path name="compress-offload-playback6" />
+ </path>
+
+ <path name="compress-offload-playback7 speaker-and-bt-a2dp">
+ <path name="compress-offload-playback7 bt-a2dp" />
+ <path name="compress-offload-playback7" />
+ </path>
+
+ <path name="compress-offload-playback8 speaker-and-bt-a2dp">
+ <path name="compress-offload-playback8 bt-a2dp" />
+ <path name="compress-offload-playback8" />
+ </path>
+
+ <path name="compress-offload-playback9 speaker-and-bt-a2dp">
+ <path name="compress-offload-playback9 bt-a2dp" />
+ <path name="compress-offload-playback9" />
+ </path>
+
+ <path name="audio-ull-playback speaker-and-bt-a2dp">
+ <path name="audio-ull-playback bt-a2dp" />
+ <path name="audio-ull-playback" />
+ </path>
+</mixer>
diff --git a/configs/msmcobalt/mixer_paths_tavil.xml b/configs/msmcobalt/mixer_paths_tavil.xml
index 34543f5..29212f9 100644
--- a/configs/msmcobalt/mixer_paths_tavil.xml
+++ b/configs/msmcobalt/mixer_paths_tavil.xml
@@ -474,6 +474,8 @@
<!-- Headphone Default mode - uLP -->
<ctl name="RX HPH Mode" value="CLS_H_ULP" />
+ <ctl name="ASRC0 Output Mode" value="INT" />
+ <ctl name="ASRC1 Output Mode" value="INT" />
<!-- IIR/voice anc -->
<ctl name="IIR0 Band1" id ="0" value="268435456" />
@@ -1881,6 +1883,8 @@
</path>
<path name="asrc-mode">
+ <ctl name="ASRC0 Output Mode" value="FRAC" />
+ <ctl name="ASRC1 Output Mode" value="FRAC" />
<ctl name="RX INT1_2 NATIVE MUX" value="ON" />
<ctl name="RX INT2_2 NATIVE MUX" value="ON" />
<ctl name="ASRC0 MUX" value="ASRC_IN_HPHL" />
diff --git a/configs/msmcobalt/msmcobalt.mk b/configs/msmcobalt/msmcobalt.mk
index e864f4b..b7684ed 100644
--- a/configs/msmcobalt/msmcobalt.mk
+++ b/configs/msmcobalt/msmcobalt.mk
@@ -22,8 +22,7 @@
AUDIO_FEATURE_ENABLED_HDMI_PASSTHROUGH := true
#AUDIO_FEATURE_ENABLED_KEEP_ALIVE := true
AUDIO_FEATURE_ENABLED_DISPLAY_PORT := true
-#AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true
-#DOLBY_DDP := true
+AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true
AUDIO_FEATURE_ENABLED_HFP := true
AUDIO_FEATURE_ENABLED_INCALL_MUSIC := false
AUDIO_FEATURE_ENABLED_MULTI_VOICE_SESSIONS := true
@@ -75,6 +74,8 @@
hardware/qcom/audio/configs/msmcobalt/mixer_paths.xml:system/etc/mixer_paths.xml \
hardware/qcom/audio/configs/msmcobalt/mixer_paths_tasha.xml:system/etc/mixer_paths_tasha.xml \
hardware/qcom/audio/configs/msmcobalt/mixer_paths_tavil.xml:system/etc/mixer_paths_tavil.xml \
+ hardware/qcom/audio/configs/msmcobalt/mixer_paths_skuk.xml:system/etc/mixer_paths_skuk.xml \
+ hardware/qcom/audio/configs/msmcobalt/mixer_paths_skuk.xml:system/etc/mixer_paths_qvr.xml \
hardware/qcom/audio/configs/msmcobalt/mixer_paths_dtp.xml:system/etc/mixer_paths_dtp.xml \
hardware/qcom/audio/configs/msmcobalt/mixer_paths_i2s.xml:system/etc/mixer_paths_i2s.xml \
hardware/qcom/audio/configs/msmcobalt/aanc_tuning_mixer.txt:system/etc/aanc_tuning_mixer.txt \
diff --git a/hal/audio_extn/a2dp.c b/hal/audio_extn/a2dp.c
index e72cb76..28d0f75 100644
--- a/hal/audio_extn/a2dp.c
+++ b/hal/audio_extn/a2dp.c
@@ -645,6 +645,35 @@
return ret;
}
+static void reset_a2dp_enc_config_params()
+{
+ int ret =0;
+
+ struct mixer_ctl *ctl_enc_config, *ctrl_bit_format;
+ struct sbc_enc_cfg_t dummy_reset_config;
+
+ memset(&dummy_reset_config, 0x0, sizeof(struct sbc_enc_cfg_t));
+ ctl_enc_config = mixer_get_ctl_by_name(a2dp.adev->mixer,
+ MIXER_ENC_CONFIG_BLOCK);
+ if (!ctl_enc_config) {
+ ALOGE(" ERROR a2dp encoder format mixer control not identifed");
+ } else {
+ ret = mixer_ctl_set_array(ctl_enc_config, (void *)&dummy_reset_config,
+ sizeof(struct sbc_enc_cfg_t));
+ a2dp.bt_encoder_format = ENC_MEDIA_FMT_NONE;
+ }
+ ctrl_bit_format = mixer_get_ctl_by_name(a2dp.adev->mixer,
+ MIXER_ENC_BIT_FORMAT);
+ if (!ctrl_bit_format) {
+ ALOGE(" ERROR bit format CONFIG data mixer control not identifed");
+ } else {
+ ret = mixer_ctl_set_enum_by_string(ctrl_bit_format, "S16_LE");
+ if (ret != 0) {
+ ALOGE("%s: Failed to set bit format to encoder", __func__);
+ }
+ }
+}
+
int audio_extn_a2dp_stop_playback()
{
int ret =0;
@@ -659,35 +688,13 @@
a2dp.a2dp_total_active_session_request--;
if ( a2dp.a2dp_started && !a2dp.a2dp_total_active_session_request) {
- struct mixer_ctl *ctl_enc_config, *ctrl_bit_format;
- struct sbc_enc_cfg_t dummy_reset_config;
-
ALOGV("calling BT module stream stop");
ret = a2dp.audio_stop_stream();
if (ret < 0)
ALOGE("stop stream to BT IPC lib failed");
else
ALOGV("stop steam to BT IPC lib successful");
- memset(&dummy_reset_config, 0x0, sizeof(struct sbc_enc_cfg_t));
- ctl_enc_config = mixer_get_ctl_by_name(a2dp.adev->mixer,
- MIXER_ENC_CONFIG_BLOCK);
- if (!ctl_enc_config) {
- ALOGE(" ERROR a2dp encoder format mixer control not identifed");
- } else {
- ret = mixer_ctl_set_array(ctl_enc_config, (void *)&dummy_reset_config,
- sizeof(struct sbc_enc_cfg_t));
- a2dp.bt_encoder_format = ENC_MEDIA_FMT_NONE;
- }
- ctrl_bit_format = mixer_get_ctl_by_name(a2dp.adev->mixer,
- MIXER_ENC_BIT_FORMAT);
- if (!ctrl_bit_format) {
- ALOGE(" ERROR bit format CONFIG data mixer control not identifed");
- } else {
- ret = mixer_ctl_set_enum_by_string(ctrl_bit_format, "S16_LE");
- if (ret != 0) {
- ALOGE("%s: Failed to set bit format to encoder", __func__);
- }
- }
+ reset_a2dp_enc_config_params();
}
if(!a2dp.a2dp_total_active_session_request)
a2dp.a2dp_started = false;
@@ -724,6 +731,7 @@
val = atoi(value);
if (val & AUDIO_DEVICE_OUT_ALL_A2DP) {
ALOGV("Received device dis- connect request");
+ reset_a2dp_enc_config_params();
close_a2dp_output();
}
goto param_handled;
@@ -735,6 +743,7 @@
if ((!strncmp(value,"true",sizeof(value)))) {
ALOGD("Setting a2dp to suspend state");
a2dp.a2dp_suspended = true;
+ reset_a2dp_enc_config_params();
if(a2dp.audio_suspend_stream)
a2dp.audio_suspend_stream();
} else if (a2dp.a2dp_suspended == true) {
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index 65f516c..0f38b82 100644
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -129,7 +129,7 @@
int i = 0;
FILE *ext_disp_fd = NULL;
- for(i = 0; i < 3; i++) {
+ while (1) {
snprintf(fbpath, sizeof(fbpath),
"/sys/class/graphics/fb%d/msm_fb_type", i);
ext_disp_fd = fopen(fbpath, "r");
@@ -146,8 +146,10 @@
}
}
fclose(ext_disp_fd);
+ i++;
} else {
- ALOGE("%s: Failed to open fb node %d", __func__, i);
+ ALOGE("%s: Scanned till end of fbs or Failed to open fb node %d", __func__, i);
+ break;
}
}
@@ -183,7 +185,7 @@
return ret;
}
-static void check_and_set_ext_disp_connection_status(const struct audio_device *adev,
+static void audio_extn_ext_disp_set_parameters(const struct audio_device *adev,
struct str_parms *parms)
{
char value[32] = {0};
@@ -202,13 +204,14 @@
&& (atoi(value) & AUDIO_DEVICE_OUT_AUX_DIGITAL)){
//params = "disconnect=1024" for external display disconnection.
update_ext_disp_sysfs_node(adev, 0);
+ ALOGV("invalidate cached edid");
+ platform_invalidate_hdmi_config(adev->platform);
} else {
// handle ext disp devices only
return;
}
}
-
#ifndef FM_POWER_OPT
#define audio_extn_fm_set_parameters(adev, parms) (0)
#else
@@ -770,7 +773,7 @@
audio_extn_source_track_set_parameters(adev, parms);
audio_extn_fbsp_set_parameters(parms);
audio_extn_keep_alive_set_parameters(adev, parms);
- check_and_set_ext_disp_connection_status(adev, parms);
+ audio_extn_ext_disp_set_parameters(adev, parms);
if (adev->offload_effects_set_parameters != NULL)
adev->offload_effects_set_parameters(parms);
}
@@ -1142,3 +1145,52 @@
}
}
#endif /* KPI_OPTIMIZE_ENABLED */
+
+static int audio_extn_set_multichannel_mask(struct audio_device *adev,
+ struct stream_in *in,
+ struct audio_config *config,
+ bool *channel_mask_updated)
+{
+ int ret = -EINVAL;
+ int channel_count = audio_channel_count_from_in_mask(in->channel_mask);
+ *channel_mask_updated = false;
+
+ int max_mic_count = platform_get_max_mic_count(adev->platform);
+ /* validate input params*/
+ if ((channel_count == 6) &&
+ (in->format == AUDIO_FORMAT_PCM_16_BIT)) {
+
+ switch (max_mic_count) {
+ case 4:
+ config->channel_mask = AUDIO_CHANNEL_INDEX_MASK_4;
+ break;
+ case 3:
+ config->channel_mask = AUDIO_CHANNEL_INDEX_MASK_3;
+ break;
+ case 2:
+ config->channel_mask = AUDIO_CHANNEL_IN_STEREO;
+ break;
+ default:
+ config->channel_mask = AUDIO_CHANNEL_IN_STEREO;
+ break;
+ }
+ ret = 0;
+ *channel_mask_updated = true;
+ }
+ return ret;
+}
+
+int audio_extn_check_and_set_multichannel_usecase(struct audio_device *adev,
+ struct stream_in *in,
+ struct audio_config *config,
+ bool *update_params)
+{
+ bool ssr_supported = false;
+ ssr_supported = audio_extn_ssr_check_usecase(in);
+ if (ssr_supported) {
+ return audio_extn_ssr_set_usecase(in, config, update_params);
+ } else {
+ return audio_extn_set_multichannel_mask(adev, in, config,
+ update_params);
+ }
+}
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index cd9763e..07714f6 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -194,17 +194,21 @@
#endif
#ifndef SSR_ENABLED
-#define audio_extn_ssr_check_and_set_usecase(in) (-1)
-#define audio_extn_ssr_init(in, num_out_chan) (0)
-#define audio_extn_ssr_deinit() (0)
-#define audio_extn_ssr_update_enabled() (0)
-#define audio_extn_ssr_get_enabled() (0)
-#define audio_extn_ssr_read(stream, buffer, bytes) (0)
-#define audio_extn_ssr_set_parameters(adev, parms) (0)
-#define audio_extn_ssr_get_parameters(adev, parms, reply) (0)
-#define audio_extn_ssr_get_stream() (0)
+#define audio_extn_ssr_check_usecase(in) (0)
+#define audio_extn_ssr_set_usecase(in, config, channel_mask_updated) (0)
+#define audio_extn_ssr_init(in, num_out_chan) (0)
+#define audio_extn_ssr_deinit() (0)
+#define audio_extn_ssr_update_enabled() (0)
+#define audio_extn_ssr_get_enabled() (0)
+#define audio_extn_ssr_read(stream, buffer, bytes) (0)
+#define audio_extn_ssr_set_parameters(adev, parms) (0)
+#define audio_extn_ssr_get_parameters(adev, parms, reply) (0)
+#define audio_extn_ssr_get_stream() (0)
#else
-int audio_extn_ssr_check_and_set_usecase(struct stream_in *in);
+bool audio_extn_ssr_check_usecase(struct stream_in *in);
+int audio_extn_ssr_set_usecase(struct stream_in *in,
+ struct audio_config *config,
+ bool *channel_mask_updated);
int32_t audio_extn_ssr_init(struct stream_in *in,
int num_out_chan);
int32_t audio_extn_ssr_deinit();
@@ -219,6 +223,10 @@
struct str_parms *reply);
struct stream_in *audio_extn_ssr_get_stream();
#endif
+int audio_extn_check_and_set_multichannel_usecase(struct audio_device *adev,
+ struct stream_in *in,
+ struct audio_config *config,
+ bool *update_params);
#ifndef HW_VARIANTS_ENABLED
#define hw_info_init(snd_card_name) (0)
diff --git a/hal/audio_extn/dolby.c b/hal/audio_extn/dolby.c
index f07c66a..b958bf6 100644
--- a/hal/audio_extn/dolby.c
+++ b/hal/audio_extn/dolby.c
@@ -484,9 +484,7 @@
};
int audio_extn_dap_hal_init(int snd_card) {
- char c_dmid[128] = {0};
- void *handle = NULL;
- int i_dmid, ret = -EINVAL;
+ int ret = -EINVAL;
dap_hal_device_be_id_map_t device_be_id_map;
ALOGV("%s: opening DAP HAL lib\n", __func__);
@@ -532,9 +530,7 @@
void audio_extn_dolby_ds2_set_endpoint(struct audio_device *adev) {
struct listnode *node;
struct audio_usecase *usecase;
- struct mixer_ctl *ctl;
- const char *mixer_ctl_name = "DS1 DAP Endpoint";
- int endpoint = 0, ret;
+ int endpoint = 0;
bool send = false;
list_for_each(node, &adev->usecase_list) {
@@ -587,7 +583,7 @@
return 0;
}
-int audio_extn_dolby_set_dap_bypass(struct audio_device *adev, int state) {
+int audio_extn_dolby_set_dap_bypass(struct audio_device *adev __unused, int state) {
ALOGV("%s: state %d", __func__, state);
if (ds2extnmod.dap_hal_set_hw_info) {
@@ -599,12 +595,12 @@
return 0;
}
-void audio_extn_dolby_set_license(struct audio_device *adev)
+void audio_extn_dolby_set_license(struct audio_device *adev __unused)
{
int i_key=0;
char c_key[128] = {0};
char c_dmid[128] = {0};
- int i_dmid, ret = -EINVAL;
+ int i_dmid;
struct dolby_param_license dolby_license;
#ifdef DOLBY_ACDB_LICENSE
@@ -631,7 +627,7 @@
void audio_extn_ds2_set_parameters(struct audio_device *adev,
struct str_parms *parms)
{
- int val, ret;
+ int ret;
char value[32]={0};
ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_SND_CARD_STATUS, value,
diff --git a/hal/audio_extn/ssr.c b/hal/audio_extn/ssr.c
index f55f3ce..51a6a26 100644
--- a/hal/audio_extn/ssr.c
+++ b/hal/audio_extn/ssr.c
@@ -331,33 +331,55 @@
return false;
}
-int audio_extn_ssr_check_and_set_usecase(struct stream_in *in)
-{
- int ret = -1;
+bool audio_extn_ssr_check_usecase(struct stream_in *in) {
+ int ret = false;
int channel_count = audio_channel_count_from_in_mask(in->channel_mask);
audio_devices_t devices = in->device;
audio_source_t source = in->source;
- /* validate input params
- * only stereo and 5:1 channel config is supported
- * only AUDIO_DEVICE_IN_BUILTIN_MIC, AUDIO_DEVICE_IN_BACK_MIC supports 3 mics */
- if (audio_extn_ssr_get_enabled() &&
- ((channel_count == 2) || (channel_count == 6)) &&
- ((AUDIO_SOURCE_MIC == source) || (AUDIO_SOURCE_CAMCORDER == source)) &&
- ((AUDIO_DEVICE_IN_BUILTIN_MIC == devices) || (AUDIO_DEVICE_IN_BACK_MIC == devices)) &&
- (in->format == AUDIO_FORMAT_PCM_16_BIT)) {
-
- ALOGD("%s: Found SSR use case starting SSR lib with channel_count :%d",
+ if ((audio_extn_ssr_get_enabled()) &&
+ ((channel_count == 2) || (channel_count == 6)) &&
+ ((AUDIO_SOURCE_MIC == source) || (AUDIO_SOURCE_CAMCORDER == source)) &&
+ ((AUDIO_DEVICE_IN_BUILTIN_MIC == devices) || (AUDIO_DEVICE_IN_BACK_MIC == devices)) &&
+ (in->format == AUDIO_FORMAT_PCM_16_BIT)) {
+ ALOGD("%s: SSR enabled with channel_count :%d",
__func__, channel_count);
+ ret = true;
+ }
+ return ret;
+}
- if (!audio_extn_ssr_init(in, channel_count)) {
- ALOGD("%s: Created SSR session succesfully", __func__);
+int audio_extn_ssr_set_usecase(struct stream_in *in,
+ struct audio_config *config,
+ bool *update_params)
+{
+ int ret = -EINVAL;
+ int channel_count = audio_channel_count_from_in_mask(in->channel_mask);
+ audio_channel_representation_t representation =
+ audio_channel_mask_get_representation(in->channel_mask);
+ *update_params = false;
+
+ if (audio_extn_ssr_check_usecase(in)) {
+
+ if (representation == AUDIO_CHANNEL_REPRESENTATION_INDEX) {
+ /* update params in case channel representation index.
+ * on returning error, flinger will retry with supported representation passed
+ */
+ ALOGD("%s: SSR supports only channel representation position, channel_mask(%#x)"
+ ,__func__, config->channel_mask);
+ config->channel_mask = AUDIO_CHANNEL_IN_5POINT1;
ret = 0;
+ *update_params = true;
} else {
- ALOGE("%s: Unable to start SSR record session", __func__);
+ if (!audio_extn_ssr_init(in, channel_count)) {
+ ALOGD("%s: Created SSR session succesfully", __func__);
+ ret = 0;
+ } else {
+ ALOGE("%s: Unable to start SSR record session", __func__);
+ }
}
- }
- return ret;
+ }
+ return ret;
}
static void pcm_buffer_queue_push(struct pcm_buffer_queue **queue,
diff --git a/hal/audio_extn/usb.c b/hal/audio_extn/usb.c
index b3bd58f..f936f99 100644
--- a/hal/audio_extn/usb.c
+++ b/hal/audio_extn/usb.c
@@ -47,7 +47,7 @@
#define SAMPLE_RATE_11025 11025
// Supported sample rates for USB
static uint32_t supported_sample_rates[] =
- {44100, 48000, 64000, 88200, 96000, 176400, 192000};
+ {44100, 48000, 64000, 88200, 96000, 176400, 192000, 384000};
#define MAX_SAMPLE_RATE_SIZE sizeof(supported_sample_rates)/sizeof(supported_sample_rates[0])
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index 18c55cf..9542fbd 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -495,7 +495,7 @@
struct stream_format *sf_info;
char value[PROPERTY_VALUE_MAX] = {0};
- if ((24 == bit_width) &&
+ if ((bit_width >= 24) &&
(devices & AUDIO_DEVICE_OUT_SPEAKER)) {
int32_t bw = platform_get_snd_device_bit_width(SND_DEVICE_OUT_SPEAKER);
if (-ENOSYS != bw)
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 673c17e..e82cd51 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -383,13 +383,6 @@
{
struct audio_device *adev = out->dev;
- if (out->routing_change) {
- out->routing_change = false;
- // must be checked for backward compatibility
- if (adev->adm_on_routing_change)
- adev->adm_on_routing_change(adev->adm_data, out->handle);
- }
-
if (adev->adm_request_focus_v2)
adev->adm_request_focus_v2(adev->adm_data, out->handle, ns);
else if (adev->adm_request_focus)
@@ -400,12 +393,6 @@
{
struct audio_device *adev = in->dev;
- if (in->routing_change) {
- in->routing_change = false;
- if (adev->adm_on_routing_change)
- adev->adm_on_routing_change(adev->adm_data, in->capture_handle);
- }
-
if (adev->adm_request_focus_v2)
adev->adm_request_focus_v2(adev->adm_data, in->capture_handle, ns);
else if (adev->adm_request_focus)
@@ -622,29 +609,75 @@
return 0;
}
-/*
- * Enable ASRC mode if native or DSD stream is active.
- */
-static void audio_check_and_set_asrc_mode(struct audio_device *adev, snd_device_t snd_device)
+static void enable_asrc_mode(struct audio_device *adev)
{
- if (SND_DEVICE_OUT_HEADPHONES == snd_device &&
- !adev->asrc_mode_enabled) {
+ ALOGV("%s", __func__);
+ audio_route_apply_and_update_path(adev->audio_route,
+ "asrc-mode");
+ adev->asrc_mode_enabled = true;
+}
+
+static void disable_asrc_mode(struct audio_device *adev)
+{
+ ALOGV("%s", __func__);
+ audio_route_reset_and_update_path(adev->audio_route,
+ "asrc-mode");
+ adev->asrc_mode_enabled = false;
+}
+
+/*
+ * - Enable ASRC mode for incoming mix path use case(Headphone backend)if Headphone
+ * 44.1 or Native DSD backends are enabled for any of current use case.
+ * e.g. 48-> + (Naitve DSD or Headphone 44.1)
+ * - Disable current mix path use case(Headphone backend) and re-enable it with
+ * ASRC mode for incoming Headphone 44.1 or Native DSD use case.
+ * e.g. Naitve DSD or Headphone 44.1 -> + 48
+ */
+static void check_and_set_asrc_mode(struct audio_device *adev, snd_device_t snd_device)
+{
+ ALOGV("%s snd device %d", __func__, snd_device);
+ int new_backend_idx = platform_get_backend_index(snd_device);
+
+ if (((new_backend_idx == HEADPHONE_BACKEND) ||
+ (new_backend_idx == HEADPHONE_44_1_BACKEND) ||
+ (new_backend_idx == DSD_NATIVE_BACKEND)) &&
+ !adev->asrc_mode_enabled) {
struct listnode *node = NULL;
struct audio_usecase *uc = NULL;
struct stream_out *curr_out = NULL;
+ int usecase_backend_idx = DEFAULT_CODEC_BACKEND;
list_for_each(node, &adev->usecase_list) {
uc = node_to_item(node, struct audio_usecase, list);
curr_out = (struct stream_out*) uc->stream.out;
-
if (curr_out && PCM_PLAYBACK == uc->type) {
- if((platform_get_backend_index(uc->out_snd_device) == HEADPHONE_44_1_BACKEND) ||
- (platform_get_backend_index(uc->out_snd_device) == DSD_NATIVE_BACKEND)) {
+ usecase_backend_idx = platform_get_backend_index(uc->out_snd_device);
+
+ if((new_backend_idx == HEADPHONE_BACKEND) &&
+ ((usecase_backend_idx == HEADPHONE_44_1_BACKEND) ||
+ (usecase_backend_idx == DSD_NATIVE_BACKEND))) {
ALOGD("%s:DSD or native stream detected enabling asrcmode in hardware",
__func__);
- audio_route_apply_and_update_path(adev->audio_route,
- "asrc-mode");
- adev->asrc_mode_enabled = true;
+ enable_asrc_mode(adev);
+ break;
+ } else if(((new_backend_idx == HEADPHONE_44_1_BACKEND) ||
+ (new_backend_idx == DSD_NATIVE_BACKEND)) &&
+ (usecase_backend_idx == HEADPHONE_BACKEND)) {
+ ALOGD("%s:48K stream detected, disabling and enabling it with asrcmode in hardware",
+ __func__);
+ disable_audio_route(adev, uc);
+ disable_snd_device(adev, uc->out_snd_device);
+ // Apply true-high-quality-mode if DSD or > 44.1KHz or >=24-bit
+ if (new_backend_idx == DSD_NATIVE_BACKEND)
+ audio_route_apply_and_update_path(adev->audio_route,
+ "hph-true-highquality-mode");
+ else if ((new_backend_idx == HEADPHONE_44_1_BACKEND) &&
+ (curr_out->bit_width >= 24))
+ audio_route_apply_and_update_path(adev->audio_route,
+ "hph-highquality-mode");
+ enable_asrc_mode(adev);
+ enable_snd_device(adev, uc->out_snd_device);
+ enable_audio_route(adev, uc);
break;
}
}
@@ -802,8 +835,7 @@
audio_route_apply_and_update_path(adev->audio_route,
"true-native-mode");
adev->native_playback_enabled = true;
- } else
- audio_check_and_set_asrc_mode(adev, snd_device);
+ }
}
return 0;
}
@@ -862,8 +894,8 @@
} else if (SND_DEVICE_OUT_HEADPHONES == snd_device &&
adev->asrc_mode_enabled) {
ALOGD("%s: %d: disabling asrc mode in hardware", __func__, __LINE__);
- audio_route_reset_and_update_path(adev->audio_route, "asrc-mode");
- adev->asrc_mode_enabled = false;
+ disable_asrc_mode(adev);
+ audio_route_apply_and_update_path(adev->audio_route, "hph-lowpower-mode");
}
audio_extn_dev_arbi_release(snd_device);
@@ -936,9 +968,8 @@
(usecase->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) ||
(usecase->devices & AUDIO_DEVICE_OUT_USB_DEVICE) ||
(force_restart_session)) &&
- (platform_check_backends_match(snd_device, usecase->out_snd_device)||
- (platform_check_codec_asrc_support(adev->platform) && !adev->asrc_mode_enabled &&
- platform_check_if_backend_has_to_be_disabled(snd_device,usecase->out_snd_device)))) {
+ (platform_check_backends_match(snd_device, usecase->out_snd_device))) {
+
ALOGD("%s:becf: check_usecases (%s) is active on (%s) - disabling ..",
__func__, use_case_table[usecase->id],
platform_get_snd_device_name(usecase->out_snd_device));
@@ -1087,10 +1118,9 @@
reset_hdmi_sink_caps(out);
/* Cache ext disp type */
- ret = platform_get_ext_disp_type(adev->platform);
- if (ret < 0) {
+ if (platform_get_ext_disp_type(adev->platform) <= 0) {
ALOGE("%s: Failed to query disp type, ret:%d", __func__, ret);
- return ret;
+ return -EINVAL;
}
switch (channels) {
@@ -1422,6 +1452,8 @@
/* Enable new sound devices */
if (out_snd_device != SND_DEVICE_NONE) {
check_usecases_codec_backend(adev, usecase, out_snd_device);
+ if (platform_check_codec_asrc_support(adev->platform))
+ check_and_set_asrc_mode(adev, out_snd_device);
enable_snd_device(adev, out_snd_device);
}
@@ -2183,6 +2215,35 @@
return size;
}
+static size_t get_output_period_size(uint32_t sample_rate,
+ audio_format_t format,
+ int channel_count,
+ int duration /*in millisecs*/)
+{
+ size_t size = 0;
+ uint32_t bytes_per_sample = audio_bytes_per_sample(format);
+
+ if ((duration == 0) || (sample_rate == 0) ||
+ (bytes_per_sample == 0) || (channel_count == 0)) {
+ ALOGW("Invalid config duration %d sr %d bps %d ch %d", duration, sample_rate,
+ bytes_per_sample, channel_count);
+ return -EINVAL;
+ }
+
+ size = (sample_rate *
+ duration *
+ bytes_per_sample *
+ channel_count) / 1000;
+ /*
+ * To have same PCM samples for all channels, the buffer size requires to
+ * be multiple of (number of channels * bytes per sample)
+ * For writes to succeed, the buffer must be written at address which is multiple of 32
+ */
+ size = ALIGN(size, (bytes_per_sample * channel_count * 32));
+
+ return (size/(channel_count * bytes_per_sample));
+}
+
static uint64_t get_actual_pcm_frames_rendered(struct stream_out *out)
{
uint64_t actual_frames_rendered = 0;
@@ -2391,7 +2452,15 @@
(val == AUDIO_DEVICE_NONE)) {
val = AUDIO_DEVICE_OUT_SPEAKER;
}
-
+ /* To avoid a2dp to sco overlapping force route BT usecases
+ * to speaker based on Phone state
+ */
+ if ((val & AUDIO_DEVICE_OUT_BLUETOOTH_A2DP) &&
+ ((adev->mode == AUDIO_MODE_RINGTONE) ||
+ (adev->mode == AUDIO_MODE_IN_CALL))) {
+ ALOGD("Forcing a2dp routing to speaker for ring/call mode");
+ val = AUDIO_DEVICE_OUT_SPEAKER;
+ }
/*
* select_devices() call below switches all the usecases on the same
* backend to the new device. Refer to check_usecases_codec_backend() in
@@ -2430,10 +2499,12 @@
if (!out->standby) {
if (!same_dev) {
ALOGV("update routing change");
- out->routing_change = true;
audio_extn_perf_lock_acquire(&adev->perf_lock_handle, 0,
adev->perf_lock_opts,
adev->perf_lock_opts_size);
+ if (adev->adm_on_routing_change)
+ adev->adm_on_routing_change(adev->adm_data,
+ out->handle);
}
select_devices(adev, out->usecase);
if (!same_dev)
@@ -3291,7 +3362,9 @@
/* If recording is in progress, change the tx device to new device */
if (!in->standby && !in->is_st_session) {
ALOGV("update input routing change");
- in->routing_change = true;
+ if (adev->adm_on_routing_change)
+ adev->adm_on_routing_change(adev->adm_data,
+ in->capture_handle);
ret = select_devices(adev, in->usecase);
}
}
@@ -3853,6 +3926,17 @@
out->config = pcm_config_afe_proxy_playback;
adev->voice_tx_output = out;
} else {
+ unsigned int channels = 0;
+ /*Update config params to default if not set by the caller*/
+ if (config->sample_rate == 0)
+ config->sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
+ if (config->channel_mask == AUDIO_CHANNEL_NONE)
+ config->channel_mask = AUDIO_CHANNEL_OUT_STEREO;
+ if (config->format == AUDIO_FORMAT_DEFAULT)
+ config->format = AUDIO_FORMAT_PCM_16_BIT;
+
+ channels = audio_channel_count_from_out_mask(out->channel_mask);
+
if (out->flags & AUDIO_OUTPUT_FLAG_RAW) {
out->usecase = USECASE_AUDIO_PLAYBACK_ULL;
out->realtime = may_use_noirq_mode(adev, USECASE_AUDIO_PLAYBACK_ULL,
@@ -3864,6 +3948,13 @@
} else if (out->flags & AUDIO_OUTPUT_FLAG_DEEP_BUFFER) {
out->usecase = USECASE_AUDIO_PLAYBACK_DEEP_BUFFER;
out->config = pcm_config_deep_buffer;
+ out->config.period_size = get_output_period_size(config->sample_rate, out->format,
+ channels, DEEP_BUFFER_OUTPUT_PERIOD_DURATION);
+ if (out->config.period_size <= 0) {
+ ALOGE("Invalid configuration period size is not valid");
+ ret = -EINVAL;
+ goto error_open;
+ }
} else {
/* primary path is the default path selected if no other outputs are available/suitable */
out->usecase = USECASE_AUDIO_PLAYBACK_PRIMARY;
@@ -3875,7 +3966,7 @@
out->bit_width = format_to_bitwidth_table[out->hal_op_format] << 3;
out->config.rate = config->sample_rate;
out->sample_rate = out->config.rate;
- out->config.channels = audio_channel_count_from_out_mask(out->channel_mask);
+ out->config.channels = channels;
if (out->hal_ip_format != out->hal_op_format) {
uint32_t buffer_size = out->config.period_size *
format_to_bitwidth_table[out->hal_op_format] *
@@ -4143,7 +4234,8 @@
ret = platform_get_ext_disp_type(adev->platform);
if (ret < 0) {
ALOGE("%s: Failed to query disp type, ret:%d", __func__, ret);
- return ret;
+ status = ret;
+ goto done;
}
platform_cache_edid(adev->platform);
} else if ((val & AUDIO_DEVICE_OUT_USB_DEVICE) ||
@@ -4167,10 +4259,13 @@
ret = str_parms_get_str(parms, AUDIO_PARAMETER_DEVICE_DISCONNECT, value, sizeof(value));
if (ret >= 0) {
val = atoi(value);
- if (val & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
- ALOGV("invalidate cached edid");
- platform_invalidate_hdmi_config(adev->platform);
- } else if ((val & AUDIO_DEVICE_OUT_USB_DEVICE) ||
+ /*
+ * The HDMI / Displayport disconnect handling has been moved to
+ * audio extension to ensure that its parameters are not
+ * invalidated prior to updating sysfs of the disconnect event
+ * Invalidate will be handled by audio_extn_ext_disp_set_parameters()
+ */
+ if ((val & AUDIO_DEVICE_OUT_USB_DEVICE) ||
!(val ^ AUDIO_DEVICE_IN_USB_DEVICE)) {
ret = str_parms_get_str(parms, "card", value, sizeof(value));
if (ret >= 0) {
@@ -4356,6 +4451,7 @@
int ret = 0, buffer_size, frame_size;
int channel_count = audio_channel_count_from_in_mask(config->channel_mask);
bool is_low_latency = false;
+ bool channel_mask_updated = false;
*stream_in = NULL;
if (check_input_parameters(config->sample_rate, config->format, channel_count) != 0) {
@@ -4450,7 +4546,14 @@
in->config.channels = channel_count;
in->config.rate = config->sample_rate;
in->sample_rate = config->sample_rate;
- } else if (!audio_extn_ssr_check_and_set_usecase(in)) {
+ } else if (!audio_extn_check_and_set_multichannel_usecase(adev,
+ in, config, &channel_mask_updated)) {
+ if (channel_mask_updated == true) {
+ ALOGD("%s: return error to retry with updated channel mask (%#x)",
+ __func__, config->channel_mask);
+ ret = -EINVAL;
+ goto err_open;
+ }
ALOGD("%s: created surround sound session succesfully",__func__);
} else if (audio_extn_compr_cap_enabled() &&
audio_extn_compr_cap_format_supported(config->format) &&
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 0633eb0..83ad54d 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -238,8 +238,6 @@
bool realtime;
int af_period_multiplier;
- bool routing_change;
-
struct audio_device *dev;
void* qaf_stream_handle;
pthread_cond_t qaf_offload_cond;
@@ -270,8 +268,6 @@
int bit_width;
bool realtime;
int af_period_multiplier;
- bool routing_change;
-
struct audio_device *dev;
};
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 47943da..0a14629 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -780,8 +780,8 @@
static int msm_device_to_be_id_external_codec [][NO_COLS] = {
{AUDIO_DEVICE_OUT_EARPIECE , 2},
{AUDIO_DEVICE_OUT_SPEAKER , 2},
- {AUDIO_DEVICE_OUT_WIRED_HEADSET , 2},
- {AUDIO_DEVICE_OUT_WIRED_HEADPHONE , 2},
+ {AUDIO_DEVICE_OUT_WIRED_HEADSET , 41},
+ {AUDIO_DEVICE_OUT_WIRED_HEADPHONE , 41},
{AUDIO_DEVICE_OUT_BLUETOOTH_SCO , 11},
{AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET , 11},
{AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT , 11},
@@ -2924,6 +2924,7 @@
*num_devices = 2;
new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;
new_snd_devices[1] = SND_DEVICE_OUT_BT_A2DP;
+ status = true;
}
ALOGD("%s: snd_device(%d) num devices(%d) new_snd_devices(%d)", __func__,
@@ -4304,7 +4305,7 @@
else
mixer_ctl_set_enum_by_string(ctl, "S24_LE");
} else if (bit_width == 32) {
- mixer_ctl_set_enum_by_string(ctl, "S24_LE");
+ mixer_ctl_set_enum_by_string(ctl, "S32_LE");
} else {
mixer_ctl_set_enum_by_string(ctl, "S16_LE");
}
@@ -4640,6 +4641,13 @@
} else if ((usecase->devices & AUDIO_DEVICE_OUT_SPEAKER) ||
(usecase->devices & AUDIO_DEVICE_OUT_EARPIECE) ) {
sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
+
+ if (bit_width >= 24) {
+ bit_width = platform_get_snd_device_bit_width(SND_DEVICE_OUT_SPEAKER);
+ ALOGD("%s:becf: afe: reset bitwidth to %d (based on supported"
+ " value for this platform)", __func__, bit_width);
+ }
+
ALOGD("%s:becf: afe: playback on codec device not supporting native playback set "
"default Sample Rate(48k)", __func__);
}
@@ -4660,6 +4668,13 @@
hdmi_backend_cfg.channels = channels;
hdmi_backend_cfg.passthrough_enabled = false;
+ /*HDMI does not support 384Khz/32bit playback hence configure BE to 24b/192Khz*/
+ /* TODO: Instead have the validation against edid return the next best match*/
+ if (bit_width > 24)
+ hdmi_backend_cfg.bit_width = 24;
+ if (sample_rate > 192000)
+ hdmi_backend_cfg.sample_rate = 192000;
+
platform_check_hdmi_backend_cfg(adev, usecase, backend_idx, &hdmi_backend_cfg);
bit_width = hdmi_backend_cfg.bit_width;
@@ -5618,12 +5633,6 @@
return false;
}
-bool platform_check_if_backend_has_to_be_disabled(snd_device_t new_snd_device __unused,
- snd_device_t cuurent_snd_device __unused)
-{
- return false;
-}
-
int platform_send_audio_cal(void* platform __unused,
int acdb_dev_id __unused, int acdb_device_type __unused,
int app_type __unused, int topology_id __unused,
@@ -5663,3 +5672,8 @@
{
return -ENOSYS;
}
+
+int platform_get_max_mic_count(void *platform) {
+ struct platform_data *my_data = (struct platform_data *)platform;
+ return my_data->max_mic_count;
+}
diff --git a/hal/msm8916/platform.h b/hal/msm8916/platform.h
index 33be141..cba9068 100644
--- a/hal/msm8916/platform.h
+++ b/hal/msm8916/platform.h
@@ -267,6 +267,7 @@
* the buffer size of an input/output stream
*/
#define DEEP_BUFFER_OUTPUT_PERIOD_SIZE 1920
+#define DEEP_BUFFER_OUTPUT_PERIOD_DURATION 40 /* 40 millisecs */
#define DEEP_BUFFER_OUTPUT_PERIOD_COUNT 2
#define LOW_LATENCY_OUTPUT_PERIOD_SIZE 240
#define LOW_LATENCY_OUTPUT_PERIOD_COUNT 2
diff --git a/hal/msm8960/platform.c b/hal/msm8960/platform.c
index b687d96..b5a4f11 100644
--- a/hal/msm8960/platform.c
+++ b/hal/msm8960/platform.c
@@ -1330,8 +1330,3 @@
return false;
}
-bool platform_check_if_backend_has_to_be_disabled(snd_device_t new_snd_device __unused,
- snd_device_t cuurent_snd_device __unused)
-{
- return false;
-}
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 6930286..f506130 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -795,8 +795,8 @@
static int msm_device_to_be_id [][NO_COLS] = {
{AUDIO_DEVICE_OUT_EARPIECE , 2},
{AUDIO_DEVICE_OUT_SPEAKER , 2},
- {AUDIO_DEVICE_OUT_WIRED_HEADSET , 2},
- {AUDIO_DEVICE_OUT_WIRED_HEADPHONE , 2},
+ {AUDIO_DEVICE_OUT_WIRED_HEADSET , 41},
+ {AUDIO_DEVICE_OUT_WIRED_HEADPHONE , 41},
{AUDIO_DEVICE_OUT_BLUETOOTH_SCO , 11},
{AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET , 11},
{AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT , 11},
@@ -1987,32 +1987,6 @@
return result;
}
-bool platform_check_if_backend_has_to_be_disabled(snd_device_t new_snd_device,
- snd_device_t cuurent_snd_device)
-{
- bool result = false;
-
- ALOGV("%s: current snd device = %s, new snd device = %s", __func__,
- platform_get_snd_device_name(cuurent_snd_device),
- platform_get_snd_device_name(new_snd_device));
-
- if ((new_snd_device < SND_DEVICE_MIN) || (new_snd_device >= SND_DEVICE_OUT_END) ||
- (cuurent_snd_device < SND_DEVICE_MIN) || (cuurent_snd_device >= SND_DEVICE_OUT_END)) {
- ALOGE("%s: Invalid snd_device",__func__);
- return false;
- }
-
- if (cuurent_snd_device == SND_DEVICE_OUT_HEADPHONES &&
- (new_snd_device == SND_DEVICE_OUT_HEADPHONES_44_1 ||
- new_snd_device == SND_DEVICE_OUT_HEADPHONES_DSD)) {
- result = true;
- }
-
- ALOGV("%s: Need to disable current backend %s, %d",
- __func__, platform_get_snd_device_name(cuurent_snd_device), result);
- return result;
-}
-
int platform_get_pcm_device_id(audio_usecase_t usecase, int device_type)
{
int device_id;
@@ -2191,7 +2165,7 @@
{
if ((snd_device < SND_DEVICE_MIN) || (snd_device >= SND_DEVICE_MAX)) {
ALOGE("%s: Invalid snd_device = %d", __func__, snd_device);
- return DEFAULT_OUTPUT_SAMPLING_RATE;
+ return CODEC_BACKEND_DEFAULT_BIT_WIDTH;
}
return backend_bit_width_table[snd_device];
}
@@ -2768,9 +2742,9 @@
*num_devices = 2;
new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;
new_snd_devices[1] = SND_DEVICE_OUT_BT_A2DP;
+ status = true;
}
-
ALOGD("%s: snd_device(%d) num devices(%d) new_snd_devices(%d)", __func__,
snd_device, *num_devices, *new_snd_devices);
@@ -4389,7 +4363,7 @@
else
ret = mixer_ctl_set_enum_by_string(ctl, "S24_LE");
} else if (bit_width == 32) {
- ret = mixer_ctl_set_enum_by_string(ctl, "S24_LE");
+ ret = mixer_ctl_set_enum_by_string(ctl, "S32_LE");
} else {
ret = mixer_ctl_set_enum_by_string(ctl, "S16_LE");
}
@@ -4723,13 +4697,41 @@
ALOGD("%s:becf: afe: true napb active set rate to 44.1 khz",
__func__);
}
- } else if (OUTPUT_SAMPLING_RATE_44100 == sample_rate) {
- sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
- ALOGD("%s:becf: afe: napb not active - set (48k) default rate",
+ } else if (na_mode != NATIVE_AUDIO_MODE_MULTIPLE_44_1) {
+ /*
+ * Map native sampling rates to upper limit range
+ * if multiple of native sampling rates are not supported.
+ * This check also indicates that this is not tavil codec
+ * And 32bit/384kHz is only supported on tavil
+ * Hence reset 32b/384kHz to 24b/192kHz.
+ */
+ switch (sample_rate) {
+ case 44100:
+ sample_rate = 48000;
+ break;
+ case 88200:
+ sample_rate = 96000;
+ break;
+ case 176400:
+ case 352800:
+ case 384000:
+ sample_rate = 192000;
+ break;
+ }
+ if (bit_width > 24)
+ bit_width = 24;
+
+ ALOGD("%s:becf: afe: napb not active - set non fractional rate",
__func__);
}
} else if ((usecase->devices & AUDIO_DEVICE_OUT_SPEAKER) ||
(usecase->devices & AUDIO_DEVICE_OUT_EARPIECE) ) {
+
+ if (bit_width >= 24) {
+ bit_width = platform_get_snd_device_bit_width(SND_DEVICE_OUT_SPEAKER);
+ ALOGD("%s:becf: afe: reset bitwidth to %d (based on supported"
+ " value for this platform)", __func__, bit_width);
+ }
sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
ALOGD("%s:becf: afe: playback on codec device not supporting native playback set "
"default Sample Rate(48k)", __func__);
@@ -4750,6 +4752,15 @@
hdmi_backend_cfg.channels = channels;
hdmi_backend_cfg.passthrough_enabled = false;
+ /*
+ * HDMI does not support 384Khz/32bit playback hence configure BE to 24b/192Khz
+ * TODO: Instead have the validation against edid return the next best match
+ */
+ if (bit_width > 24)
+ hdmi_backend_cfg.bit_width = 24;
+ if (sample_rate > 192000)
+ hdmi_backend_cfg.sample_rate = 192000;
+
platform_check_hdmi_backend_cfg(adev, usecase, backend_idx, &hdmi_backend_cfg);
bit_width = hdmi_backend_cfg.bit_width;
@@ -4761,23 +4772,6 @@
channels_updated = true;
}
- /*
- * Map native sampling rates to upper limit range
- * if multiple of native sampling rates are not supported.
- */
- if (NATIVE_AUDIO_MODE_MULTIPLE_44_1 != na_mode) {
- switch (sample_rate) {
- case 88200:
- sample_rate = 96000;
- break;
- case 176400:
- sample_rate = 192000;
- break;
- case 352800:
- sample_rate = 192000;
- break;
- }
- }
ALOGI("%s:becf: afe: Codec selected backend: %d updated bit width: %d and sample rate: %d",
__func__, backend_idx , bit_width, sample_rate);
@@ -5802,3 +5796,8 @@
ERROR_RETURN:
return ret;
}
+
+int platform_get_max_mic_count(void *platform) {
+ struct platform_data *my_data = (struct platform_data *)platform;
+ return my_data->max_mic_count;
+}
diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h
index 2b65950..c231843 100644
--- a/hal/msm8974/platform.h
+++ b/hal/msm8974/platform.h
@@ -257,7 +257,14 @@
* We should take care of returning proper size when AudioFlinger queries for
* the buffer size of an input/output stream
*/
+
+/* for 384Khz output below period size corresponds to 20ms worth duration of buffer,
+ * current implementation can support buffer size of 40ms duration
+ * for 32b/384Khz/stereo output.
+ */
#define DEEP_BUFFER_OUTPUT_PERIOD_SIZE 1920
+#define DEEP_BUFFER_OUTPUT_PERIOD_DURATION 40 /* 40 milisecs */
+
#define DEEP_BUFFER_OUTPUT_PERIOD_COUNT 2
#define LOW_LATENCY_OUTPUT_PERIOD_SIZE 240
#define LOW_LATENCY_OUTPUT_PERIOD_COUNT 2
diff --git a/hal/platform_api.h b/hal/platform_api.h
index 7dcd1b6..76d99b3 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -163,6 +163,7 @@
bool platform_check_codec_asrc_support(void *platform);
int platform_get_backend_index(snd_device_t snd_device);
int platform_get_ext_disp_type(void *platform);
+void platform_invalidate_hdmi_config(void *platform);
int platform_send_audio_cal(void* platform, int acdb_dev_id, int acdb_device_type,
int app_type, int topology_id, int sample_rate, uint32_t module_id, uint32_t param_id,
@@ -181,4 +182,5 @@
void* data, int* length);
unsigned char* platform_get_license(void* platform, int* size);
+int platform_get_max_mic_count(void *platform);
#endif // AUDIO_PLATFORM_API_H
diff --git a/policy_hal/Android.mk b/policy_hal/Android.mk
index 854eaee..f9913c4 100644
--- a/policy_hal/Android.mk
+++ b/policy_hal/Android.mk
@@ -1,3 +1,16 @@
+# This file was modified by Dolby Laboratories, Inc. The portions of the
+# code that are surrounded by "DOLBY..." are copyrighted and
+# licensed separately, as follows:
+#
+# (C) 2016 Dolby Laboratories, Inc.
+# All rights reserved.
+#
+# This program is protected under international and U.S. Copyright laws as
+# an unpublished work. This program is confidential and proprietary to the
+# copyright owners. Reproduction or disclosure, in whole or in part, or the
+# production of derivative works therefrom without the express permission of
+# the copyright owners is prohibited.
+#
ifneq ($(USE_LEGACY_AUDIO_POLICY), 1)
ifeq ($(USE_CUSTOM_AUDIO_POLICY), 1)
LOCAL_PATH := $(call my-dir)
@@ -64,6 +77,11 @@
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_FM_POWER_OPT)),true)
LOCAL_CFLAGS += -DFM_POWER_OPT
endif
+# DOLBY_START
+ifeq ($(strip $(DOLBY_ENABLE)),true)
+LOCAL_CFLAGS += $(dolby_cflags)
+endif
+# DOLBY_END
ifeq ($(USE_XML_AUDIO_POLICY_CONF), 1)
LOCAL_CFLAGS += -DUSE_XML_AUDIO_POLICY_CONF
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index 022a3c0..8bfea9a 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -435,6 +435,48 @@
return BAD_VALUE;
}
+bool AudioPolicyManagerCustom::isInvalidationOfMusicStreamNeeded(routing_strategy strategy)
+{
+ if (strategy == STRATEGY_MEDIA) {
+ for (size_t i = 0; i < mOutputs.size(); i++) {
+ sp<SwAudioOutputDescriptor> newOutputDesc = mOutputs.valueAt(i);
+ if (newOutputDesc->mFormat == AUDIO_FORMAT_DSD)
+ return false;
+ }
+ }
+ return true;
+}
+
+void AudioPolicyManagerCustom::checkOutputForStrategy(routing_strategy strategy)
+{
+ audio_devices_t oldDevice = getDeviceForStrategy(strategy, true /*fromCache*/);
+ audio_devices_t newDevice = getDeviceForStrategy(strategy, false /*fromCache*/);
+ SortedVector<audio_io_handle_t> srcOutputs = getOutputsForDevice(oldDevice, mOutputs);
+ SortedVector<audio_io_handle_t> dstOutputs = getOutputsForDevice(newDevice, mOutputs);
+
+ // also take into account external policy-related changes: add all outputs which are
+ // associated with policies in the "before" and "after" output vectors
+ ALOGV("checkOutputForStrategy(): policy related outputs");
+ for (size_t i = 0 ; i < mPreviousOutputs.size() ; i++) {
+ const sp<SwAudioOutputDescriptor> desc = mPreviousOutputs.valueAt(i);
+ if (desc != 0 && desc->mPolicyMix != NULL) {
+ srcOutputs.add(desc->mIoHandle);
+ ALOGV(" previous outputs: adding %d", desc->mIoHandle);
+ }
+ }
+ for (size_t i = 0 ; i < mOutputs.size() ; i++) {
+ const sp<SwAudioOutputDescriptor> desc = mOutputs.valueAt(i);
+ if (desc != 0 && desc->mPolicyMix != NULL) {
+ dstOutputs.add(desc->mIoHandle);
+ ALOGV(" new outputs: adding %d", desc->mIoHandle);
+ }
+ }
+
+ if (!vectorsEqual(srcOutputs,dstOutputs) && isInvalidationOfMusicStreamNeeded(strategy)) {
+ AudioPolicyManager::checkOutputForStrategy(strategy);
+ }
+}
+
// This function checks for the parameters which can be offloaded.
// This can be enhanced depending on the capability of the DSP and policy
// of the system.
@@ -2189,40 +2231,6 @@
ALOGD("USE_XML_AUDIO_POLICY_CONF is FALSE");
#endif
- //TODO: Check the new logic to parse policy conf and update the below code
- // Need this when SSR encoding is enabled
- char ssr_enabled[PROPERTY_VALUE_MAX] = {0};
- bool prop_ssr_enabled = false;
-
- if (property_get("ro.qc.sdk.audio.ssr", ssr_enabled, NULL)) {
- prop_ssr_enabled = atoi(ssr_enabled) || !strncmp("true", ssr_enabled, 4);
- }
-
- for (size_t i = 0; i < mHwModules.size(); i++) {
- ALOGV("Hw module %zu", i);
- for (size_t j = 0; j < mHwModules[i]->mInputProfiles.size(); j++) {
- const sp<IOProfile> inProfile = mHwModules[i]->mInputProfiles[j];
- AudioProfileVector profiles = inProfile->getAudioProfiles();
- for (size_t k = 0; k < profiles.size(); k++){
- ChannelsVector channels = profiles[k]->getChannels();
- for (size_t x = 0; x < channels.size(); x++) {
- audio_channel_mask_t channelMask = channels[x];
- ALOGV("Channel Mask %x size %zu", channelMask,
- channels.size());
- if (AUDIO_CHANNEL_IN_5POINT1 == channelMask) {
- if (!prop_ssr_enabled) {
- ALOGI("removing AUDIO_CHANNEL_IN_5POINT1 from"
- " input profile as SSR(surround sound record)"
- " is not supported on this chipset variant");
- channels.removeItemsAt(x, 1);
- ALOGV("Channel Mask size now %zu",
- channels.size());
- }
- }
- }
- }
- }
- }
#ifdef RECORD_PLAY_CONCURRENCY
mIsInputRequestOnProgress = false;
#endif
diff --git a/policy_hal/AudioPolicyManager.h b/policy_hal/AudioPolicyManager.h
index deef57d..00da599 100644
--- a/policy_hal/AudioPolicyManager.h
+++ b/policy_hal/AudioPolicyManager.h
@@ -96,6 +96,14 @@
// see getDeviceForStrategy() for the use of fromCache parameter
audio_devices_t getNewOutputDevice(const sp<AudioOutputDescriptor>& outputDesc,
bool fromCache);
+
+ // avoid invalidation for active music stream on previous outputs
+ // which is supported on the new device.
+ bool isInvalidationOfMusicStreamNeeded(routing_strategy strategy);
+
+ // Must be called before updateDevicesAndOutputs()
+ void checkOutputForStrategy(routing_strategy strategy);
+
// returns true if given output is direct output
bool isDirectOutput(audio_io_handle_t output);
diff --git a/post_proc/volume_listener.c b/post_proc/volume_listener.c
index e1dd026..7b60248 100644
--- a/post_proc/volume_listener.c
+++ b/post_proc/volume_listener.c
@@ -697,24 +697,31 @@
struct listnode *node = NULL;
vol_listener_context_t *context = NULL;
vol_listener_context_t *recv_contex = (vol_listener_context_t *)handle;
- int status = -1;
+ int status = -EINVAL;
bool recompute_flag = false;
int active_stream_count = 0;
+ uint32_t session_id;
+ uint32_t stream_type;
+ effect_uuid_t uuid;
+
ALOGV("%s context %p", __func__, handle);
- if (recv_contex == NULL || recv_contex->desc == NULL) {
- ALOGE("%s: Got invalid handle while release, DO NOTHING ", __func__);
+
+ if (recv_contex == NULL) {
return status;
}
-
pthread_mutex_lock(&vol_listner_init_lock);
+ session_id = recv_contex->session_id;
+ stream_type = recv_contex->stream_type;
+ uuid = recv_contex->desc->uuid;
// check if the handle/context provided is valid
list_for_each(node, &vol_effect_list) {
context = node_to_item(node, struct vol_listener_context_s, effect_list_node);
- if ((memcmp(&(context->desc->uuid), &(recv_contex->desc->uuid), sizeof(effect_uuid_t)) == 0)
- && (context->session_id == recv_contex->session_id)
- && (context->stream_type == recv_contex->stream_type)) {
+ if ((memcmp(&(context->desc->uuid), &uuid, sizeof(effect_uuid_t)) == 0)
+ && (context->session_id == session_id)
+ && (context->stream_type == stream_type)) {
ALOGV("--- Found something to remove ---");
+ list_remove(node);
PRINT_STREAM_TYPE(context->stream_type);
if (context->dev_id == AUDIO_DEVICE_OUT_SPEAKER) {
recompute_flag = true;
@@ -730,6 +737,8 @@
if (status != 0) {
ALOGE("something wrong ... <<<--- Found NOTHING to remove ... ???? --->>>>>");
+ pthread_mutex_unlock(&vol_listner_init_lock);
+ return status;
}
// if there are no active streams, reset cal and volume level
diff --git a/qahw_api/Android.mk b/qahw_api/Android.mk
new file mode 100644
index 0000000..8c99c5b
--- /dev/null
+++ b/qahw_api/Android.mk
@@ -0,0 +1,32 @@
+ifeq ($(strip $(BOARD_SUPPORTS_QAHW)),true)
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+libqahw-inc := $(LOCAL_PATH)/inc
+
+LOCAL_MODULE := libqahw
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_OWNER := qti
+LOCAL_C_INCLUDES := $(libqahw-inc)
+
+LOCAL_SRC_FILES := \
+ src/qahw.c
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+ libcutils \
+ libhardware
+
+LOCAL_COPY_HEADERS_TO := mm-audio/qahw_api/inc
+LOCAL_COPY_HEADERS := inc/qahw_api.h
+LOCAL_COPY_HEADERS += inc/qahw_defs.h
+
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SHARED_LIBRARY)
+
+#test app compilation
+include $(LOCAL_PATH)/test/Android.mk
+endif
diff --git a/qahw_api/inc/qahw_api.h b/qahw_api/inc/qahw_api.h
new file mode 100644
index 0000000..17f6f5f
--- /dev/null
+++ b/qahw_api/inc/qahw_api.h
@@ -0,0 +1,420 @@
+/*
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ * Not a Contribution.
+ *
+ * Copyright (C) 2011 The Android Open Source Project *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef QTI_AUDIO_HAL_API_H
+#define QTI_AUDIO_HAL_API_H
+
+#include <stdint.h>
+#include <strings.h>
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <cutils/bitops.h>
+#include <system/audio.h>
+#include "qahw_defs.h"
+
+__BEGIN_DECLS
+/*
+ * Helper macros for module implementors.
+ *
+ * The derived modules should provide convenience macros for supported
+ * versions so that implementations can explicitly specify module
+ * versions at definition time.
+ */
+
+#define QAHW_MAKE_API_VERSION(maj,min) \
+ ((((maj) & 0xff) << 8) | ((min) & 0xff))
+
+/* First generation of audio devices had version hardcoded to 0. all devices with
+ * versions < 1.0 will be considered of first generation API.
+ */
+#define QAHW_MODULE_API_VERSION_0_0 QAHW_MAKE_API_VERSION(0, 0)
+
+/* Minimal QTI audio HAL version supported by the audio framework */
+#define QAHW_MODULE_API_VERSION_MIN QAHW_MODULE_API_VERSION_0_0
+
+/**
+ * List of known audio HAL modules. This is the base name of the audio HAL
+ * library composed of the "audio." prefix, one of the base names below and
+ * a suffix specific to the device.
+ * e.g: audio.primary.goldfish.so or audio.a2dp.default.so
+ */
+
+#define QAHW_MODULE_ID_PRIMARY "audio.primary"
+#define QAHW_MODULE_ID_A2DP "audio.a2dp"
+#define QAHW_MODULE_ID_USB "audio.usb"
+
+typedef void qahw_module_handle_t;
+typedef void qahw_stream_handle_t;
+
+/**************************************/
+/* Output stream specific APIs **/
+
+/*
+ * This method creates and opens the audio hardware output stream.
+ * The "address" parameter qualifies the "devices" audio device type if needed.
+ * The format format depends on the device type:
+ * - Bluetooth devices use the MAC address of the device in the form "00:11:22:AA:BB:CC"
+ * - USB devices use the ALSA card and device numbers in the form "card=X;device=Y"
+ * - Other devices may use a number or any other string.
+ */
+
+int qahw_open_output_stream(qahw_module_handle_t *hw_module,
+ audio_io_handle_t handle,
+ audio_devices_t devices,
+ audio_output_flags_t flags,
+ struct audio_config *config,
+ qahw_stream_handle_t **out_handle,
+ const char *address);
+
+int qahw_close_output_stream(qahw_stream_handle_t *out_handle);
+
+
+/*
+ * Return the sampling rate in Hz - eg. 44100.
+ */
+uint32_t qahw_out_get_sample_rate(const qahw_stream_handle_t *stream);
+
+/*
+ * use set_parameters with key QAHW_PARAMETER_STREAM_SAMPLING_RATE
+ */
+int qahw_out_set_sample_rate(qahw_stream_handle_t *stream, uint32_t rate);
+
+/*
+ * Return size of input/output buffer in bytes for this stream - eg. 4800.
+ * It should be a multiple of the frame size. See also get_input_buffer_size.
+ */
+size_t qahw_out_get_buffer_size(const qahw_stream_handle_t *stream);
+
+/*
+ * Return the channel mask -
+ * e.g. AUDIO_CHANNEL_OUT_STEREO or AUDIO_CHANNEL_IN_STEREO
+ */
+audio_channel_mask_t qahw_out_get_channels(const qahw_stream_handle_t *stream);
+
+/*
+ * Return the audio format - e.g. AUDIO_FORMAT_PCM_16_BIT
+ */
+audio_format_t qahw_out_get_format(const qahw_stream_handle_t *stream);
+
+/*
+ * Put the audio hardware input/output into standby mode.
+ * Driver should exit from standby mode at the next I/O operation.
+ * Returns 0 on success and <0 on failure.
+ */
+int qahw_out_standby(qahw_stream_handle_t *stream);
+
+/*
+ * set/get audio stream parameters. The function accepts a list of
+ * parameter key value pairs in the form: key1=value1;key2=value2;...
+ *
+ * Some keys are reserved for standard parameters (See AudioParameter class)
+ *
+ * If the implementation does not accept a parameter change while
+ * the output is active but the parameter is acceptable otherwise, it must
+ * return -ENOSYS.
+ *
+ * The audio flinger will put the stream in standby and then change the
+ * parameter value.
+ */
+int qahw_out_set_parameters(qahw_stream_handle_t *stream, const char*kv_pairs);
+
+/*
+ * Returns a pointer to a heap allocated string. The caller is responsible
+ * for freeing the memory for it using free().
+ */
+char* qahw_out_get_parameters(const qahw_stream_handle_t *stream,
+ const char *keys);
+
+/*
+ * Return the audio hardware driver estimated latency in milliseconds.
+ */
+uint32_t qahw_out_get_latency(const qahw_stream_handle_t *stream);
+
+/*
+ * Use this method in situations where audio mixing is done in the
+ * hardware. This method serves as a direct interface with hardware,
+ * allowing you to directly set the volume as apposed to via the framework.
+ * This method might produce multiple PCM outputs or hardware accelerated
+ * codecs, such as MP3 or AAC.
+ */
+int qahw_out_set_volume(qahw_stream_handle_t *stream, float left, float right);
+
+/*
+ * Write audio buffer present in meta_data starting from offset
+ * along with timestamp to driver. Returns number of bytes
+ * written or a negative status_t. If at least one frame was written successfully
+ * prior to the error, it is suggested that the driver return that successful
+ * (short) byte count and then return an error in the subsequent call.
+ * timestamp is only sent driver is session has been opened with timestamp flag
+ * otherwise its ignored.
+ *
+ * If set_callback() has previously been called to enable non-blocking mode
+ * the write() is not allowed to block. It must write only the number of
+ * bytes that currently fit in the driver/hardware buffer and then return
+ * this byte count. If this is less than the requested write size the
+ * callback function must be called when more space is available in the
+ * driver/hardware buffer.
+ */
+ssize_t qahw_out_write(qahw_stream_handle_t *stream,
+ qahw_out_buffer_t *out_buf);
+
+/*
+ * return the number of audio frames written by the audio dsp to DAC since
+ * the output has exited standby
+ */
+int qahw_out_get_render_position(const qahw_stream_handle_t *stream,
+ uint32_t *dsp_frames);
+
+/*
+ * set the callback function for notifying completion of non-blocking
+ * write and drain.
+ * Calling this function implies that all future rite() and drain()
+ * must be non-blocking and use the callback to signal completion.
+ */
+int qahw_out_set_callback(qahw_stream_handle_t *stream,
+ qahw_stream_callback_t callback,
+ void *cookie);
+
+/*
+ * Notifies to the audio driver to stop playback however the queued buffers are
+ * retained by the hardware. Useful for implementing pause/resume. Empty implementation
+ * if not supported however should be implemented for hardware with non-trivial
+ * latency. In the pause state audio hardware could still be using power. User may
+ * consider calling suspend after a timeout.
+ *
+ * Implementation of this function is mandatory for offloaded playback.
+ */
+int qahw_out_pause(qahw_stream_handle_t *out_handle);
+
+/*
+ * Notifies to the audio driver to resume playback following a pause.
+ * Returns error if called without matching pause.
+ *
+ * Implementation of this function is mandatory for offloaded playback.
+ */
+int qahw_out_resume(qahw_stream_handle_t *out_handle);
+
+/*
+ * Requests notification when data buffered by the driver/hardware has
+ * been played. If set_callback() has previously been called to enable
+ * non-blocking mode, the drain() must not block, instead it should return
+ * quickly and completion of the drain is notified through the callback.
+ * If set_callback() has not been called, the drain() must block until
+ * completion.
+ * If type==AUDIO_DRAIN_ALL, the drain completes when all previously written
+ * data has been played.
+ * If type==AUDIO_DRAIN_EARLY_NOTIFY, the drain completes shortly before all
+ * data for the current track has played to allow time for the framework
+ * to perform a gapless track switch.
+ *
+ * Drain must return immediately on stop() and flush() call
+ *
+ * Implementation of this function is mandatory for offloaded playback.
+ */
+int qahw_out_drain(qahw_stream_handle_t *out_handle, qahw_drain_type_t type);
+
+/*
+ * Notifies to the audio driver to flush the queued data. Stream must already
+ * be paused before calling flush().
+ *
+ * Implementation of this function is mandatory for offloaded playback.
+ */
+int qahw_out_flush(qahw_stream_handle_t *out_handle);
+
+/*
+ * Return a recent count of the number of audio frames presented to an external observer.
+ * This excludes frames which have been written but are still in the pipeline.
+ * The count is not reset to zero when output enters standby.
+ * Also returns the value of CLOCK_MONOTONIC as of this presentation count.
+ * The returned count is expected to be 'recent',
+ * but does not need to be the most recent possible value.
+ * However, the associated time should correspond to whatever count is returned.
+ * Example: assume that N+M frames have been presented, where M is a 'small' number.
+ * Then it is permissible to return N instead of N+M,
+ * and the timestamp should correspond to N rather than N+M.
+ * The terms 'recent' and 'small' are not defined.
+ * They reflect the quality of the implementation.
+ *
+ * 3.0 and higher only.
+ */
+int qahw_out_get_presentation_position(const qahw_stream_handle_t *out_handle,
+ uint64_t *frames, struct timespec *timestamp);
+
+/* Input stream specific APIs */
+
+/* This method creates and opens the audio hardware input stream */
+int qahw_open_input_stream(qahw_module_handle_t *hw_module,
+ audio_io_handle_t handle,
+ audio_devices_t devices,
+ struct audio_config *config,
+ qahw_stream_handle_t **stream_in,
+ audio_input_flags_t flags,
+ const char *address,
+ audio_source_t source);
+
+int qahw_close_input_stream(qahw_stream_handle_t *in_handle);
+
+
+/*
+ * Return the sampling rate in Hz - eg. 44100.
+ */
+uint32_t qahw_in_get_sample_rate(const qahw_stream_handle_t *in_handle);
+
+/*
+ * currently unused - use set_parameters with key
+ * QAHW_PARAMETER_STREAM_SAMPLING_RATE
+ */
+int qahw_in_set_sample_rate(qahw_stream_handle_t *in_handle, uint32_t rate);
+
+/*
+ * Return size of input/output buffer in bytes for this stream - eg. 4800.
+ * It should be a multiple of the frame size. See also get_input_buffer_size.
+ */
+size_t qahw_in_get_buffer_size(const qahw_stream_handle_t *in_handle);
+
+/*
+ * Return the channel mask -
+ * e.g. AUDIO_CHANNEL_OUT_STEREO or AUDIO_CHANNEL_IN_STEREO
+ */
+audio_channel_mask_t qahw_in_get_channels(const qahw_stream_handle_t *in_handle);
+
+/*
+ * Return the audio format - e.g. AUDIO_FORMAT_PCM_16_BIT
+ */
+audio_format_t qahw_in_get_format(const qahw_stream_handle_t *in_handle);
+
+/*
+ * currently unused - use set_parameters with key
+ * QAHW_PARAMETER_STREAM_FORMAT
+ */
+int qahw_in_set_format(qahw_stream_handle_t *in_handle, audio_format_t format);
+
+/*
+ * Put the audio hardware input/output into standby mode.
+ * Driver should exit from standby mode at the next I/O operation.
+ * Returns 0 on success and <0 on failure.
+ */
+int qahw_in_standby(qahw_stream_handle_t *in_handle);
+
+/*
+ * set/get audio stream parameters. The function accepts a list of
+ * parameter key value pairs in the form: key1=value1;key2=value2;...
+ *
+ * Some keys are reserved for standard parameters (See AudioParameter class)
+ *
+ * If the implementation does not accept a parameter change while
+ * the output is active but the parameter is acceptable otherwise, it must
+ * return -ENOSYS.
+ *
+ * The audio flinger will put the stream in standby and then change the
+ * parameter value.
+ */
+int qahw_in_set_parameters(qahw_stream_handle_t *in_handle, const char *kv_pairs);
+
+/*
+ * Returns a pointer to a heap allocated string. The caller is responsible
+ * for freeing the memory for it using free().
+ */
+char* qahw_in_get_parameters(const qahw_stream_handle_t *in_handle,
+ const char *keys);
+/*
+ * Read audio buffer in from audio driver. Returns number of bytes read, or a
+ * negative status_t. meta_data structure is filled buffer pointer, start
+ * offset and valid catpure timestamp (if session is opened with timetamp flag)
+ * and buffer. if at least one frame was read prior to the error,
+ * read should return that byte count and then return an error in the
+ * subsequent call.
+ */
+ssize_t qahw_in_read(qahw_stream_handle_t *in_handle,
+ qahw_in_buffer_t *in_buf);
+/*
+ * Return the amount of input frames lost in the audio driver since the
+ * last call of this function.
+ * Audio driver is expected to reset the value to 0 and restart counting
+ * upon returning the current value by this function call.
+ * Such loss typically occurs when the user space process is blocked
+ * longer than the capacity of audio driver buffers.
+ *
+ * Unit: the number of input audio frames
+ */
+uint32_t qahw_in_get_input_frames_lost(qahw_stream_handle_t *in_handle);
+
+/*
+ * Return a recent count of the number of audio frames received and
+ * the clock time associated with that frame count.
+ *
+ * frames is the total frame count received. This should be as early in
+ * the capture pipeline as possible. In general,
+ * frames should be non-negative and should not go "backwards".
+ *
+ * time is the clock MONOTONIC time when frames was measured. In general,
+ * time should be a positive quantity and should not go "backwards".
+ *
+ * The status returned is 0 on success, -ENOSYS if the device is not
+ * ready/available, or -EINVAL if the arguments are null or otherwise invalid.
+ */
+int qahw_in_get_capture_position(const qahw_stream_handle_t *in_handle,
+ int64_t *frames, int64_t *time);
+
+/* Module specific APIs */
+
+/* convenience API for opening and closing an audio HAL module */
+qahw_module_handle_t *qahw_load_module(const char *hw_module_id);
+
+int qahw_unload_module(qahw_module_handle_t *hw_module);
+
+/*
+ * check to see if the audio hardware interface has been initialized.
+ * returns 0 on success, -ENODEV on failure.
+ */
+int qahw_init_check(const qahw_module_handle_t *hw_module);
+
+/* set the audio volume of a voice call. Range is between 0.0 and 1.0 */
+int qahw_set_voice_volume(qahw_module_handle_t *hw_module, float volume);
+
+/*
+ * set_mode is called when the audio mode changes. AUDIO_MODE_NORMAL mode
+ * is for standard audio playback, AUDIO_MODE_RINGTONE when a ringtone is
+ * playing, and AUDIO_MODE_IN_CALL when a call is in progress.
+ */
+int qahw_set_mode(qahw_module_handle_t *hw_module, audio_mode_t mode);
+
+/* set/get global audio parameters */
+int qahw_set_parameters(qahw_module_handle_t *hw_module, const char *kv_pairs);
+
+/*
+ * Returns a pointer to a heap allocated string. The caller is responsible
+ * for freeing the memory for it using free().
+ */
+char* qahw_get_parameters(const qahw_module_handle_t *hw_module,
+ const char *keys);
+
+/* Returns audio input buffer size according to parameters passed or
+ * 0 if one of the parameters is not supported.
+ * See also get_buffer_size which is for a particular stream.
+ */
+size_t qahw_get_input_buffer_size(const qahw_module_handle_t *hw_module,
+ const struct audio_config *config);
+
+/*returns current QTI HAL version */
+int qahw_get_version();
+
+__END_DECLS
+
+#endif // QTI_AUDIO_HAL_API_H
diff --git a/qahw_api/inc/qahw_defs.h b/qahw_api/inc/qahw_defs.h
new file mode 100644
index 0000000..4441435
--- /dev/null
+++ b/qahw_api/inc/qahw_defs.h
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ * Not a Contribution.
+ *
+ * Copyright (C) 2011 The Android Open Source Project *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sys/cdefs.h>
+#include <stdint.h>
+
+#ifndef QTI_AUDIO_HAL_DEFS_H
+#define QTI_AUDIO_HAL_DEFS_H
+
+__BEGIN_DECLS
+
+/**************************************/
+
+/**
+ * standard audio parameters that the HAL may need to handle
+ */
+
+/**
+ * audio device parameters
+ */
+
+/* BT SCO Noise Reduction + Echo Cancellation parameters */
+#define QAHW_PARAMETER_KEY_BT_NREC "bt_headset_nrec"
+#define QAHW_PARAMETER_VALUE_ON "on"
+#define QAHW_PARAMETER_VALUE_OFF "off"
+
+/* TTY mode selection */
+#define QAHW_PARAMETER_KEY_TTY_MODE "tty_mode"
+#define QAHW_PARAMETER_VALUE_TTY_OFF "tty_off"
+#define QAHW_PARAMETER_VALUE_TTY_VCO "tty_vco"
+#define QAHW_PARAMETER_VALUE_TTY_HCO "tty_hco"
+#define QAHW_PARAMETER_VALUE_TTY_FULL "tty_full"
+
+/* Hearing Aid Compatibility - Telecoil (HAC-T) mode on/off
+ Strings must be in sync with CallFeaturesSetting.java */
+#define QAHW_PARAMETER_KEY_HAC "HACSetting"
+#define QAHW_PARAMETER_VALUE_HAC_ON "ON"
+#define QAHW_PARAMETER_VALUE_HAC_OFF "OFF"
+
+/* A2DP sink address set by framework */
+#define QAHW_PARAMETER_A2DP_SINK_ADDRESS "a2dp_sink_address"
+
+/* A2DP source address set by framework */
+#define QAHW_PARAMETER_A2DP_SOURCE_ADDRESS "a2dp_source_address"
+
+/* Screen state */
+#define QAHW_PARAMETER_KEY_SCREEN_STATE "screen_state"
+
+/* Bluetooth SCO wideband */
+#define QAHW_PARAMETER_KEY_BT_SCO_WB "bt_wbs"
+
+/* Get a new HW synchronization source identifier.
+ * Return a valid source (positive integer) or AUDIO_HW_SYNC_INVALID if an error occurs
+ * or no HW sync is available. */
+#define QAHW_PARAMETER_HW_AV_SYNC "hw_av_sync"
+
+/**
+ * audio stream parameters
+ */
+
+#define QAHW_PARAMETER_STREAM_ROUTING "routing" /* audio_devices_t */
+#define QAHW_PARAMETER_STREAM_FORMAT "format" /* audio_format_t */
+#define QAHW_PARAMETER_STREAM_CHANNELS "channels" /* audio_channel_mask_t */
+#define QAHW_PARAMETER_STREAM_FRAME_COUNT "frame_count" /* size_t */
+#define QAHW_PARAMETER_STREAM_INPUT_SOURCE "input_source" /* audio_source_t */
+#define QAHW_PARAMETER_STREAM_SAMPLING_RATE "sampling_rate" /* uint32_t */
+
+#define QAHW_PARAMETER_DEVICE_CONNECT "connect" /* audio_devices_t */
+#define QAHW_PARAMETER_DEVICE_DISCONNECT "disconnect" /* audio_devices_t */
+
+/* Query supported formats. The response is a '|' separated list of strings from
+ * audio_format_t enum e.g: "sup_formats=AUDIO_FORMAT_PCM_16_BIT" */
+#define QAHW_PARAMETER_STREAM_SUP_FORMATS "sup_formats"
+
+/* Query supported channel masks. The response is a '|' separated list of
+ * strings from audio_channel_mask_t enum
+ * e.g: "sup_channels=AUDIO_CHANNEL_OUT_STEREO|AUDIO_CHANNEL_OUT_MONO" */
+#define QAHW_PARAMETER_STREAM_SUP_CHANNELS "sup_channels"
+
+/* Query supported sampling rates. The response is a '|' separated list of
+ * integer values e.g: "sup_sampling_rates=44100|48000" */
+#define QAHW_PARAMETER_STREAM_SUP_SAMPLING_RATES "sup_sampling_rates"
+
+/* Set the HW synchronization source for an output stream. */
+#define QAHW_PARAMETER_STREAM_HW_AV_SYNC "hw_av_sync"
+
+/* Enable mono audio playback if 1, else should be 0. */
+#define QAHW_PARAMETER_MONO_OUTPUT "mono_output"
+
+/**
+ * audio codec parameters
+ */
+
+#define QAHW_OFFLOAD_CODEC_PARAMS "music_offload_codec_param"
+#define QAHW_OFFLOAD_CODEC_BIT_PER_SAMPLE "music_offload_bit_per_sample"
+#define QAHW_OFFLOAD_CODEC_BIT_RATE "music_offload_bit_rate"
+#define QAHW_OFFLOAD_CODEC_AVG_BIT_RATE "music_offload_avg_bit_rate"
+#define QAHW_OFFLOAD_CODEC_ID "music_offload_codec_id"
+#define QAHW_OFFLOAD_CODEC_BLOCK_ALIGN "music_offload_block_align"
+#define QAHW_OFFLOAD_CODEC_SAMPLE_RATE "music_offload_sample_rate"
+#define QAHW_OFFLOAD_CODEC_ENCODE_OPTION "music_offload_encode_option"
+#define QAHW_OFFLOAD_CODEC_NUM_CHANNEL "music_offload_num_channels"
+#define QAHW_OFFLOAD_CODEC_DOWN_SAMPLING "music_offload_down_sampling"
+#define QAHW_OFFLOAD_CODEC_DELAY_SAMPLES "delay_samples"
+#define QAHW_OFFLOAD_CODEC_PADDING_SAMPLES "padding_samples"
+
+/**
+ * extended audio codec parameters
+ */
+
+#define QAHW_OFFLOAD_CODEC_WMA_FORMAT_TAG "music_offload_wma_format_tag"
+#define QAHW_OFFLOAD_CODEC_WMA_BLOCK_ALIGN "music_offload_wma_block_align"
+#define QAHW_OFFLOAD_CODEC_WMA_BIT_PER_SAMPLE "music_offload_wma_bit_per_sample"
+#define QAHW_OFFLOAD_CODEC_WMA_CHANNEL_MASK "music_offload_wma_channel_mask"
+#define QAHW_OFFLOAD_CODEC_WMA_ENCODE_OPTION "music_offload_wma_encode_option"
+#define QAHW_OFFLOAD_CODEC_WMA_ENCODE_OPTION1 "music_offload_wma_encode_option1"
+#define QAHW_OFFLOAD_CODEC_WMA_ENCODE_OPTION2 "music_offload_wma_encode_option2"
+
+#define QAHW_OFFLOAD_CODEC_FLAC_MIN_BLK_SIZE "music_offload_flac_min_blk_size"
+#define QAHW_OFFLOAD_CODEC_FLAC_MAX_BLK_SIZE "music_offload_flac_max_blk_size"
+#define QAHW_OFFLOAD_CODEC_FLAC_MIN_FRAME_SIZE "music_offload_flac_min_frame_size"
+#define QAHW_OFFLOAD_CODEC_FLAC_MAX_FRAME_SIZE "music_offload_flac_max_frame_size"
+
+#define QAHW_OFFLOAD_CODEC_ALAC_FRAME_LENGTH "music_offload_alac_frame_length"
+#define QAHW_OFFLOAD_CODEC_ALAC_COMPATIBLE_VERSION "music_offload_alac_compatible_version"
+#define QAHW_OFFLOAD_CODEC_ALAC_BIT_DEPTH "music_offload_alac_bit_depth"
+#define QAHW_OFFLOAD_CODEC_ALAC_PB "music_offload_alac_pb"
+#define QAHW_OFFLOAD_CODEC_ALAC_MB "music_offload_alac_mb"
+#define QAHW_OFFLOAD_CODEC_ALAC_KB "music_offload_alac_kb"
+#define QAHW_OFFLOAD_CODEC_ALAC_NUM_CHANNELS "music_offload_alac_num_channels"
+#define QAHW_OFFLOAD_CODEC_ALAC_MAX_RUN "music_offload_alac_max_run"
+#define QAHW_OFFLOAD_CODEC_ALAC_MAX_FRAME_BYTES "music_offload_alac_max_frame_bytes"
+#define QAHW_OFFLOAD_CODEC_ALAC_AVG_BIT_RATE "music_offload_alac_avg_bit_rate"
+#define QAHW_OFFLOAD_CODEC_ALAC_SAMPLING_RATE "music_offload_alac_sampling_rate"
+#define QAHW_OFFLOAD_CODEC_ALAC_CHANNEL_LAYOUT_TAG "music_offload_alac_channel_layout_tag"
+
+#define QAHW_OFFLOAD_CODEC_APE_COMPATIBLE_VERSION "music_offload_ape_compatible_version"
+#define QAHW_OFFLOAD_CODEC_APE_COMPRESSION_LEVEL "music_offload_ape_compression_level"
+#define QAHW_OFFLOAD_CODEC_APE_FORMAT_FLAGS "music_offload_ape_format_flags"
+#define QAHW_OFFLOAD_CODEC_APE_BLOCKS_PER_FRAME "music_offload_ape_blocks_per_frame"
+#define QAHW_OFFLOAD_CODEC_APE_FINAL_FRAME_BLOCKS "music_offload_ape_final_frame_blocks"
+#define QAHW_OFFLOAD_CODEC_APE_TOTAL_FRAMES "music_offload_ape_total_frames"
+#define QAHW_OFFLOAD_CODEC_APE_BITS_PER_SAMPLE "music_offload_ape_bits_per_sample"
+#define QAHW_OFFLOAD_CODEC_APE_NUM_CHANNELS "music_offload_ape_num_channels"
+#define QAHW_OFFLOAD_CODEC_APE_SAMPLE_RATE "music_offload_ape_sample_rate"
+#define QAHW_OFFLOAD_CODEC_APE_SEEK_TABLE_PRESENT "music_offload_seek_table_present"
+
+#define QAHW_OFFLOAD_CODEC_VORBIS_BITSTREAM_FMT "music_offload_vorbis_bitstream_fmt"
+
+/* Query fm volume */
+#define QAHW_PARAMETER_KEY_FM_VOLUME "fm_volume"
+
+/* Query if a2dp is supported */
+#define QAHW_PARAMETER_KEY_HANDLE_A2DP_DEVICE "isA2dpDeviceSupported"
+
+/* type of asynchronous write callback events. Mutually exclusive */
+typedef enum {
+ QAHW_STREAM_CBK_EVENT_WRITE_READY, /* non blocking write completed */
+ QAHW_STREAM_CBK_EVENT_DRAIN_READY /* drain completed */
+} qahw_stream_callback_event_t;
+
+typedef int qahw_stream_callback_t(qahw_stream_callback_event_t event,
+ void *param,
+ void *cookie);
+
+/* type of drain requested to audio_stream_out->drain(). Mutually exclusive */
+typedef enum {
+ QAHW_DRAIN_ALL, /* drain() returns when all data has been played */
+ QAHW_DRAIN_EARLY_NOTIFY /* drain() returns a short time before all data
+ from the current track has been played to
+ give time for gapless track switch */
+} qahw_drain_type_t;
+
+/* meta data flags */
+/*TBD: Extend this based on stb requirement*/
+typedef enum {
+ QAHW_META_DATA_FLAGS_NONE = 0,
+} qahw_meta_data_flags_t;
+
+typedef struct {
+ const void *buffer; /* write buffer pointer */
+ size_t bytes; /* size of buffer */
+ size_t offset; /* offset in buffer from where valid byte starts */
+ int64_t *timestamp; /* timestmap */
+ qahw_meta_data_flags_t flags; /* meta data flags */
+ uint32_t reserved[64]; /*reserved for future */
+} qahw_out_buffer_t;
+
+typedef struct {
+ void *buffer; /* read buffer pointer */
+ size_t bytes; /* size of buffer */
+ size_t offset; /* offset in buffer from where valid byte starts */
+ int64_t *timestamp; /* timestmap */
+ uint32_t reserved[64]; /*reserved for future */
+} qahw_in_buffer_t;
+
+__END_DECLS
+
+#endif // QTI_AUDIO_HAL_DEFS_H
+
diff --git a/qahw_api/src/qahw.c b/qahw_api/src/qahw.c
new file mode 100644
index 0000000..06bcee1
--- /dev/null
+++ b/qahw_api/src/qahw.c
@@ -0,0 +1,1513 @@
+/*
+* Copyright (c) 2016, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* 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.
+*/
+
+#define LOG_TAG "qahw"
+/*#define LOG_NDEBUG 0*/
+#define LOG_NDDEBUG 0
+
+#include <utils/Log.h>
+#include <stdlib.h>
+#include <cutils/list.h>
+
+#include <hardware/audio.h>
+#include "qahw_api.h"
+
+#define NO_ERROR 0
+#define MAX_MODULE_NAME_LENGTH 100
+
+/*
+ * The current HAL API version.
+ */
+#define QAHW_MODULE_API_VERSION_CURRENT QAHW_MODULE_API_VERSION_0_0
+
+typedef struct {
+ audio_hw_device_t *audio_device;
+ char module_name[MAX_MODULE_NAME_LENGTH];
+ struct listnode module_list;
+ struct listnode in_list;
+ struct listnode out_list;
+ pthread_mutex_t lock;
+ uint32_t ref_count;
+} qahw_module_t;
+
+typedef struct {
+ qahw_module_t *module;
+ struct listnode module_list;
+ pthread_mutex_t lock;
+} qahw_module_instances_t;
+
+typedef struct {
+ audio_stream_out_t *stream;
+ qahw_module_t *module;
+ struct listnode list;
+ pthread_mutex_t lock;
+} qahw_stream_out_t;
+
+typedef struct {
+ audio_stream_in_t *stream;
+ qahw_module_t *module;
+ struct listnode list;
+ pthread_mutex_t lock;
+} qahw_stream_in_t;
+
+typedef enum {
+ STREAM_DIR_IN,
+ STREAM_DIR_OUT,
+} qahw_stream_direction_t;
+
+static struct listnode qahw_module_list;
+static int qahw_list_count;
+static pthread_mutex_t qahw_module_init_lock = PTHREAD_MUTEX_INITIALIZER;
+
+/** Start of internal functions */
+/******************************************************************************/
+
+/* call this function without anylock held */
+static bool is_valid_qahw_stream(void *qahw_stream,
+ qahw_stream_direction_t dir)
+{
+
+ int is_valid = false;
+ struct listnode *module_node = NULL;
+ struct listnode *stream_node = NULL;
+ struct listnode *list_node = NULL;
+ void *stream = NULL;
+ qahw_module_t *qahw_module = NULL;
+
+ if (qahw_stream == NULL) {
+ ALOGE("%s:: Invalid stream", __func__);
+ goto exit;
+ }
+
+ if ((dir != STREAM_DIR_OUT) && (dir != STREAM_DIR_IN)) {
+ ALOGE("%s:: Invalid stream direction %d", __func__, dir);
+ goto exit;
+ }
+
+ /* go through all the modules and check for valid stream */
+ pthread_mutex_lock(&qahw_module_init_lock);
+ list_for_each(module_node, &qahw_module_list) {
+ qahw_module = node_to_item(module_node, qahw_module_t, module_list);
+ pthread_mutex_lock(&qahw_module->lock);
+ if(dir == STREAM_DIR_OUT)
+ list_node = &qahw_module->out_list;
+ else
+ list_node = &qahw_module->in_list;
+ list_for_each(stream_node, list_node) {
+ if(dir == STREAM_DIR_OUT)
+ stream = (void *)node_to_item(stream_node,
+ qahw_stream_out_t,
+ list);
+ else
+ stream = (void *)node_to_item(stream_node,
+ qahw_stream_in_t,
+ list);
+ if(stream == qahw_stream) {
+ is_valid = true;
+ break;
+ }
+ }
+ pthread_mutex_unlock(&qahw_module->lock);
+ if(is_valid)
+ break;
+ }
+ pthread_mutex_unlock(&qahw_module_init_lock);
+
+exit:
+ return is_valid;
+}
+
+/* call this fucntion with ahw_module_init_lock held*/
+static qahw_module_t* get_qahw_module_by_ptr(qahw_module_t *qahw_module)
+{
+ struct listnode *node = NULL;
+ qahw_module_t *module = NULL, *module_temp = NULL;
+
+ if (qahw_module == NULL)
+ goto exit;
+
+ list_for_each(node, &qahw_module_list) {
+ module_temp = node_to_item(node, qahw_module_t, module_list);
+ if (module_temp == qahw_module) {
+ module = module_temp;
+ break;
+ }
+ }
+exit:
+ return module;
+}
+
+/* call this function with qahw_module_init_lock held*/
+static qahw_module_t* get_qahw_module_by_name(const char *qahw_name)
+{
+ struct listnode *node = NULL;
+ qahw_module_t *module = NULL, *module_temp = NULL;
+
+ if (qahw_name == NULL)
+ goto exit;
+
+ list_for_each(node, &qahw_module_list) {
+ module_temp = node_to_item(node, qahw_module_t, module_list);
+ if(!strncmp(qahw_name, module_temp->module_name, MAX_MODULE_NAME_LENGTH)) {
+ module = module_temp;
+ break;
+ }
+ }
+exit:
+ return module;
+}
+/* End of of internal functions */
+
+/*
+ * Return the sampling rate in Hz - eg. 44100.
+ */
+uint32_t qahw_out_get_sample_rate(const qahw_stream_handle_t *out_handle)
+{
+ uint32_t rate = 0;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ audio_stream_out_t *out = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGV("%s::Invalid out handle %p", __func__, out_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ out = qahw_stream_out->stream;
+ if (out->common.get_sample_rate)
+ rate = out->common.get_sample_rate(&out->common);
+ else
+ ALOGW("%s not supported", __func__);
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+
+exit:
+ return rate;
+}
+
+/*
+ * currently unused - use set_parameters with key
+ * AUDIO_PARAMETER_STREAM_SAMPLING_RATE
+ */
+int qahw_out_set_sample_rate(qahw_stream_handle_t *out_handle, uint32_t rate)
+{
+ int32_t rc = -EINVAL;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ audio_stream_out_t *out = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGE("%s::Invalid out handle %p", __func__, out_handle);
+ goto exit;
+ }
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ out = qahw_stream_out->stream;
+ if (out->common.set_sample_rate) {
+ rc = out->common.set_sample_rate(&out->common, rate);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+exit:
+ return rc;
+}
+
+size_t qahw_out_get_buffer_size(const qahw_stream_handle_t *out_handle)
+{
+ size_t buf_size = 0;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ audio_stream_out_t *out = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGE("%s::Invalid out handle %p", __func__, out_handle);
+ goto exit;
+ }
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ out = qahw_stream_out->stream;
+ if (out->common.get_buffer_size) {
+ buf_size = out->common.get_buffer_size(&out->common);
+ } else {
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+
+exit:
+ return buf_size;
+}
+
+audio_channel_mask_t qahw_out_get_channels(const qahw_stream_handle_t *out_handle)
+{
+ audio_channel_mask_t ch_mask = 0;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ audio_stream_out_t *out = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGE("%s::Invalid out handle %p", __func__, out_handle);
+ goto exit;
+ }
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ out = qahw_stream_out->stream;
+ if (out->common.get_channels) {
+ ch_mask = out->common.get_channels(&out->common);
+ } else {
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+
+exit:
+ return ch_mask;
+}
+
+audio_format_t qahw_out_get_format(const qahw_stream_handle_t *out_handle)
+{
+ audio_format_t format = AUDIO_FORMAT_INVALID;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ audio_stream_out_t *out = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGE("%s::Invalid out handle %p", __func__, out_handle);
+ goto exit;
+ }
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ out = qahw_stream_out->stream;
+ if (out->common.get_format) {
+ format = out->common.get_format(&out->common);
+ } else {
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+
+exit:
+ return format;
+}
+
+int qahw_out_standby(qahw_stream_handle_t *out_handle)
+{
+ int32_t rc = -EINVAL;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ audio_stream_out_t *out = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGE("%s::Invalid out handle %p", __func__, out_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ out = qahw_stream_out->stream;
+ if (out->common.standby) {
+ rc = out->common.standby(&out->common);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+
+exit:
+ return rc;
+}
+
+int qahw_out_set_parameters(qahw_stream_handle_t *out_handle, const char *kv_pairs)
+{
+ int rc = NO_ERROR;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ audio_stream_out_t *out = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGE("%s::Invalid out handle %p", __func__, out_handle);
+ rc = -EINVAL;
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ out = qahw_stream_out->stream;
+ if (out->common.set_parameters) {
+ rc = out->common.set_parameters(&out->common, kv_pairs);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+
+exit:
+ return rc;
+}
+
+char *qahw_out_get_parameters(const qahw_stream_handle_t *out_handle,
+ const char *keys)
+{
+ char *str_param = NULL;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ audio_stream_out_t *out = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGE("%s::Invalid out handle %p", __func__, out_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ out = qahw_stream_out->stream;
+ if (out->common.get_parameters) {
+ str_param = out->common.get_parameters(&out->common, keys);
+ } else {
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+
+exit:
+ return str_param;
+}
+
+uint32_t qahw_out_get_latency(const qahw_stream_handle_t *out_handle)
+{
+ uint32_t latency = 0;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ audio_stream_out_t *out = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGE("%s::Invalid out handle %p", __func__, out_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ out = qahw_stream_out->stream;
+ if (out->get_latency) {
+ latency = out->get_latency(out);
+ } else {
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+
+exit:
+ return latency;
+}
+
+int qahw_out_set_volume(qahw_stream_handle_t *out_handle, float left, float right)
+{
+ int rc = -EINVAL;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ audio_stream_out_t *out = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGE("%s::Invalid out handle %p", __func__, out_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ out = qahw_stream_out->stream;
+ if (out->set_volume) {
+ rc = out->set_volume(out, left, right);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+
+exit:
+ return rc;
+}
+
+ssize_t qahw_out_write(qahw_stream_handle_t *out_handle,
+ qahw_out_buffer_t *out_buf)
+{
+ int rc = -EINVAL;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ audio_stream_out_t *out = NULL;
+
+ if ((out_buf == NULL) || (out_buf->buffer == NULL)) {
+ ALOGE("%s::Invalid meta data %p", __func__, out_buf);
+ goto exit;
+ }
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGE("%s::Invalid out handle %p", __func__, out_handle);
+ goto exit;
+ }
+
+ /*TBD:: validate other meta data parameters */
+
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ out = qahw_stream_out->stream;
+ if (out->write) {
+ rc = out->write(out, out_buf->buffer, out_buf->bytes);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+exit:
+ return rc;
+}
+
+int qahw_out_get_render_position(const qahw_stream_handle_t *out_handle,
+ uint32_t *dsp_frames)
+{
+ int rc = -EINVAL;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ audio_stream_out_t *out = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGE("%s::Invalid out handle %p", __func__, out_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ out = qahw_stream_out->stream;
+ if (out->get_render_position) {
+ rc = out->get_render_position(out, dsp_frames);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+exit:
+ return rc;
+}
+
+int qahw_out_set_callback(qahw_stream_handle_t *out_handle,
+ qahw_stream_callback_t callback,
+ void *cookie)
+{
+ /*TBD:load hal func pointer and call */
+ int rc = -EINVAL;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ audio_stream_out_t *out = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGE("%s::Invalid out handle %p", __func__, out_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ out = qahw_stream_out->stream;
+ if (out->set_callback) {
+ rc = out->set_callback(out, (stream_callback_t)callback, cookie);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+
+exit:
+ return rc;
+}
+
+int qahw_out_pause(qahw_stream_handle_t *out_handle)
+{
+ /*TBD:load hal func pointer and call */
+ int rc = -EINVAL;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ audio_stream_out_t *out = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGE("%s::Invalid out handle %p", __func__, out_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ out = qahw_stream_out->stream;
+ if (out->pause) {
+ rc = out->pause(out);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+
+exit:
+ return rc;
+}
+
+int qahw_out_resume(qahw_stream_handle_t *out_handle)
+{
+ /*TBD:load hal func pointer and call */
+ int rc = -EINVAL;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ audio_stream_out_t *out = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGE("%s::Invalid out handle %p", __func__, out_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ out = qahw_stream_out->stream;
+ if (out->resume) {
+ rc = out->resume(out);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+
+exit:
+ return rc;
+}
+
+int qahw_out_drain(qahw_stream_handle_t *out_handle, qahw_drain_type_t type )
+{
+ /*TBD:load hal func pointer and call */
+ int rc = -EINVAL;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ audio_stream_out_t *out = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGE("%s::Invalid out handle %p", __func__, out_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ out = qahw_stream_out->stream;
+ if (out->drain) {
+ rc = out->drain(out,(audio_drain_type_t)type);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+
+exit:
+ return rc;
+}
+
+int qahw_out_flush(qahw_stream_handle_t *out_handle)
+{
+ int rc = -EINVAL;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ audio_stream_out_t *out = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGE("%s::Invalid out handle %p", __func__, out_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ out = qahw_stream_out->stream;
+ if (out->flush) {
+ rc = out->flush(out);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+
+exit:
+ return rc;
+}
+
+int qahw_out_get_presentation_position(const qahw_stream_handle_t *out_handle,
+ uint64_t *frames, struct timespec *timestamp)
+{
+ int rc = -EINVAL;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ audio_stream_out_t *out = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGE("%s::Invalid out handle %p", __func__, out_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ out = qahw_stream_out->stream;
+ if (out->get_presentation_position) {
+ rc = out->get_presentation_position(out, frames, timestamp);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+
+exit:
+ return rc;
+}
+
+/* Input stream specific APIs */
+uint32_t qahw_in_get_sample_rate(const qahw_stream_handle_t *in_handle)
+{
+ uint32_t rate = 0;
+ qahw_stream_in_t *qahw_stream_in = (qahw_stream_in_t *)in_handle;
+ audio_stream_in_t *in = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_in, STREAM_DIR_IN)) {
+ ALOGV("%s::Invalid in handle %p", __func__, in_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_in->lock);
+ in = qahw_stream_in->stream;
+ if (in->common.get_sample_rate) {
+ rate = in->common.get_sample_rate(&in->common);
+ } else {
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_in->lock);
+
+exit:
+ return rate;
+}
+
+/*
+ * currently unused - use set_parameters with key
+ * AUDIO_PARAMETER_STREAM_SAMPLING_RATE
+ */
+int qahw_in_set_sample_rate(qahw_stream_handle_t *in_handle, uint32_t rate)
+{
+ int rc = -EINVAL;
+ qahw_stream_in_t *qahw_stream_in = (qahw_stream_in_t *)in_handle;
+ audio_stream_in_t *in = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_in, STREAM_DIR_IN)) {
+ ALOGV("%s::Invalid in handle %p", __func__, in_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_in->lock);
+ in = qahw_stream_in->stream;
+ if (in->common.set_sample_rate) {
+ rc = in->common.set_sample_rate(&in->common, rate);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_in->lock);
+
+exit:
+ return rc;
+}
+
+size_t qahw_in_get_buffer_size(const qahw_stream_handle_t *in_handle)
+{
+ size_t buf_size = 0;
+ qahw_stream_in_t *qahw_stream_in = (qahw_stream_in_t *)in_handle;
+ audio_stream_in_t *in = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_in, STREAM_DIR_IN)) {
+ ALOGV("%s::Invalid in handle %p", __func__, in_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_in->lock);
+ in = qahw_stream_in->stream;
+ if (in->common.get_sample_rate) {
+ buf_size = in->common.get_buffer_size(&in->common);
+ } else {
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_in->lock);
+
+exit:
+ return buf_size;
+}
+
+
+audio_channel_mask_t qahw_in_get_channels(const qahw_stream_handle_t *in_handle)
+{
+ audio_channel_mask_t ch_mask = 0;;
+ qahw_stream_in_t *qahw_stream_in = (qahw_stream_in_t *)in_handle;
+ audio_stream_in_t *in = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_in, STREAM_DIR_IN)) {
+ ALOGV("%s::Invalid in handle %p", __func__, in_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_in->lock);
+ in = qahw_stream_in->stream;
+ if (in->common.get_channels) {
+ ch_mask = in->common.get_channels(&in->common);
+ } else {
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_in->lock);
+
+exit:
+ return ch_mask;
+}
+
+audio_format_t qahw_in_get_format(const qahw_stream_handle_t *in_handle)
+{
+ audio_format_t format = AUDIO_FORMAT_INVALID;
+ qahw_stream_in_t *qahw_stream_in = (qahw_stream_in_t *)in_handle;
+ audio_stream_in_t *in = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_in, STREAM_DIR_IN)) {
+ ALOGV("%s::Invalid in handle %p", __func__, in_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_in->lock);
+ in = qahw_stream_in->stream;
+ if (in->common.get_format) {
+ format = in->common.get_format(&in->common);
+ } else {
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_in->lock);
+
+exit:
+ return format;
+}
+
+/*
+ * currently unused - use set_parameters with key
+ * AUDIO_PARAMETER_STREAM_FORMAT
+ */
+int qahw_in_set_format(qahw_stream_handle_t *in_handle, audio_format_t format)
+{
+ int rc = -EINVAL;
+ qahw_stream_in_t *qahw_stream_in = (qahw_stream_in_t *)in_handle;
+ audio_stream_in_t *in = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_in, STREAM_DIR_IN)) {
+ ALOGV("%s::Invalid in handle %p", __func__, in_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_in->lock);
+ in = qahw_stream_in->stream;
+ if (in->common.set_format) {
+ rc = in->common.set_format(&in->common, format);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_in->lock);
+
+exit:
+ return rc;
+}
+
+int qahw_in_standby(qahw_stream_handle_t *in_handle)
+{
+ int rc = -EINVAL;
+ qahw_stream_in_t *qahw_stream_in = (qahw_stream_in_t *)in_handle;
+ audio_stream_in_t *in = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_in, STREAM_DIR_IN)) {
+ ALOGV("%s::Invalid in handle %p", __func__, in_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_in->lock);
+ in = qahw_stream_in->stream;
+ if (in->common.standby) {
+ rc = in->common.standby(&in->common);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_in->lock);
+
+exit:
+ return rc;
+}
+
+/*
+ * set/get audio stream parameters. The function accepts a list of
+ * parameter key value pairs in the form: key1=value1;key2=value2;...
+ *
+ * Some keys are reserved for standard parameters (See AudioParameter class)
+ *
+ * If the implementation does not accept a parameter change while
+ * the output is active but the parameter is acceptable otherwise, it must
+ * return -ENOSYS.
+ *
+ * The audio flinger will put the stream in standby and then change the
+ * parameter value.
+ */
+int qahw_in_set_parameters(qahw_stream_handle_t *in_handle, const char *kv_pairs)
+{
+ int rc = -EINVAL;
+ qahw_stream_in_t *qahw_stream_in = (qahw_stream_in_t *)in_handle;
+ audio_stream_in_t *in = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_in, STREAM_DIR_IN)) {
+ ALOGV("%s::Invalid in handle %p", __func__, in_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_in->lock);
+ in = qahw_stream_in->stream;
+ if (in->common.set_parameters) {
+ rc = in->common.set_parameters(&in->common, kv_pairs);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_in->lock);
+exit:
+ return rc;
+}
+
+/*
+ * Returns a pointer to a heap allocated string. The caller is responsible
+ * for freeing the memory for it using free().
+ */
+char * qahw_in_get_parameters(const qahw_stream_handle_t *in_handle,
+ const char *keys)
+{
+ char *str_param = NULL;
+ qahw_stream_in_t *qahw_stream_in = (qahw_stream_in_t *)in_handle;
+ audio_stream_in_t *in = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_in, STREAM_DIR_IN)) {
+ ALOGV("%s::Invalid in handle %p", __func__, in_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_in->lock);
+ in = qahw_stream_in->stream;
+ if (in->common.get_parameters) {
+ str_param = in->common.get_parameters(&in->common, keys);
+ } else {
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_in->lock);
+
+exit:
+ return str_param;
+}
+
+/*
+ * Read audio buffer in from audio driver. Returns number of bytes read, or a
+ * negative status_t. If at least one frame was read prior to the error,
+ * read should return that byte count and then return an error in the subsequent call.
+ */
+ssize_t qahw_in_read(qahw_stream_handle_t *in_handle,
+ qahw_in_buffer_t *in_buf)
+{
+ int rc = -EINVAL;
+ qahw_stream_in_t *qahw_stream_in = (qahw_stream_in_t *)in_handle;
+ audio_stream_in_t *in = NULL;
+
+ if ((in_buf == NULL) || (in_buf->buffer == NULL)) {
+ ALOGE("%s::Invalid meta data %p", __func__, in_buf);
+ goto exit;
+ }
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_in, STREAM_DIR_IN)) {
+ ALOGV("%s::Invalid in handle %p", __func__, in_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_in->lock);
+ in = qahw_stream_in->stream;
+ /*TBD:: call HAL timestamp read API*/
+ if (in->read) {
+ rc = in->read(in, in_buf->buffer, in_buf->bytes);
+ in_buf->offset = 0;
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_in->lock);
+
+exit:
+ return rc;
+}
+
+/*
+ * Return the amount of input frames lost in the audio driver since the
+ * last call of this function.
+ * Audio driver is expected to reset the value to 0 and restart counting
+ * upon returning the current value by this function call.
+ * Such loss typically occurs when the user space process is blocked
+ * longer than the capacity of audio driver buffers.
+ *
+ * Unit: the number of input audio frames
+ */
+uint32_t qahw_in_get_input_frames_lost(qahw_stream_handle_t *in_handle)
+{
+ uint32_t rc = 0;
+ qahw_stream_in_t *qahw_stream_in = (qahw_stream_in_t *)in_handle;
+ audio_stream_in_t *in = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_in, STREAM_DIR_IN)) {
+ ALOGV("%s::Invalid in handle %p", __func__, in_handle);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_stream_in->lock);
+ in = qahw_stream_in->stream;
+ if (in->get_input_frames_lost) {
+ rc = in->get_input_frames_lost(in);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_stream_in->lock);
+
+exit:
+ return rc;
+}
+
+/*
+ * Return a recent count of the number of audio frames received and
+ * the clock time associated with that frame count.
+ *
+ * frames is the total frame count received. This should be as early in
+ * the capture pipeline as possible. In general,
+ * frames should be non-negative and should not go "backwards".
+ *
+ * time is the clock MONOTONIC time when frames was measured. In general,
+ * time should be a positive quantity and should not go "backwards".
+ *
+ * The status returned is 0 on success, -ENOSYS if the device is not
+ * ready/available, or -EINVAL if the arguments are null or otherwise invalid.
+ */
+int qahw_in_get_capture_position(const qahw_stream_handle_t *in_handle __unused,
+ int64_t *frames __unused, int64_t *time __unused)
+{
+ /*TBD:: do we need this*/
+ return -ENOSYS;
+}
+
+/*
+ * check to see if the audio hardware interface has been initialized.
+ * returns 0 on success, -ENODEV on failure.
+ */
+int qahw_init_check(const qahw_module_handle_t *hw_module)
+{
+ int rc = -EINVAL;
+ qahw_module_t *qahw_module = (qahw_module_t *)hw_module;
+ qahw_module_t *qahw_module_temp;
+
+ pthread_mutex_lock(&qahw_module_init_lock);
+ qahw_module_temp = get_qahw_module_by_ptr(qahw_module);
+ pthread_mutex_unlock(&qahw_module_init_lock);
+ if (qahw_module_temp == NULL) {
+ ALOGE("%s:: invalid hw module %p", __func__, qahw_module);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_module->lock);
+ if (qahw_module->audio_device->init_check) {
+ rc = qahw_module->audio_device->init_check(qahw_module->audio_device);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_module->lock);
+
+exit:
+ return rc;
+}
+/* set the audio volume of a voice call. Range is between 0.0 and 1.0 */
+int qahw_set_voice_volume(qahw_module_handle_t *hw_module, float volume)
+{
+ int rc = -EINVAL;
+ qahw_module_t *qahw_module = (qahw_module_t *)hw_module;
+ qahw_module_t *qahw_module_temp;
+
+ pthread_mutex_lock(&qahw_module_init_lock);
+ qahw_module_temp = get_qahw_module_by_ptr(qahw_module);
+ pthread_mutex_unlock(&qahw_module_init_lock);
+ if (qahw_module_temp == NULL) {
+ ALOGE("%s:: invalid hw module %p", __func__, qahw_module);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_module->lock);
+ if (qahw_module->audio_device->set_voice_volume) {
+ rc = qahw_module->audio_device->set_voice_volume(qahw_module->audio_device,
+ volume);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_module->lock);
+
+exit:
+ return rc;
+}
+
+/*
+ * set_mode is called when the audio mode changes. AUDIO_MODE_NORMAL mode
+ * is for standard audio playback, AUDIO_MODE_RINGTONE when a ringtone is
+ * playing, and AUDIO_MODE_IN_CALL when a call is in progress.
+ */
+int qahw_set_mode(qahw_module_handle_t *hw_module, audio_mode_t mode)
+{
+ int rc = -EINVAL;
+ qahw_module_t *qahw_module = (qahw_module_t *)hw_module;
+ qahw_module_t *qahw_module_temp;
+
+ pthread_mutex_lock(&qahw_module_init_lock);
+ qahw_module_temp = get_qahw_module_by_ptr(qahw_module);
+ pthread_mutex_unlock(&qahw_module_init_lock);
+ if (qahw_module_temp == NULL) {
+ ALOGE("%s:: invalid hw module %p", __func__, qahw_module);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_module->lock);
+ if (qahw_module->audio_device->set_mode) {
+ rc = qahw_module->audio_device->set_mode(qahw_module->audio_device,
+ mode);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_module->lock);
+
+exit:
+ return rc;
+}
+
+/* set/get global audio parameters */
+int qahw_set_parameters(qahw_module_handle_t *hw_module, const char *kv_pairs)
+{
+ int rc = -EINVAL;
+ qahw_module_t *qahw_module = (qahw_module_t *)hw_module;
+ qahw_module_t *qahw_module_temp;
+ audio_hw_device_t *audio_device;
+
+ pthread_mutex_lock(&qahw_module_init_lock);
+ qahw_module_temp = get_qahw_module_by_ptr(qahw_module);
+ pthread_mutex_unlock(&qahw_module_init_lock);
+ if (qahw_module_temp == NULL) {
+ ALOGE("%s:: invalid hw module %p", __func__, qahw_module);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_module->lock);
+ audio_device = qahw_module->audio_device;
+ if (qahw_module->audio_device->set_parameters) {
+ rc = audio_device->set_parameters(qahw_module->audio_device, kv_pairs);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_module->lock);
+
+exit:
+ return rc;
+}
+
+/*
+ * Returns a pointer to a heap allocated string. The caller is responsible
+ * for freeing the memory for it using free().
+ */
+char * qahw_get_parameters(const qahw_module_handle_t *hw_module,
+ const char *keys)
+{
+ char *str_param = NULL;
+ qahw_module_t *qahw_module = (qahw_module_t *)hw_module;
+ qahw_module_t *qahw_module_temp;
+ audio_hw_device_t *audio_device;
+
+ pthread_mutex_lock(&qahw_module_init_lock);
+ qahw_module_temp = get_qahw_module_by_ptr(qahw_module);
+ pthread_mutex_unlock(&qahw_module_init_lock);
+ if (qahw_module_temp == NULL) {
+ ALOGE("%s:: invalid hw module %p", __func__, qahw_module);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_module->lock);
+ audio_device = qahw_module->audio_device;
+ if (qahw_module->audio_device->get_parameters) {
+ str_param = audio_device->get_parameters(qahw_module->audio_device, keys);
+ } else {
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_module->lock);
+
+exit:
+ return str_param;
+}
+
+/* Returns audio input buffer size according to parameters passed or
+ * 0 if one of the parameters is not supported.
+ * See also get_buffer_size which is for a particular stream.
+ */
+size_t qahw_get_input_buffer_size(const qahw_module_handle_t *hw_module,
+ const struct audio_config *config)
+{
+ size_t rc = 0;
+ qahw_module_t *qahw_module = (qahw_module_t *)hw_module;
+ qahw_module_t *qahw_module_temp;
+ audio_hw_device_t *audio_device;
+
+ pthread_mutex_lock(&qahw_module_init_lock);
+ qahw_module_temp = get_qahw_module_by_ptr(qahw_module);
+ pthread_mutex_unlock(&qahw_module_init_lock);
+ if (qahw_module_temp == NULL) {
+ ALOGE("%s:: invalid hw module %p", __func__, qahw_module);
+ goto exit;
+ }
+
+ pthread_mutex_lock(&qahw_module->lock);
+ audio_device = qahw_module->audio_device;
+ if (qahw_module->audio_device->get_input_buffer_size) {
+ rc = audio_device->get_input_buffer_size(qahw_module->audio_device,
+ config);
+ } else {
+ rc = -ENOSYS;
+ ALOGW("%s not supported", __func__);
+ }
+ pthread_mutex_unlock(&qahw_module->lock);
+
+exit:
+ return rc;
+}
+
+/*
+ * This method creates and opens the audio hardware output stream.
+ * The "address" parameter qualifies the "devices" audio device type if needed.
+ * The format format depends on the device type:
+ * - Bluetooth devices use the MAC address of the device in the form "00:11:22:AA:BB:CC"
+ * - USB devices use the ALSA card and device numbers in the form "card=X;device=Y"
+ * - Other devices may use a number or any other string.
+ */
+int qahw_open_output_stream(qahw_module_handle_t *hw_module,
+ audio_io_handle_t handle,
+ audio_devices_t devices,
+ audio_output_flags_t flags,
+ struct audio_config *config,
+ qahw_stream_handle_t **out_handle,
+ const char *address)
+{
+ int rc = -EINVAL;
+ qahw_module_t *qahw_module = (qahw_module_t *)hw_module;
+ qahw_module_t *qahw_module_temp = NULL;
+ audio_hw_device_t *audio_device = NULL;
+ qahw_stream_out_t *qahw_stream_out = NULL;
+
+ pthread_mutex_lock(&qahw_module_init_lock);
+ qahw_module_temp = get_qahw_module_by_ptr(qahw_module);
+ pthread_mutex_unlock(&qahw_module_init_lock);
+ if (qahw_module_temp == NULL) {
+ ALOGE("%s:: invalid hw module %p", __func__, qahw_module);
+ return rc;
+ }
+
+ pthread_mutex_lock(&qahw_module->lock);
+ audio_device = qahw_module->audio_device;
+ qahw_stream_out = (qahw_stream_out_t *)calloc(1, sizeof(qahw_stream_out_t));
+ if (qahw_stream_out == NULL) {
+ ALOGE("%s:: calloc failed for out stream_out_t",__func__);
+ rc = -ENOMEM;
+ goto exit;
+ }
+
+ rc = audio_device->open_output_stream(audio_device,
+ handle,
+ devices,
+ flags,
+ config,
+ &qahw_stream_out->stream,
+ address);
+ if (rc) {
+ ALOGE("%s::open output stream failed %d",__func__, rc);
+ free(qahw_stream_out);
+ } else {
+ qahw_stream_out->module = hw_module;
+ *out_handle = (void *)qahw_stream_out;
+ pthread_mutex_init(&qahw_stream_out->lock, (const pthread_mutexattr_t *)NULL);
+ list_add_tail(&qahw_module->out_list, &qahw_stream_out->list);
+ }
+
+exit:
+ pthread_mutex_unlock(&qahw_module->lock);
+ return rc;
+}
+
+int qahw_close_output_stream(qahw_stream_handle_t *out_handle)
+{
+
+ int rc = 0;
+ qahw_stream_out_t *qahw_stream_out = (qahw_stream_out_t *)out_handle;
+ qahw_module_t *qahw_module = NULL;
+ audio_hw_device_t *audio_device = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_out, STREAM_DIR_OUT)) {
+ ALOGE("%s::Invalid out handle %p", __func__, out_handle);
+ rc = -EINVAL;
+ goto exit;
+ }
+
+ ALOGV("%s::calling device close_output_stream %p", __func__, out_handle);
+ pthread_mutex_lock(&qahw_stream_out->lock);
+ qahw_module = qahw_stream_out->module;
+ audio_device = qahw_module->audio_device;
+ audio_device->close_output_stream(audio_device,
+ qahw_stream_out->stream);
+
+ pthread_mutex_lock(&qahw_module->lock);
+ list_remove(&qahw_stream_out->list);
+ pthread_mutex_unlock(&qahw_module->lock);
+
+ pthread_mutex_unlock(&qahw_stream_out->lock);
+
+ pthread_mutex_destroy(&qahw_stream_out->lock);
+ free(qahw_stream_out);
+
+exit:
+ return rc;
+}
+
+/* This method creates and opens the audio hardware input stream */
+int qahw_open_input_stream(qahw_module_handle_t *hw_module,
+ audio_io_handle_t handle,
+ audio_devices_t devices,
+ struct audio_config *config,
+ qahw_stream_handle_t **in_handle,
+ audio_input_flags_t flags,
+ const char *address,
+ audio_source_t source)
+{
+ int rc = -EINVAL;
+ qahw_module_t *qahw_module = (qahw_module_t *)hw_module;
+ qahw_module_t *qahw_module_temp = NULL;
+ audio_hw_device_t *audio_device = NULL;
+ qahw_stream_in_t *qahw_stream_in = NULL;
+
+ pthread_mutex_lock(&qahw_module_init_lock);
+ qahw_module_temp = get_qahw_module_by_ptr(qahw_module);
+ pthread_mutex_unlock(&qahw_module_init_lock);
+ if (qahw_module_temp == NULL) {
+ ALOGE("%s:: invalid hw module %p", __func__, qahw_module);
+ return rc;
+ }
+
+ pthread_mutex_lock(&qahw_module->lock);
+ audio_device = qahw_module->audio_device;
+ qahw_stream_in = (qahw_stream_in_t *)calloc(1, sizeof(qahw_stream_in_t));
+ if (qahw_stream_in == NULL) {
+ ALOGE("%s:: calloc failed for in stream_in_t",__func__);
+ rc = -ENOMEM;
+ goto exit;
+ }
+
+ rc = audio_device->open_input_stream(audio_device,
+ handle,
+ devices,
+ config,
+ &qahw_stream_in->stream,
+ flags,
+ address,
+ source);
+ if (rc) {
+ ALOGE("%s::open input stream failed %d",__func__, rc);
+ free(qahw_stream_in);
+ } else {
+ qahw_stream_in->module = hw_module;
+ *in_handle = (void *)qahw_stream_in;
+ pthread_mutex_init(&qahw_stream_in->lock, (const pthread_mutexattr_t *)NULL);
+ list_add_tail(&qahw_module->in_list, &qahw_stream_in->list);
+ }
+
+exit:
+ pthread_mutex_unlock(&qahw_module->lock);
+ return rc;
+}
+
+int qahw_close_input_stream(qahw_stream_handle_t *in_handle)
+{
+ int rc = 0;
+ qahw_stream_in_t *qahw_stream_in = (qahw_stream_in_t *)in_handle;
+ qahw_module_t *qahw_module = NULL;
+ audio_hw_device_t *audio_device = NULL;
+
+ if (!is_valid_qahw_stream((void *)qahw_stream_in, STREAM_DIR_IN)) {
+ ALOGV("%s::Invalid in handle %p", __func__, in_handle);
+ rc = -EINVAL;
+ goto exit;
+ }
+
+ ALOGV("%s:: calling device close_input_stream %p", __func__, in_handle);
+ pthread_mutex_lock(&qahw_stream_in->lock);
+ qahw_module = qahw_stream_in->module;
+ audio_device = qahw_module->audio_device;
+ audio_device->close_input_stream(audio_device,
+ qahw_stream_in->stream);
+
+ pthread_mutex_lock(&qahw_module->lock);
+ list_remove(&qahw_stream_in->list);
+ pthread_mutex_unlock(&qahw_module->lock);
+
+ pthread_mutex_unlock(&qahw_stream_in->lock);
+
+ pthread_mutex_destroy(&qahw_stream_in->lock);
+ free(qahw_stream_in);
+
+exit:
+ return rc;
+}
+
+/*returns current QTI HAL verison */
+int qahw_get_version() {
+ return QAHW_MODULE_API_VERSION_CURRENT;
+}
+
+/* convenience API for opening and closing an audio HAL module */
+
+qahw_module_handle_t *qahw_load_module(const char *hw_module_id)
+{
+ int rc = -EINVAL;
+ qahw_module_handle_t *qahw_mod_handle = NULL;
+ qahw_module_t *qahw_module = NULL;
+ char *ahal_name = NULL;
+ const hw_module_t* module = NULL;
+ audio_hw_device_t* audio_device = NULL;
+
+ if (hw_module_id == NULL) {
+ ALOGE("%s::module id is NULL",__func__);
+ goto exit;
+ }
+
+ if (!strcmp(hw_module_id, QAHW_MODULE_ID_PRIMARY)) {
+ ahal_name = "primary";
+ } else if (!strcmp(hw_module_id, QAHW_MODULE_ID_A2DP)) {
+ ahal_name = "a2dp";
+ } else if (!strcmp(hw_module_id, QAHW_MODULE_ID_USB)) {
+ ahal_name = "usb";
+ } else {
+ ALOGE("%s::Invalid Module id %s", __func__, hw_module_id);
+ goto exit;
+ }
+
+ /* return exiting module ptr if already loaded */
+ pthread_mutex_lock(&qahw_module_init_lock);
+ if (qahw_list_count > 0) {
+ qahw_module = get_qahw_module_by_name(hw_module_id);
+ if(qahw_module != NULL) {
+ qahw_mod_handle = (void *)qahw_module;
+ pthread_mutex_lock(&qahw_module->lock);
+ qahw_module->ref_count++;
+ pthread_mutex_unlock(&qahw_module->lock);
+ goto error_exit;
+ }
+ }
+
+ rc = hw_get_module_by_class(AUDIO_HARDWARE_MODULE_ID, ahal_name, &module);
+ if(rc) {
+ ALOGE("%s::HAL Loading failed %d", __func__, rc);
+ goto error_exit;
+ }
+
+ rc = audio_hw_device_open(module, &audio_device);
+ if(rc) {
+ ALOGE("%s::HAL Device open failed %d", __func__, rc);
+ goto error_exit;
+ }
+
+ qahw_module = (qahw_module_t *)calloc(1, sizeof(qahw_module_t));
+ if(qahw_module == NULL) {
+ ALOGE("%s::calloc failed", __func__);
+ audio_hw_device_close(audio_device);
+ goto error_exit;
+ }
+ ALOGD("%s::Loaded HAL %s module %p", __func__, ahal_name, qahw_module);
+
+ if (!qahw_list_count)
+ list_init(&qahw_module_list);
+ qahw_list_count++;
+
+ pthread_mutex_init(&qahw_module->lock, (const pthread_mutexattr_t *) NULL);
+ pthread_mutex_lock(&qahw_module->lock);
+ qahw_module->ref_count++;
+ pthread_mutex_unlock(&qahw_module->lock);
+
+ list_init(&qahw_module->out_list);
+ list_init(&qahw_module->in_list);
+
+ /* update qahw_module */
+ qahw_module->audio_device = audio_device;
+ strlcpy(&qahw_module->module_name[0], hw_module_id, MAX_MODULE_NAME_LENGTH);
+
+ qahw_mod_handle = (void *)qahw_module;
+
+ /* Add module list to global module list */
+ list_add_tail(&qahw_module_list, &qahw_module->module_list);
+
+
+error_exit:
+ pthread_mutex_unlock(&qahw_module_init_lock);
+
+exit:
+ return qahw_mod_handle;
+}
+
+int qahw_unload_module(qahw_module_handle_t *hw_module)
+{
+ int rc = -EINVAL;
+ bool is_empty = false;
+ qahw_module_t *qahw_module = (qahw_module_t *)hw_module;
+ qahw_module_t *qahw_module_temp = NULL;
+
+ /* close HW device if its valid and all the streams on
+ * it is closed
+ */
+ pthread_mutex_lock(&qahw_module_init_lock);
+ qahw_module_temp = get_qahw_module_by_ptr(qahw_module);
+ if (qahw_module_temp == NULL) {
+ ALOGE("%s:: invalid hw module %p", __func__, qahw_module);
+ goto error_exit;
+ }
+
+ pthread_mutex_lock(&qahw_module->lock);
+ qahw_module->ref_count--;
+ if (qahw_module->ref_count > 0) {
+ rc = 0;
+ ALOGE("%s:: skipping module unload of %p count %d", __func__,
+ qahw_module,
+ qahw_module->ref_count);
+ pthread_mutex_unlock(&qahw_module->lock);
+ goto error_exit;
+ }
+
+ is_empty = (list_empty(&qahw_module->out_list) &&
+ list_empty(&qahw_module->in_list));
+ if (is_empty) {
+ rc = audio_hw_device_close(qahw_module->audio_device);
+ if(rc) {
+ ALOGE("%s::HAL Device close failed Error %d Module %p",__func__,
+ rc, qahw_module);
+ rc = 0;
+ }
+ qahw_list_count--;
+ list_remove(&qahw_module->module_list);
+ pthread_mutex_unlock(&qahw_module->lock);
+ pthread_mutex_destroy(&qahw_module->lock);
+ free(qahw_module);
+ } else {
+ pthread_mutex_unlock(&qahw_module->lock);
+ ALOGE("%s::failed as all the streams on this module"
+ "is not closed", __func__);
+ rc = -EINVAL;
+ }
+
+error_exit:
+ pthread_mutex_unlock(&qahw_module_init_lock);
+
+exit:
+ return rc;
+}
+
+__END_DECLS
diff --git a/qahw_api/test/Android.mk b/qahw_api/test/Android.mk
new file mode 100644
index 0000000..1688069
--- /dev/null
+++ b/qahw_api/test/Android.mk
@@ -0,0 +1,40 @@
+LOCAL_PATH := $(call my-dir)
+
+# audio_hal_playback_test
+# ==============================================================================
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := qahw_playback_test.c
+LOCAL_MODULE := hal_play_test
+
+hal-play-inc = $(TARGET_OUT_HEADERS)/mm-audio/qahw_api/inc
+
+LOCAL_CFLAGS += -Wall -Werror -Wno-sign-compare
+
+LOCAL_SHARED_LIBRARIES := \
+ libaudioutils\
+ libqahw \
+ libutils
+
+LOCAL_32_BIT_ONLY := true
+
+LOCAL_C_INCLUDES += $(hal-play-inc)
+
+include $(BUILD_EXECUTABLE)
+
+# audio_hal_multi_record_test
+# ==============================================================================
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := qahw_multi_record_test.c
+LOCAL_MODULE := hal_rec_test
+LOCAL_CFLAGS += -Wall -Werror -Wno-sign-compare
+LOCAL_SHARED_LIBRARIES := \
+ libaudioutils \
+ libqahw \
+ libutils
+
+LOCAL_32_BIT_ONLY := true
+
+hal-rec-inc = $(TARGET_OUT_HEADERS)/mm-audio/qahw_api/inc
+
+LOCAL_C_INCLUDES += $(hal-rec-inc)
+include $(BUILD_EXECUTABLE)
diff --git a/qahw_api/test/qahw_multi_record_test.c b/qahw_api/test/qahw_multi_record_test.c
new file mode 100644
index 0000000..07dede7
--- /dev/null
+++ b/qahw_api/test/qahw_multi_record_test.c
@@ -0,0 +1,488 @@
+/*
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ * Not a Contribution.
+ *
+ * Copyright (C) 2015 The Android Open Source Project *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* Test app to record multiple audio sessions at the HAL layer */
+
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <pthread.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "qahw_api.h"
+#include "qahw_defs.h"
+
+struct audio_config_params {
+ qahw_module_handle_t *qahw_mod_handle;
+ audio_io_handle_t handle;
+ audio_devices_t input_device;
+ audio_config_t config;
+ audio_input_flags_t flags;
+ const char* kStreamName ;
+ audio_source_t kInputSource;
+ char output_filename[256];
+ double loopTime;
+ char profile[50];
+};
+
+#define SOUNDFOCUS_PARAMS "SoundFocus.start_angles;SoundFocus.enable_sectors;" \
+ "SoundFocus.gain_step"
+#define SOURCETRACK_PARAMS "SourceTrack.vad;SourceTrack.doa_speech;SourceTrack.doa_noise;"\
+ "SourceTrack.polar_activity;ssr.noise_level;ssr.noise_level_after_ns"
+int sourcetrack_done = 0;
+static pthread_mutex_t glock;
+pthread_cond_t gcond;
+int tests_running;
+bool gerror;
+
+void *read_sourcetrack_data(void* data)
+{
+ char kvpair_soundfocus[200] = SOUNDFOCUS_PARAMS;
+ char kvpair_sourcetrack[200] = SOURCETRACK_PARAMS;
+ char *string = NULL;
+ char *token = NULL;
+ char choice = '\0';
+ int i =0;
+ qahw_module_handle_t *qawh_module_handle =
+ (qahw_module_handle_t *)data;
+
+ while (1) {
+ printf("\nGet SoundFocus Params from app");
+ string = qahw_get_parameters(qawh_module_handle, kvpair_soundfocus);
+ if (!string) {
+ printf("Error.Failed Get SoundFocus Params\n");
+ } else {
+ token = strtok (string , "=");
+ while (token) {
+ if (*token == 'S') {
+ choice = *(token + 11);
+ token = strtok (NULL,",;");
+ i=0;
+ }
+ switch (choice) {
+ case 'g':
+ printf ("\nSoundFocus.gain_step=%s",token);
+ break;
+ case 'e':
+ printf ("\nSoundFocus.enable_sectors[%d]=%s",i,token);
+ i++;
+ break;
+ case 's':
+ printf ("\nSoundFocus.start_angles[%d]=%s",i,token);
+ i++;
+ break;
+ }
+ token = strtok (NULL,",;=");
+ }
+ }
+ choice = '\0';
+ printf ("\nGet SourceTracking Params from app");
+ string = qahw_get_parameters(qawh_module_handle, kvpair_sourcetrack);
+ if (!string) {
+ printf ("Error.Failed Get SourceTrack Params\n");
+ } else {
+ token = strtok (string , "=");
+ while (token) {
+ if (*token == 'S') {
+ choice = *(token + 12);
+ if (choice == 'd')
+ choice = *(token + 16);
+ token = strtok (NULL,",;");
+ i=0;
+ }
+ switch (choice) {
+ case 'p':
+ printf ("\nSourceTrack.polar_activity=%s,",token);
+ choice = '\0';
+ break;
+ case 'v':
+ printf ("\nSourceTrack.vad[%d]=%s",i,token);
+ i++;
+ break;
+ case 's':
+ printf ("\nSourceTrack.doa_speech=%s",token);
+ break;
+ case 'n':
+ printf ("\nSourceTrack.doa_noise[%d]=%s",i,token);
+ i++;
+ break;
+ default :
+ printf ("%s,",token);
+ break;
+ }
+ token = strtok (NULL,",;=");
+ }
+ }
+ if (sourcetrack_done == 1)
+ return NULL;
+ }
+}
+
+void *start_input(void *thread_param)
+{
+ int rc = 0;
+ struct audio_config_params* params = (struct audio_config_params*) thread_param;
+ qahw_module_handle_t *qahw_mod_handle = params->qahw_mod_handle;
+
+ // Open audio input stream.
+ qahw_stream_handle_t* in_handle = NULL;
+
+ rc = qahw_open_input_stream(qahw_mod_handle,
+ params->handle, params->input_device,
+ ¶ms->config, &in_handle,
+ params->flags, params->kStreamName,
+ params->kInputSource);
+ if (rc) {
+ printf("ERROR :::: Could not open input stream.\n" );
+ pthread_mutex_lock(&glock);
+ gerror = true;
+ pthread_cond_signal(&gcond);
+ pthread_mutex_unlock(&glock);
+ pthread_exit(0);
+ }
+
+ // Get buffer size to get upper bound on data to read from the HAL.
+ size_t buffer_size;
+ buffer_size = qahw_in_get_buffer_size(in_handle);
+ char *buffer;
+ buffer = (char *)calloc(1, buffer_size);
+ if (buffer == NULL) {
+ printf("calloc failed!!\n");
+ pthread_mutex_lock(&glock);
+ gerror = true;
+ pthread_cond_signal(&gcond);
+ pthread_mutex_unlock(&glock);
+ pthread_exit(0);
+ }
+
+ printf("input opened, buffer = %p, size %zun",
+ buffer, buffer_size);
+
+ int num_channels = audio_channel_count_from_in_mask(params->config.channel_mask);
+
+ time_t start_time = time(0);
+ ssize_t bytes_read = -1;
+ char param[100] = "audio_stream_profile=";
+ qahw_in_buffer_t in_buf;
+
+ // set profile for the recording session
+ strlcat(param, params->profile, sizeof(param));
+ qahw_in_set_parameters(in_handle, param);
+
+ printf("\nPlease speak into the microphone for %lf seconds.\n", params->loopTime);
+
+ FILE *fd = fopen(params->output_filename,"w");
+ if (fd == NULL) {
+ printf("File open failed \n");
+ pthread_mutex_lock(&glock);
+ gerror = true;
+ pthread_cond_signal(&gcond);
+ pthread_mutex_unlock(&glock);
+ pthread_exit(0);
+ }
+ pthread_mutex_lock(&glock);
+ tests_running++;
+ pthread_cond_signal(&gcond);
+ pthread_mutex_unlock(&glock);
+ memset(&in_buf,0, sizeof(qahw_in_buffer_t));
+
+ while(true) {
+ in_buf.buffer = buffer;
+ in_buf.bytes = buffer_size;
+ bytes_read = qahw_in_read(in_handle, &in_buf);
+ fwrite(in_buf.buffer, sizeof(char), buffer_size, fd);
+ if(difftime(time(0), start_time) > params->loopTime) {
+ printf("\nTest completed.\n");
+ break;
+ }
+ }
+
+ printf("closing input");
+
+ // Close output stream and device.
+ rc = qahw_in_standby(in_handle);
+ if (rc) {
+ printf("out standby failed %d \n",rc);
+ }
+
+ rc = qahw_close_input_stream(in_handle);
+ if (rc) {
+ printf("could not close input stream %d \n",rc);
+ }
+
+ // Print instructions to access the file.
+ printf("\nThe audio recording has been saved to %s. Please use adb pull to get "
+ "the file and play it using audacity. The audio data has the "
+ "following characteristics:\nsample rate: %i\nformat: %d\n"
+ "num channels: %i\n",
+ params->output_filename, params->config.sample_rate,
+ params->config.format, num_channels);
+
+ pthread_mutex_lock(&glock);
+ tests_running--;
+ pthread_cond_signal(&gcond);
+ pthread_mutex_unlock(&glock);
+ pthread_exit(0);
+ return NULL;
+}
+
+int read_config_params_from_user(struct audio_config_params *thread_param, int rec_session) {
+ int channels = 0, format = 0, sample_rate = 0,source = 0, device = 0;
+
+ thread_param->kStreamName = "input_stream";
+
+ printf(" \n Enter input device (4->built-in mic, 16->wired_headset .. etc) ::::: ");
+ scanf(" %d", &device);
+ if (device & AUDIO_DEVICE_IN_BUILTIN_MIC)
+ thread_param->input_device = AUDIO_DEVICE_IN_BUILTIN_MIC;
+ else if (device & AUDIO_DEVICE_IN_WIRED_HEADSET)
+ thread_param->input_device = AUDIO_DEVICE_IN_WIRED_HEADSET;
+
+ printf(" \n Enter the channels (1 -mono, 2 -stereo and 4 -quad channels) ::::: ");
+ scanf(" %d", &channels);
+ if (channels == 1) {
+ thread_param->config.channel_mask = AUDIO_CHANNEL_IN_MONO;
+ } else if (channels == 2) {
+ thread_param->config.channel_mask = AUDIO_CHANNEL_IN_STEREO;
+ } else if (channels == 4) {
+ thread_param->config.channel_mask = AUDIO_CHANNEL_INDEX_MASK_4;
+ } else {
+ gerror = true;
+ printf("\nINVALID channels");
+ return -1;
+ }
+
+ printf(" \n Enter the format (16 - 16 bit recording, 24 - 24 bit recording) ::::: ");
+ scanf(" %d", &format);
+ if (format == 16) {
+ thread_param->config.format = AUDIO_FORMAT_PCM_16_BIT;
+ } else if (format == 24) {
+ thread_param->config.format = AUDIO_FORMAT_PCM_24_BIT_PACKED;
+ } else {
+ gerror = true;
+ printf("\n INVALID format");
+ return -1;
+ }
+
+ printf(" \n Enter the sample rate (48000, 16000 etc) :::: ");
+ scanf(" %d", &sample_rate);
+ thread_param->config.sample_rate = sample_rate;
+
+#ifdef MULTIRECORD_SUPPOT
+ printf(" \n Enter profile (none, record_fluence, record_mec, record_unprocessed etc) :::: ");
+ scanf(" %s", thread_param->profile);
+#else
+ thread_param->flags = (audio_input_flags_t)AUDIO_INPUT_FLAG_NONE;
+#endif
+ printf("\n Enter the audio source ( ref: system/media/audio/include/system/audio.h) :::: ");
+ scanf(" %d", &source);
+ thread_param->kInputSource = (audio_source_t)source;
+
+ if (rec_session == 1) {
+ thread_param->handle = 0x999;
+ strcpy(thread_param->output_filename, "/data/rec1.raw");
+ } else if (rec_session == 2) {
+ thread_param->handle = 0x998;
+ strcpy(thread_param->output_filename, "/data/rec2.raw");
+ } else if (rec_session == 3) {
+ thread_param->handle = 0x997;
+ strcpy(thread_param->output_filename, "/data/rec3.raw");
+ } else if (rec_session == 4) {
+ thread_param->handle = 0x996;
+ strcpy(thread_param->output_filename, "/data/rec4.raw");
+ }
+
+ printf("\n Enter the record duration in seconds :::: ");
+ scanf(" %lf", &thread_param->loopTime);
+ return 0;
+}
+
+int main() {
+ int max_recordings_requested = 0, source_track = 0;
+ int thread_active[4] = {0};
+ qahw_module_handle_t *qahw_mod_handle;
+ const char *mod_name = "audio.primary";
+
+ pthread_cond_init(&gcond, (const pthread_condattr_t *) NULL);
+
+ qahw_mod_handle = qahw_load_module(mod_name);
+ if(qahw_mod_handle == NULL) {
+ printf(" qahw_load_module failed");
+ return -1;
+ }
+#ifdef MULTIRECORD_SUPPOT
+ printf("Starting audio hal multi recording test. \n");
+ printf(" Enter number of record sessions to be started \n");
+ printf(" (Maximum of 4 record sessions are allowed):::: ");
+ scanf(" %d", &max_recordings_requested);
+#else
+ max_recordings_requested = 1;
+#endif
+ printf(" \n Source Tracking enabled ??? ( 1 - Enable 0 - Disable)::: ");
+ scanf(" %d", &source_track);
+
+ struct audio_config_params thread1_params, thread2_params;
+ struct audio_config_params thread3_params, thread4_params;
+
+ switch (max_recordings_requested) {
+ case 4:
+ printf(" Enter the config params for fourth record session \n");
+ thread4_params.qahw_mod_handle = qahw_mod_handle;
+ read_config_params_from_user( &thread4_params, 4);
+ thread_active[3] = 1;
+ printf(" \n");
+ case 3:
+ printf(" Enter the config params for third record session \n");
+ thread3_params.qahw_mod_handle = qahw_mod_handle;
+ read_config_params_from_user( &thread3_params, 3);
+ thread_active[2] = 1;
+ printf(" \n");
+ case 2:
+ printf(" Enter the config params for second record session \n");
+ thread2_params.qahw_mod_handle = qahw_mod_handle;
+ read_config_params_from_user( &thread2_params, 2);
+ thread_active[1] = 1;
+ printf(" \n");
+ case 1:
+ printf(" Enter the config params for first record session \n");
+ thread1_params.qahw_mod_handle = qahw_mod_handle;
+ read_config_params_from_user( &thread1_params, 1);
+ thread_active[0] = 1;
+ printf(" \n");
+ break;
+ default:
+ printf(" INVALID input -- Max record sessions supported is 4 -exit \n");
+ gerror = true;
+ break;
+ }
+
+ pthread_t tid[4];
+ pthread_t sourcetrack_thread;
+ int ret = -1;
+
+ if (thread_active[0] == 1) {
+ printf("\n Create first record thread \n");
+ ret = pthread_create(&tid[0], NULL, start_input, (void *)&thread1_params);
+ if (ret) {
+ gerror = true;
+ printf(" Failed to create first record thread \n ");
+ thread_active[0] = 0;
+ }
+ }
+ if (thread_active[1] == 1) {
+ printf("Create second record thread \n");
+ ret = pthread_create(&tid[1], NULL, start_input, (void *)&thread2_params);
+ if (ret) {
+ gerror = true;
+ printf(" Failed to create second record thread \n ");
+ thread_active[1] = 0;
+ }
+ }
+ if (thread_active[2] == 1) {
+ printf("Create third record thread \n");
+ ret = pthread_create(&tid[2], NULL, start_input, (void *)&thread3_params);
+ if (ret) {
+ gerror = true;
+ printf(" Failed to create third record thread \n ");
+ thread_active[2] = 0;
+ }
+ }
+ if (thread_active[3] == 1) {
+ printf("Create fourth record thread \n");
+ ret = pthread_create(&tid[3], NULL, start_input, (void *)&thread4_params);
+ if (ret) {
+ gerror = true;
+ printf(" Failed to create fourth record thread \n ");
+ thread_active[3] = 0;
+ }
+ }
+ if (source_track && max_recordings_requested) {
+ printf("Create source tracking thread \n");
+ ret = pthread_create(&sourcetrack_thread,
+ NULL, read_sourcetrack_data,
+ (void *)qahw_mod_handle);
+ if (ret) {
+ printf(" Failed to create source tracking thread \n ");
+ source_track = 0;
+ }
+ }
+
+ // set bad mic param
+ while (max_recordings_requested && !source_track) {
+ bool test_completed = false;
+
+ pthread_mutex_lock(&glock);
+ if (!tests_running && !gerror)
+ pthread_cond_wait(&gcond, &glock);
+ test_completed = (tests_running == 0);
+ gerror = true;
+ pthread_mutex_unlock(&glock);
+
+ if (test_completed)
+ break;
+#ifdef MULTIRECORD_SUPPOT
+ char ch;
+ printf("\n Bad mic test required (y/n):::");
+ scanf(" %c", &ch);
+ if (ch == 'y' || ch == 'Y') {
+ int bad_mic_ch_index, ret;
+ char param[100] = "bad_mic_channel_index=";
+ printf("\nEnter bad mic channel index (1, 2, 4 ...):::");
+ scanf(" %d", &bad_mic_ch_index);
+ snprintf(param, sizeof(param), "%s%d", param, bad_mic_ch_index);
+ ret = qahw_set_parameters(qahw_mod_handle, param);
+ printf("param %s set to hal with return value %d\n", param, ret);
+ } else {
+ break;
+ }
+#endif
+ }
+
+ printf(" Waiting for threads exit \n");
+ if (thread_active[0] == 1) {
+ pthread_join(tid[0], NULL);
+ printf("after first record thread exit \n");
+ }
+ if (thread_active[1] == 1) {
+ pthread_join(tid[1], NULL);
+ printf("after second record thread exit \n");
+ }
+ if (thread_active[2] == 1) {
+ pthread_join(tid[2], NULL);
+ printf("after third record thread exit \n");
+ }
+ if (thread_active[3] == 1) {
+ pthread_join(tid[3], NULL);
+ printf("after fourth record thread exit \n");
+ }
+ if (source_track) {
+ sourcetrack_done = 1;
+ pthread_join(sourcetrack_thread,NULL);
+ printf("after source tracking thread exit \n");
+ }
+
+ ret = qahw_unload_module(qahw_mod_handle);
+ if (ret) {
+ printf("could not unload hal %d \n",ret);
+ }
+
+
+ printf("Done with hal record test \n");
+ pthread_cond_destroy(&gcond);
+ return 0;
+}
diff --git a/qahw_api/test/qahw_playback_test.c b/qahw_api/test/qahw_playback_test.c
new file mode 100644
index 0000000..f334719
--- /dev/null
+++ b/qahw_api/test/qahw_playback_test.c
@@ -0,0 +1,488 @@
+/*
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ * Not a Contribution.
+ *
+ * Copyright (C) 2015 The Android Open Source Project *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* Test app to play audio at the HAL layer */
+
+#include <getopt.h>
+#include <pthread.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include "qahw_api.h"
+#include "qahw_defs.h"
+
+#define nullptr NULL
+FILE * log_file = NULL;
+const char *log_filename = NULL;
+float vol_level = 0.01;
+
+enum {
+ FILE_WAV = 1,
+ FILE_MP3,
+ FILE_AAC,
+ FILE_AAC_ADTS
+};
+
+typedef enum {
+ AAC_LC = 1,
+ AAC_HE_V1,
+ AAC_HE_V2
+} aac_format_type_t;
+
+static pthread_mutex_t write_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t write_cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t drain_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t drain_cond = PTHREAD_COND_INITIALIZER;
+
+
+int async_callback(qahw_stream_callback_event_t event, void *param,
+ void *cookie)
+{
+ switch (event) {
+ case QAHW_STREAM_CBK_EVENT_WRITE_READY:
+ fprintf(log_file, "QAHW_STREAM_CBK_EVENT_DRAIN_READY\n");
+ pthread_mutex_lock(&write_lock);
+ pthread_cond_signal(&write_cond);
+ pthread_mutex_unlock(&write_lock);
+ break;
+ case QAHW_STREAM_CBK_EVENT_DRAIN_READY:
+ fprintf(log_file, "QAHW_STREAM_CBK_EVENT_DRAIN_READY\n");
+ pthread_mutex_lock(&drain_lock);
+ pthread_cond_signal(&drain_cond);
+ pthread_mutex_unlock(&drain_lock);
+ default:
+ break;
+ }
+ return 0;
+}
+
+
+int write_to_hal(qahw_stream_handle_t* out_handle, char *data,
+ size_t bytes)
+{
+ ssize_t ret;
+ pthread_mutex_lock(&write_lock);
+ qahw_out_buffer_t out_buf;
+
+ memset(&out_buf,0, sizeof(qahw_out_buffer_t));
+ out_buf.buffer = data;
+ out_buf.bytes = bytes;
+
+ ret = qahw_out_write(out_handle, &out_buf);
+ if (ret < 0 || ret == bytes) {
+ fprintf(log_file, "Writing data to hal failed or full write %ld, %ld\n",
+ ret, bytes);
+ } else if (ret != bytes) {
+ fprintf(log_file, "ret %ld, bytes %ld\n", ret, bytes);
+ fprintf(log_file, "Waiting for event write ready\n");
+ pthread_cond_wait(&write_cond, &write_lock);
+ fprintf(log_file, "out of wait for event write ready\n");
+ }
+
+ pthread_mutex_unlock(&write_lock);
+ return ret;
+}
+
+
+/* Play audio from a WAV file.
+ *
+ * Parameters:
+ * out_stream: A pointer to the output audio stream.
+ * in_file: A pointer to a SNDFILE object.
+ * config: A pointer to struct that contains audio configuration data.
+ *
+ * Returns: An int which has a non-negative number on success.
+ */
+
+int play_file(qahw_stream_handle_t* out_handle, FILE* in_file,
+ bool is_offload) {
+ int rc = 0;
+ int offset = 0;
+ size_t bytes_wanted = 0;
+ size_t write_length = 0;
+ size_t bytes_remaining = 0;
+ size_t bytes_written = 0;
+ size_t bytes_read = 0;
+ char *data = NULL;
+ qahw_out_buffer_t out_buf;
+ bool exit = false;
+
+ if (is_offload) {
+ fprintf(log_file, "Set callback for offload stream\n");
+ qahw_out_set_callback(out_handle, async_callback, NULL);
+ }
+
+ rc = qahw_out_set_volume(out_handle, vol_level, vol_level);
+ if (rc < 0)
+ fprintf(log_file, "unable to set volume");
+
+ bytes_wanted = qahw_out_get_buffer_size(out_handle);
+ data = (char *) malloc (bytes_wanted);
+ if (data == NULL) {
+ fprintf(log_file, "calloc failed!!\n");
+ return -ENOMEM;
+ }
+
+ while (!exit) {
+ if (!bytes_remaining) {
+ bytes_read = fread(data, 1, bytes_wanted, in_file);
+ fprintf(log_file, "fread from file %ld\n", bytes_read);
+ if (bytes_read <= 0) {
+ if (feof(in_file)) {
+ fprintf(log_file, "End of file");
+ if (is_offload) {
+ pthread_mutex_lock(&drain_lock);
+ if (is_offload) {
+ qahw_out_drain(out_handle, QAHW_DRAIN_ALL);
+ pthread_cond_wait(&drain_cond, &drain_lock);
+ fprintf(log_file, "Out of compress drain\n");
+ }
+ pthread_mutex_unlock(&drain_lock);
+ }
+ } else {
+ fprintf(log_file, "Error in fread --%d\n", ferror(in_file));
+ fprintf(stderr, "Error in fread --%d\n", ferror(in_file));
+ }
+ exit = true;
+ continue;
+ }
+ bytes_remaining = write_length = bytes_read;
+ }
+
+ offset = write_length - bytes_remaining;
+ fprintf(log_file, "bytes_remaining %ld, offset %d, write length %ld\n",
+ bytes_remaining, offset, write_length);
+ bytes_written = write_to_hal(out_handle, data+offset, bytes_remaining);
+ bytes_remaining -= bytes_written;
+ fprintf(log_file, "bytes_written %ld, bytes_remaining %ld\n",
+ bytes_written, bytes_remaining);
+ }
+
+ return rc;
+}
+
+bool is_valid_aac_format_type(aac_format_type_t format_type)
+{
+ bool valid_format_type = false;
+
+ switch (format_type) {
+ case AAC_LC:
+ case AAC_HE_V1:
+ case AAC_HE_V2:
+ valid_format_type = true;
+ break;
+ default:
+ break;
+ }
+ return valid_format_type;
+}
+
+/*
+ * Obtain aac format (refer audio.h) for format type entered.
+ */
+
+audio_format_t get_aac_format(int filetype, aac_format_type_t format_type)
+{
+ audio_format_t aac_format = AUDIO_FORMAT_AAC_ADTS_LC; /* default aac frmt*/
+
+ if (filetype == FILE_AAC_ADTS) {
+ switch (format_type) {
+ case AAC_LC:
+ aac_format = AUDIO_FORMAT_AAC_ADTS_LC;
+ break;
+ case AAC_HE_V1:
+ aac_format = AUDIO_FORMAT_AAC_ADTS_HE_V1;
+ break;
+ case AAC_HE_V2:
+ aac_format = AUDIO_FORMAT_AAC_ADTS_HE_V2;
+ break;
+ default:
+ break;
+ }
+ } else if (filetype == FILE_AAC) {
+ switch (format_type) {
+ case AAC_LC:
+ aac_format = AUDIO_FORMAT_AAC_LC;
+ break;
+ case AAC_HE_V1:
+ aac_format = AUDIO_FORMAT_AAC_HE_V1;
+ break;
+ case AAC_HE_V2:
+ aac_format = AUDIO_FORMAT_AAC_HE_V2;
+ break;
+ default:
+ break;
+ }
+ } else {
+ fprintf(log_file, "Invalid filetype provided %d\n", filetype);
+ fprintf(stderr, "Invalid filetype provided %d\n", filetype);
+ }
+
+ fprintf(log_file, "aac format %d\n", aac_format);
+ return aac_format;
+}
+
+void usage() {
+ printf(" \n Command \n");
+ printf(" \n hal_play_test <file path> - path of file to be played\n");
+ printf(" \n Options\n");
+ printf(" -r --sample-rate <sampling rate> - Required for Non-WAV streams\n");
+ printf(" For AAC-HE pls specify half the sample rate\n\n");
+ printf(" -c --channel count <channels> - Required for Non-WAV streams\n\n");
+ printf(" -v --volume <float volume level> - Volume level float value between 0.0 - 1.0.\n");
+ printf(" -d --device <decimal value> - see system/media/audio/include/system/audio.h for device values\n");
+ printf(" Optional Argument and Default value is 2, i.e Speaker\n\n");
+ printf(" -t --file-type <file type> - 1:WAV 2:MP3 3:AAC 4:AAC_ADTS\n");
+ printf(" Required for non WAV formats\n\n");
+ printf(" -a --aac-type <aac type> - Required for AAC streams\n");
+ printf(" 1: LC 2: HE_V1 3: HE_V2\n\n");
+ printf(" -l --log-file <FILEPATH> - File path for debug msg, to print\n");
+ printf(" on console use stdout or 1 \n\n");
+ printf(" \n Examples \n");
+ printf(" hal_play_test /etc/Anukoledenadu.wav -> plays Wav stream with default params\n\n");
+ printf(" hal_play_test /etc/MateRani.mp3 -t 2 -d 2 -v 0.01 -r 44100 -c 2 \n");
+ printf(" -> plays MP3 stream(-t = 2) on speaker device(-d = 2)\n");
+ printf(" -> 2 channels and 44100 sample rate\n\n");
+ printf(" hal_play_test /etc/AACLC-71-48000Hz-384000bps.aac -t 4 -d 2 -v 0.05 -r 48000 -c 2 -a 1 \n");
+ printf(" -> plays AAC-ADTS stream(-t = 4) on speaker device(-d = 2)\n");
+ printf(" -> AAC format type is LC(-a = 1)\n");
+ printf(" -> 2 channels and 48000 sample rate\n\n");
+ printf(" hal_play_test /etc/AACHE-adts-stereo-32000KHz-128000Kbps.aac -t 4 -d 2 -v 0.05 -r 16000 -c 2 -a 3 \n");
+ printf(" -> plays AAC-ADTS stream(-t = 4) on speaker device(-d = 2)\n");
+ printf(" -> AAC format type is HE V2(-a = 3)\n");
+ printf(" -> 2 channels and 16000 sample rate\n");
+ printf(" -> note that the sample rate is half the actual sample rate\n\n");
+}
+
+int main(int argc, char* argv[]) {
+
+ FILE *file_stream = NULL;
+ char header[44] = {0};
+ char* filename = nullptr;
+ qahw_module_handle_t *qahw_mod_handle;
+ const char *mod_name = "audio.primary";
+ qahw_stream_handle_t* out_handle = nullptr;
+ int rc = 0;
+
+ /*
+ * Default values
+ */
+ int filetype = FILE_WAV;
+ int sample_rate = 44100;
+ int channels = 2;
+ const int audio_device_base = 0x2;/* spkr device*/
+ aac_format_type_t format_type = AAC_LC;
+ log_file = stdout;
+ audio_devices_t output_device = AUDIO_DEVICE_OUT_SPEAKER;
+
+ struct option long_options[] = {
+ /* These options set a flag. */
+ {"device", required_argument, 0, 'd'},
+ {"sample-rate", required_argument, 0, 'r'},
+ {"channels", required_argument, 0, 'c'},
+ {"volume", required_argument, 0, 'v'},
+ {"log-file", required_argument, 0, 'l'},
+ {"file-type", required_argument, 0, 't'},
+ {"aac-type", required_argument, 0, 'a'},
+ {"help", no_argument, 0, 'h'},
+ {0, 0, 0, 0}
+ };
+
+ int opt = 0;
+ int option_index = 0;
+ while ((opt = getopt_long(argc,
+ argv,
+ "-r:c:d:v:l::t:a:h",
+ long_options,
+ &option_index)) != -1) {
+ switch (opt) {
+ case 'r':
+ sample_rate = atoi(optarg);
+ break;
+ case 'c':;
+ channels = atoi(optarg);
+ break;
+ case 'd':
+ output_device = atoi(optarg);
+ break;
+ case 'v':
+ vol_level = atof(optarg);
+ break;
+ case 'l':
+ /*
+ * Fix Me: unable to log to a given file.
+ */
+ log_filename = optarg;
+ if((log_file = fopen(log_filename,"wb"))== NULL) {
+ fprintf(stderr, "Cannot open log file %s\n", log_filename);
+ /*
+ * continue to log to std out.
+ */
+ log_file = stdout;
+ }
+
+ break;
+ case 't':
+ filetype = atoi(optarg);
+ break;
+ case 'a':
+ format_type = atoi(optarg);
+ break;
+ case 'h':
+ usage();
+ return 0;
+ break;
+ }
+ }
+
+ filename = argv[1];
+ if((file_stream = fopen(filename, "r"))== NULL) {
+ fprintf(stderr, "Cannot Open Audio File %s\n", filename);
+ goto EXIT;
+ }
+
+ /*
+ * Set to a high number so it doesn't interfere with existing stream handles
+ */
+
+ audio_io_handle_t handle = 0x999;
+ audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD;
+
+ fprintf(stdout, "Playing:%s\n", filename);
+ fprintf(stdout, "File Type:%d\n", filetype);
+ fprintf(stdout, "Sample Rate:%d\n", sample_rate);
+ fprintf(stdout, "Channels:%d\n", channels);
+ fprintf(stdout, "Log file:%s\n", log_filename);
+ fprintf(stdout, "Volume level:%f\n", vol_level);
+ fprintf(stdout, "Output Device:%d\n", output_device);
+ fprintf(stdout, "Format Type:%d\n", format_type);
+
+ fprintf(stdout, "Starting audio hal tests.\n");
+
+ qahw_mod_handle = qahw_load_module(mod_name);
+
+ audio_config_t config;
+ memset(&config, 0, sizeof(audio_config_t));
+
+ switch (filetype) {
+ case FILE_WAV:
+ /*
+ * Read the wave header
+ */
+ rc = fread (header, 44 , 1, file_stream);
+ if (rc != 1) {
+ fprintf(stdout, "Error .Fread failed\n");
+ exit(0);
+ }
+ if (strncmp (header, "RIFF", 4) && strncmp (header+8, "WAVE", 4)) {
+ fprintf(stdout, "Not a wave format\n");
+ exit (1);
+ }
+ memcpy (&channels, &header[22], 2);
+ memcpy (&sample_rate, &header[24], 4);
+ config.channel_mask = audio_channel_out_mask_from_count(channels);
+ config.offload_info.channel_mask = config.channel_mask;
+ config.offload_info.sample_rate = sample_rate;
+ config.offload_info.format = AUDIO_FORMAT_PCM_16_BIT;
+ break;
+
+ case FILE_MP3:
+ config.channel_mask = audio_channel_out_mask_from_count(channels);
+ config.offload_info.channel_mask = config.channel_mask;
+ config.sample_rate = sample_rate;
+ config.offload_info.sample_rate = sample_rate;
+ config.offload_info.format = AUDIO_FORMAT_MP3;
+ flags |= AUDIO_OUTPUT_FLAG_NON_BLOCKING;
+ break;
+
+ case FILE_AAC:
+ case FILE_AAC_ADTS:
+ config.channel_mask = audio_channel_out_mask_from_count(channels);
+ config.offload_info.channel_mask = config.channel_mask;
+ config.sample_rate = sample_rate;
+ config.offload_info.sample_rate = sample_rate;
+ if (!is_valid_aac_format_type(format_type)) {
+ fprintf(log_file, "Invalid format type for AAC %d\n", format_type);
+ goto EXIT;
+ }
+ config.offload_info.format = get_aac_format(filetype, format_type);
+ flags |= AUDIO_OUTPUT_FLAG_NON_BLOCKING;
+ break;
+
+
+ default:
+ fprintf(stderr, "Does not support given filetype\n");
+ usage();
+ return 0;
+ }
+ config.offload_info.version = AUDIO_OFFLOAD_INFO_VERSION_CURRENT;
+ config.offload_info.size = sizeof(audio_offload_info_t);
+
+ fprintf(log_file, "Now playing to output_device=%d sample_rate=%d \n"
+ , output_device, config.offload_info.sample_rate);
+ const char* stream_name = "output_stream";
+
+ fprintf(log_file, "calling open_out_put_stream:\n");
+ rc = qahw_open_output_stream(qahw_mod_handle,
+ handle,
+ output_device,
+ flags,
+ &config,
+ &out_handle,
+ stream_name);
+ fprintf(log_file, "open output stream is sucess:%d out_handhle %p\n"
+ , rc, out_handle);
+ if (rc) {
+ fprintf(stdout, "could not open output stream %d \n", rc);
+ goto EXIT;
+ }
+
+ play_file(out_handle,
+ file_stream,
+ (flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD));
+
+EXIT:
+
+ if (out_handle != nullptr) {
+ rc = qahw_out_standby(out_handle);
+ if (rc) {
+ fprintf(stdout, "out standby failed %d \n", rc);
+ }
+
+ rc = qahw_close_output_stream(out_handle);
+ if (rc) {
+ fprintf(stdout, "could not close output stream %d \n", rc);
+ }
+
+ rc = qahw_unload_module(qahw_mod_handle);
+ if (rc) {
+ fprintf(stdout, "could not unload hal %d \n", rc);
+ return -1;
+ }
+ }
+
+ if ((log_file != stdout) && (log_file != nullptr))
+ fclose(log_file);
+
+ if (file_stream != nullptr)
+ fclose(file_stream);
+
+ fprintf(stdout, "\nBYE BYE\n");
+ return 0;
+}