diff options
author | Liam Girdwood <liam.r.girdwood@linux.intel.com> | 2017-06-09 15:43:23 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2017-06-09 18:46:08 +0100 |
commit | ebd259d33a900b28ef774c4c26e8ce6e2baea7e5 (patch) | |
tree | a178243366c8e0ad58a8b9a158249238639dcd62 /sound | |
parent | 102ebe266c317da59471e2cde0dce603de031482 (diff) | |
download | linux-ebd259d33a900b28ef774c4c26e8ce6e2baea7e5.tar.gz linux-ebd259d33a900b28ef774c4c26e8ce6e2baea7e5.tar.bz2 linux-ebd259d33a900b28ef774c4c26e8ce6e2baea7e5.zip |
ASoC: topology: Allow bespoke configuration post widget creation
Current topology only allows for widget configuration before the widget
is registered. This patch also allows further configuration and usage
after registration is complete.
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-topology.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index f4ec236a418e..12e189701924 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -344,6 +344,17 @@ static int soc_tplg_widget_load(struct soc_tplg *tplg, return 0; } +/* optionally pass new dynamic widget to component driver. This is mainly for + * external widgets where we can assign private data/ops */ +static int soc_tplg_widget_ready(struct soc_tplg *tplg, + struct snd_soc_dapm_widget *w, struct snd_soc_tplg_dapm_widget *tplg_w) +{ + if (tplg->comp && tplg->ops && tplg->ops->widget_ready) + return tplg->ops->widget_ready(tplg->comp, w, tplg_w); + + return 0; +} + /* pass DAI configurations to component driver for extra initialization */ static int soc_tplg_dai_load(struct soc_tplg *tplg, struct snd_soc_dai_driver *dai_drv) @@ -1579,8 +1590,16 @@ widget: widget->dobj.ops = tplg->ops; widget->dobj.index = tplg->index; list_add(&widget->dobj.list, &tplg->comp->dobj_list); + + ret = soc_tplg_widget_ready(tplg, widget, w); + if (ret < 0) + goto ready_err; + return 0; +ready_err: + snd_soc_tplg_widget_remove(widget); + snd_soc_dapm_free_widget(widget); hdr_err: kfree(template.sname); err: |