hal: Fix for device check against wrong codec backend
Make sure out stream device is checked against out codec backend
device and in stream device against in codec backend. Checking out
device against in codec backend or vice versa leads to issues as
some out and in device ids are common except the bit in.
CRs-Fixed: 1088820
Change-Id: I1197411c287cf65d41ed1d16f300e962b677b832
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index a6de6e9..c2bcbe0 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -2607,6 +2607,8 @@
if (backend_tag_table[snd_device] != NULL) {
if (strcmp(backend_tag_table[snd_device], "usb-headset-mic") == 0)
port = USB_AUDIO_TX_BACKEND;
+ else if (strstr(backend_tag_table[snd_device], "bt-sco") != NULL)
+ port = BT_SCO_TX_BACKEND;
}
} else {
ALOGW("%s:napb: Invalid device - %d ", __func__, snd_device);
@@ -3324,6 +3326,10 @@
{
struct platform_data *my_data = (struct platform_data *)platform;
struct audio_device *adev = my_data->adev;
+ /*
+ * TODO: active_input always points to last opened input. Source returned will
+ * be wrong if more than one active inputs are present.
+ */
audio_source_t source = (adev->active_input == NULL) ?
AUDIO_SOURCE_DEFAULT : adev->active_input->source;
@@ -4377,8 +4383,8 @@
__func__, bit_width, sample_rate, channels,backend_idx,
platform_get_snd_device_name(snd_device));
- if (bit_width !=
- my_data->current_backend_cfg[backend_idx].bit_width) {
+ if ((my_data->current_backend_cfg[backend_idx].bitwidth_mixer_ctl) &&
+ (bit_width != my_data->current_backend_cfg[backend_idx].bit_width)) {
struct mixer_ctl *ctl = NULL;
ctl = mixer_get_ctl_by_name(adev->mixer,
@@ -4416,7 +4422,8 @@
*/
// TODO: This has to be more dynamic based on policy file
- if ((sample_rate != my_data->current_backend_cfg[(int)backend_idx].sample_rate) &&
+ if ((my_data->current_backend_cfg[backend_idx].samplerate_mixer_ctl) &&
+ (sample_rate != my_data->current_backend_cfg[(int)backend_idx].sample_rate) &&
(my_data->hifi_audio)) {
/*
* sample rate update is needed only for hifi audio enabled platforms