hal: set combo device with default sample rate on bengal
In bengal, there is only one clock source, it cannot
support set different sample rate for HS and SPKR
combo device.
Fix it by setting 48Khz sample rate for HS and SPKR
combo device.
Change-Id: Ic327643a11b4418b9e152d9bc8f153bcea800a69
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 985de83..833c1d9 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -363,6 +363,7 @@
struct snd_device_to_mic_map mic_map[SND_DEVICE_MAX];
struct spkr_device_chmap *spkr_ch_map;
bool use_sprk_default_sample_rate;
+ bool is_multiple_sample_rate_combo_supported;
struct listnode custom_mtmx_params_list;
struct listnode custom_mtmx_in_params_list;
};
@@ -3164,6 +3165,7 @@
my_data->use_sprk_default_sample_rate = true;
my_data->fluence_in_voice_comm = false;
my_data->ec_car_state = false;
+ my_data->is_multiple_sample_rate_combo_supported = true;
platform_reset_edid_info(my_data);
//set max volume step for voice call
@@ -3628,6 +3630,7 @@
my_data->current_backend_cfg[DEFAULT_CODEC_BACKEND].samplerate_mixer_ctl =
strdup("RX_CDC_DMA_RX_1 SampleRate");
default_rx_backend = strdup("RX_CDC_DMA_RX_1");
+ my_data->is_multiple_sample_rate_combo_supported = false;
}
} else if (!strncmp(snd_card_name, "sdm660", strlen("sdm660")) ||
!strncmp(snd_card_name, "sdm670", strlen("sdm670")) ||
@@ -5082,6 +5085,23 @@
return ret;
}
+int is_hdset_combo_device(struct listnode *out_devices)
+{
+ int ret = false;
+
+ if ((compare_device_type(out_devices, AUDIO_DEVICE_OUT_WIRED_HEADPHONE) &&
+ compare_device_type(out_devices, AUDIO_DEVICE_OUT_SPEAKER_SAFE)) ||
+ (compare_device_type(out_devices, AUDIO_DEVICE_OUT_WIRED_HEADSET) &&
+ compare_device_type(out_devices, AUDIO_DEVICE_OUT_SPEAKER_SAFE)) ||
+ (compare_device_type(out_devices, AUDIO_DEVICE_OUT_WIRED_HEADPHONE) &&
+ compare_device_type(out_devices, AUDIO_DEVICE_OUT_SPEAKER)) ||
+ (compare_device_type(out_devices, AUDIO_DEVICE_OUT_WIRED_HEADSET) &&
+ compare_device_type(out_devices, AUDIO_DEVICE_OUT_SPEAKER)))
+ ret = true;
+
+ return ret;
+}
+
int platform_get_backend_index(snd_device_t snd_device)
{
int32_t port = DEFAULT_CODEC_BACKEND;
@@ -9472,6 +9492,12 @@
sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
ALOGD("%s:becf: afe: set sample rate to default Sample Rate(48k)",__func__);
}
+
+ /*set sample rate to 48khz if multiple sample rates are not supported in spkr and hdset*/
+ if (is_hdset_combo_device(&usecase->device_list) &&
+ !my_data->is_multiple_sample_rate_combo_supported)
+ sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
+ ALOGD("%s:becf: afe: set default Sample Rate(48k) for combo device",__func__);
}
if (backend_idx != platform_get_voice_call_backend(adev)