summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAditya Bavanari <abavanar@codeaurora.org>2016-11-09 18:49:36 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2016-12-01 22:48:24 -0800
commit3522bcb2dd97919b98a5ed3a396345c301b15abf (patch)
tree5724669461032f04936fe495fe170d6928b7f937
parentc2cbb11bf972db542cbd637ea4c4215b82aa1df5 (diff)
ASoc: msm: Add changes to support multiple meta key value pairs
Add changes to get the cal_block on the basis of meta key and set the license in core with the obtained cal_block CRs-Fixed: 1093003 Change-Id: I7c931ca0ad4eed4da9252a05ee426d2ef4bd10b1 Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
-rw-r--r--sound/soc/msm/qdsp6v2/q6core.c44
1 files changed, 27 insertions, 17 deletions
diff --git a/sound/soc/msm/qdsp6v2/q6core.c b/sound/soc/msm/qdsp6v2/q6core.c
index cc7616f1d897..9782fa26a2e9 100644
--- a/sound/soc/msm/qdsp6v2/q6core.c
+++ b/sound/soc/msm/qdsp6v2/q6core.c
@@ -193,6 +193,31 @@ void ocm_core_open(void)
pr_err("%s: Unable to register CORE\n", __func__);
}
+struct cal_block_data *cal_utils_get_cal_block_by_key(
+ struct cal_type_data *cal_type, uint32_t key)
+{
+ struct list_head *ptr, *next;
+ struct cal_block_data *cal_block = NULL;
+ struct audio_cal_info_metainfo *metainfo;
+
+ list_for_each_safe(ptr, next,
+ &cal_type->cal_blocks) {
+
+ cal_block = list_entry(ptr,
+ struct cal_block_data, list);
+ metainfo = (struct audio_cal_info_metainfo *)
+ cal_block->cal_info;
+ if (metainfo->nKey != key) {
+ pr_debug("%s: metainfo key mismatch!!! found:%x, needed:%x\n",
+ __func__, metainfo->nKey, key);
+ } else {
+ pr_debug("%s: metainfo key match found", __func__);
+ return cal_block;
+ }
+ }
+ return NULL;
+}
+
int32_t core_set_license(uint32_t key, uint32_t module_id)
{
struct avcs_cmd_set_license *cmd_setl = NULL;
@@ -210,8 +235,8 @@ int32_t core_set_license(uint32_t key, uint32_t module_id)
}
mutex_lock(&((q6core_lcl.cal_data[META_CAL])->lock));
- cal_block =
- cal_utils_get_only_cal_block(q6core_lcl.cal_data[META_CAL]);
+ cal_block = cal_utils_get_cal_block_by_key(
+ q6core_lcl.cal_data[META_CAL], key);
if (cal_block == NULL ||
cal_block->cal_data.kvaddr == NULL ||
cal_block->cal_data.size <= 0) {
@@ -219,21 +244,6 @@ int32_t core_set_license(uint32_t key, uint32_t module_id)
rc = -EINVAL;
goto cal_data_unlock;
}
- metainfo = (struct audio_cal_info_metainfo *)cal_block->cal_info;
- if (metainfo == NULL) {
- pr_err("%s: No metainfo!!!", __func__);
- rc = -EINVAL;
- goto cal_data_unlock;
- }
- if (metainfo->nKey != key) {
- pr_err("%s: metainfo key mismatch!!! found:%x, needed:%x\n",
- __func__, metainfo->nKey, key);
- rc = -EINVAL;
- goto cal_data_unlock;
- } else if (key == 0) {
- pr_err("%s: metainfo key is %d a invalid key", __func__, key);
- goto cal_data_unlock;
- }
packet_size = sizeof(struct avcs_cmd_set_license) +
cal_block->cal_data.size;