summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Shi <meixuanshi@google.com>2019-07-09 00:03:57 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-07-09 00:03:57 +0000
commit230ca99a444401388c1e4618bc2b412e900041ad (patch)
treeda0dcb3eb2d7fec3920eb726c15c1cba9824b656
parent87c2a586a5f206a6253b8dd94e61b45989d84c7e (diff)
parentc749946217cd28b1df144f69de8b5f7daa9979e6 (diff)
downloadandroid_hardware_knowles_athletico_sound_trigger_hal-230ca99a444401388c1e4618bc2b412e900041ad.tar.gz
android_hardware_knowles_athletico_sound_trigger_hal-230ca99a444401388c1e4618bc2b412e900041ad.tar.bz2
android_hardware_knowles_athletico_sound_trigger_hal-230ca99a444401388c1e4618bc2b412e900041ad.zip
Merge changes Id4210e9b,I560e980f into qt-r1-dev
* changes: sthal: subscribe to oslo data event sthal: add wakeup event from codec to host1
-rw-r--r--cvq_ioctl.h6
-rw-r--r--cvq_util.c47
-rw-r--r--sound_trigger_hw_iaxxx.c5
3 files changed, 56 insertions, 2 deletions
diff --git a/cvq_ioctl.h b/cvq_ioctl.h
index f195fed..0cafd61 100644
--- a/cvq_ioctl.h
+++ b/cvq_ioctl.h
@@ -54,6 +54,7 @@
#define SENSOR_PRESENCE_MODE 0
#define SENSOR_DETECTED_MODE 1
#define SENSOR_MAX_MODE 2
+#define OSLO_DATA_EVENT_ID 1
#define OSLO_CONFIGURED (0x201)
#define OSLO_DESTROYED (0x202)
#define OSLO_EP_DISCONNECT (0x205)
@@ -74,6 +75,9 @@
#define CHRE_DESTROYED (0x204)
#define CHRE_EVT_MASK (0x1f)
+#define IAXXX_SYSID_CTRL_MGR_CM4 0x2610
+#define IAXXX_HOST1_WAKEUP_EVENT_ID 4
+
#define MIXER_PKG_ID 5
#define MIXER_PLUGIN_IDX 0
#define MIXER_INSTANCE_ID 7
@@ -227,5 +231,5 @@ int get_fw_status(struct iaxxx_odsp_hw *odsp_hdl, unsigned int *status);
int reset_fw(struct iaxxx_odsp_hw *odsp_hdl);
int trigger_sensor_destroy_event(struct iaxxx_odsp_hw *odsp_hdl);
int trigger_chre_destroy_event(struct iaxxx_odsp_hw *odsp_hdl);
-
+int setup_slpi_wakeup_event(struct iaxxx_odsp_hw *odsp_hdl, bool enabled);
#endif /* _CVQ_IOCTL_H */
diff --git a/cvq_util.c b/cvq_util.c
index 9b1fa7b..9c80c0d 100644
--- a/cvq_util.c
+++ b/cvq_util.c
@@ -493,6 +493,13 @@ int sensor_event_init_params(struct iaxxx_odsp_hw *odsp_hdl)
goto exit;
}
+ err = iaxxx_odsp_evt_subscribe(odsp_hdl, OSLO_EVT_SRC_ID,
+ OSLO_DATA_EVENT_ID, IAXXX_SYSID_HOST_1, 0);
+ if (err != 0) {
+ ALOGE("%s: ERROR: Sensor subscribe (oslo data event) failed %d(%s)",
+ __func__, errno, strerror(errno));
+ goto exit;
+ }
err = iaxxx_odsp_evt_subscribe(odsp_hdl, OSLO_EVT_SRC_ID,
OSLO_CONFIGURED, IAXXX_SYSID_HOST_1, 0);
@@ -565,6 +572,15 @@ static int sensor_event_deinit_params(struct iaxxx_odsp_hw *odsp_hdl)
}
err = iaxxx_odsp_evt_unsubscribe(odsp_hdl, OSLO_EVT_SRC_ID,
+ OSLO_DATA_EVENT_ID, IAXXX_SYSID_HOST_1);
+ if (err != 0) {
+ ALOGE("%s: Failed to unsubscribe sensor event (src id %d event id %d)"
+ " from host %d error %d(%s)", __func__, OSLO_EVT_SRC_ID,
+ OSLO_DATA_EVENT_ID, IAXXX_SYSID_HOST_1, errno, strerror(errno));
+ goto exit;
+ }
+
+ err = iaxxx_odsp_evt_unsubscribe(odsp_hdl, OSLO_EVT_SRC_ID,
OSLO_CONFIGURED, IAXXX_SYSID_HOST_1);
if (err != 0) {
ALOGE("%s: Failed to unsubscribe sensor event (src id %d event id %d)"
@@ -1745,5 +1761,36 @@ int reset_fw(struct iaxxx_odsp_hw *odsp_hdl)
exit:
ALOGD("-%s-", __func__);
return err;
+}
+int setup_slpi_wakeup_event(struct iaxxx_odsp_hw *odsp_hdl, bool enabled)
+{
+ int err;
+
+ ALOGD("+%s+", __func__);
+
+ if (enabled) {
+ err = iaxxx_odsp_evt_subscribe(odsp_hdl, IAXXX_SYSID_CTRL_MGR_CM4,
+ IAXXX_HOST1_WAKEUP_EVENT_ID,
+ IAXXX_SYSID_HOST_1, 0);
+ if (err != 0) {
+ ALOGE("%s: ERROR: ODSP_EVENT_SUBSCRIBE (for event_id %d, src_id %d)"
+ " IOCTL failed %d(%s)", __func__, IAXXX_HOST1_WAKEUP_EVENT_ID,
+ IAXXX_SYSID_CTRL_MGR_CM4, errno, strerror(errno));
+ goto exit;
+ }
+ } else {
+ err = iaxxx_odsp_evt_unsubscribe(odsp_hdl, IAXXX_SYSID_CTRL_MGR_CM4,
+ IAXXX_HOST1_WAKEUP_EVENT_ID,
+ IAXXX_SYSID_HOST_1);
+ if (err != 0) {
+ ALOGE("%s: ERROR: ODSP_EVENT_UNSUBSCRIBE (for event_id %d, src_id %d)"
+ " IOCTL failed %d(%s)", __func__, IAXXX_HOST1_WAKEUP_EVENT_ID,
+ IAXXX_SYSID_CTRL_MGR_CM4, errno, strerror(errno));
+ goto exit;
+ }
+ }
+exit:
+ ALOGD("-%s-", __func__);
+ return err;
}
diff --git a/sound_trigger_hw_iaxxx.c b/sound_trigger_hw_iaxxx.c
index a65a8e7..3ca1505 100644
--- a/sound_trigger_hw_iaxxx.c
+++ b/sound_trigger_hw_iaxxx.c
@@ -1570,6 +1570,7 @@ static int crash_recovery(struct knowles_sound_trigger_device *stdev)
int err = 0;
set_default_apll_clk(stdev->mixer);
+ setup_slpi_wakeup_event(stdev->odsp_hdl, true);
// Redownload the keyword model files and start recognition
err = restart_recognition(stdev);
@@ -2039,7 +2040,7 @@ static void *callback_thread_loop(void *context)
}
set_default_apll_clk(stdev->mixer);
-
+ setup_slpi_wakeup_event(stdev->odsp_hdl, true);
stdev->is_st_hal_ready = true;
}
pthread_mutex_unlock(&stdev->lock);
@@ -2901,6 +2902,8 @@ static int stdev_close(hw_device_t *device)
goto exit;
}
+ setup_slpi_wakeup_event(stdev->odsp_hdl, false);
+
stdev->opened = false;
if (stdev->send_sock >= 0)