summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2020-12-08 23:49:26 -0800
committerXin Li <delphij@google.com>2020-12-08 23:49:26 -0800
commit6530472021b5aa44f7c6b02f59548753485a7fd3 (patch)
tree168b34e98caa1900eab61a2be26a0aaf266bcf53
parent46533bc15cc49be143176e6945caf20f2609d795 (diff)
parent22e684054625d9923b1663f0ff26a256ef86e79f (diff)
downloadsound_trigger_hal-6530472021b5aa44f7c6b02f59548753485a7fd3.tar.gz
DO NOT MERGE - Merge Android R QPR1android-s-preview-1
Bug: 172690556 Merged-In: I47caff651827119801e9151b9a4954061f169553 Change-Id: If6cd64317773108fd0f559fd7d7ce1b907db0117
-rw-r--r--cvq_ioctl.h15
-rw-r--r--cvq_util.c54
-rw-r--r--sound_trigger_hw_iaxxx.c10
3 files changed, 66 insertions, 13 deletions
diff --git a/cvq_ioctl.h b/cvq_ioctl.h
index 232e928..dcbf481 100644
--- a/cvq_ioctl.h
+++ b/cvq_ioctl.h
@@ -116,6 +116,13 @@
#define HOTWORD_DEFAULT_VER 0
#define AMBIENT_DEFAULT_VER 0
+enum {
+ PARAM_BLOCK_GET_MIN = 0,
+ PARAM_BLOCK_GET_RECOGNITION_PAYLOAD = 100,
+ PARAM_BLOCK_GET_DSP_IDENTIFIER,
+ PARAM_BLOCK_GET_MAX,
+};
+
#define BUFFER_PACKAGE "BufferPackage.bin"
#define BUFFER_CONFIG_OSLO_VAL "BufferConfigValOslo.bin"
#define BUFFER_CONFIG_VAL_MULTI_SEC "BufferConfigVal.bin"
@@ -131,6 +138,8 @@
#define SRC_PACKAGE "SampleRateConverterPackage.bin"
#define SRC_CONFIG "SampleRateConverterCreateCfgBlkGen.bin"
+#define PAYLOAD_MAX_STRING_LEN 64
+
/* The routing definition depend on the platform
and the features plugin.
*/
@@ -202,10 +211,12 @@ int setup_buffer_package(struct iaxxx_odsp_hw *odsp_hdl);
int destroy_buffer_package(struct iaxxx_odsp_hw *odsp_hdl);
int setup_hotword_package(struct iaxxx_odsp_hw *odsp_hdl);
int destroy_hotword_package(struct iaxxx_odsp_hw *odsp_hdl);
-unsigned int get_hotword_version(struct iaxxx_odsp_hw *odsp_hdl);
+int get_hotword_info(struct iaxxx_odsp_hw *odsp_hdl,
+ unsigned int *hotword_version, void *supported_model_arch);
int setup_ambient_package(struct iaxxx_odsp_hw *odsp_hdl);
int destroy_ambient_package(struct iaxxx_odsp_hw *odsp_hdl);
-unsigned int get_ambient_version(struct iaxxx_odsp_hw *odsp_hdl);
+int get_ambient_info(struct iaxxx_odsp_hw *odsp_hdl,
+ unsigned int *ambient_version, void *supported_model_arch);
int setup_aec_package(struct iaxxx_odsp_hw *odsp_hdl);
int destroy_aec_package(struct iaxxx_odsp_hw *odsp_hdl);
int setup_chre_package(struct iaxxx_odsp_hw *odsp_hdl);
diff --git a/cvq_util.c b/cvq_util.c
index 62c9514..3fe23ca 100644
--- a/cvq_util.c
+++ b/cvq_util.c
@@ -796,7 +796,8 @@ exit:
return err;
}
-unsigned int get_hotword_version(struct iaxxx_odsp_hw *odsp_hdl)
+int get_hotword_info(struct iaxxx_odsp_hw *odsp_hdl,
+ unsigned int *hotword_version, void *supported_model_arch)
{
int err = 0;
const uint32_t inst_id = HOTWORD_INSTANCE_ID;
@@ -817,6 +818,15 @@ unsigned int get_hotword_version(struct iaxxx_odsp_hw *odsp_hdl)
ALOGD("%s: Value of parameter id %u is %u", __func__, param_id,
param_val);
}
+ *hotword_version = param_val;
+ err = iaxxx_odsp_plugin_get_parameter_blk(odsp_hdl, inst_id, block_id,
+ PARAM_BLOCK_GET_DSP_IDENTIFIER,
+ supported_model_arch,
+ PAYLOAD_MAX_STRING_LEN);
+ if (err != 0) {
+ ALOGE("%s: Failed to get dsp identifier with error %d: %s",
+ __func__, err, strerror(errno));
+ }
} else {
ALOGE("%s: ERROR: setup hotword package failed", __func__);
}
@@ -830,12 +840,21 @@ unsigned int get_hotword_version(struct iaxxx_odsp_hw *odsp_hdl)
ALOGD("%s: Value of parameter id %u is %u", __func__, param_id,
param_val);
}
+ *hotword_version = param_val;
+ err = iaxxx_odsp_plugin_get_parameter_blk(odsp_hdl, inst_id, block_id,
+ PARAM_BLOCK_GET_DSP_IDENTIFIER,
+ supported_model_arch,
+ PAYLOAD_MAX_STRING_LEN);
+ if (err != 0) {
+ ALOGE("%s: Failed to get dsp identifier with error %d: %s",
+ __func__, err, strerror(errno));
+ }
err = destroy_hotword_package(odsp_hdl);
if (err != 0)
ALOGE("%s: ERROR: destroy hotword package failed", __func__);
}
- return param_val;
+ return err;
}
int setup_ambient_package(struct iaxxx_odsp_hw *odsp_hdl)
@@ -905,7 +924,8 @@ exit:
return err;
}
-unsigned int get_ambient_version(struct iaxxx_odsp_hw *odsp_hdl)
+int get_ambient_info(struct iaxxx_odsp_hw *odsp_hdl,
+ unsigned int *ambient_version, void *supported_model_arch)
{
int err = 0;
const uint32_t inst_id = AMBIENT_INSTANCE_ID;
@@ -926,6 +946,15 @@ unsigned int get_ambient_version(struct iaxxx_odsp_hw *odsp_hdl)
ALOGD("%s: Value of parameter id %u is %u", __func__, param_id,
param_val);
}
+ *ambient_version = param_val;
+ err = iaxxx_odsp_plugin_get_parameter_blk(odsp_hdl, inst_id, block_id,
+ PARAM_BLOCK_GET_DSP_IDENTIFIER,
+ supported_model_arch,
+ PAYLOAD_MAX_STRING_LEN);
+ if (err != 0) {
+ ALOGE("%s: Failed to get dsp identifier with error %d: %s",
+ __func__, err, strerror(errno));
+ }
} else {
ALOGE("%s: ERROR: setup Ambient package failed", __func__);
}
@@ -939,12 +968,21 @@ unsigned int get_ambient_version(struct iaxxx_odsp_hw *odsp_hdl)
ALOGD("%s: Value of parameter id %u is %u", __func__, param_id,
param_val);
}
+ *ambient_version = param_val;
+ err = iaxxx_odsp_plugin_get_parameter_blk(odsp_hdl, inst_id, block_id,
+ PARAM_BLOCK_GET_DSP_IDENTIFIER,
+ supported_model_arch,
+ PAYLOAD_MAX_STRING_LEN);
+ if (err != 0) {
+ ALOGE("%s: Failed to get dsp identifier with error %d: %s",
+ __func__, err, strerror(errno));
+ }
err = destroy_ambient_package(odsp_hdl);
if (err != 0)
ALOGE("%s: ERROR: destroy Ambient package failed", __func__);
}
- return param_val;
+ return err;
}
int setup_aec_package(struct iaxxx_odsp_hw *odsp_hdl)
@@ -1783,8 +1821,8 @@ int get_entity_param_blk(struct iaxxx_odsp_hw *odsp_hdl, void *payload,
err = iaxxx_odsp_plugin_get_parameter_blk(odsp_hdl,
AMBIENT_INSTANCE_ID,
IAXXX_HMD_BLOCK_ID,
- 100, payload,
- payload_size);
+ PARAM_BLOCK_GET_RECOGNITION_PAYLOAD,
+ payload, payload_size);
if (err < 0) {
ALOGE("%s: Failed to get param blk error %s\n",
@@ -1800,8 +1838,8 @@ int get_wakeup_param_blk(struct iaxxx_odsp_hw *odsp_hdl, void *payload,
err = iaxxx_odsp_plugin_get_parameter_blk(odsp_hdl,
HOTWORD_INSTANCE_ID,
IAXXX_HMD_BLOCK_ID,
- 100, payload,
- payload_size);
+ PARAM_BLOCK_GET_RECOGNITION_PAYLOAD,
+ payload, payload_size);
if (err < 0) {
ALOGE("%s: Failed to get param blk error %s\n",
diff --git a/sound_trigger_hw_iaxxx.c b/sound_trigger_hw_iaxxx.c
index 014c96a..fbbfa79 100644
--- a/sound_trigger_hw_iaxxx.c
+++ b/sound_trigger_hw_iaxxx.c
@@ -115,7 +115,7 @@ static struct sound_trigger_properties_extended_1_3 hw_properties = {
false, // trigger_in_event
POWER_CONSUMPTION // power_consumption_mw
},
- "9b55e25e-8ea3-4f73-bce9-b37860d57f5a", //supported arch
+ "", //supported arch
0, // audio capability
};
@@ -2252,7 +2252,9 @@ static void *callback_thread_loop(void *context)
if (fw_status == IAXXX_FW_ACTIVE) {
stdev->is_st_hal_ready = false;
// query version during reset progress.
- stdev->hotword_version = get_hotword_version(stdev->odsp_hdl);
+ get_hotword_info(stdev->odsp_hdl,
+ &stdev->hotword_version,
+ &hw_properties.supported_model_arch);
// reset the firmware and wait for firmware download complete
err = reset_fw(stdev->odsp_hdl);
if (err == -1) {
@@ -2264,7 +2266,9 @@ static void *callback_thread_loop(void *context)
// Firmware has crashed wait till it recovers
stdev->is_st_hal_ready = false;
} else if (fw_status == IAXXX_FW_IDLE) {
- stdev->hotword_version = get_hotword_version(stdev->odsp_hdl);
+ err = get_hotword_info(stdev->odsp_hdl,
+ &stdev->hotword_version,
+ &hw_properties.supported_model_arch);
if (stdev->hotword_version == HOTWORD_DEFAULT_VER) {
/* This is unlikely use-case, the codec is abnormal at the beginning
* reset_fw the firmware to recovery.