Snap for 6777077 from c30d34012aa045594e53577c7d1b89cfed0f4ca4 to rvc-qpr1-release

Change-Id: Ic6f0d16b4c1f0a447bf7b349fb85dac3667ae93e
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 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 bd285eb..d6be720 100644
--- a/cvq_util.c
+++ b/cvq_util.c
@@ -796,7 +796,8 @@
     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 @@
                 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 @@
             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 @@
     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 @@
                 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 @@
             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 @@
     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 @@
     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 @@
         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 @@
     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 @@
         // 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.