summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVignesh Kulothungan <vigneshk@codeaurora.org>2019-06-05 11:49:28 -0700
committerBubble Fang <bubblefang@google.com>2019-06-09 15:56:18 +0000
commit3ff768954a8d1ac1effc3a745f842b231f58a93c (patch)
tree25ea1dcd7af56e8927861ba43c41fce789242cc1
parentb0c9148b009e4488f4a8b2ae3d009cb46ce2bc04 (diff)
downloadandroid_hardware_qcom_audio-3ff768954a8d1ac1effc3a745f842b231f58a93c.tar.gz
android_hardware_qcom_audio-3ff768954a8d1ac1effc3a745f842b231f58a93c.tar.bz2
android_hardware_qcom_audio-3ff768954a8d1ac1effc3a745f842b231f58a93c.zip
audio: Add support for DSDS for incall music feature
Add support for incall-music-uplink2 usecase to enable Dual Sim Dual Standby (DSDS) voice scenarios Bug: 132080107 Test: Local test Change-Id: I26206b1887f002bb58fcfb3378600ef81e111662 Signed-off-by: BubbleFang <bubblefang@google.com>
-rw-r--r--hal/audio_hw.c26
-rw-r--r--hal/audio_hw.h1
-rw-r--r--hal/msm8974/platform.c3
-rw-r--r--hal/msm8974/platform.h1
-rw-r--r--hal/voice_extn/voice_extn.c11
5 files changed, 37 insertions, 5 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 2113c7db..5d611c6b 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -315,6 +315,7 @@ const char * const use_case_table[AUDIO_USECASE_MAX] = {
[USECASE_AUDIO_RECORD_VOIP] = "audio-record-voip",
[USECASE_INCALL_MUSIC_UPLINK] = "incall-music-uplink",
+ [USECASE_INCALL_MUSIC_UPLINK2] = "incall-music-uplink2",
[USECASE_AUDIO_A2DP_ABR_FEEDBACK] = "a2dp-abr-feedback",
};
@@ -1725,7 +1726,8 @@ int select_devices_with_force_switch(struct audio_device *adev,
out_snd_device = SND_DEVICE_OUT_SPEAKER;
}
- if (usecase->id == USECASE_INCALL_MUSIC_UPLINK) {
+ if (usecase->id == USECASE_INCALL_MUSIC_UPLINK ||
+ usecase->id == USECASE_INCALL_MUSIC_UPLINK2) {
out_snd_device = SND_DEVICE_OUT_VOICE_MUSIC_TX;
}
@@ -2338,8 +2340,10 @@ static int stop_output_stream(struct stream_out *out)
audio_low_latency_hint_end();
}
- if (out->usecase == USECASE_INCALL_MUSIC_UPLINK)
+ if (out->usecase == USECASE_INCALL_MUSIC_UPLINK ||
+ out->usecase == USECASE_INCALL_MUSIC_UPLINK2) {
voice_set_device_mute_flag(adev, false);
+ }
/* 1. Get and set stream specific mixer controls */
disable_audio_route(adev, uc_info);
@@ -2444,6 +2448,16 @@ int start_output_stream(struct stream_out *out)
goto error_config;
}
+ //Update incall music usecase to reflect correct voice session
+ if (out->flags & AUDIO_OUTPUT_FLAG_INCALL_MUSIC) {
+ ret = voice_extn_check_and_set_incall_music_usecase(adev, out);
+ if (ret != 0) {
+ ALOGE("%s: Incall music delivery usecase cannot be set error:%d",
+ __func__, ret);
+ goto error_config;
+ }
+ }
+
if (out->devices & AUDIO_DEVICE_OUT_ALL_A2DP) {
if (!audio_extn_a2dp_is_ready()) {
if (out->devices & (AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_SPEAKER_SAFE)) {
@@ -2506,8 +2520,10 @@ int start_output_stream(struct stream_out *out)
audio_extn_extspk_update(adev->extspk);
- if (out->usecase == USECASE_INCALL_MUSIC_UPLINK)
+ if (out->usecase == USECASE_INCALL_MUSIC_UPLINK ||
+ out->usecase == USECASE_INCALL_MUSIC_UPLINK2) {
voice_set_device_mute_flag(adev, true);
+ }
ALOGV("%s: Opening PCM device card_id(%d) device_id(%d) format(%#x)",
__func__, adev->snd_card, out->pcm_device_id, out->config.format);
@@ -3502,7 +3518,9 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer,
if (out->muted)
memset((void *)buffer, 0, bytes);
// FIXME: this can be removed once audio flinger mixer supports mono output
- if (out->usecase == USECASE_AUDIO_PLAYBACK_VOIP || out->usecase == USECASE_INCALL_MUSIC_UPLINK) {
+ if (out->usecase == USECASE_AUDIO_PLAYBACK_VOIP ||
+ out->usecase == USECASE_INCALL_MUSIC_UPLINK ||
+ out->usecase == USECASE_INCALL_MUSIC_UPLINK2) {
size_t channel_count = audio_channel_count_from_out_mask(out->channel_mask);
int16_t *src = (int16_t *)buffer;
int16_t *dst = (int16_t *)buffer;
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 764093ff..54ee72c5 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -134,6 +134,7 @@ enum {
USECASE_AUDIO_RECORD_VOIP,
USECASE_INCALL_MUSIC_UPLINK,
+ USECASE_INCALL_MUSIC_UPLINK2,
USECASE_AUDIO_A2DP_ABR_FEEDBACK,
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 4ae5d1c3..41d8bd28 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -251,6 +251,8 @@ static int pcm_device_table[AUDIO_USECASE_MAX][2] = {
[USECASE_INCALL_MUSIC_UPLINK] = {INCALL_MUSIC_UPLINK_PCM_DEVICE,
INCALL_MUSIC_UPLINK_PCM_DEVICE},
+ [USECASE_INCALL_MUSIC_UPLINK2] = {INCALL_MUSIC_UPLINK2_PCM_DEVICE,
+ INCALL_MUSIC_UPLINK2_PCM_DEVICE},
};
/* Array to store sound devices */
@@ -712,6 +714,7 @@ static const struct name_to_index usecase_name_index[AUDIO_USECASE_MAX] = {
{TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_VOIP)},
{TO_NAME_INDEX(USECASE_AUDIO_RECORD_VOIP)},
{TO_NAME_INDEX(USECASE_INCALL_MUSIC_UPLINK)},
+ {TO_NAME_INDEX(USECASE_INCALL_MUSIC_UPLINK2)},
{TO_NAME_INDEX(USECASE_AUDIO_A2DP_ABR_FEEDBACK)},
};
diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h
index c2beec99..3ab31787 100644
--- a/hal/msm8974/platform.h
+++ b/hal/msm8974/platform.h
@@ -336,6 +336,7 @@ enum {
#define AFE_PROXY_RECORD_PCM_DEVICE 8
#define INCALL_MUSIC_UPLINK_PCM_DEVICE 27
+#define INCALL_MUSIC_UPLINK2_PCM_DEVICE 27
#define HFP_PCM_RX 5
#ifdef PLATFORM_MSM8x26
diff --git a/hal/voice_extn/voice_extn.c b/hal/voice_extn/voice_extn.c
index c4b8cff0..5d0596a4 100644
--- a/hal/voice_extn/voice_extn.c
+++ b/hal/voice_extn/voice_extn.c
@@ -576,7 +576,16 @@ void voice_extn_get_parameters(const struct audio_device *adev,
int voice_extn_check_and_set_incall_music_usecase(struct audio_device *adev,
struct stream_out *out)
{
- out->usecase = USECASE_INCALL_MUSIC_UPLINK;
+ uint32_t session_id = get_session_id_with_state(adev, CALL_ACTIVE);
+ if (session_id == VOICEMMODE1_VSID)
+ out->usecase = USECASE_INCALL_MUSIC_UPLINK;
+ else if (session_id == VOICEMMODE2_VSID)
+ out->usecase = USECASE_INCALL_MUSIC_UPLINK2;
+ else {
+ ALOGE("%s: Invalid session id %x", __func__, session_id);
+ out->usecase = USECASE_INCALL_MUSIC_UPLINK;
+ }
+
out->config = pcm_config_incall_music;
//FIXME: add support for MONO stream configuration when audioflinger mixer supports it
out->supported_channel_masks[0] = AUDIO_CHANNEL_OUT_STEREO;