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/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,