Merge "hal: avoid select stereo speaker during quad-mic call"
diff --git a/configs/lahaina/mixer_paths.xml b/configs/lahaina/mixer_paths.xml
index 32a39bd..05b2928 100644
--- a/configs/lahaina/mixer_paths.xml
+++ b/configs/lahaina/mixer_paths.xml
@@ -2515,7 +2515,7 @@
<ctl name="SWR DAC_Port Switch" value="1" />
</path>
- <path name="speaker-mono">
+ <path name="speaker-mono-2">
<ctl name="WSA_CDC_DMA_RX_0 Channels" value="One" />
<ctl name="WSA RX0 MUX" value="AIF1_PB" />
<ctl name="WSA_RX0 INP0" value="RX0" />
@@ -2525,7 +2525,7 @@
<ctl name="SpkrLeft SWR DAC_Port Switch" value="1" />
</path>
- <path name="speaker-mono-2">
+ <path name="speaker-mono">
<ctl name="WSA_CDC_DMA_RX_0 Channels" value="One" />
<ctl name="WSA RX1 MUX" value="AIF1_PB" />
<ctl name="WSA_RX1 INP0" value="RX1" />
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 bee414b..135aca1 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));
@@ -886,6 +888,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));
@@ -1031,3 +1034,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 18191c8..88ed018 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -6608,7 +6608,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;