Merge "hal: start keep alive session to feed EC with silence data"
diff --git a/configure.ac b/configure.ac
index c3c0e34..f9f36e3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -122,6 +122,7 @@
AM_CONDITIONAL([QAP], [test x$AUDIO_FEATURE_ENABLED_QAP = xtrue])
AM_CONDITIONAL([AUDIO_HW_FFV], [test x$AUDIO_FEATURE_ENABLED_FFV = xtrue])
AM_CONDITIONAL([CUSTOM_STEREO], [test x$AUDIO_FEATURE_ENABLED_CUSTOM_STEREO = xtrue])
+AM_CONDITIONAL([RUN_KEEP_ALIVE_IN_ARM_FFV], [test x$AUDIO_FEATURE_ENABLED_KEEP_ALIVE_ARM_FFV = xtrue])
AC_CONFIG_FILES([ \
Makefile \
diff --git a/hal/Makefile.am b/hal/Makefile.am
index 4f01efc..95224d0 100644
--- a/hal/Makefile.am
+++ b/hal/Makefile.am
@@ -189,6 +189,10 @@
c_sources += audio_extn/hw_loopback.c
endif
+if RUN_KEEP_ALIVE_IN_ARM_FFV
+AM_CFLAGS += -DRUN_KEEP_ALIVE_IN_ARM_FFV
+endif
+
if AUDIO_HW_FFV
AM_CFLAGS += -DFFV_ENABLED \
-I $(PKG_CONFIG_SYSROOT_DIR)/usr/include/ffv/
diff --git a/hal/audio_extn/ffv.c b/hal/audio_extn/ffv.c
index 50b776b..511179a 100644
--- a/hal/audio_extn/ffv.c
+++ b/hal/audio_extn/ffv.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -47,6 +47,7 @@
#include <sys/resource.h>
#include "audio_hw.h"
+#include "audio_extn.h"
#include "platform.h"
#include "platform_api.h"
@@ -497,7 +498,9 @@
}
ffvmod.in = in;
-
+#ifdef RUN_KEEP_ALIVE_IN_ARM_FFV
+ audio_extn_keep_alive_start(KEEP_ALIVE_OUT_PRIMARY);
+#endif
#ifdef FFV_PCM_DUMP
if (!ffvmod.fp_input) {
ALOGD("%s: Opening input dump file \n", __func__);
@@ -547,7 +550,9 @@
if (ffvmod.buffers_allocated)
deallocate_buffers();
-
+#ifdef RUN_KEEP_ALIVE_IN_ARM_FFV
+ audio_extn_keep_alive_stop(KEEP_ALIVE_OUT_PRIMARY);
+#endif
ffvmod.handle = NULL;
ffvmod.in = NULL;
ALOGV("%s: exit", __func__);
diff --git a/hal/audio_extn/soundtrigger.c b/hal/audio_extn/soundtrigger.c
index c2dee84..7ad8e9f 100644
--- a/hal/audio_extn/soundtrigger.c
+++ b/hal/audio_extn/soundtrigger.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2014, 2016-2017 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2014, 2016-2018 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -135,6 +135,13 @@
list_add_tail(&st_dev->st_ses_list, &st_ses_info->list);
break;
+ case ST_EVENT_START_KEEP_ALIVE:
+ pthread_mutex_unlock(&st_dev->lock);
+ pthread_mutex_lock(&st_dev->adev->lock);
+ audio_extn_keep_alive_start(KEEP_ALIVE_OUT_PRIMARY);
+ pthread_mutex_unlock(&st_dev->adev->lock);
+ goto done;
+
case ST_EVENT_SESSION_DEREGISTER:
if (!config) {
ALOGE("%s: NULL config", __func__);
@@ -152,11 +159,20 @@
list_remove(&st_ses_info->list);
free(st_ses_info);
break;
+
+ case ST_EVENT_STOP_KEEP_ALIVE:
+ pthread_mutex_unlock(&st_dev->lock);
+ pthread_mutex_lock(&st_dev->adev->lock);
+ audio_extn_keep_alive_stop(KEEP_ALIVE_OUT_PRIMARY);
+ pthread_mutex_unlock(&st_dev->adev->lock);
+ goto done;
+
default:
ALOGW("%s: Unknown event %d", __func__, event);
break;
}
pthread_mutex_unlock(&st_dev->lock);
+done:
return status;
}