diff --git a/configs/holi/audio_platform_info.xml b/configs/holi/audio_platform_info.xml
index bb3673d3..be986b3f 100644
--- a/configs/holi/audio_platform_info.xml
+++ b/configs/holi/audio_platform_info.xml
@@ -133,6 +133,10 @@
+
+
+
+
diff --git a/configs/holi/audio_platform_info_intcodec.xml b/configs/holi/audio_platform_info_intcodec.xml
index 33b1d0a1..a032a925 100644
--- a/configs/holi/audio_platform_info_intcodec.xml
+++ b/configs/holi/audio_platform_info_intcodec.xml
@@ -110,6 +110,10 @@
+
+
+
+
diff --git a/configs/holi/audio_platform_info_qrd.xml b/configs/holi/audio_platform_info_qrd.xml
index 2d51fc34..f39273dd 100644
--- a/configs/holi/audio_platform_info_qrd.xml
+++ b/configs/holi/audio_platform_info_qrd.xml
@@ -110,6 +110,10 @@
+
+
+
+
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index f441d3b2..6da2652e 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -935,6 +935,36 @@ static void disable_asrc_mode(struct audio_device *adev)
adev->asrc_mode_enabled = false;
}
+static void check_and_configure_headphone(struct audio_device *adev,
+ struct audio_usecase *uc_info,
+ snd_device_t snd_device)
+{
+ struct listnode *node;
+ struct audio_usecase *usecase;
+ int new_backend_idx, usecase_backend_idx;
+ bool spkr_hph_single_be_native_concurrency;
+
+ new_backend_idx = platform_get_backend_index(snd_device);
+ spkr_hph_single_be_native_concurrency = platform_get_spkr_hph_single_be_native_concurrency_flag();
+ if ( spkr_hph_single_be_native_concurrency && (new_backend_idx == DEFAULT_CODEC_BACKEND)) {
+ list_for_each(node, &adev->usecase_list) {
+ usecase = node_to_item(node, struct audio_usecase, list);
+ if ((usecase->type != PCM_CAPTURE) && (usecase != uc_info)) {
+ usecase_backend_idx = platform_get_backend_index(usecase->out_snd_device);
+ if (((usecase_backend_idx == HEADPHONE_BACKEND) ||
+ (usecase_backend_idx == HEADPHONE_44_1_BACKEND)) &&
+ ((usecase->stream.out->sample_rate % OUTPUT_SAMPLING_RATE_44100) == 0)) {
+ disable_audio_route(adev, usecase);
+ disable_snd_device(adev, usecase->out_snd_device);
+ usecase->stream.out->sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
+ enable_audio_route(adev, usecase);
+ enable_snd_device(adev, usecase->out_snd_device);
+ }
+ }
+ }
+ }
+}
+
/*
* - Enable ASRC mode for incoming mix path use case(Headphone backend)if Headphone
* 44.1 or Native DSD backends are enabled for any of current use case.
@@ -2968,6 +2998,7 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id)
/* Enable new sound devices */
if (out_snd_device != SND_DEVICE_NONE) {
check_usecases_codec_backend(adev, usecase, out_snd_device);
+ check_and_configure_headphone(adev, usecase, out_snd_device);
if (platform_check_codec_asrc_support(adev->platform))
check_and_set_asrc_mode(adev, usecase, out_snd_device);
enable_snd_device(adev, out_snd_device);
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 526a88f3..8b884850 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -282,6 +282,7 @@ typedef struct codec_backend_cfg {
static native_audio_prop na_props = {0, 0, NATIVE_AUDIO_MODE_INVALID};
static bool supports_true_32_bit = false;
+static bool spkr_hph_single_be_native_concurrency = false;
static int max_be_dai_names = 0;
static const struct be_dai_name_struct *be_dai_name_table;
@@ -5159,6 +5160,27 @@ int platform_get_native_support()
return ret;
}
+bool platform_get_spkr_hph_single_be_native_concurrency_flag()
+{
+ return spkr_hph_single_be_native_concurrency;
+}
+
+void spkr_hph_single_be_native_concurrency_params(struct str_parms *parms,
+ char *value, int len)
+{
+ int ret = 0;
+
+ ret = str_parms_get_str(parms, AUDIO_PARAMETER_SPKR_HPH_SINGLE_BE_NATIVE_CONCURRENCY,
+ value, len);
+ if (ret >= 0) {
+ if (value && !strncmp(value, "true", sizeof("true")))
+ spkr_hph_single_be_native_concurrency = true;
+ else
+ spkr_hph_single_be_native_concurrency = false;
+ str_parms_del(parms, AUDIO_PARAMETER_SPKR_HPH_SINGLE_BE_NATIVE_CONCURRENCY);
+ }
+}
+
void native_audio_get_params(struct str_parms *query,
struct str_parms *reply,
char *value, int len)
@@ -8427,6 +8449,7 @@ int platform_set_parameters(void *platform, struct str_parms *parms)
/* handle audio calibration parameters */
set_audiocal(platform, parms, value, len);
+ spkr_hph_single_be_native_concurrency_params(parms, value, len);
native_audio_set_params(platform, parms, value, len);
audio_extn_spkr_prot_set_parameters(parms, value, len);
audio_extn_usb_set_sidetone_gain(parms, value, len);
diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h
index 415e4b07..1375c88a 100644
--- a/hal/msm8974/platform.h
+++ b/hal/msm8974/platform.h
@@ -370,6 +370,8 @@ enum {
#define AUDIO_PARAMETER_KEY_TRUE_32_BIT "true_32_bit"
+#define AUDIO_PARAMETER_SPKR_HPH_SINGLE_BE_NATIVE_CONCURRENCY "spkr_hph_single_be_native_concurrency"
+
#define AUDIO_MAX_DSP_CHANNELS 32
#define ALL_SESSION_VSID 0xFFFFFFFF
diff --git a/hal/platform_api.h b/hal/platform_api.h
index f68d6e7a..f58dce0b 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -334,6 +334,7 @@ int platform_get_backend_index(snd_device_t snd_device);
int platform_get_ext_disp_type(void *platform);
void platform_invalidate_hdmi_config(void *platform);
void platform_invalidate_backend_config(void * platform,snd_device_t snd_device);
+bool platform_get_spkr_hph_single_be_native_concurrency_flag();
#ifdef INSTANCE_ID_ENABLED
void platform_make_cal_cfg(acdb_audio_cal_cfg_t* cal, int acdb_dev_id,