Commit 1c87d381 authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Mark Brown

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: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20221027102710.21407-4-srinivas.kandagatla@linaro.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5b488e80
...@@ -731,6 +731,7 @@ static int apm_probe(gpr_device_t *gdev) ...@@ -731,6 +731,7 @@ static int apm_probe(gpr_device_t *gdev)
apm->gdev = gdev; apm->gdev = gdev;
init_waitqueue_head(&apm->wait); init_waitqueue_head(&apm->wait);
INIT_LIST_HEAD(&apm->widget_list);
idr_init(&apm->graph_idr); idr_init(&apm->graph_idr);
idr_init(&apm->graph_info_idr); idr_init(&apm->graph_info_idr);
idr_init(&apm->sub_graphs_idr); idr_init(&apm->sub_graphs_idr);
......
...@@ -58,6 +58,7 @@ struct q6apm { ...@@ -58,6 +58,7 @@ struct q6apm {
struct mutex lock; struct mutex lock;
uint32_t state; uint32_t state;
struct list_head widget_list;
struct idr graph_idr; struct idr graph_idr;
struct idr graph_info_idr; struct idr graph_info_idr;
struct idr sub_graphs_idr; struct idr sub_graphs_idr;
......
...@@ -16,7 +16,11 @@ ...@@ -16,7 +16,11 @@
#include "audioreach.h" #include "audioreach.h"
struct snd_ar_control { struct snd_ar_control {
u32 graph_id; /* Graph ID */
u32 sgid; /* Sub 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; struct snd_soc_component *scomp;
}; };
...@@ -692,6 +696,7 @@ static int audioreach_widget_load_mixer(struct snd_soc_component *component, ...@@ -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_value_elem *w_elem;
struct snd_soc_tplg_vendor_array *w_array; struct snd_soc_tplg_vendor_array *w_array;
struct snd_ar_control *scontrol; struct snd_ar_control *scontrol;
struct q6apm *data = dev_get_drvdata(component->dev);
struct snd_soc_dobj *dobj; struct snd_soc_dobj *dobj;
int tkn_count = 0; int tkn_count = 0;
...@@ -711,6 +716,9 @@ static int audioreach_widget_load_mixer(struct snd_soc_component *component, ...@@ -711,6 +716,9 @@ static int audioreach_widget_load_mixer(struct snd_soc_component *component,
case AR_TKN_U32_SUB_GRAPH_INSTANCE_ID: case AR_TKN_U32_SUB_GRAPH_INSTANCE_ID:
scontrol->sgid = le32_to_cpu(w_elem->value); scontrol->sgid = le32_to_cpu(w_elem->value);
break; break;
case AR_TKN_DAI_INDEX:
scontrol->graph_id = le32_to_cpu(w_elem->value);
break;
default: /* ignore other tokens */ default: /* ignore other tokens */
break; break;
} }
...@@ -718,6 +726,9 @@ static int audioreach_widget_load_mixer(struct snd_soc_component *component, ...@@ -718,6 +726,9 @@ static int audioreach_widget_load_mixer(struct snd_soc_component *component,
w_elem++; w_elem++;
} }
scontrol->w = w;
list_add_tail(&scontrol->node, &data->widget_list);
return 0; return 0;
} }
...@@ -819,7 +830,10 @@ static int audioreach_widget_unload(struct snd_soc_component *scomp, ...@@ -819,7 +830,10 @@ static int audioreach_widget_unload(struct snd_soc_component *scomp,
if (w->id == snd_soc_dapm_mixer) { if (w->id == snd_soc_dapm_mixer) {
/* virtual widget */ /* virtual widget */
kfree(dobj->private); struct snd_ar_control *scontrol = dobj->private;
list_del(&scontrol->node);
kfree(scontrol);
return 0; return 0;
} }
...@@ -998,6 +1012,9 @@ static int audioreach_control_load_mix(struct snd_soc_component *scomp, ...@@ -998,6 +1012,9 @@ static int audioreach_control_load_mix(struct snd_soc_component *scomp,
case AR_TKN_U32_SUB_GRAPH_INSTANCE_ID: case AR_TKN_U32_SUB_GRAPH_INSTANCE_ID:
scontrol->sgid = le32_to_cpu(c_elem->value); scontrol->sgid = le32_to_cpu(c_elem->value);
break; break;
case AR_TKN_DAI_INDEX:
scontrol->graph_id = le32_to_cpu(c_elem->value);
break;
default: default:
/* Ignore other tokens */ /* Ignore other tokens */
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment