summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRios Kao <rioskao@google.com>2019-08-05 17:18:12 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-08-05 17:18:12 +0000
commitcc990608baf3a6cfc8fe6187852d0260db82f689 (patch)
tree9add976c1430d983e85f100d22f4e744f21f0b87
parentd192ff15d4a67bbeb6ff015ec8a8c8cf9d96265e (diff)
parent5051429c2c9a6dcf3c1e152642e7f3eae5ef09a7 (diff)
downloadandroid_hardware_knowles_athletico_sound_trigger_hal-cc990608baf3a6cfc8fe6187852d0260db82f689.tar.gz
android_hardware_knowles_athletico_sound_trigger_hal-cc990608baf3a6cfc8fe6187852d0260db82f689.tar.bz2
android_hardware_knowles_athletico_sound_trigger_hal-cc990608baf3a6cfc8fe6187852d0260db82f689.zip
Merge "sthal: fix race condition of amp-ref route" into qt-r1-dev
-rw-r--r--sound_trigger_hw_iaxxx.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/sound_trigger_hw_iaxxx.c b/sound_trigger_hw_iaxxx.c
index 2f12383..268f14d 100644
--- a/sound_trigger_hw_iaxxx.c
+++ b/sound_trigger_hw_iaxxx.c
@@ -1382,6 +1382,12 @@ static bool do_handle_functions(struct knowles_sound_trigger_device *stdev,
ALOGE("Failed to disable mic route with EXT OSC");
goto exit;
}
+
+ ret = enable_amp_ref_route(stdev->route_hdl, true, STRM_48K);
+ if (ret != 0) {
+ ALOGE("Failed to enable amp-ref route");
+ goto exit;
+ }
} else {
ret = enable_mic_route(stdev->route_hdl, false,
INTERNAL_OSCILLATOR);
@@ -1438,6 +1444,11 @@ static bool do_handle_functions(struct knowles_sound_trigger_device *stdev,
// reconfig mic
if (stdev->is_mic_route_enabled == true) {
if (stdev->is_bargein_route_enabled == true) {
+ ret = enable_amp_ref_route(stdev->route_hdl, false, STRM_48K);
+ if (ret != 0) {
+ ALOGE("Failed to disable amp-ref route");
+ goto exit;
+ }
ret = enable_mic_route(stdev->route_hdl, true,
EXTERNAL_OSCILLATOR);
if (ret != 0) {
@@ -3552,15 +3563,6 @@ int sound_trigger_hw_call_back(audio_event_type_t event,
else if (config->u.usecase.type == USECASE_TYPE_PCM_CAPTURE)
stdev->is_media_recording = false;
- // turn off amp-ref with 48khz before turning off main mic by media recording
- if (is_mic_controlled_by_audhal(stdev) == true &&
- stdev->is_bargein_route_enabled == true) {
- ret = enable_amp_ref_route(stdev->route_hdl, false, STRM_48K);
- if (ret != 0) {
- ALOGE("Failed to disable amp-ref route");
- goto exit;
- }
- }
break;
case AUDIO_EVENT_CAPTURE_DEVICE_ACTIVE:
/*
@@ -3599,15 +3601,6 @@ int sound_trigger_hw_call_back(audio_event_type_t event,
ALOGD("%s: handle capture stream active event %d, usecase :%d",
__func__, event, config->u.usecase.type);
- // turn on amp-ref with 48khz after turning on main mic by media recording
- if (is_mic_controlled_by_audhal(stdev) == true &&
- stdev->is_bargein_route_enabled == true) {
- ret = enable_amp_ref_route(stdev->route_hdl, true, STRM_48K);
- if (ret != 0) {
- ALOGE("Failed to enable amp-ref route");
- goto exit;
- }
- }
break;
case AUDIO_EVENT_PLAYBACK_STREAM_INACTIVE:
ALOGD("%s: handle playback stream inactive", __func__);