st-hal: check for second stage detection support present or not
-> Based on new attribute in vendor specific platform xml file
-> Parse and load second stage modules only if support present on given
target
Change-Id: I8bbd062bbeae2b14a600c4028b4eda210d4b1f2b
diff --git a/sound_trigger_hw.c b/sound_trigger_hw.c
index fde2cb1..4a65991 100644
--- a/sound_trigger_hw.c
+++ b/sound_trigger_hw.c
@@ -2079,11 +2079,13 @@
goto exit_1;
}
+ ALOGD("%s: second state detection %s",__func__,
+ st_session->vendor_uuid_info->second_stage_supported ? "supported" : "not supported");
/*
* Parse second stage sound models and populate the second stage list for
* this session.
*/
- if (sml_version == SML_MODEL_V3) {
+ if (sml_version == SML_MODEL_V3 && st_session->vendor_uuid_info->second_stage_supported) {
status = check_and_configure_second_stage_models(st_session, sm_payload,
num_models, phrase_sm->phrases[0].recognition_mode);
if (status) {
diff --git a/sound_trigger_platform.c b/sound_trigger_platform.c
index 9e30e47..032617b 100644
--- a/sound_trigger_platform.c
+++ b/sound_trigger_platform.c
@@ -128,6 +128,7 @@
#define ST_PARAM_KEY_KW_START_TOLERANCE "kw_start_tolerance"
#define ST_PARAM_KEY_KW_END_TOLERANCE "kw_end_tolerance"
#define ST_PARAM_KEY_EXECUTION_TYPE "execution_type"
+#define ST_PARAM_KEY_SECOND_STAGE_SUPPORTED "second_stage_supported"
#define ST_PARAM_KEY_EVENT_TIMESTAMP_MODE "event_timestamp_mode"
#define ST_PARAM_KEY_BACKEND_PORT_NAME "backend_port_name"
#define ST_PARAM_KEY_BACKEND_DAI_NAME "backend_dai_name"
@@ -2658,6 +2659,21 @@
}
}
+ err = str_parms_get_str(parms, ST_PARAM_KEY_SECOND_STAGE_SUPPORTED,
+ str_value, sizeof(str_value));
+ //By default set to true
+ sm_info->second_stage_supported = true;
+ if (err >= 0) {
+ str_parms_del(parms, ST_PARAM_KEY_SECOND_STAGE_SUPPORTED);
+ if (!strcmp(str_value, "true")) {
+ sm_info->second_stage_supported = true;
+ } else if (!strcmp(str_value, "false")) {
+ sm_info->second_stage_supported = false;
+ } else {
+ ALOGE("%s: invalid second stage support value set: %s", __func__, str_value);
+ }
+ }
+
err = str_parms_get_str(parms, ST_PARAM_KEY_APP_TYPE,
str_value, sizeof(str_value));
if (err >= 0) {
diff --git a/sound_trigger_platform.h b/sound_trigger_platform.h
index 310071e..0ec821d 100644
--- a/sound_trigger_platform.h
+++ b/sound_trigger_platform.h
@@ -377,6 +377,7 @@
unsigned int avail_transit_ape_phrases;
unsigned int avail_transit_ape_users;
st_exec_mode_config_t exec_mode_cfg;
+ bool second_stage_supported;
bool lpi_enable;
bool vad_enable;
struct lab_dam_cfg_payload lab_dam_cfg_payload;
diff --git a/st_hw_session_lsm.c b/st_hw_session_lsm.c
index 137d038..6198c20 100644
--- a/st_hw_session_lsm.c
+++ b/st_hw_session_lsm.c
@@ -2179,8 +2179,10 @@
* Custom config is mandatory for adsp multi-stage session,
* Default config would be sent if not explicitly set from client applicaiton.
*/
- if ((p_ses->custom_data_size && !disable_custom_config) ||
- !list_empty(&p_ses->lsm_ss_cfg_list)) {
+ ALOGD("%s: second state detection %s",__func__,
+ p_ses->vendor_uuid_info->second_stage_supported ? "supported" : "not supported");
+ if (((p_ses->custom_data_size && !disable_custom_config) ||
+ !list_empty(&p_ses->lsm_ss_cfg_list)) && p_ses->vendor_uuid_info->second_stage_supported) {
/* fill opaque data as custom params */
cus_params = ¶m_info[param_count++];
if (param_tag_tracker & PARAM_CUSTOM_CONFIG_BIT) {