ASoC: qdsp6: audioreach: update dapm kcontrol private data

Update kcontrol private date to include more information like graph id
and module instance id which its connected to. Also maintain this virtual
dapm mixer widget in a list so that we could lookup while FE and BE connection
are added.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20221027102710.21407-4-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Srinivas Kandagatla 2022-10-27 11:27:04 +01:00 committed by Mark Brown
parent 5b488e8007
commit 1c87d3817b
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0
3 changed files with 20 additions and 1 deletions

View file

@ -731,6 +731,7 @@ static int apm_probe(gpr_device_t *gdev)
apm->gdev = gdev;
init_waitqueue_head(&apm->wait);
INIT_LIST_HEAD(&apm->widget_list);
idr_init(&apm->graph_idr);
idr_init(&apm->graph_info_idr);
idr_init(&apm->sub_graphs_idr);

View file

@ -58,6 +58,7 @@ struct q6apm {
struct mutex lock;
uint32_t state;
struct list_head widget_list;
struct idr graph_idr;
struct idr graph_info_idr;
struct idr sub_graphs_idr;

View file

@ -16,7 +16,11 @@
#include "audioreach.h"
struct snd_ar_control {
u32 graph_id; /* Graph ID */
u32 sgid; /* Sub Graph ID */
u32 module_instance_id; /* Connected Module Instance ID */
struct snd_soc_dapm_widget *w;
struct list_head node;
struct snd_soc_component *scomp;
};
@ -692,6 +696,7 @@ static int audioreach_widget_load_mixer(struct snd_soc_component *component,
struct snd_soc_tplg_vendor_value_elem *w_elem;
struct snd_soc_tplg_vendor_array *w_array;
struct snd_ar_control *scontrol;
struct q6apm *data = dev_get_drvdata(component->dev);
struct snd_soc_dobj *dobj;
int tkn_count = 0;
@ -711,6 +716,9 @@ static int audioreach_widget_load_mixer(struct snd_soc_component *component,
case AR_TKN_U32_SUB_GRAPH_INSTANCE_ID:
scontrol->sgid = le32_to_cpu(w_elem->value);
break;
case AR_TKN_DAI_INDEX:
scontrol->graph_id = le32_to_cpu(w_elem->value);
break;
default: /* ignore other tokens */
break;
}
@ -718,6 +726,9 @@ static int audioreach_widget_load_mixer(struct snd_soc_component *component,
w_elem++;
}
scontrol->w = w;
list_add_tail(&scontrol->node, &data->widget_list);
return 0;
}
@ -819,7 +830,10 @@ static int audioreach_widget_unload(struct snd_soc_component *scomp,
if (w->id == snd_soc_dapm_mixer) {
/* virtual widget */
kfree(dobj->private);
struct snd_ar_control *scontrol = dobj->private;
list_del(&scontrol->node);
kfree(scontrol);
return 0;
}
@ -998,6 +1012,9 @@ static int audioreach_control_load_mix(struct snd_soc_component *scomp,
case AR_TKN_U32_SUB_GRAPH_INSTANCE_ID:
scontrol->sgid = le32_to_cpu(c_elem->value);
break;
case AR_TKN_DAI_INDEX:
scontrol->graph_id = le32_to_cpu(c_elem->value);
break;
default:
/* Ignore other tokens */
break;