Thanks Amadeusz for quick review,
On 03/08/2021 15:21, Amadeusz Sławiński wrote:
On 8/3/2021 2:54 PM, Srinivas Kandagatla wrote:
Add ASoC topology support in audioreach
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx>
---
...
+
+/* DAI Tokens */
+#define AR_TKN_DAI_INDEX 1
+/* SUB GRAPH Tokens */
+#define AR_TKN_U32_SUB_GRAPH_INSTANCE_ID 2
+#define AR_TKN_U32_SUB_GRAPH_PERF_MODE 3
+#define AR_TKN_U32_SUB_GRAPH_DIRECTION 4
+#define AR_TKN_U32_SUB_GRAPH_SCENARIO_ID 5
+
+/* Container Tokens */
+#define AR_TKN_U32_CONAINER_INSTANCE_ID 100
+#define AR_TKN_U32_CONAINER_CAPABILITY_ID 101
+#define AR_TKN_U32_CONAINER_STACK_SIZE 102
+#define AR_TKN_U32_CONAINER_GRAPH_POS 103
+#define AR_TKN_U32_CONAINER_PROC_DOMAIN 104
typo in all of the above and in comment documenting them
AR_TKN_U32_CONTAINER_ *
.. Not sure how i missed this one.. Its not fixed.
#define APM_AUDIO_DRV_NAME "q6apm-audio"
diff --git a/sound/soc/qcom/qdsp6/topology.c
b/sound/soc/qcom/qdsp6/topology.c
new file mode 100644
index 000000000000..409e19486d57
--- /dev/null
+++ b/sound/soc/qcom/qdsp6/topology.c
@@ -0,0 +1,1114 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2020, Linaro Limited
+
+#include <sound/soc.h>
+#include <sound/soc-dapm.h>
+#include <sound/pcm.h>
+#include <sound/control.h>
+#include <sound/asound.h>
+#include <linux/firmware.h>
+#include <sound/soc-topology.h>
+#include <sound/soc-dpcm.h>
+#include <uapi/sound/snd_ar_tokens.h>
+#include <linux/kernel.h>
+#include <linux/wait.h>
+#include "q6apm.h"
+#include "audioreach.h"
+
+struct snd_ar_control {
+ u32 sgid; /* Sub Graph ID */
+ struct snd_soc_component *scomp;
+};
+
+static struct audioreach_graph_info *audioreach_tplg_alloc_graph_info(
+ struct q6apm *apm, uint32_t graph_id,
+ bool *found)
+{
+ struct audioreach_graph_info *info;
+ int ret;
+
+ spin_lock(&apm->lock);
+ info = idr_find(&apm->graph_info_idr, graph_id);
+ spin_unlock(&apm->lock);
+
+ if (info) {
+ *found = true;
+ return info;
+ }
+
+ *found = false;
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
+ if (!info)
+ return ERR_PTR(-ENOMEM);
+
+
+ INIT_LIST_HEAD(&info->sg_list);
+ spin_lock_init(&info->sg_list_lock);
+
+ spin_lock(&apm->lock);
+ ret = idr_alloc(&apm->graph_info_idr, info, graph_id,
+ graph_id + 1, GFP_ATOMIC);
+ spin_unlock(&apm->lock);
+
+ if (ret < 0) {
+ dev_err(apm->dev, "Failed to allocate Graph ID (%x)\n",
graph_id);
+ return ERR_PTR(ret);
+ }
need to free info here?
All such instances are now fixed, thanks for spotting these!
--srini