Merge "Merge 6da25f4fd2cefebd5c2bc25c08bd31a8ad32a68f on remote branch"
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index e64d318..197bdfb 100755
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -569,6 +569,9 @@
if (snd_device == SND_DEVICE_OUT_HDMI)
adev->mChannelStatusSet = false;
+ if (snd_device == SND_DEVICE_OUT_HDMI)
+ adev->mChannelStatusSet = false;
+
audio_extn_dev_arbi_release(snd_device);
audio_extn_sound_trigger_update_device_status(snd_device,
ST_EVENT_SND_DEVICE_FREE);
@@ -916,8 +919,14 @@
(usecase->in_snd_device != SND_DEVICE_NONE) &&
(usecase->out_snd_device != SND_DEVICE_NONE)) {
status = platform_switch_voice_call_device_pre(adev->platform);
- /* Disable sidetone only if voice call already exists */
- if (voice_is_call_state_active(adev))
+ }
+
+ if (((usecase->type == VOICE_CALL) ||
+ (usecase->type == VOIP_CALL)) &&
+ (usecase->out_snd_device != SND_DEVICE_NONE)) {
+ /* Disable sidetone only if voice/voip call already exists */
+ if (voice_is_call_state_active(adev) ||
+ voice_extn_compress_voip_is_started(adev))
voice_set_sidetone(adev, usecase->out_snd_device, false);
}
@@ -961,8 +970,9 @@
out_snd_device,
in_snd_device);
enable_audio_route_for_voice_usecases(adev, usecase);
- /* Enable sidetone only if voice call already exists */
- if (voice_is_call_state_active(adev))
+ /* Enable sidetone only if voice/voip call already exists */
+ if (voice_is_call_state_active(adev) ||
+ voice_extn_compress_voip_is_started(adev))
voice_set_sidetone(adev, out_snd_device, true);
}
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 54532f4..92b4f13 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -1397,7 +1397,7 @@
#define TZ_TYPE "/sys/class/thermal/thermal_zone%d/type"
#define TZ_WSA "/sys/class/thermal/thermal_zone%d/temp"
-bool is_wsa_found(void)
+static bool is_wsa_found(int *wsaCount)
{
DIR *tdir = NULL;
struct dirent *tdirent = NULL;
@@ -1406,6 +1406,7 @@
char cwd[MAX_PATH] = {0};
char file[10] = "wsa";
bool found = false;
+ int wsa_count = 0;
if (!getcwd(cwd, sizeof(cwd)))
return false;
@@ -1433,14 +1434,19 @@
ALOGD("Opening %s\n", name);
read_line_from_file(name, buf, sizeof(buf));
if (strstr(buf, file)) {
- found = true;
- break;
+ wsa_count++;
+ /*We support max only two WSA speakers*/
+ if (wsa_count == 2)
+ break;
}
tzn++;
}
closedir(tzdir);
- if (found == true)
- break;
+ }
+ if (wsa_count > 0){
+ ALOGD("Found %d WSA present on the platform", wsa_count);
+ found = true;
+ *wsaCount = wsa_count;
}
closedir(tdir);
chdir(cwd); /* Restore current working dir */
@@ -1460,6 +1466,7 @@
const char *mixer_ctl_name = "Set HPX ActiveBe";
struct mixer_ctl *ctl = NULL;
int idx;
+ int wsaCount =0;
my_data = calloc(1, sizeof(struct platform_data));
if (!my_data) {
@@ -1570,6 +1577,17 @@
my_data->fluence_mode = FLUENCE_BROADSIDE;
}
}
+
+ if (is_wsa_found(&wsaCount)) {
+ /*Set ACDB ID of Stereo speaker if two WSAs are present*/
+ /*Default ACDB ID for wsa speaker is that for mono*/
+ if (wsaCount == 2) {
+ platform_set_snd_device_acdb_id(SND_DEVICE_OUT_SPEAKER_WSA, 15);
+ platform_set_snd_device_acdb_id(SND_DEVICE_OUT_SPEAKER_VBAT, 15);
+ }
+ my_data->is_wsa_speaker = true;
+ }
+
property_get("persist.audio.FFSP.enable", ffspEnable, "");
if (!strncmp("true", ffspEnable, sizeof("true"))) {
acdb_device_table[SND_DEVICE_OUT_SPEAKER] = 131;
@@ -1652,9 +1670,6 @@
}
audio_extn_pm_vote();
- if (is_wsa_found())
- my_data->is_wsa_speaker = true;
-
/* Configure active back end for HPX*/
ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
if (ctl) {
diff --git a/hal/voice_extn/compress_voip.c b/hal/voice_extn/compress_voip.c
index 04e0cd0..bb1caf9 100644
--- a/hal/voice_extn/compress_voip.c
+++ b/hal/voice_extn/compress_voip.c
@@ -238,6 +238,7 @@
__func__, USECASE_COMPRESS_VOIP_CALL);
return -EINVAL;
}
+ voice_set_sidetone(adev, uc_info->out_snd_device, false);
/* 1. Close the PCM devices */
if (voip_data.pcm_rx) {
@@ -309,6 +310,19 @@
goto error_start_voip;
}
+ ALOGD("%s: Opening PCM capture device card_id(%d) device_id(%d)",
+ __func__, adev->snd_card, pcm_dev_tx_id);
+ voip_data.pcm_tx = pcm_open(adev->snd_card,
+ pcm_dev_tx_id,
+ PCM_IN, voip_config);
+ if (voip_data.pcm_tx && !pcm_is_ready(voip_data.pcm_tx)) {
+ ALOGE("%s: %s", __func__, pcm_get_error(voip_data.pcm_tx));
+ pcm_close(voip_data.pcm_tx);
+ voip_data.pcm_tx = NULL;
+ ret = -EIO;
+ goto error_start_voip;
+ }
+
ALOGD("%s: Opening PCM playback device card_id(%d) device_id(%d)",
__func__, adev->snd_card, pcm_dev_rx_id);
voip_data.pcm_rx = pcm_open(adev->snd_card,
@@ -318,35 +332,19 @@
ALOGE("%s: %s", __func__, pcm_get_error(voip_data.pcm_rx));
pcm_close(voip_data.pcm_rx);
voip_data.pcm_rx = NULL;
- ret = -EIO;
- goto error_start_voip;
- }
-
- ALOGD("%s: Opening PCM capture device card_id(%d) device_id(%d)",
- __func__, adev->snd_card, pcm_dev_tx_id);
- voip_data.pcm_tx = pcm_open(adev->snd_card,
- pcm_dev_tx_id,
- PCM_IN, voip_config);
- if (voip_data.pcm_tx && !pcm_is_ready(voip_data.pcm_tx)) {
- ALOGE("%s: %s", __func__, pcm_get_error(voip_data.pcm_tx));
- pcm_close(voip_data.pcm_rx);
- voip_data.pcm_tx = NULL;
- if (voip_data.pcm_rx) {
- pcm_close(voip_data.pcm_rx);
- voip_data.pcm_rx = NULL;
+ if (voip_data.pcm_tx) {
+ pcm_close(voip_data.pcm_tx);
+ voip_data.pcm_tx = NULL;
}
ret = -EIO;
goto error_start_voip;
}
- pcm_start(voip_data.pcm_rx);
+
pcm_start(voip_data.pcm_tx);
+ pcm_start(voip_data.pcm_rx);
+ voice_set_sidetone(adev, uc_info->out_snd_device, true);
voice_extn_compress_voip_set_volume(adev, adev->voice.volume);
-
- if (ret < 0) {
- ALOGE("%s: error %d\n", __func__, ret);
- goto error_start_voip;
- }
} else {
ALOGV("%s: voip usecase is already enabled", __func__);
if (voip_data.out_stream)
@@ -730,3 +728,13 @@
}
return ret;
}
+
+bool voice_extn_compress_voip_is_started(struct audio_device *adev)
+{
+ bool ret = false;
+ if (voice_extn_compress_voip_is_active(adev) &&
+ voip_data.pcm_tx && voip_data.pcm_rx)
+ ret = true;
+
+ return ret;
+}
diff --git a/hal/voice_extn/voice_extn.h b/hal/voice_extn/voice_extn.h
index 4a04adb..af0ad08 100644
--- a/hal/voice_extn/voice_extn.h
+++ b/hal/voice_extn/voice_extn.h
@@ -145,6 +145,7 @@
bool voice_extn_compress_voip_is_active(struct audio_device *adev);
bool voice_extn_compress_voip_is_format_supported(audio_format_t format);
bool voice_extn_compress_voip_is_config_supported(struct audio_config *config);
+bool voice_extn_compress_voip_is_started(struct audio_device *adev);
#else
static int voice_extn_compress_voip_close_output_stream(struct audio_stream *stream __unused)
{
@@ -264,6 +265,12 @@
ALOGE("%s: COMPRESS_VOIP_ENABLED is not defined", __func__);
return true;
}
+
+static bool voice_extn_compress_voip_is_started(struct audio_device *adev __unused)
+{
+ ALOGE("%s: COMPRESS_VOIP_ENABLED is not defined", __func__);
+ return false;
+}
#endif
#endif //VOICE_EXTN_H