audio: hal: Add support for Ambisonic capture
Add changes in platform and config file to support
ambisonic capture.
Change-Id: I55cc5c039b0f49681b2054153c10e72a22d81d94
diff --git a/configs/sdm670/audio_output_policy.conf b/configs/sdm670/audio_output_policy.conf
index d66782e..f3dc620 100644
--- a/configs/sdm670/audio_output_policy.conf
+++ b/configs/sdm670/audio_output_policy.conf
@@ -115,4 +115,20 @@
bit_width 16
app_type 69944
}
+ record_ambisonic_16 {
+ profile record_ambisonic
+ flags AUDIO_INPUT_FLAG_NONE
+ formats AUDIO_FORMAT_PCM_16_BIT
+ sampling_rates 48000
+ bit_width 16
+ app_type 69949
+ }
+ record_ambisonic_24 {
+ profile record_ambisonic
+ flags AUDIO_INPUT_FLAG_NONE
+ formats AUDIO_FORMAT_PCM_24_BIT_PACKED
+ sampling_rates 48000
+ bit_width 24
+ app_type 69950
+ }
}
diff --git a/configs/sdm670/sdm670.mk b/configs/sdm670/sdm670.mk
index b939b09..f84821a 100644
--- a/configs/sdm670/sdm670.mk
+++ b/configs/sdm670/sdm670.mk
@@ -135,6 +135,11 @@
PRODUCT_PROPERTY_OVERRIDES += \
vendor.audio_hal.period_size=192
+##Ambisonic Capture
+PRODUCT_PROPERTY_OVERRIDES += \
+persist.vendor.audio.ambisonic.capture=false
+persist.vendor.audio.ambisonic.auto.profile=false
+
##fluencetype can be "fluence" or "fluencepro" or "none"
PRODUCT_PROPERTY_OVERRIDES += \
ro.vendor.audio.sdk.fluencetype=none\
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index b708a48..1c6233e 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -235,6 +235,8 @@
int fluence_type;
int fluence_mode;
char fluence_cap[PROPERTY_VALUE_MAX];
+ bool ambisonic_capture;
+ bool ambisonic_profile;
bool slowtalk;
bool hd_voice;
bool ec_ref_enabled;
@@ -2059,6 +2061,8 @@
my_data->external_mic = false;
my_data->fluence_type = FLUENCE_NONE;
my_data->fluence_mode = FLUENCE_ENDFIRE;
+ my_data->ambisonic_capture = false;
+ my_data->ambisonic_profile = false;
my_data->slowtalk = false;
my_data->hd_voice = false;
my_data->edid_info = NULL;
@@ -2117,6 +2121,13 @@
my_data->fluence_in_hfp_call = true;
}
}
+ /* Check for Ambisonic Capture Enablement */
+ if (property_get_bool("persist.vendor.audio.ambisonic.capture",false))
+ my_data->ambisonic_capture = true;
+
+ /* Check for Ambisonic Profile Assignment*/
+ if (property_get_bool("persist.vendor.audio.ambisonic.auto.profile",false))
+ my_data->ambisonic_profile = true;
/* Check if Vbat speaker enabled property is set, this should be done before acdb init */
bool ret = false;
@@ -4273,6 +4284,21 @@
source == AUDIO_SOURCE_MIC)) {
snd_device = SND_DEVICE_IN_HANDSET_GENERIC_QMIC;
platform_set_echo_reference(adev, true, out_device);
+ } 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
+ ((in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) || // AND device is buit-in or back mic
+ (in_device & AUDIO_DEVICE_IN_BACK_MIC)) &&
+ (source == AUDIO_SOURCE_MIC) && // AND source is MIC
+ (int)channel_mask == (int)AUDIO_CHANNEL_INDEX_MASK_4) { // AND input channel is 4
+ 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
+ */
+ if (my_data->ambisonic_profile == true) {
+ strlcpy(adev->active_input->profile, "record_ambisonic",
+ sizeof(adev->active_input->profile));
+ }
} else if (source == AUDIO_SOURCE_CAMCORDER) {
if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC ||
in_device & AUDIO_DEVICE_IN_BACK_MIC) {