audio: hal: add support for combo backend capture
-Add support to capture 10 channel audio from two backends
6 channel from SLIM_0_TX and 4 channel from TERT_MI2S_TX.
-add support for SOURCE_DEC_TYPE to support 10 channel
generic mic capture.
Change-Id: I4fdfb7fa07d916426a0f11d88506039d0556bac7
diff --git a/configure.ac b/configure.ac
old mode 100755
new mode 100644
index d2692c7..8c318df
--- a/configure.ac
+++ b/configure.ac
@@ -114,7 +114,7 @@
if (test x$TARGET_SUPPORT = xsdmsteppe); then
AC_SUBST([TARGET_PLATFORM], ["msm8974"])
TARGET_CFLAGS="-DPLATFORM_MSMSTEPPE"
- TARGET_CFLAGS+=" -DMAX_TARGET_SPECIFIC_CHANNEL_CNT=\"4\""
+ TARGET_CFLAGS+=" -DMAX_TARGET_SPECIFIC_CHANNEL_CNT=\"16\""
TARGET_CFLAGS+=" -DINCALL_STEREO_CAPTURE_ENABLED"
fi
if (test x$TARGET_SUPPORT = xqrbx210); then
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index 81fdcc3..c4fa9ac 100644
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -479,7 +479,7 @@
cust_ch_mixer_cfg[len++] = pinfo->ip_channels;
cust_ch_mixer_cfg[len++] = pinfo->op_channels;
for (i = 0; i < (int) (pinfo->op_channels * pinfo->ip_channels); i++) {
- ALOGV("%s: coeff[%d] %d", __func__, i, params->coeffs[i]);
+ ALOGV("%s: coeff[%d] %lu", __func__, i, (unsigned long )params->coeffs[i]);
cust_ch_mixer_cfg[len++] = params->coeffs[i];
}
err = mixer_ctl_set_array(ctl, cust_ch_mixer_cfg, len);
@@ -634,7 +634,7 @@
struct mixer_ctl *ctl = NULL;
char mixer_ctl_name[128] = {0};
int ret = 0;
- int channel_map[AUDIO_MAX_DSP_CHANNELS] = {0};
+ long channel_map[AUDIO_MAX_DSP_CHANNELS] = {0};
ALOGV("%s channel_count %d", __func__, ch_count);
@@ -3790,7 +3790,8 @@
int max_mic_count = platform_get_max_mic_count(adev->platform);
/* validate input params. Avoid updated channel mask if loopback device */
- if ((channel_count == 6) &&
+ /* validate input params. Avoid updated channel mask if HDMI or loopback device */
+ if ((channel_count > max_mic_count) &&
(in->format == AUDIO_FORMAT_PCM_16_BIT) &&
(!is_loopback_input_device(get_device_types(&in->device_list)))) {
switch (max_mic_count) {
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index 89ad5af..057d9a8 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -98,6 +98,14 @@
#define AUDIO_OUTPUT_FLAG_INTERACTIVE 0x4000000
#endif
+#ifndef AUDIO_DEVICE_IN_SPEAKER_MIC2
+#define AUDIO_DEVICE_IN_SPEAKER_MIC2 0x10000000
+#endif
+
+#ifndef AUDIO_DEVICE_IN_SPEAKER_MIC3
+#define AUDIO_DEVICE_IN_SPEAKER_MIC3 0x20000000
+#endif
+
int audio_extn_parse_compress_metadata(struct stream_out *out,
struct str_parms *parms);
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index d231a33..05a33b4 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -148,6 +148,9 @@
#define STR(x) #x
#endif
+#define IS_USB_HIFI (MAX_HIFI_CHANNEL_COUNT >= MAX_CHANNEL_COUNT) ? \
+ true : false
+
#ifdef LINUX_ENABLED
static inline int64_t audio_utils_ns_from_timespec(const struct timespec *ts)
{
@@ -799,6 +802,17 @@
return 0;
}
+bool is_combo_audio_input_device(struct listnode *devices){
+
+ if (devices == NULL)
+ return false;
+
+ if(compare_device_type(devices, AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_SPEAKER_MIC2))
+ return true;
+ else
+ return false;
+}
+
static inline void adjust_frames_for_device_delay(struct stream_out *out,
uint32_t *dsp_frames) {
// Adjustment accounts for A2dp encoder latency with offload usecases
@@ -1444,7 +1458,11 @@
if (usecase->type == PCM_CAPTURE) {
in = usecase->stream.in;
- if (in && is_loopback_input_device(get_device_types(&in->device_list))) {
+ if ((in && is_loopback_input_device(get_device_types(&in->device_list))) ||
+ (in && is_combo_audio_input_device(&in->device_list)) ||
+ (in && ((compare_device_type(&in->device_list, AUDIO_DEVICE_IN_BUILTIN_MIC) ||
+ compare_device_type(&in->device_list, AUDIO_DEVICE_IN_LINE)) &&
+ (snd_device == SND_DEVICE_IN_HANDSET_GENERIC_6MIC)))) {
ALOGD("%s: set custom mtmx params v1", __func__);
audio_extn_set_custom_mtmx_params_v1(adev, usecase, true);
}
@@ -1539,7 +1557,11 @@
if (usecase->type == PCM_CAPTURE) {
in = usecase->stream.in;
- if (in && is_loopback_input_device(get_device_types(&in->device_list))) {
+ if ((in && is_loopback_input_device(get_device_types(&in->device_list))) ||
+ (in && is_combo_audio_input_device(&in->device_list)) ||
+ (in && ((compare_device_type(&in->device_list, AUDIO_DEVICE_IN_BUILTIN_MIC) ||
+ compare_device_type(&in->device_list, AUDIO_DEVICE_IN_LINE)) &&
+ (snd_device == SND_DEVICE_IN_HANDSET_GENERIC_6MIC)))){
ALOGD("%s: reset custom mtmx params v1", __func__);
audio_extn_set_custom_mtmx_params_v1(adev, usecase, false);
}
@@ -4708,9 +4730,10 @@
int channel_count,
bool is_low_latency)
{
+ bool is_usb_hifi = IS_USB_HIFI;
/* Don't know if USB HIFI in this context so use true to be conservative */
if (check_input_parameters(sample_rate, format, channel_count,
- true /*is_usb_hifi */) != 0)
+ is_usb_hifi) != 0)
return 0;
return get_stream_buffer_size(AUDIO_CAPTURE_PERIOD_DURATION_MSEC,
@@ -9593,11 +9616,12 @@
static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev __unused,
const struct audio_config *config)
{
+ bool is_usb_hifi = IS_USB_HIFI;
int channel_count = audio_channel_count_from_in_mask(config->channel_mask);
/* Don't know if USB HIFI in this context so use true to be conservative */
if (check_input_parameters(config->sample_rate, config->format, channel_count,
- true /*is_usb_hifi */) != 0)
+ is_usb_hifi) != 0)
return 0;
return get_input_buffer_size(config->sample_rate, config->format, channel_count,
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index a25f68d..d24202c 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -908,6 +908,7 @@
#define CHECK(condition) LOG_ALWAYS_FATAL_IF(!(condition), "%s",\
__FILE__ ":" LITERAL_TO_STRING(__LINE__)\
" ASSERT_FATAL(" #condition ") failed.")
+bool is_combo_audio_input_device(struct listnode *devices);
static inline bool is_loopback_input_device(audio_devices_t device) {
if (!audio_is_output_device(device) &&
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index a6d546a..52df55c 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -824,6 +824,17 @@
[SND_DEVICE_IN_ICC] = "speaker-mic",
[SND_DEVICE_IN_SYNTH_MIC] = "speaker-mic",
[SND_DEVICE_IN_ECHO_REFERENCE] = "echo-reference",
+ [SND_DEVICE_IN_HANDSET_GENERIC_DMIC] = "dmic-endfire",
+ [SND_DEVICE_IN_HANDSET_GENERIC_6MIC] = "handset-6mic",
+ [SND_DEVICE_IN_HANDSET_GENERIC_8MIC] = "handset-8mic",
+ [SND_DEVICE_IN_HANDSET_GENERIC_DMIC_AND_EC_REF_LOOPBACK] = "handset-dmic-and-ec-ref-loopback",
+ [SND_DEVICE_IN_HANDSET_GENERIC_QMIC_AND_EC_REF_LOOPBACK] = "handset-qmic-and-ec-ref-loopback",
+ [SND_DEVICE_IN_HANDSET_GENERIC_6MIC_AND_EC_REF_LOOPBACK] = "handset-6mic-and-ec-ref-loopback",
+ [SND_DEVICE_IN_HANDSET_GENERIC_8MIC_AND_EC_REF_LOOPBACK] = "handset-8mic-and-ec-ref-loopback",
+ [SND_DEVICE_IN_ECALL] = "handset-mic",
+ [SND_DEVICE_IN_SPEAKER_MIC2] = "speaker-mic2",
+ [SND_DEVICE_IN_SPEAKER_MIC3] = "speaker-mic3",
+ [SND_DEVICE_IN_HANDSET_GENERIC_6MIC_AND_SPEAKER_MIC2] = "handset-6mic-and-speaker-mic2",
};
// Platform specific backend bit width table
@@ -1122,6 +1133,8 @@
[SND_DEVICE_IN_CALL_PROXY] = 33,
[SND_DEVICE_IN_ICC] = 46,
[SND_DEVICE_IN_SYNTH_MIC] = 11,
+ [SND_DEVICE_IN_SPEAKER_MIC2] = 11,
+ [SND_DEVICE_IN_SPEAKER_MIC3] = 11,
};
struct name_to_index {
@@ -1388,6 +1401,16 @@
{TO_NAME_INDEX(SND_DEVICE_OUT_ICC)},
{TO_NAME_INDEX(SND_DEVICE_OUT_SYNTH_SPKR)},
{TO_NAME_INDEX(SND_DEVICE_IN_SYNTH_MIC)},
+ {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_DMIC)},
+ {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_6MIC)},
+ {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_8MIC)},
+ {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_DMIC_AND_EC_REF_LOOPBACK)},
+ {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_QMIC_AND_EC_REF_LOOPBACK)},
+ {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_6MIC_AND_EC_REF_LOOPBACK)},
+ {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_8MIC_AND_EC_REF_LOOPBACK)},
+ {TO_NAME_INDEX(SND_DEVICE_IN_SPEAKER_MIC2)},
+ {TO_NAME_INDEX(SND_DEVICE_IN_SPEAKER_MIC3)},
+ {TO_NAME_INDEX(SND_DEVICE_IN_HANDSET_GENERIC_6MIC_AND_SPEAKER_MIC2)},
};
static char * backend_tag_table[SND_DEVICE_MAX] = {0};
@@ -2466,6 +2489,8 @@
backend_tag_table[SND_DEVICE_OUT_CALL_PROXY] = strdup("call-proxy");
backend_tag_table[SND_DEVICE_OUT_HAPTICS] = strdup("haptics");
backend_tag_table[SND_DEVICE_IN_CALL_PROXY] = strdup("call-proxy-in");
+ backend_tag_table[SND_DEVICE_IN_SPEAKER_MIC2] = strdup("speaker-mic2");
+ backend_tag_table[SND_DEVICE_IN_SPEAKER_MIC3] = strdup("speaker-mic3");
hw_interface_table[SND_DEVICE_OUT_HANDSET] = strdup("SLIMBUS_0_RX");
hw_interface_table[SND_DEVICE_OUT_SPEAKER] = strdup("SLIMBUS_0_RX");
@@ -2716,6 +2741,8 @@
hw_interface_table[SND_DEVICE_OUT_SYNTH_SPKR] = strdup("TERT_TDM_RX_0");
hw_interface_table[SND_DEVICE_IN_SYNTH_MIC] = strdup("TERT_TDM_TX_0");
hw_interface_table[SND_DEVICE_IN_ECHO_REFERENCE] = strdup("SEC_TDM_TX_0");
+ hw_interface_table[SND_DEVICE_IN_SPEAKER_MIC2] = strdup("QUAT_TDM_TX_0");
+ hw_interface_table[SND_DEVICE_IN_SPEAKER_MIC3] = strdup("SEN_TDM_TX_0");
my_data->max_mic_count = PLATFORM_DEFAULT_MIC_COUNT;
/*remove ALAC & APE from DSP decoder list based on software decoder availability*/
@@ -3091,6 +3118,10 @@
{
// support max to mono, example if max count is 3, usecase supports Three, dual and mono mic
switch (my_data->max_mic_count) {
+ case 10:
+ my_data->source_mic_type |= SOURCE_DEC_MIC;
+ case 8:
+ my_data->source_mic_type |= SOURCE_OCT_MIC;
case 6:
my_data->source_mic_type |= SOURCE_HEX_MIC;
case 4:
@@ -4071,6 +4102,31 @@
strdup("QUAT_MI2S_TX Channels");
}
+ my_data->current_backend_cfg[SEC_MI2S_RX_BACKEND].samplerate_mixer_ctl =
+ strdup("SEC_MI2S_RX SampleRate");
+ my_data->current_backend_cfg[SEC_MI2S_RX_BACKEND].channels_mixer_ctl =
+ strdup("SEC_MI2S_RX Channels");
+ my_data->current_backend_cfg[TERT_MI2S_RX_BACKEND].bitwidth_mixer_ctl =
+ strdup("TERT_MI2S_RX Format");
+ my_data->current_backend_cfg[TERT_MI2S_RX_BACKEND].samplerate_mixer_ctl =
+ strdup("TERT_MI2S_RX SampleRate");
+ my_data->current_backend_cfg[TERT_MI2S_RX_BACKEND].channels_mixer_ctl =
+ strdup("TERT_MI2S_RX Channels");
+
+ my_data->current_backend_cfg[TERT_MI2S_TX_BACKEND].bitwidth_mixer_ctl =
+ strdup("TERT_MI2S_TX Format");
+ my_data->current_backend_cfg[TERT_MI2S_TX_BACKEND].samplerate_mixer_ctl =
+ strdup("TERT_MI2S_TX SampleRate");
+ my_data->current_backend_cfg[TERT_MI2S_TX_BACKEND].channels_mixer_ctl =
+ strdup("TERT_MI2S_TX Channels");
+
+ my_data->current_backend_cfg[QUAT_MI2S_RX_BACKEND].bitwidth_mixer_ctl =
+ strdup("QUAT_MI2S_RX Format");
+ my_data->current_backend_cfg[QUAT_MI2S_RX_BACKEND].samplerate_mixer_ctl =
+ strdup("QUAT_MI2S_RX SampleRate");
+ my_data->current_backend_cfg[QUAT_MI2S_RX_BACKEND].channels_mixer_ctl =
+ strdup("QUAT_MI2S_RX Channels");
+
my_data->current_backend_cfg[SPDIF_TX_BACKEND].bitwidth_mixer_ctl =
strdup("PRIM_SPDIF_TX Format");
my_data->current_backend_cfg[SPDIF_TX_BACKEND].samplerate_mixer_ctl =
@@ -5505,6 +5561,15 @@
port = HEADSET_TX_BACKEND;
else if (strcmp(backend_tag_table[snd_device], "call-proxy-in") == 0)
port = CALL_PROXY_TX_BACKEND;
+ else if (!strncmp(platform_get_snd_device_backend_interface(snd_device),
+ "QUAT_TDM_TX_0", sizeof("QUAT_TDM_TX_0")))
+ port = QUAT_TDM_TX_BACKEND;
+ else if (!strncmp(platform_get_snd_device_backend_interface(snd_device),
+ "SEN_TDM_TX_0", sizeof("SEN_TDM_TX_0")))
+ port = SEN_TDM_TX_BACKEND;
+ else if (!strncmp(platform_get_snd_device_backend_interface(snd_device),
+ "TERT_MI2S_TX", sizeof("TERT_MI2S_TX")))
+ port = TERT_MI2S_TX_BACKEND;
}
} else {
ALOGW("%s:napb: Invalid device - %d ", __func__, snd_device);
@@ -6336,6 +6401,31 @@
new_snd_devices[0] = SND_DEVICE_IN_HANDSET_8MIC;
new_snd_devices[1] = SND_DEVICE_IN_EC_REF_LOOPBACK;
ret = 0;
+ } else if (SND_DEVICE_IN_HANDSET_GENERIC_DMIC_AND_EC_REF_LOOPBACK == snd_device) {
+ *num_devices = 2;
+ new_snd_devices[0] = SND_DEVICE_IN_HANDSET_GENERIC_DMIC;
+ new_snd_devices[1] = SND_DEVICE_IN_EC_REF_LOOPBACK;
+ ret = 0;
+ } else if (SND_DEVICE_IN_HANDSET_GENERIC_QMIC_AND_EC_REF_LOOPBACK == snd_device) {
+ *num_devices = 2;
+ new_snd_devices[0] = SND_DEVICE_IN_HANDSET_GENERIC_QMIC;
+ new_snd_devices[1] = SND_DEVICE_IN_EC_REF_LOOPBACK;
+ ret = 0;
+ } else if (SND_DEVICE_IN_HANDSET_GENERIC_6MIC_AND_EC_REF_LOOPBACK == snd_device) {
+ *num_devices = 2;
+ new_snd_devices[0] = SND_DEVICE_IN_HANDSET_GENERIC_6MIC;
+ new_snd_devices[1] = SND_DEVICE_IN_EC_REF_LOOPBACK;
+ ret = 0;
+ } else if (SND_DEVICE_IN_HANDSET_GENERIC_8MIC_AND_EC_REF_LOOPBACK == snd_device) {
+ *num_devices = 2;
+ new_snd_devices[0] = SND_DEVICE_IN_HANDSET_GENERIC_8MIC;
+ new_snd_devices[1] = SND_DEVICE_IN_EC_REF_LOOPBACK;
+ ret = 0;
+ } else if (SND_DEVICE_IN_HANDSET_GENERIC_6MIC_AND_SPEAKER_MIC2 == snd_device) {
+ *num_devices = 2;
+ new_snd_devices[0] = SND_DEVICE_IN_HANDSET_GENERIC_6MIC;
+ new_snd_devices[1] = SND_DEVICE_IN_SPEAKER_MIC2;
+ ret = 0;
}
@@ -6891,9 +6981,8 @@
snd_device = SND_DEVICE_OUT_SPEAKER_VBAT;
else if (my_data->is_wsa_speaker)
snd_device = SND_DEVICE_OUT_SPEAKER_WSA;
- else {
+ else
snd_device = SND_DEVICE_OUT_SPEAKER;
- }
} else if (is_sco_out_device_type(&devices)) {
if (adev->swb_speech_mode != SPEECH_MODE_INVALID)
snd_device = SND_DEVICE_OUT_BT_SCO_SWB;
@@ -7399,7 +7488,7 @@
(my_data->source_mic_type & SOURCE_QUAD_MIC) && // AND 4mic is available
(compare_device_type(&in_devices, AUDIO_DEVICE_IN_BUILTIN_MIC) || // AND device is buit-in mic or back mic
compare_device_type(&in_devices, AUDIO_DEVICE_IN_BACK_MIC)) &&
- (my_data->fluence_in_audio_rec == true && // AND fluencepro is enabled
+ (my_data->fluence_in_audio_rec == true && (channel_count == 4) && // 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 ||
@@ -7407,36 +7496,55 @@
snd_device = SND_DEVICE_IN_HANDSET_GENERIC_QMIC;
platform_set_echo_reference(adev, true, out_devices);
} else if (my_data->use_generic_handset == true && // System prop is enabled
- (my_data->ambisonic_capture == true) && // Enable Ambisonic capture
- (my_data->source_mic_type & SOURCE_QUAD_MIC) && // AND 4mic is available
- (compare_device_type(&in_devices, AUDIO_DEVICE_IN_BUILTIN_MIC) || // AND device is Built-in
- compare_device_type(&in_devices, AUDIO_DEVICE_IN_BACK_MIC)) && // OR Back-mic
+ (my_data->source_mic_type & SOURCE_QUAD_MIC) && // AND 4mic is available
+ (compare_device_type(&in_devices, AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_SPEAKER_MIC2) ||
+ compare_device_type(&in_devices, AUDIO_DEVICE_IN_BUILTIN_MIC) || // AND device is Built-in
+ compare_device_type(&in_devices, AUDIO_DEVICE_IN_BACK_MIC)) &&
+ // OR Back-mic
(source == AUDIO_SOURCE_MIC || // AND source is MIC for 16bit
source == AUDIO_SOURCE_UNPROCESSED || // OR unprocessed for 24bit
- source == AUDIO_SOURCE_CAMCORDER) && // OR camera usecase
- ((int)channel_mask == (int)AUDIO_CHANNEL_INDEX_MASK_4) && // AND 4mic channel mask
- (sample_rate == 48000)) { // AND sample rate is 48Khz
+ source == AUDIO_SOURCE_CAMCORDER)) { // OR camera usecase
+
+ if ( my_data->ambisonic_capture == true )
+ {
snd_device = SND_DEVICE_IN_HANDSET_GENERIC_QMIC;
/* Below check is true only in LA build to set
- ambisonic profile. In LE hal client will set profile
- */
+ ambisonic profile. In LE hal client will set profile
+ */
if (my_data->ambisonic_profile == true &&
in != NULL)
strlcpy(in->profile, "record_ambisonic",
sizeof(in->profile));
if (in != NULL && !strncmp(in->profile, "record_ambisonic",
- strlen("record_ambisonic"))) {
+ strlen("record_ambisonic")))
+ {
/* Validate input stream configuration for
- Ambisonic capture.
- */
+ Ambisonic capture.
+ */
if (((int)channel_mask != (int)AUDIO_CHANNEL_INDEX_MASK_4) ||
- (sample_rate != 48000)) {
- snd_device = SND_DEVICE_NONE;
- ALOGW("Unsupported Input configuration for ambisonic capture");
- goto exit;
+ (sample_rate != 48000))
+ {
+ snd_device = SND_DEVICE_NONE;
}
}
+ }
+ else if (my_data->source_mic_type & SOURCE_DEC_MIC) {
+ if(compare_device_type(&in_devices, AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_SPEAKER_MIC2))
+ snd_device = SND_DEVICE_IN_HANDSET_GENERIC_6MIC_AND_SPEAKER_MIC2;
+ else if(channel_count == 6)
+ snd_device = SND_DEVICE_IN_HANDSET_GENERIC_6MIC;
+ } else if (my_data->source_mic_type & SOURCE_OCT_MIC) {
+ snd_device = SND_DEVICE_IN_HANDSET_GENERIC_8MIC;
+ } else if (my_data->source_mic_type & SOURCE_HEX_MIC) {
+ snd_device = SND_DEVICE_IN_HANDSET_GENERIC_6MIC;
+ } else if (my_data->source_mic_type & SOURCE_QUAD_MIC) {
+ snd_device = SND_DEVICE_IN_HANDSET_GENERIC_QMIC;
+ } else if (my_data->source_mic_type & SOURCE_DUAL_MIC) {
+ snd_device = SND_DEVICE_IN_HANDSET_GENERIC_DMIC;
+ } else
+ snd_device = SND_DEVICE_NONE;
+
} else if (source == AUDIO_SOURCE_CAMCORDER) {
if (compare_device_type(&in_devices, AUDIO_DEVICE_IN_BUILTIN_MIC) ||
compare_device_type(&in_devices, AUDIO_DEVICE_IN_BACK_MIC)) {
@@ -10621,6 +10729,11 @@
int backend_idx = platform_get_backend_index(snd_device);
int ret = 0;
struct audio_backend_cfg backend_cfg;
+ struct audio_custom_mtmx_in_params_info in_info = {0};
+ struct audio_custom_mtmx_in_params *in_params = NULL;
+ int new_snd_devices[SND_DEVICE_OUT_END] = {0};
+ int i, num_devices = 1;
+ struct platform_data *my_data = (struct platform_data *)adev->platform;
backend_cfg.passthrough_enabled = false;
@@ -10659,12 +10772,46 @@
backend_cfg.format,
backend_idx, usecase->id,
platform_get_snd_device_name(snd_device));
- if (platform_check_capture_codec_backend_cfg(adev, backend_idx,
- &backend_cfg, snd_device)) {
- ret = platform_set_codec_backend_cfg(adev, usecase, snd_device,
+
+ if (is_combo_audio_input_device(&usecase->stream.in->device_list) &&
+ platform_split_snd_device(my_data, snd_device, &num_devices,
+ new_snd_devices) == 0){
+
+ in_info.usecase_id[0] = usecase->id;
+ in_info.op_channels = backend_cfg.channels;
+ in_params = platform_get_custom_mtmx_in_params(adev->platform, &in_info);
+
+ for (i = 0; i < num_devices; i++) {
+ if (in_params) {
+ if(new_snd_devices[i] == SND_DEVICE_IN_SPEAKER_MIC2){
+ backend_cfg.channels = in_params->i2s_ch;
+ ALOGD("%s txbecf: set channels to %d from mtmx in params",__func__,in_params->i2s_ch);
+ } else {
+ ALOGD("%s: txbecf: set channels to %d from mtmx in params",
+ __func__, in_params->mic_ch);
+ backend_cfg.channels = in_params->mic_ch;
+ }
+ }
+ if (platform_check_capture_codec_backend_cfg(adev, platform_get_backend_index(new_snd_devices[i]),
+ &backend_cfg, new_snd_devices[i])) {
+ ret = platform_set_codec_backend_cfg(adev, usecase, new_snd_devices[i],
backend_cfg);
- if(!ret)
- return true;
+ if(!ret)
+ ret = true;
+ else
+ ret = false;
+ }
+ }
+ return ret;
+
+ } else {
+ if (platform_check_capture_codec_backend_cfg(adev, backend_idx,
+ &backend_cfg, snd_device)) {
+ ret = platform_set_codec_backend_cfg(adev, usecase, snd_device,
+ backend_cfg);
+ if(!ret)
+ return true;
+ }
}
return false;
diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h
index cdd9469..1535940 100644
--- a/hal/msm8974/platform.h
+++ b/hal/msm8974/platform.h
@@ -43,6 +43,8 @@
SOURCE_THREE_MIC = 0x4, /* Target contains 3 mics */
SOURCE_QUAD_MIC = 0x8, /* Target contains 4 mics */
SOURCE_HEX_MIC = 0x16, /* Target contains 6 mics */
+ SOURCE_OCT_MIC = 0x20, /* Target contains 8 mics */
+ SOURCE_DEC_MIC = 0x40,
};
enum {
@@ -366,6 +368,18 @@
SND_DEVICE_IN_ICC,
SND_DEVICE_IN_SYNTH_MIC,
SND_DEVICE_IN_ECHO_REFERENCE,
+ SND_DEVICE_IN_HANDSET_GENERIC_DMIC,
+ SND_DEVICE_IN_HANDSET_GENERIC_6MIC,
+ SND_DEVICE_IN_HANDSET_GENERIC_8MIC,
+ SND_DEVICE_IN_HANDSET_GENERIC_DMIC_AND_EC_REF_LOOPBACK,
+ SND_DEVICE_IN_HANDSET_GENERIC_QMIC_AND_EC_REF_LOOPBACK,
+ SND_DEVICE_IN_HANDSET_GENERIC_6MIC_AND_EC_REF_LOOPBACK,
+ SND_DEVICE_IN_HANDSET_GENERIC_8MIC_AND_EC_REF_LOOPBACK,
+ SND_DEVICE_IN_HDMI_MIC_DSD,
+ SND_DEVICE_IN_ECALL,
+ SND_DEVICE_IN_SPEAKER_MIC2,
+ SND_DEVICE_IN_SPEAKER_MIC3,
+ SND_DEVICE_IN_HANDSET_GENERIC_6MIC_AND_SPEAKER_MIC2,
SND_DEVICE_IN_END,
SND_DEVICE_MAX = SND_DEVICE_IN_END,
@@ -405,6 +419,12 @@
HDMI_ARC_TX_BACKEND,
HEADSET_TX_BACKEND,
CALL_PROXY_TX_BACKEND,
+ SEC_MI2S_RX_BACKEND,
+ TERT_MI2S_RX_BACKEND,
+ TERT_MI2S_TX_BACKEND,
+ QUAT_MI2S_RX_BACKEND,
+ QUAT_TDM_TX_BACKEND,
+ SEN_TDM_TX_BACKEND,
MAX_CODEC_BACKENDS
};
diff --git a/hal/platform_api.h b/hal/platform_api.h
index 805db2f..9663372 100755
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -9,7 +9,7 @@
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
- *
+
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -149,7 +149,7 @@
struct audio_custom_mtmx_params {
struct listnode list;
struct audio_custom_mtmx_params_info info;
- uint32_t coeffs[0];
+ uint64_t coeffs[0];
};
struct audio_custom_mtmx_in_params_info {
@@ -168,6 +168,7 @@
struct audio_custom_mtmx_in_params_info in_info;
uint32_t ip_channels;
uint32_t mic_ch;
+ uint32_t i2s_ch;
uint32_t ec_ref_ch;
struct audio_custom_mtmx_params_in_ch_info in_ch_info[MAX_IN_CHANNELS];
};
diff --git a/hal/platform_info.c b/hal/platform_info.c
old mode 100755
new mode 100644
index da11cae..de7f187
--- a/hal/platform_info.c
+++ b/hal/platform_info.c
@@ -1225,6 +1225,10 @@
ENUM_TO_STRING(AUDIO_DEVICE_IN_LOOPBACK),
sizeof(mtmx_in_params->in_ch_info[in_ch_idx].device)))
mtmx_in_params->ec_ref_ch = mtmx_in_params->in_ch_info[in_ch_idx].ch_count;
+ else if (!strncmp(mtmx_in_params->in_ch_info[in_ch_idx].device,
+ ENUM_TO_STRING(AUDIO_DEVICE_IN_SPEAKER_MIC2),
+ sizeof(mtmx_in_params->in_ch_info[in_ch_idx].device)))
+ mtmx_in_params->i2s_ch = mtmx_in_params->in_ch_info[in_ch_idx].ch_count;
mtmx_in_params->ip_channels += mtmx_in_params->in_ch_info[in_ch_idx].ch_count;
}
@@ -1541,6 +1545,8 @@
return;
}
section = CUSTOM_MTMX_PARAM_IN_CH_INFO;
+ section_process_fn fn = section_table[section];
+ fn(attr);
} else if (strcmp(tag_name, "audio_input_source_delay") == 0) {
section = AUDIO_SOURCE_DELAY;
} else if (strcmp(tag_name, "audio_source_delay") == 0) {
diff --git a/qahw/inc/qahw_defs.h b/qahw/inc/qahw_defs.h
index 4601a2b..87389b4 100644
--- a/qahw/inc/qahw_defs.h
+++ b/qahw/inc/qahw_defs.h
@@ -228,6 +228,9 @@
#define QAHW_AUDIO_DEVICE_OUT_SPEAKER3 0x20000000
#define QAHW_AUDIO_DEVICE_OUT_OPTICAL 0x40000
+#define QAHW_AUDIO_DEVICE_IN_SPEAKER_MIC2 0x10000000
+#define QAHW_AUDIO_DEVICE_IN_SPEAKER_MIC3 0x20000000
+
#define QAHW_PCM_CUSTOM_CHANNEL_MAP_12 59
#define QAHW_PCM_CUSTOM_CHANNEL_MAP_13 60
#define QAHW_PCM_CUSTOM_CHANNEL_MAP_14 61
diff --git a/qahw_api/test/qahw_multi_record_test.c b/qahw_api/test/qahw_multi_record_test.c
index e033921..63f5e22 100644
--- a/qahw_api/test/qahw_multi_record_test.c
+++ b/qahw_api/test/qahw_multi_record_test.c
@@ -280,6 +280,9 @@
case 4:
params->config.channel_mask = AUDIO_CHANNEL_INDEX_MASK_4;
break;
+ case 6:
+ params->config.channel_mask = AUDIO_CHANNEL_INDEX_MASK_6;
+ break;
case 8:
params->config.channel_mask = AUDIO_CHANNEL_INDEX_MASK_8;
break;