hal: Add change to fix speaker and headphone concurrency.
After the device switch from headset to the speaker, lag in playback
was observed.
The issue was seen because both the speaker and headphone was
configured using the native clock.
Add change to configure headphone to 48Khz sample rate before enabling
the use case on speaker.
Change-Id: I8ad1f2690e94a960f61fb7f36f49e8f6e5cace60
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 526a88f..8b88485 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -282,6 +282,7 @@
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 @@
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 @@
/* 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);