diff options
author | rioskao <rioskao@google.com> | 2020-08-19 09:33:56 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-08-19 09:33:56 +0000 |
commit | 78ac9bd19b3680d2dc507e6f44a3bae016ab0bf8 (patch) | |
tree | 168b34e98caa1900eab61a2be26a0aaf266bcf53 | |
parent | 9ca2071fdf72419e94720e6ec377529a87404d2c (diff) | |
parent | c30d34012aa045594e53577c7d1b89cfed0f4ca4 (diff) | |
download | sound_trigger_hal-78ac9bd19b3680d2dc507e6f44a3bae016ab0bf8.tar.gz |
sthal: add support getting dsp identifier from dsp am: c30d34012a
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/knowles/athletico/sound_trigger_hal/+/12199125
Change-Id: I8f056044fbc584cec38f097b58928fbd73377964
-rw-r--r-- | cvq_ioctl.h | 15 | ||||
-rw-r--r-- | cvq_util.c | 54 | ||||
-rw-r--r-- | sound_trigger_hw_iaxxx.c | 10 |
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); @@ -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. |