Merge "hal: add quad mic support for audio recording and VoIP calls"

This commit is contained in:
Linux Build Service Account 2015-02-12 09:58:02 -08:00 committed by Gerrit - the friendly Code Review server
commit 2d3bb44603
2 changed files with 52 additions and 21 deletions

View File

@ -292,6 +292,10 @@ static const char * const device_table[SND_DEVICE_MAX] = {
[SND_DEVICE_IN_SPEAKER_DMIC_NS_BROADSIDE] = "speaker-dmic-broadside",
[SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE] = "speaker-dmic-broadside",
[SND_DEVICE_IN_VOICE_FLUENCE_DMIC_AANC] = "aanc-fluence-dmic-handset",
[SND_DEVICE_IN_HANDSET_QMIC] = "quad-mic",
[SND_DEVICE_IN_SPEAKER_QMIC_AEC] = "quad-mic",
[SND_DEVICE_IN_SPEAKER_QMIC_NS] = "quad-mic",
[SND_DEVICE_IN_SPEAKER_QMIC_AEC_NS] = "quad-mic",
};
/* ACDB IDs (audio DSP path configuration IDs) for each sound device */
@ -378,6 +382,10 @@ static int acdb_device_table[SND_DEVICE_MAX] = {
[SND_DEVICE_IN_SPEAKER_DMIC_NS_BROADSIDE] = 121,
[SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE] = 120,
[SND_DEVICE_IN_VOICE_FLUENCE_DMIC_AANC] = 135,
[SND_DEVICE_IN_HANDSET_QMIC] = 125,
[SND_DEVICE_IN_SPEAKER_QMIC_AEC] = 126,
[SND_DEVICE_IN_SPEAKER_QMIC_NS] = 127,
[SND_DEVICE_IN_SPEAKER_QMIC_AEC_NS] = 129,
};
struct snd_device_index {
@ -464,6 +472,10 @@ struct snd_device_index snd_device_name_index[SND_DEVICE_MAX] = {
{TO_NAME_INDEX(SND_DEVICE_IN_SPEAKER_STEREO_DMIC)},
{TO_NAME_INDEX(SND_DEVICE_IN_CAPTURE_VI_FEEDBACK)},
{TO_NAME_INDEX(SND_DEVICE_IN_VOICE_FLUENCE_DMIC_AANC)},
{TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_QMIC)},
{TO_NAME_INDEX(SND_DEVICE_IN_SPEAKER_QMIC_AEC)},
{TO_NAME_INDEX(SND_DEVICE_IN_SPEAKER_QMIC_NS)},
{TO_NAME_INDEX(SND_DEVICE_IN_SPEAKER_QMIC_AEC_NS)},
};
#define NO_COLS 2
@ -1917,12 +1929,15 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
if (adev->active_input->enable_aec &&
adev->active_input->enable_ns) {
if (in_device & AUDIO_DEVICE_IN_BACK_MIC) {
if (my_data->fluence_type & FLUENCE_DUAL_MIC &&
my_data->fluence_in_spkr_mode) {
if (my_data->fluence_mode == FLUENCE_BROADSIDE)
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE;
else
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS;
if (my_data->fluence_in_spkr_mode) {
if (my_data->fluence_type & FLUENCE_QUAD_MIC) {
snd_device = SND_DEVICE_IN_SPEAKER_QMIC_AEC_NS;
} else if (my_data->fluence_type & FLUENCE_DUAL_MIC) {
if (my_data->fluence_mode == FLUENCE_BROADSIDE)
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE;
else
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS;
}
adev->acdb_settings |= DMIC_FLAG;
} else
snd_device = SND_DEVICE_IN_SPEAKER_MIC_AEC_NS;
@ -1938,12 +1953,15 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
platform_set_echo_reference(adev->platform, true);
} else if (adev->active_input->enable_aec) {
if (in_device & AUDIO_DEVICE_IN_BACK_MIC) {
if (my_data->fluence_type & FLUENCE_DUAL_MIC &&
my_data->fluence_in_spkr_mode) {
if (my_data->fluence_mode == FLUENCE_BROADSIDE)
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_AEC_BROADSIDE;
else
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_AEC;
if (my_data->fluence_in_spkr_mode) {
if (my_data->fluence_type & FLUENCE_QUAD_MIC) {
snd_device = SND_DEVICE_IN_SPEAKER_QMIC_AEC;
} else if (my_data->fluence_type & FLUENCE_DUAL_MIC) {
if (my_data->fluence_mode == FLUENCE_BROADSIDE)
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_AEC_BROADSIDE;
else
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_AEC;
}
adev->acdb_settings |= DMIC_FLAG;
} else
snd_device = SND_DEVICE_IN_SPEAKER_MIC_AEC;
@ -1959,12 +1977,15 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
platform_set_echo_reference(adev->platform, true);
} else if (adev->active_input->enable_ns) {
if (in_device & AUDIO_DEVICE_IN_BACK_MIC) {
if (my_data->fluence_type & FLUENCE_DUAL_MIC &&
my_data->fluence_in_spkr_mode) {
if (my_data->fluence_mode == FLUENCE_BROADSIDE)
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_NS_BROADSIDE;
else
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_NS;
if (my_data->fluence_in_spkr_mode) {
if (my_data->fluence_type & FLUENCE_QUAD_MIC) {
snd_device = SND_DEVICE_IN_SPEAKER_QMIC_NS;
} else if (my_data->fluence_type & FLUENCE_DUAL_MIC) {
if (my_data->fluence_mode == FLUENCE_BROADSIDE)
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_NS_BROADSIDE;
else
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_NS;
}
adev->acdb_settings |= DMIC_FLAG;
} else
snd_device = SND_DEVICE_IN_SPEAKER_MIC_NS;
@ -1984,9 +2005,15 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
} else if (source == AUDIO_SOURCE_MIC) {
if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC &&
channel_count == 1 ) {
if(my_data->fluence_type & FLUENCE_DUAL_MIC &&
my_data->fluence_in_audio_rec)
snd_device = SND_DEVICE_IN_HANDSET_DMIC;
if(my_data->fluence_in_audio_rec) {
if(my_data->fluence_type & FLUENCE_QUAD_MIC) {
snd_device = SND_DEVICE_IN_HANDSET_QMIC;
platform_set_echo_reference(adev->platform, true);
} else if (my_data->fluence_type & FLUENCE_DUAL_MIC) {
snd_device = SND_DEVICE_IN_HANDSET_DMIC;
platform_set_echo_reference(adev->platform, true);
}
}
}
} else if (source == AUDIO_SOURCE_FM_RX ||
source == AUDIO_SOURCE_FM_RX_A2DP) {

View File

@ -141,6 +141,10 @@ enum {
SND_DEVICE_IN_SPEAKER_DMIC_NS_BROADSIDE,
SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE,
SND_DEVICE_IN_VOICE_FLUENCE_DMIC_AANC,
SND_DEVICE_IN_HANDSET_QMIC,
SND_DEVICE_IN_SPEAKER_QMIC_AEC,
SND_DEVICE_IN_SPEAKER_QMIC_NS,
SND_DEVICE_IN_SPEAKER_QMIC_AEC_NS,
SND_DEVICE_IN_END,
SND_DEVICE_MAX = SND_DEVICE_IN_END,