ASoC: qdsp6: audioreach: update dapm kcontrol private data
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Thu, 27 Oct 2022 10:27:04 +0000 (11:27 +0100)
committerMark Brown <broonie@kernel.org>
Fri, 28 Oct 2022 16:19:19 +0000 (17:19 +0100)
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>
sound/soc/qcom/qdsp6/q6apm.c
sound/soc/qcom/qdsp6/q6apm.h
sound/soc/qcom/qdsp6/topology.c

index 7940192..81e2d70 100644 (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);
index 54eadad..96ad5ea 100644 (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;
index 9a3d9e0..0c4886d 100644 (file)
 #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;