Merge "hal : Changes for 24 bit recording support" into audio-userspace.lnx.2.2-dev

This commit is contained in:
Linux Build Service Account 2016-12-21 05:44:01 -08:00 committed by Gerrit - the friendly Code Review server
commit d919863070
5 changed files with 90 additions and 12 deletions

View File

@ -102,6 +102,12 @@ audio_hw_modules {
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

View File

@ -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>

View File

@ -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" />

View File

@ -3431,6 +3431,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
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 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
} 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) &&

View File

@ -3088,6 +3088,7 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
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 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
} 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_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
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)