hal: avoid select stereo speaker during quad-mic call
During quad-mic all, recevier mic is selected in TX path.
When using stereo speaker, top speaker is near to
the mic. This causes instant feedback loop during tuning.
Fix it by using bottom speaker during quad-mic call.
Change-Id: Ie0f14356872f013fdc8b38ff41f61504b86a2553
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index 0e4b9b0..a198076 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -408,6 +408,7 @@
snd_device, device_name) (0)
#define hw_info_enable_wsa_combo_usecase_support(hw_info) (0)
#define hw_info_is_stereo_spkr(hw_info) (0)
+#define hw_info_use_mono_spkr_for_qmic(hw_info) (0)
#else
void *hw_info_init(const char *snd_card_name);
@@ -416,6 +417,7 @@
char *device_name);
void hw_info_enable_wsa_combo_usecase_support(void *hw_info);
bool hw_info_is_stereo_spkr(void *hw_info);
+bool hw_info_use_mono_spkr_for_qmic(void *hw_info);
#endif
diff --git a/hal/msm8974/hw_info.c b/hal/msm8974/hw_info.c
index d8d6215..be39da9 100644
--- a/hal/msm8974/hw_info.c
+++ b/hal/msm8974/hw_info.c
@@ -54,6 +54,7 @@
snd_device_t *snd_devices;
bool is_wsa_combo_suppported;
bool is_stereo_spkr;
+ bool use_mono_spkr_for_qmic;
};
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
@@ -591,6 +592,7 @@
if (!strncmp(snd_card_name, "lahaina-mtp-snd-card",
sizeof("lahaina-mtp-snd-card"))) {
strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
+ hw_info->use_mono_spkr_for_qmic = true;
} else if (!strncmp(snd_card_name, "lahaina-qrd-snd-card",
sizeof("lahaina-qrd-snd-card"))) {
strlcpy(hw_info->name, "lahaina", sizeof(hw_info->name));
@@ -876,6 +878,7 @@
hw_info->snd_devices = NULL;
hw_info->num_snd_devices = 0;
hw_info->is_stereo_spkr = true;
+ hw_info->use_mono_spkr_for_qmic = false;
hw_info->is_wsa_combo_suppported = false;
strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
strlcpy(hw_info->type, "", sizeof(hw_info->type));
@@ -1021,3 +1024,10 @@
return my_data->is_stereo_spkr;
}
+
+bool hw_info_use_mono_spkr_for_qmic(void *hw_info)
+{
+ struct hardware_info *my_data = (struct hardware_info*) hw_info;
+
+ return my_data->use_mono_spkr_for_qmic;
+}
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 8bd2bbf..066314f 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -6580,7 +6580,10 @@
snd_device = SND_DEVICE_OUT_VOICE_SPEAKER_2_WSA;
} else {
if (hw_info_is_stereo_spkr(my_data->hw_info)) {
- if (my_data->voice_speaker_stereo)
+ if (my_data->fluence_type & FLUENCE_QUAD_MIC &&
+ hw_info_use_mono_spkr_for_qmic(my_data->hw_info))
+ snd_device = SND_DEVICE_OUT_VOICE_SPEAKER;
+ else 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;