hal: Update check to fix incorrect configuration of speaker backend.
-Speaker backend also gets configured to HIFI configuration, if
a combo request comes in during any HIFI playback.
-This leads to failure in playback on speaker.
-Add a separate check to ensure that for any speaker backend
the configuration is fixed to correct values.
Change-Id: I9f383438c2f10804b093505ff605eee7221a7fb5
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 5cef2b8..0022996 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -2524,8 +2524,9 @@
|| NATIVE_AUDIO_MODE_MULTIPLE_44_1 == na_mode) {
na_props.platform_na_prop_enabled = na_props.ui_na_prop_enabled = true;
na_props.na_mode = na_mode;
- ALOGD("%s:napb: native audio playback enabled in (%s) mode v2.0", __func__,
- ((na_mode == NATIVE_AUDIO_MODE_SRC)?"SRC mode":"True 44.1 mode"));
+ ALOGD("%s:napb: native audio playback enabled in (%s) mode", __func__,
+ ((na_mode == NATIVE_AUDIO_MODE_SRC)?"SRC":
+ (na_mode == NATIVE_AUDIO_MODE_TRUE_44_1)?"True":"Multiple"));
} else {
na_props.platform_na_prop_enabled = false;
na_props.na_mode = NATIVE_AUDIO_MODE_INVALID;
@@ -4929,8 +4930,13 @@
ALOGD("%s:becf: afe: napb not active - set non fractional rate",
__func__);
}
- } else if ((usecase->devices & AUDIO_DEVICE_OUT_SPEAKER) ||
- (usecase->devices & AUDIO_DEVICE_OUT_EARPIECE) ) {
+ }
+
+ /*
+ * Check if the device is speaker or handset,assumption handset shares
+ * backend with speaker, and these devices are restricited to 48kHz.
+ */
+ if (platform_check_backends_match(SND_DEVICE_OUT_SPEAKER, snd_device)) {
sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
if (bit_width >= 24) {
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index f9ee4b1..fd8c773 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -2237,8 +2237,9 @@
|| NATIVE_AUDIO_MODE_MULTIPLE_44_1 == na_mode) {
na_props.platform_na_prop_enabled = na_props.ui_na_prop_enabled = true;
na_props.na_mode = na_mode;
- ALOGD("%s:napb: native audio playback enabled in (%s) mode v2.0", __func__,
- ((na_mode == NATIVE_AUDIO_MODE_SRC)?"SRC mode":"True 44.1 mode"));
+ ALOGD("%s:napb: native audio playback enabled in (%s) mode", __func__,
+ ((na_mode == NATIVE_AUDIO_MODE_SRC)?"SRC":
+ (na_mode == NATIVE_AUDIO_MODE_TRUE_44_1)?"True":"Multiple"));
}
else {
na_props.platform_na_prop_enabled = false;
@@ -4831,8 +4832,13 @@
ALOGD("%s:becf: afe: napb not active - set non fractional rate",
__func__);
}
- } else if ((usecase->devices & AUDIO_DEVICE_OUT_SPEAKER) ||
- (usecase->devices & AUDIO_DEVICE_OUT_EARPIECE) ) {
+ }
+
+ /*
+ * Check if the device is speaker or handset,assumption handset shares
+ * backend with speaker, and these devices are restricited to 48kHz.
+ */
+ if (platform_check_backends_match(SND_DEVICE_OUT_SPEAKER, snd_device)) {
if (bit_width >= 24) {
bit_width = platform_get_snd_device_bit_width(SND_DEVICE_OUT_SPEAKER);