Merge "hal: update bt-sco sample rate before device enable"
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index d6007be..9f76d31 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -296,6 +296,18 @@
return 0;
}
+ /* Set BT sample rate before enabling the devices. Adding sample rate mixer
+ * control in use-case does not work because rate update takes place after
+ * AFE port open due to the limitation of mixer control order execution.
+ */
+ if (snd_device == SND_DEVICE_OUT_BT_SCO) {
+ audio_route_apply_path(adev->audio_route, BT_SCO_SAMPLE_RATE);
+ audio_route_update_mixer(adev->audio_route);
+ } else if (snd_device == SND_DEVICE_OUT_BT_SCO_WB) {
+ audio_route_apply_path(adev->audio_route, BT_SCO_WB_SAMPLE_RATE);
+ audio_route_update_mixer(adev->audio_route);
+ }
+
/* start usb playback thread */
if(SND_DEVICE_OUT_USB_HEADSET == snd_device ||
SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET == snd_device)
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index e1172ef..7a79a1f 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
* Not a contribution.
*
* Copyright (C) 2013 The Android Open Source Project
@@ -31,6 +31,9 @@
#define VISUALIZER_LIBRARY_PATH "/system/lib/soundfx/libqcomvisualizer.so"
#define OFFLOAD_EFFECTS_BUNDLE_LIBRARY_PATH "/system/lib/soundfx/libqcompostprocbundle.so"
+#define BT_SCO_SAMPLE_RATE "bt-sco-samplerate"
+#define BT_SCO_WB_SAMPLE_RATE "bt-sco-wb-samplerate"
+
/* Flags used to initialize acdb_settings variable that goes to ACDB library */
#define NONE_FLAG 0x00000000
#define DMIC_FLAG 0x00000002
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 8777a73..aa49c7b 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -1767,11 +1767,6 @@
if (err >= 0) {
str_parms_del(parms, AUDIO_PARAMETER_KEY_BTSCO);
my_data->btsco_sample_rate = val;
- if (val == SAMPLE_RATE_16KHZ) {
- audio_route_apply_path(my_data->adev->audio_route,
- "bt-sco-wb-samplerate");
- audio_route_update_mixer(my_data->adev->audio_route);
- }
}
err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_SLOWTALK, value, sizeof(value));