未验证 提交 28aa6f77 编写于 作者: L Liam Girdwood 提交者: Mark Brown

ASoC: topology: Add callback for DAPM route load/unload

Add a callback fro clients for notification about DAPM route loading and
unloading.
Signed-off-by: NLiam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 81e9b0a0
...@@ -32,6 +32,7 @@ struct snd_kcontrol_new; ...@@ -32,6 +32,7 @@ struct snd_kcontrol_new;
struct snd_soc_dai_link; struct snd_soc_dai_link;
struct snd_soc_dai_driver; struct snd_soc_dai_driver;
struct snd_soc_dai; struct snd_soc_dai;
struct snd_soc_dapm_route;
/* object scan be loaded and unloaded in groups with identfying indexes */ /* object scan be loaded and unloaded in groups with identfying indexes */
#define SND_SOC_TPLG_INDEX_ALL 0 /* ID that matches all FW objects */ #define SND_SOC_TPLG_INDEX_ALL 0 /* ID that matches all FW objects */
...@@ -116,6 +117,12 @@ struct snd_soc_tplg_ops { ...@@ -116,6 +117,12 @@ struct snd_soc_tplg_ops {
int (*control_unload)(struct snd_soc_component *, int (*control_unload)(struct snd_soc_component *,
struct snd_soc_dobj *); struct snd_soc_dobj *);
/* DAPM graph route element loading and unloading */
int (*dapm_route_load)(struct snd_soc_component *, int index,
struct snd_soc_dapm_route *route);
int (*dapm_route_unload)(struct snd_soc_component *,
struct snd_soc_dobj *);
/* external widget init - used for any driver specific init */ /* external widget init - used for any driver specific init */
int (*widget_load)(struct snd_soc_component *, int index, int (*widget_load)(struct snd_soc_component *, int index,
struct snd_soc_dapm_widget *, struct snd_soc_dapm_widget *,
......
...@@ -1161,6 +1161,17 @@ static int soc_tplg_kcontrol_elems_load(struct soc_tplg *tplg, ...@@ -1161,6 +1161,17 @@ static int soc_tplg_kcontrol_elems_load(struct soc_tplg *tplg,
return 0; return 0;
} }
/* optionally pass new dynamic kcontrol to component driver. */
static int soc_tplg_add_route(struct soc_tplg *tplg,
struct snd_soc_dapm_route *route)
{
if (tplg->comp && tplg->ops && tplg->ops->dapm_route_load)
return tplg->ops->dapm_route_load(tplg->comp, tplg->index,
route);
return 0;
}
static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg, static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
struct snd_soc_tplg_hdr *hdr) struct snd_soc_tplg_hdr *hdr)
{ {
...@@ -1209,6 +1220,8 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg, ...@@ -1209,6 +1220,8 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
else else
route.control = elem->control; route.control = elem->control;
soc_tplg_add_route(tplg, &route);
/* add route, but keep going if some fail */ /* add route, but keep going if some fail */
snd_soc_dapm_add_routes(dapm, &route, 1); snd_soc_dapm_add_routes(dapm, &route, 1);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册