hal: add generic handset mic definitions

-Add generic handset mic to support different use-cases
 on this single device using tx app_type config.
-The change is guarded with a system property which should
 be enabled only if tx app_type support is already available
 and generic device definition is added in acdb files.

Change-Id: I3fea2e12bd99a0d229fb5753d47dba2501ea528b
This commit is contained in:
Dhananjay Kumar 2017-09-28 22:08:00 +05:30 committed by Gerrit - the friendly Code Review server
parent 386d187130
commit 704ce6fbec
6 changed files with 43 additions and 1 deletions

View File

@ -161,6 +161,7 @@ static bool is_stt_supported_snd_device(snd_device_t snd_device)
case SND_DEVICE_IN_VOICE_SPEAKER_DMIC:
case SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BROADSIDE:
case SND_DEVICE_IN_VOICE_SPEAKER_QMIC:
case SND_DEVICE_IN_HANDSET_GENERIC_QMIC:
ret = true;
break;
default:

View File

@ -134,6 +134,7 @@ const struct string_to_enum s_flag_name_to_enum_table[] = {
STRING_TO_ENUM(AUDIO_INPUT_FLAG_RAW),
STRING_TO_ENUM(AUDIO_INPUT_FLAG_SYNC),
STRING_TO_ENUM(AUDIO_INPUT_FLAG_TIMESTAMP),
STRING_TO_ENUM(AUDIO_INPUT_FLAG_COMPRESS),
};
const struct string_to_enum s_format_name_to_enum_table[] = {

View File

@ -302,6 +302,7 @@ struct platform_data {
bool is_dsd_supported;
bool is_asrc_supported;
struct listnode acdb_meta_key_list;
bool use_generic_handset;
};
static bool is_external_codec = false;
@ -548,6 +549,7 @@ static const char * const device_table[SND_DEVICE_MAX] = {
[SND_DEVICE_IN_HANDSET_8MIC] = "handset-8mic",
[SND_DEVICE_IN_EC_REF_LOOPBACK_MONO] = "ec-ref-loopback-mono",
[SND_DEVICE_IN_EC_REF_LOOPBACK_STEREO] = "ec-ref-loopback-stereo",
[SND_DEVICE_IN_HANDSET_GENERIC_QMIC] = "quad-mic",
};
// Platform specific backend bit width table
@ -710,7 +712,8 @@ static int acdb_device_table[SND_DEVICE_MAX] = {
[SND_DEVICE_IN_HANDSET_6MIC] = 4,
[SND_DEVICE_IN_HANDSET_8MIC] = 4,
[SND_DEVICE_IN_EC_REF_LOOPBACK_MONO] = 4,
[SND_DEVICE_IN_EC_REF_LOOPBACK_STEREO] = 4
[SND_DEVICE_IN_EC_REF_LOOPBACK_STEREO] = 4,
[SND_DEVICE_IN_HANDSET_GENERIC_QMIC] = 150
};
struct name_to_index {
@ -859,6 +862,7 @@ static struct name_to_index snd_device_name_index[SND_DEVICE_MAX] = {
{TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_8MIC)},
{TO_NAME_INDEX(SND_DEVICE_IN_EC_REF_LOOPBACK_MONO)},
{TO_NAME_INDEX(SND_DEVICE_IN_EC_REF_LOOPBACK_STEREO)},
{TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_QMIC)},
};
static char * backend_tag_table[SND_DEVICE_MAX] = {0};
@ -1650,6 +1654,7 @@ static void set_platform_defaults(struct platform_data * my_data)
hw_interface_table[SND_DEVICE_IN_UNPROCESSED_THREE_MIC] = strdup("SLIMBUS_0_TX");
hw_interface_table[SND_DEVICE_IN_UNPROCESSED_QUAD_MIC] = strdup("SLIMBUS_0_TX");
hw_interface_table[SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC] = strdup("SLIMBUS_0_TX");
hw_interface_table[SND_DEVICE_IN_HANDSET_GENERIC_QMIC] = strdup("SLIMBUS_0_TX");
my_data->max_mic_count = PLATFORM_DEFAULT_MIC_COUNT;
/*remove ALAC & APE from DSP decoder list based on software decoder availability*/
@ -2623,6 +2628,9 @@ acdb_init_fail:
}
}
if (property_get_bool("vendor.audio.apptype.multirec.enabled", false))
my_data->use_generic_handset = true;
my_data->edid_info = NULL;
return my_data;
}
@ -4347,6 +4355,17 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
snd_device = SND_DEVICE_IN_VOICE_USB_HEADSET_MIC;
}
}
} else if (my_data->use_generic_handset == true && // system prop is enabled
(my_data->source_mic_type & SOURCE_QUAD_MIC) && // AND 4mic is available
((in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) || // AND device is buit-in mic or back mic
(in_device & AUDIO_DEVICE_IN_BACK_MIC)) &&
(my_data->fluence_in_audio_rec == true && // AND fluencepro is enabled
my_data->fluence_type & FLUENCE_QUAD_MIC) &&
(source == AUDIO_SOURCE_CAMCORDER || // AND source is cam/mic/unprocessed
source == AUDIO_SOURCE_UNPROCESSED ||
source == AUDIO_SOURCE_MIC)) {
snd_device = SND_DEVICE_IN_HANDSET_GENERIC_QMIC;
platform_set_echo_reference(adev, true, out_device);
} else if (source == AUDIO_SOURCE_CAMCORDER) {
if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC ||
in_device & AUDIO_DEVICE_IN_BACK_MIC) {

View File

@ -228,6 +228,7 @@ enum {
SND_DEVICE_IN_HANDSET_8MIC,
SND_DEVICE_IN_EC_REF_LOOPBACK_MONO,
SND_DEVICE_IN_EC_REF_LOOPBACK_STEREO,
SND_DEVICE_IN_HANDSET_GENERIC_QMIC,
SND_DEVICE_IN_END,
SND_DEVICE_MAX = SND_DEVICE_IN_END,

View File

@ -275,6 +275,7 @@ struct platform_data {
bool is_dsd_supported;
bool is_asrc_supported;
struct listnode acdb_meta_key_list;
bool use_generic_handset;
};
static int pcm_device_table[AUDIO_USECASE_MAX][2] = {
@ -524,6 +525,7 @@ static const char * const device_table[SND_DEVICE_MAX] = {
[SND_DEVICE_IN_UNPROCESSED_THREE_MIC] = "unprocessed-three-mic",
[SND_DEVICE_IN_UNPROCESSED_QUAD_MIC] = "unprocessed-quad-mic",
[SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC] = "unprocessed-headset-mic",
[SND_DEVICE_IN_HANDSET_GENERIC_QMIC] = "quad-mic",
};
// Platform specific backend bit width table
@ -682,6 +684,7 @@ static int acdb_device_table[SND_DEVICE_MAX] = {
[SND_DEVICE_IN_UNPROCESSED_THREE_MIC] = 145,
[SND_DEVICE_IN_UNPROCESSED_QUAD_MIC] = 146,
[SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC] = 147,
[SND_DEVICE_IN_HANDSET_GENERIC_QMIC] = 150,
};
struct name_to_index {
@ -824,6 +827,7 @@ static struct name_to_index snd_device_name_index[SND_DEVICE_MAX] = {
{TO_NAME_INDEX(SND_DEVICE_IN_UNPROCESSED_THREE_MIC)},
{TO_NAME_INDEX(SND_DEVICE_IN_UNPROCESSED_QUAD_MIC)},
{TO_NAME_INDEX(SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC)},
{TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_QMIC)},
};
static char * backend_tag_table[SND_DEVICE_MAX] = {0};
@ -1492,6 +1496,7 @@ static void set_platform_defaults(struct platform_data * my_data)
hw_interface_table[SND_DEVICE_IN_UNPROCESSED_THREE_MIC] = strdup("SLIMBUS_0_TX");
hw_interface_table[SND_DEVICE_IN_UNPROCESSED_QUAD_MIC] = strdup("SLIMBUS_0_TX");
hw_interface_table[SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC] = strdup("SLIMBUS_0_TX");
hw_interface_table[SND_DEVICE_IN_HANDSET_GENERIC_QMIC] = strdup("SLIMBUS_0_TX");
my_data->max_mic_count = PLATFORM_DEFAULT_MIC_COUNT;
@ -2398,6 +2403,9 @@ acdb_init_fail:
my_data->current_backend_cfg[USB_AUDIO_RX_BACKEND].channels_mixer_ctl =
strdup("USB_AUDIO_RX Channels");
if (property_get_bool("vendor.audio.apptype.multirec.enabled", false))
my_data->use_generic_handset = true;
my_data->edid_info = NULL;
free(snd_card_name);
free(snd_card_name_t);
@ -4100,6 +4108,17 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
snd_device = SND_DEVICE_IN_VOICE_USB_HEADSET_MIC;
}
}
} else if (my_data->use_generic_handset == true && // system prop is enabled
(my_data->source_mic_type & SOURCE_QUAD_MIC) && // AND 4mic is available
((in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) || // AND device is buit-in mic or back mic
(in_device & AUDIO_DEVICE_IN_BACK_MIC)) &&
(my_data->fluence_in_audio_rec == true && // AND fluencepro is enabled
my_data->fluence_type & FLUENCE_QUAD_MIC) &&
(source == AUDIO_SOURCE_CAMCORDER || // AND source is cam/mic/unprocessed
source == AUDIO_SOURCE_UNPROCESSED ||
source == AUDIO_SOURCE_MIC)) {
snd_device = SND_DEVICE_IN_HANDSET_GENERIC_QMIC;
platform_set_echo_reference(adev, true, out_device);
} else if (source == AUDIO_SOURCE_CAMCORDER) {
if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC ||
in_device & AUDIO_DEVICE_IN_BACK_MIC) {

View File

@ -228,6 +228,7 @@ enum {
SND_DEVICE_IN_HANDSET_8MIC,
SND_DEVICE_IN_EC_REF_LOOPBACK_MONO,
SND_DEVICE_IN_EC_REF_LOOPBACK_STEREO,
SND_DEVICE_IN_HANDSET_GENERIC_QMIC,
SND_DEVICE_IN_END,
SND_DEVICE_MAX = SND_DEVICE_IN_END,