diff --git a/configs/msm8953/audio_policy.conf b/configs/msm8953/audio_policy.conf index b7b858ef..b11d0ae9 100644 --- a/configs/msm8953/audio_policy.conf +++ b/configs/msm8953/audio_policy.conf @@ -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 diff --git a/configs/msm8953/audio_policy_configuration.xml b/configs/msm8953/audio_policy_configuration.xml index 44abe281..b1ea1b91 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"/> + + + + + @@ -268,6 +279,8 @@ sources="Wired Headset Mic,BT SCO Headset Mic,FM Tuner,Telephony Rx"/> + diff --git a/configs/msm8953/mixer_paths_wcd9326.xml b/configs/msm8953/mixer_paths_wcd9326.xml index bf974cb9..286c3934 100644 --- a/configs/msm8953/mixer_paths_wcd9326.xml +++ b/configs/msm8953/mixer_paths_wcd9326.xml @@ -2292,6 +2292,14 @@ + + + + + + + + diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c index 0f53792f..f657f774 100644 --- a/hal/msm8916/platform.c +++ b/hal/msm8916/platform.c @@ -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) && diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c index 7a040054..83a859c8 100644 --- a/hal/msm8974/platform.c +++ b/hal/msm8974/platform.c @@ -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)