From 552b08320f8d730a0c928ef699e5da1be06bde69 Mon Sep 17 00:00:00 2001 From: Aalique Grahame Date: Mon, 11 Mar 2019 10:16:38 -0700 Subject: [PATCH] hal: msm8974: fix device selection for voice call Fix output device selection for voice call so that stereo speaker is able to be selected. CRs-Fixed: 2411983 Change-Id: If5872a5ba5bd8a4a31e686cadaf9d947c3ca30dc --- hal/audio_hw.c | 1 + hal/msm8974/platform.c | 48 ++++++++++++++++++++---------------------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/hal/audio_hw.c b/hal/audio_hw.c index bb4db485..c103f1af 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -8747,6 +8747,7 @@ static int adev_open(const hw_module_t *module, const char *name, adev->perf_lock_opts[1] = 0x20E; adev->perf_lock_opts_size = 2; adev->dsp_bit_width_enforce_mode = 0; + adev->enable_hfp = false; /* Loads platform specific libraries dynamically */ adev->platform = platform_init(adev); diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c index adfeaa5d..7b1f386e 100644 --- a/hal/msm8974/platform.c +++ b/hal/msm8974/platform.c @@ -4764,33 +4764,31 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o else snd_device = SND_DEVICE_OUT_BT_SCO; } else if (devices & (AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_SPEAKER_SAFE)) { - if (!adev->enable_hfp) { - snd_device = SND_DEVICE_OUT_VOICE_SPEAKER; - } else { - snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_HFP; - } - } else if (devices & AUDIO_DEVICE_OUT_SPEAKER) { - if (my_data->is_vbat_speaker || my_data->is_bcl_speaker) { - if (hw_info_is_stereo_spkr(my_data->hw_info)) { - if (my_data->mono_speaker == SPKR_1) - snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_VBAT; - else - snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_2_VBAT; - } else + if (my_data->is_vbat_speaker || my_data->is_bcl_speaker) { + if (hw_info_is_stereo_spkr(my_data->hw_info)) { + if (my_data->mono_speaker == SPKR_1) snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_VBAT; - } else { - if (hw_info_is_stereo_spkr(my_data->hw_info)) { - if (my_data->voice_speaker_stereo) - snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_STEREO; - else { - if (my_data->mono_speaker == SPKR_1) - snd_device = SND_DEVICE_OUT_VOICE_SPEAKER; - else - snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_2; - } - } else + else + snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_2_VBAT; + } else + snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_VBAT; + } else { + if (hw_info_is_stereo_spkr(my_data->hw_info)) { + if (my_data->voice_speaker_stereo) + snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_STEREO; + else if (adev->enable_hfp) + snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_HFP; + else { + if (my_data->mono_speaker == SPKR_1) snd_device = SND_DEVICE_OUT_VOICE_SPEAKER; - } + else + snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_2; + } + } else if (adev->enable_hfp) + snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_HFP; + else + snd_device = SND_DEVICE_OUT_VOICE_SPEAKER; + } } else if (devices & AUDIO_DEVICE_OUT_ALL_A2DP) { snd_device = SND_DEVICE_OUT_BT_A2DP; } else if (devices & AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET ||