2022-10-21 17:25:20

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH v2 0/9] ASoC: qdsp6: audioreach: add multi-port, SAL and MFC support

This patchset adds support to multi-port connections between AudioReach Modules
which is required for sophisticated graphs like ECNS or Speaker Protection.
Also as part of ECNS testing new module support for SAL and MFC are added.


Tested on SM8450 with ECNS.

Thanks,
Srini

Changes since v1:
Fixed two warnings on unused and unintialized variable.

Srinivas Kandagatla (9):
ASoC: qdsp6: audioreach: topology use idr_alloc_u32
ASoC: qdsp6: audioreach: remove unused connection_list
ASoC: qdsp6: audioreach: update dapm kcontrol private data
ASoC: qdsp6: audioreach: Simplify handing FE and BE graph connections
ASoC: qdsp6: audioreach: simplify module_list sz calculation
ASoC: qdsp6: audioreach: add support for more port connections
ASoC: qdsp6: audioreach: add support to enable SAL Module
ASoC: qdsp6: audioreach: add support for MFC Module
ASoC: qdsp6: audioreach: add support to enable module command

include/uapi/sound/snd_ar_tokens.h | 27 +++
sound/soc/qcom/qdsp6/audioreach.c | 310 ++++++++++++++++++++---------
sound/soc/qcom/qdsp6/audioreach.h | 47 +++--
sound/soc/qcom/qdsp6/q6apm.c | 84 +-------
sound/soc/qcom/qdsp6/q6apm.h | 6 +-
sound/soc/qcom/qdsp6/topology.c | 243 +++++++++++++++++++---
6 files changed, 489 insertions(+), 228 deletions(-)

--
2.21.0


2022-10-21 17:25:46

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH v2 2/9] ASoC: qdsp6: audioreach: remove unused connection_list

Remove unused connection_list parameter.

Signed-off-by: Srinivas Kandagatla <[email protected]>
---
sound/soc/qcom/qdsp6/audioreach.h | 1 -
1 file changed, 1 deletion(-)

diff --git a/sound/soc/qcom/qdsp6/audioreach.h b/sound/soc/qcom/qdsp6/audioreach.h
index 3ee8bfcd0121..36779ad1952d 100644
--- a/sound/soc/qcom/qdsp6/audioreach.h
+++ b/sound/soc/qcom/qdsp6/audioreach.h
@@ -595,7 +595,6 @@ struct audioreach_graph_info {
int id;
uint32_t num_sub_graphs;
struct list_head sg_list;
- struct list_head connection_list;
};

struct audioreach_sub_graph {
--
2.21.0

2022-10-21 17:36:02

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH v2 1/9] ASoC: qdsp6: audioreach: topology use idr_alloc_u32

SubGraph and Module Instance ids take 32 bits, so use idr_alloc_u32
instead of idr_alloc to able to accomdate valid ranges.

Signed-off-by: Srinivas Kandagatla <[email protected]>
---
sound/soc/qcom/qdsp6/topology.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/sound/soc/qcom/qdsp6/topology.c b/sound/soc/qcom/qdsp6/topology.c
index bd649c232a06..9a3d9e0eae53 100644
--- a/sound/soc/qcom/qdsp6/topology.c
+++ b/sound/soc/qcom/qdsp6/topology.c
@@ -44,7 +44,7 @@ static struct audioreach_graph_info *audioreach_tplg_alloc_graph_info(struct q6a
INIT_LIST_HEAD(&info->sg_list);

mutex_lock(&apm->lock);
- ret = idr_alloc(&apm->graph_info_idr, info, graph_id, graph_id + 1, GFP_KERNEL);
+ ret = idr_alloc_u32(&apm->graph_info_idr, info, &graph_id, graph_id, GFP_KERNEL);
mutex_unlock(&apm->lock);

if (ret < 0) {
@@ -53,7 +53,7 @@ static struct audioreach_graph_info *audioreach_tplg_alloc_graph_info(struct q6a
return ERR_PTR(ret);
}

- info->id = ret;
+ info->id = graph_id;

return info;
}
@@ -94,7 +94,7 @@ static struct audioreach_sub_graph *audioreach_tplg_alloc_sub_graph(struct q6apm
INIT_LIST_HEAD(&sg->container_list);

mutex_lock(&apm->lock);
- ret = idr_alloc(&apm->sub_graphs_idr, sg, sub_graph_id, sub_graph_id + 1, GFP_KERNEL);
+ ret = idr_alloc_u32(&apm->sub_graphs_idr, sg, &sub_graph_id, sub_graph_id, GFP_KERNEL);
mutex_unlock(&apm->lock);

if (ret < 0) {
@@ -103,7 +103,7 @@ static struct audioreach_sub_graph *audioreach_tplg_alloc_sub_graph(struct q6apm
return ERR_PTR(ret);
}

- sg->sub_graph_id = ret;
+ sg->sub_graph_id = sub_graph_id;

return sg;
}
@@ -136,7 +136,7 @@ static struct audioreach_container *audioreach_tplg_alloc_container(struct q6apm
INIT_LIST_HEAD(&cont->modules_list);

mutex_lock(&apm->lock);
- ret = idr_alloc(&apm->containers_idr, cont, container_id, container_id + 1, GFP_KERNEL);
+ ret = idr_alloc_u32(&apm->containers_idr, cont, &container_id, container_id, GFP_KERNEL);
mutex_unlock(&apm->lock);

if (ret < 0) {
@@ -145,7 +145,7 @@ static struct audioreach_container *audioreach_tplg_alloc_container(struct q6apm
return ERR_PTR(ret);
}

- cont->container_id = ret;
+ cont->container_id = container_id;
cont->sub_graph = sg;
/* add to container list */
list_add_tail(&cont->node, &sg->container_list);
@@ -181,7 +181,7 @@ static struct audioreach_module *audioreach_tplg_alloc_module(struct q6apm *apm,
AR_MODULE_DYNAMIC_INSTANCE_ID_START,
AR_MODULE_DYNAMIC_INSTANCE_ID_END, GFP_KERNEL);
} else {
- ret = idr_alloc(&apm->modules_idr, mod, module_id, module_id + 1, GFP_KERNEL);
+ ret = idr_alloc_u32(&apm->modules_idr, mod, &module_id, module_id, GFP_KERNEL);
}
mutex_unlock(&apm->lock);

@@ -191,7 +191,7 @@ static struct audioreach_module *audioreach_tplg_alloc_module(struct q6apm *apm,
return ERR_PTR(ret);
}

- mod->instance_id = ret;
+ mod->instance_id = module_id;
/* add to module list */
list_add_tail(&mod->node, &cont->modules_list);
mod->container = cont;
--
2.21.0

2022-10-22 02:55:38

by Pierre-Louis Bossart

[permalink] [raw]
Subject: Re: [PATCH v2 1/9] ASoC: qdsp6: audioreach: topology use idr_alloc_u32



On 10/21/22 11:51, Srinivas Kandagatla wrote:
> SubGraph and Module Instance ids take 32 bits, so use idr_alloc_u32
> instead of idr_alloc to able to accomdate valid ranges.

typo: accommodate.

Also worth checking https://www.kernel.org/doc/html/latest/core-api/idr.html
"The IDR interface is deprecated; please use the XArray instead."


2022-10-26 09:53:16

by Srinivas Kandagatla

[permalink] [raw]
Subject: Re: [PATCH v2 1/9] ASoC: qdsp6: audioreach: topology use idr_alloc_u32

Thanks Pierre,

On 21/10/2022 18:09, Pierre-Louis Bossart wrote:
>
>
> On 10/21/22 11:51, Srinivas Kandagatla wrote:
>> SubGraph and Module Instance ids take 32 bits, so use idr_alloc_u32
>> instead of idr_alloc to able to accomdate valid ranges.
>
> typo: accommodate.
>
will fix it in next version

> Also worth checking https://www.kernel.org/doc/html/latest/core-api/idr.html
> "The IDR interface is deprecated; please use the XArray instead."
Thanks for this hit, this looks really good and specially lookups
without Locking, this could cleanup the code a bit.

Having said that I would still like this patch go as it is with idr for
now, and I can plan to rework on converting idr to xa later, as there
are few more Qcom Audio drivers that have usage of idr.

thanks,
srini

>
>

2022-10-26 20:46:26

by Pierre-Louis Bossart

[permalink] [raw]
Subject: Re: [PATCH v2 1/9] ASoC: qdsp6: audioreach: topology use idr_alloc_u32



On 10/26/22 04:19, Srinivas Kandagatla wrote:
> Thanks Pierre,
>
> On 21/10/2022 18:09, Pierre-Louis Bossart wrote:
>>
>>
>> On 10/21/22 11:51, Srinivas Kandagatla wrote:
>>> SubGraph and Module Instance ids take 32 bits, so use idr_alloc_u32
>>> instead of idr_alloc to able to accomdate valid ranges.
>>
>> typo: accommodate.
>>
> will fix it in next version
>
>> Also worth checking
>> https://www.kernel.org/doc/html/latest/core-api/idr.html
>> "The IDR interface is deprecated; please use the XArray instead."
> Thanks for this hit, this looks really good and specially lookups
> without Locking, this could cleanup the code a bit.
>
> Having said that I would still like this patch go as it is with idr for
> now, and I can plan to rework on converting idr to xa later, as there
> are few more Qcom Audio drivers that have usage of idr.

sounds good.