BT sco and speaker combo device selection logic
Bug: 19171297
Test: make, HFP regression test, testplans/79248
Change-Id: I1a5eddceca0fc3e9e66e87337d7f7dd7415d6a87
(cherry picked from commit fad35a48351d36224c7d4747cc5f1e7e1677d7fd)
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index b0e87be..ff90c8d 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -230,6 +230,8 @@
[SND_DEVICE_OUT_SPEAKER_PROTECTED] = "speaker-protected",
[SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED] = "voice-speaker-protected",
[SND_DEVICE_OUT_VOICE_SPEAKER_HFP] = "voice-speaker-hfp",
+ [SND_DEVICE_OUT_SPEAKER_AND_BT_SCO] = "speaker-and-bt-sco",
+ [SND_DEVICE_OUT_SPEAKER_AND_BT_SCO_WB] = "speaker-and-bt-sco-wb",
/* Capture sound devices */
[SND_DEVICE_IN_HANDSET_MIC] = "handset-mic",
@@ -427,6 +429,8 @@
{TO_NAME_INDEX(SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES)},
{TO_NAME_INDEX(SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES)},
{TO_NAME_INDEX(SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET)},
+ {TO_NAME_INDEX(SND_DEVICE_OUT_SPEAKER_AND_BT_SCO)},
+ {TO_NAME_INDEX(SND_DEVICE_OUT_SPEAKER_AND_BT_SCO_WB)},
/* in */
{TO_NAME_INDEX(SND_DEVICE_OUT_SPEAKER_PROTECTED)},
@@ -1947,6 +1951,20 @@
new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER_SAFE;
new_snd_devices[1] = SND_DEVICE_OUT_LINE;
ret = 0;
+ } else if (snd_device == SND_DEVICE_OUT_SPEAKER_AND_BT_SCO &&
+ !platform_check_backends_match(SND_DEVICE_OUT_SPEAKER,
+ SND_DEVICE_OUT_BT_SCO)) {
+ *num_devices = 2;
+ new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;
+ new_snd_devices[1] = SND_DEVICE_OUT_BT_SCO;
+ ret = 0;
+ } else if (snd_device == SND_DEVICE_OUT_SPEAKER_AND_BT_SCO_WB &&
+ !platform_check_backends_match(SND_DEVICE_OUT_SPEAKER,
+ SND_DEVICE_OUT_BT_SCO_WB)) {
+ *num_devices = 2;
+ new_snd_devices[0] = SND_DEVICE_OUT_SPEAKER;
+ new_snd_devices[1] = SND_DEVICE_OUT_BT_SCO_WB;
+ ret = 0;
}
return ret;
}
@@ -1985,6 +2003,11 @@
} else if (devices == (AUDIO_DEVICE_OUT_AUX_DIGITAL |
AUDIO_DEVICE_OUT_SPEAKER)) {
snd_device = SND_DEVICE_OUT_SPEAKER_AND_HDMI;
+ } else if ((devices & AUDIO_DEVICE_OUT_ALL_SCO) &&
+ ((devices & ~AUDIO_DEVICE_OUT_ALL_SCO) == AUDIO_DEVICE_OUT_SPEAKER)) {
+ snd_device = adev->bt_wb_speech_enabled ?
+ SND_DEVICE_OUT_SPEAKER_AND_BT_SCO_WB :
+ SND_DEVICE_OUT_SPEAKER_AND_BT_SCO;
} else {
ALOGE("%s: Invalid combo device(%#x)", __func__, devices);
goto exit;
diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h
index fb6e24d..3e2c968 100644
--- a/hal/msm8974/platform.h
+++ b/hal/msm8974/platform.h
@@ -78,6 +78,8 @@
SND_DEVICE_OUT_SPEAKER_PROTECTED,
SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED,
SND_DEVICE_OUT_VOICE_SPEAKER_HFP,
+ SND_DEVICE_OUT_SPEAKER_AND_BT_SCO,
+ SND_DEVICE_OUT_SPEAKER_AND_BT_SCO_WB,
SND_DEVICE_OUT_END,
/*