Merge "configs: mmap usecase - phone bus changes"
diff --git a/configs/msmnile_au/mixer_paths_adp.xml b/configs/msmnile_au/mixer_paths_adp.xml
index ec95990..3e3c5ff 100644
--- a/configs/msmnile_au/mixer_paths_adp.xml
+++ b/configs/msmnile_au/mixer_paths_adp.xml
@@ -1144,6 +1144,10 @@
<ctl name="AFE_PCM_RX Audio Mixer MultiMedia16" value="1" />
</path>
+ <path name="mmap-record">
+ <ctl name="MultiMedia16 Mixer TERT_TDM_TX_0" value="1" />
+ </path>
+
<path name="hifi-playback afe-proxy">
<ctl name="AFE_PCM_RX Audio Mixer MultiMedia2" value="1" />
</path>
diff --git a/configs/msmnile_au/msmnile_au.mk b/configs/msmnile_au/msmnile_au.mk
index 9887d78..9e68f75 100644
--- a/configs/msmnile_au/msmnile_au.mk
+++ b/configs/msmnile_au/msmnile_au.mk
@@ -137,7 +137,7 @@
endif
AUDIO_FEATURE_ENABLED_FM_TUNER_EXT := true
AUDIO_FEATURE_ENABLED_ICC := true
-ifneq ( ,$(filter S 12, $(PLATFORM_VERSION)))
+ifneq ( ,$(filter S 12 T 13, $(PLATFORM_VERSION)))
AUDIO_FEATURE_ENABLED_POWER_POLICY := true
endif
ifneq ( ,$(filter msmnile_gvmq msmnile_au, $(TARGET_BOARD_PLATFORM)$(TARGET_BOARD_SUFFIX)))
@@ -380,9 +380,9 @@
#Enable AAudio MMAP/NOIRQ data path
#1 is AAUDIO_POLICY_NEVER so it will not try MMAP
#2 is AAUDIO_POLICY_AUTO so it will try MMAP then fallback to Legacy path
-PRODUCT_PROPERTY_OVERRIDES += aaudio.mmap_policy=1
+PRODUCT_PROPERTY_OVERRIDES += aaudio.mmap_policy=2
#Allow EXCLUSIVE then fall back to SHARED.
-PRODUCT_PROPERTY_OVERRIDES += aaudio.mmap_exclusive_policy=1
+PRODUCT_PROPERTY_OVERRIDES += aaudio.mmap_exclusive_policy=2
PRODUCT_PROPERTY_OVERRIDES += aaudio.hw_burst_min_usec=2000
#enable mirror-link feature
diff --git a/hal/acdb.c b/hal/acdb.c
index 8dfcc2c..4b1ef31 100644
--- a/hal/acdb.c
+++ b/hal/acdb.c
@@ -4,6 +4,10 @@
*
* Copyright (C) 2013 The Android Open Source Project
*
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause-Clear
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -243,6 +247,19 @@
list_remove(node);
free(key_info);
}
+
+ if (result < 0) {
+
+ if (snd_card_name)
+ free((void *)snd_card_name);
+
+ if (my_data->acdb_init_data.snd_card_name)
+ free(my_data->acdb_init_data.snd_card_name);
+
+ if (my_data)
+ platform_info_deinit();
+ }
+
free(my_data);
}
diff --git a/hal/audio_extn/keep_alive.c b/hal/audio_extn/keep_alive.c
index 386bfc1..a969412 100644
--- a/hal/audio_extn/keep_alive.c
+++ b/hal/audio_extn/keep_alive.c
@@ -25,6 +25,11 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* Changes from Qualcomm Innovation Center are provided under the following license:
+*
+* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#define LOG_TAG "keep_alive"
@@ -198,13 +203,14 @@
struct listnode out_devices;
pthread_mutex_lock(&ka.lock);
+ list_init(&out_devices);
+
ALOGV("%s: mode %x", __func__, ka_mode);
if ((ka.state == STATE_DISABLED)||(ka.state == STATE_DEINIT)) {
ALOGE(" %s : Unexpected state %x",__func__, ka.state);
goto exit;
}
- list_init(&out_devices);
get_device_id_from_mode(ka_mode, &out_devices);
if (compare_devices(&out_devices, &ka.active_devices) &&
(ka.state == STATE_ACTIVE)) {
diff --git a/hal/audio_extn/power_policy_launcher.cpp b/hal/audio_extn/power_policy_launcher.cpp
index ac846cd..b655e37 100644
--- a/hal/audio_extn/power_policy_launcher.cpp
+++ b/hal/audio_extn/power_policy_launcher.cpp
@@ -36,7 +36,7 @@
int launchPowerPolicyClient(power_policy_init_config_t init_config) {
ALOGD("%s: power policy launcher called", __func__);
- ABinderProcess_setThreadPoolMaxThreadCount(0);
+ ABinderProcess_setThreadPoolMaxThreadCount(1);
std::shared_ptr<PowerPolicyClient> powerPolicyClient =
::ndk::SharedRefBase::make<PowerPolicyClient>(init_config);
ALOGD("%s:Instantiating power policy client from launcher", __func__);
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 2407cfc..554b624 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1909,6 +1909,7 @@
snd_device_t d1 = uc->out_snd_device;
snd_device_t d2 = new_snd_device;
+ snd_device_t ret = 0;
list_init(&a1);
list_init(&a2);
@@ -1939,28 +1940,39 @@
__func__,
list_length(&a1) > 1 ? d1 : d2);
}
+ ret = d2;
goto end;
}
if (platform_check_backends_match(d3[0], d3[1])) {
- return d2; // case 5
+ ret = d2;
+ goto end; // case 5
} else {
if ((list_length(&a1) > 1) && (list_length(&a2) > 1) &&
- platform_check_backends_match(d1, d2))
- return d2; //case 9
- if (list_length(&a1) > 1)
- return d1; //case 7
+ platform_check_backends_match(d1, d2)) {
+ ret = d2;
+ goto end; //case 9
+ }
+ if (list_length(&a1) > 1) {
+ ret = d1;
+ goto end; //case 7
+ }
// check if d1 is related to any of d3's
- if (d1 == d3[0] || d1 == d3[1])
- return d1; // case 1
- else
- return d3[1]; // case 8
+ if (d1 == d3[0] || d1 == d3[1]) {
+ ret = d1;
+ goto end; // case 1
+ } else {
+ ret = d3[1];
+ goto end; // case 8
+ }
}
} else {
if (platform_check_backends_match(d1, d2)) {
- return d2; // case 2, 4
+ ret = d2;
+ goto end; // case 2, 4
} else {
- return d1; // case 6, 3
+ ret = d1;
+ goto end; // case 6, 3
}
}
@@ -1968,7 +1980,9 @@
clear_devices(&a2);
end:
- return d2; // return whatever was calculated before.
+ clear_devices(&a1);
+ clear_devices(&a2);
+ return ret; // return whatever was calculated before.
}
static void check_usecases_codec_backend(struct audio_device *adev,
diff --git a/hal/msm8974/hw_info.c b/hal/msm8974/hw_info.c
index 178c89c..ef6c790 100644
--- a/hal/msm8974/hw_info.c
+++ b/hal/msm8974/hw_info.c
@@ -1,6 +1,10 @@
/*
* Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
*
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause-Clear
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
@@ -1001,7 +1005,7 @@
{
struct hardware_info *my_data = (struct hardware_info*) hw_info;
- if(!my_data)
+ if (my_data)
free(my_data);
}
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 0736daf..c92dfe4 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -2729,8 +2729,6 @@
hw_interface_table[SND_DEVICE_IN_CAPTURE_FM] = strdup("SLIMBUS_8_TX");
hw_interface_table[SND_DEVICE_IN_AANC_HANDSET_MIC] = strdup("SLIMBUS_0_TX");
hw_interface_table[SND_DEVICE_IN_QUAD_MIC] = strdup("SLIMBUS_0_TX");
- hw_interface_table[SND_DEVICE_IN_HANDSET_DMIC_STEREO] = strdup("SLIMBUS_0_TX");
- hw_interface_table[SND_DEVICE_IN_SPEAKER_DMIC_STEREO] = strdup("SLIMBUS_0_TX");
hw_interface_table[SND_DEVICE_IN_CAPTURE_VI_FEEDBACK] = strdup("SLIMBUS_4_TX");
hw_interface_table[SND_DEVICE_IN_CAPTURE_VI_FEEDBACK_MONO_1] = strdup("SLIMBUS_4_TX");
hw_interface_table[SND_DEVICE_IN_CAPTURE_VI_FEEDBACK_MONO_2] = strdup("SLIMBUS_4_TX");
diff --git a/hal/platform_api.h b/hal/platform_api.h
index d789494..850f525 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -293,6 +293,7 @@
/* From platform_info.c */
int platform_info_init(const char *filename, void *, caller_t);
+void platform_info_deinit();
void platform_snd_card_update(void *platform, card_status_t scard_status);
diff --git a/hal/platform_info.c b/hal/platform_info.c
index 0dd7c8c..80b6e0d 100644
--- a/hal/platform_info.c
+++ b/hal/platform_info.c
@@ -1688,7 +1688,9 @@
my_data.caller = caller_type;
my_data.platform = platform;
- my_data.kvpairs = str_parms_create();
+
+ if (!my_data.kvpairs)
+ my_data.kvpairs = str_parms_create();
XML_SetElementHandler(parser, start_tag, end_tag);
@@ -1727,3 +1729,9 @@
pthread_mutex_unlock(&parser_lock);
return ret;
}
+
+void platform_info_deinit()
+{
+ if (my_data.kvpairs)
+ str_parms_destroy(my_data.kvpairs);
+}