Merge "audio: miscellaneous fixes against iot changes" into audio-userspace.lnx.2.2-dev
diff --git a/configs/msm8953/audio_policy.conf b/configs/msm8953/audio_policy.conf
index b7b858e..b11d0ae 100644
--- a/configs/msm8953/audio_policy.conf
+++ b/configs/msm8953/audio_policy.conf
@@ -102,6 +102,12 @@
formats AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_BACK_MIC
}
+ record_24 {
+ sampling_rates 8000|11025|12000|16000|22050|24000|32000|44100|48000|96000|192000
+ channel_masks AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_STEREO|AUDIO_CHANNEL_IN_FRONT_BACK|AUDIO_CHANNEL_INDEX_MASK_3|AUDIO_CHANNEL_INDEX_MASK_4
+ formats AUDIO_FORMAT_PCM_24_BIT_PACKED|AUDIO_FORMAT_PCM_8_24_BIT|AUDIO_FORMAT_PCM_FLOAT
+ devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_BACK_MIC|AUDIO_DEVICE_IN_WIRED_HEADSET
+ }
voice_rx {
sampling_rates 8000|16000|48000
channel_masks AUDIO_CHANNEL_IN_STEREO|AUDIO_CHANNEL_IN_MONO
diff --git a/configs/msm8953/audio_policy_configuration.xml b/configs/msm8953/audio_policy_configuration.xml
index 44abe28..b1ea1b9 100644
--- a/configs/msm8953/audio_policy_configuration.xml
+++ b/configs/msm8953/audio_policy_configuration.xml
@@ -152,6 +152,17 @@
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"/>
</mixPort>
+ <mixPort name="record_24" role="sink">
+ <profile name="" format="AUDIO_FORMAT_PCM_24_BIT_PACKED"
+ samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,96000,192000"
+ channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3,AUDIO_CHANNEL_INDEX_MASK_4"/>
+ <profile name="" format="AUDIO_FORMAT_PCM_8_24_BIT"
+ samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,96000,192000"
+ channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3,AUDIO_CHANNEL_INDEX_MASK_4"/>
+ <profile name="" format="AUDIO_FORMAT_PCM_FLOAT"
+ samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,96000,192000"
+ channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3,AUDIO_CHANNEL_INDEX_MASK_4"/>
+ </mixPort>
<mixPort name="voice_rx" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
samplingRates="8000,16000,48000" channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/>
@@ -268,6 +279,8 @@
sources="Wired Headset Mic,BT SCO Headset Mic,FM Tuner,Telephony Rx"/>
<route type="mix" sink="surround_sound"
sources="Built-In Mic,Built-In Back Mic"/>
+ <route type="mix" sink="record_24"
+ sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic"/>
<route type="mix" sink="voice_rx"
sources="Telephony Rx"/>
</routes>
diff --git a/configs/msm8953/mixer_paths_wcd9326.xml b/configs/msm8953/mixer_paths_wcd9326.xml
index bf974cb..286c393 100644
--- a/configs/msm8953/mixer_paths_wcd9326.xml
+++ b/configs/msm8953/mixer_paths_wcd9326.xml
@@ -2292,6 +2292,14 @@
<ctl name="MAD Input" value="DMIC0" />
</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" />
diff --git a/configs/msm8998/mixer_paths_tavil.xml b/configs/msm8998/mixer_paths_tavil.xml
index bfb2fbe..dca3def 100644
--- a/configs/msm8998/mixer_paths_tavil.xml
+++ b/configs/msm8998/mixer_paths_tavil.xml
@@ -2017,6 +2017,7 @@
<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" />
+ <ctl name="RX HPH Mode" value="CLS_H_HIFI" />
</path>
<path name="hph-highquality-mode">
diff --git a/configs/msm8998/sound_trigger_mixer_paths_wcd9340.xml b/configs/msm8998/sound_trigger_mixer_paths_wcd9340.xml
old mode 100755
new mode 100644
index be77fee..7481a80
--- a/configs/msm8998/sound_trigger_mixer_paths_wcd9340.xml
+++ b/configs/msm8998/sound_trigger_mixer_paths_wcd9340.xml
@@ -90,6 +90,13 @@
<ctl name="MAD_CPE1 Switch" value="1" />
</path>
+ <path name="listen-cpe-headset-mic">
+ <ctl name="MAD Input" value="ADC2" />
+ <ctl name="MAD_SEL MUX" value="SPE" />
+ <ctl name="MAD_INP MUX" value="MAD" />
+ <ctl name="MAD_CPE1 Switch" value="1" />
+ </path>
+
<path name="listen-cpe-handset-mic-ecpp">
<ctl name="CLK MODE" value="INTERNAL" />
<ctl name="EC BUF MUX INP" value="DEC1" />
diff --git a/configs/msm8998/sound_trigger_platform_info.xml b/configs/msm8998/sound_trigger_platform_info.xml
index 15c8ef6..b7ca132 100644
--- a/configs/msm8998/sound_trigger_platform_info.xml
+++ b/configs/msm8998/sound_trigger_platform_info.xml
@@ -32,11 +32,13 @@
<param max_wdsp_sessions="2" />
<param max_ape_sessions="8" />
<param enable_failure_detection="false" />
+ <param support_device_switch="false" />
</common_config>
<acdb_ids>
<param DEVICE_HANDSET_MIC_APE="100" />
<param DEVICE_HANDSET_MIC_CPE="128" />
<param DEVICE_HANDSET_MIC_ECPP_CPE="128" />
+ <param DEVICE_HEADSET_MIC_CPE="139" />
</acdb_ids>
<!-- Multiple sound_model_config tags can be listed, each with unique -->
<!-- vendor_uuid. The below tag represents QTI SVA engine sound model -->
diff --git a/hal/audio_extn/soundtrigger.c b/hal/audio_extn/soundtrigger.c
index 70f6d06..aff7532 100644
--- a/hal/audio_extn/soundtrigger.c
+++ b/hal/audio_extn/soundtrigger.c
@@ -349,6 +349,18 @@
event.u.value = val;
st_dev->st_callback(AUDIO_EVENT_NUM_ST_SESSIONS, &event);
}
+
+ ret = str_parms_get_int(params, AUDIO_PARAMETER_DEVICE_CONNECT, &val);
+ if ((ret >= 0) && audio_is_input_device(val)) {
+ event.u.value = val;
+ st_dev->st_callback(AUDIO_EVENT_DEVICE_CONNECT, &event);
+ }
+
+ ret = str_parms_get_int(params, AUDIO_PARAMETER_DEVICE_DISCONNECT, &val);
+ if ((ret >= 0) && audio_is_input_device(val)) {
+ event.u.value = val;
+ st_dev->st_callback(AUDIO_EVENT_DEVICE_DISCONNECT, &event);
+ }
}
int audio_extn_sound_trigger_init(struct audio_device *adev)
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 0f53792..f657f77 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -3431,6 +3431,7 @@
AUDIO_CHANNEL_IN_MONO : adev->active_input->channel_mask;
snd_device_t snd_device = SND_DEVICE_NONE;
int channel_count = popcount(channel_mask);
+ int str_bitwidth = adev->active_input->bit_width;
ALOGV("%s: enter: out_device(%#x) in_device(%#x) channel_count (%d) channel_mask (0x%x)",
__func__, out_device, in_device, channel_count, channel_mask);
@@ -3538,14 +3539,36 @@
} else if (source == AUDIO_SOURCE_CAMCORDER) {
if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC ||
in_device & AUDIO_DEVICE_IN_BACK_MIC) {
- if ((my_data->fluence_type & FLUENCE_DUAL_MIC) &&
- (my_data->source_mic_type & SOURCE_DUAL_MIC) &&
- (channel_count == 2))
- snd_device = SND_DEVICE_IN_HANDSET_STEREO_DMIC;
- else
- snd_device = SND_DEVICE_IN_CAMCORDER_MIC;
- }
- } else if (source == AUDIO_SOURCE_VOICE_RECOGNITION) {
+
+ if (str_bitwidth == 16) {
+ if ((my_data->fluence_type & FLUENCE_DUAL_MIC) &&
+ (my_data->source_mic_type & SOURCE_DUAL_MIC) &&
+ (channel_count == 2))
+ snd_device = SND_DEVICE_IN_HANDSET_STEREO_DMIC;
+ else
+ snd_device = SND_DEVICE_IN_CAMCORDER_MIC;
+ }
+ /*
+ * for other bit widths
+ */
+ else {
+ if (((channel_mask == AUDIO_CHANNEL_IN_FRONT_BACK) ||
+ (channel_mask == AUDIO_CHANNEL_IN_STEREO)) &&
+ (my_data->source_mic_type & SOURCE_DUAL_MIC)) {
+ snd_device = SND_DEVICE_IN_UNPROCESSED_STEREO_MIC;
+ }
+ else if (((int)channel_mask == AUDIO_CHANNEL_INDEX_MASK_3) &&
+ (my_data->source_mic_type & SOURCE_THREE_MIC)) {
+ snd_device = SND_DEVICE_IN_UNPROCESSED_THREE_MIC;
+ } else if (((int)channel_mask == AUDIO_CHANNEL_INDEX_MASK_4) &&
+ (my_data->source_mic_type & SOURCE_QUAD_MIC)) {
+ snd_device = SND_DEVICE_IN_UNPROCESSED_QUAD_MIC;
+ } else {
+ snd_device = SND_DEVICE_IN_UNPROCESSED_MIC;
+ }
+ }
+ }
+ } else if (source == AUDIO_SOURCE_VOICE_RECOGNITION) {
if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) {
if (my_data->fluence_in_voice_rec && channel_count == 1) {
if ((my_data->fluence_type & FLUENCE_QUAD_MIC) &&
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 7a04005..83a859c 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -3088,6 +3088,7 @@
AUDIO_CHANNEL_IN_MONO : adev->active_input->channel_mask;
snd_device_t snd_device = SND_DEVICE_NONE;
int channel_count = popcount(channel_mask);
+ int str_bitwidth = adev->active_input->bit_width;
ALOGV("%s: enter: out_device(%#x) in_device(%#x) channel_count (%d) channel_mask (0x%x)",
__func__, out_device, in_device, channel_count, channel_mask);
@@ -3190,9 +3191,36 @@
} else if (source == AUDIO_SOURCE_CAMCORDER) {
if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC ||
in_device & AUDIO_DEVICE_IN_BACK_MIC) {
- snd_device = SND_DEVICE_IN_CAMCORDER_MIC;
- }
- } else if (source == AUDIO_SOURCE_VOICE_RECOGNITION) {
+
+ if (str_bitwidth == 16) {
+ if ((my_data->fluence_type & FLUENCE_DUAL_MIC) &&
+ (my_data->source_mic_type & SOURCE_DUAL_MIC) &&
+ (channel_count == 2))
+ snd_device = SND_DEVICE_IN_HANDSET_STEREO_DMIC;
+ else
+ snd_device = SND_DEVICE_IN_CAMCORDER_MIC;
+ }
+ /*
+ * for other bit widths
+ */
+ else {
+ if (((channel_mask == AUDIO_CHANNEL_IN_FRONT_BACK) ||
+ (channel_mask == AUDIO_CHANNEL_IN_STEREO)) &&
+ (my_data->source_mic_type & SOURCE_DUAL_MIC)) {
+ snd_device = SND_DEVICE_IN_UNPROCESSED_STEREO_MIC;
+ }
+ else if (((int)channel_mask == AUDIO_CHANNEL_INDEX_MASK_3) &&
+ (my_data->source_mic_type & SOURCE_THREE_MIC)) {
+ snd_device = SND_DEVICE_IN_UNPROCESSED_THREE_MIC;
+ } else if (((int)channel_mask == AUDIO_CHANNEL_INDEX_MASK_4) &&
+ (my_data->source_mic_type & SOURCE_QUAD_MIC)) {
+ snd_device = SND_DEVICE_IN_UNPROCESSED_QUAD_MIC;
+ } else {
+ snd_device = SND_DEVICE_IN_UNPROCESSED_MIC;
+ }
+ }
+ }
+ } else if (source == AUDIO_SOURCE_VOICE_RECOGNITION) {
if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) {
if (my_data->fluence_in_voice_rec && channel_count == 1) {
if ((my_data->fluence_type & FLUENCE_QUAD_MIC) &&
@@ -3240,7 +3268,7 @@
snd_device = SND_DEVICE_IN_UNPROCESSED_MIC;
}
} else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) {
- snd_device = SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC;
+ snd_device = SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC;
}
} else if (source == AUDIO_SOURCE_VOICE_COMMUNICATION) {
if (out_device & AUDIO_DEVICE_OUT_SPEAKER)
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index 7002932..6c26b23 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -520,7 +520,7 @@
}
if ((prop_rec_play_enabled) &&
- ((true == mIsInputRequestOnProgress) || (mInputs.activeInputsCount() > 0))) {
+ ((true == mIsInputRequestOnProgress) || (mInputs.activeInputsCountOnDevices() > 0))) {
ALOGD("copl: blocking compress offload for record concurrency");
return false;
}
@@ -1661,7 +1661,7 @@
prop_rec_play_enabled = atoi(recConcPropValue) || !strncmp("true", recConcPropValue, 4);
}
if ((prop_rec_play_enabled) &&
- ((true == mIsInputRequestOnProgress) || (mInputs.activeInputsCount() > 0))) {
+ ((true == mIsInputRequestOnProgress) || (mInputs.activeInputsCountOnDevices() > 0))) {
if (AUDIO_MODE_IN_COMMUNICATION == mEngine->getPhoneState()) {
if (AUDIO_OUTPUT_FLAG_VOIP_RX & flags) {
// allow VoIP using voice path
@@ -2098,7 +2098,7 @@
prop_rec_play_enabled = atoi(getPropValue) || !strncmp("true", getPropValue, 4);
}
- if ((prop_rec_play_enabled) &&(mInputs.activeInputsCount() == 0)){
+ if ((prop_rec_play_enabled) &&(mInputs.activeInputsCountOnDevices() == 0)){
// send update to HAL on record playback concurrency
AudioParameter param = AudioParameter();
param.add(String8("rec_play_conc_on"), String8("true"));
@@ -2144,7 +2144,7 @@
MIX_STATE_MIXING);
}
- if (mInputs.activeInputsCount() == 0) {
+ if (mInputs.activeInputsCountOnDevices() == 0) {
SoundTrigger::setCaptureState(true);
}
setInputDevice(input, getNewInputDevice(input), true /* force */);
@@ -2189,7 +2189,7 @@
prop_rec_play_enabled = atoi(propValue) || !strncmp("true", propValue, 4);
}
- if ((prop_rec_play_enabled) && (mInputs.activeInputsCount() == 0)) {
+ if ((prop_rec_play_enabled) && (mInputs.activeInputsCountOnDevices() == 0)) {
//send update to HAL on record playback concurrency
AudioParameter param = AudioParameter();