Skip to content

Commit 503e79b

Browse files
lrgirdwobroonie
authored andcommitted
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: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent c60b613 commit 503e79b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

include/sound/soc-topology.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ struct snd_kcontrol_new;
3232
struct snd_soc_dai_link;
3333
struct snd_soc_dai_driver;
3434
struct snd_soc_dai;
35+
struct snd_soc_dapm_route;
3536

3637
/* object scan be loaded and unloaded in groups with identfying indexes */
3738
#define SND_SOC_TPLG_INDEX_ALL 0 /* ID that matches all FW objects */
@@ -116,6 +117,12 @@ struct snd_soc_tplg_ops {
116117
int (*control_unload)(struct snd_soc_component *,
117118
struct snd_soc_dobj *);
118119

120+
/* DAPM graph route element loading and unloading */
121+
int (*dapm_route_load)(struct snd_soc_component *, int index,
122+
struct snd_soc_dapm_route *route);
123+
int (*dapm_route_unload)(struct snd_soc_component *,
124+
struct snd_soc_dobj *);
125+
119126
/* external widget init - used for any driver specific init */
120127
int (*widget_load)(struct snd_soc_component *, int index,
121128
struct snd_soc_dapm_widget *,

sound/soc/soc-topology.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,17 @@ static int soc_tplg_kcontrol_elems_load(struct soc_tplg *tplg,
11051105
return 0;
11061106
}
11071107

1108+
/* optionally pass new dynamic kcontrol to component driver. */
1109+
static int soc_tplg_add_route(struct soc_tplg *tplg,
1110+
struct snd_soc_dapm_route *route)
1111+
{
1112+
if (tplg->comp && tplg->ops && tplg->ops->dapm_route_load)
1113+
return tplg->ops->dapm_route_load(tplg->comp, tplg->index,
1114+
route);
1115+
1116+
return 0;
1117+
}
1118+
11081119
static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
11091120
struct snd_soc_tplg_hdr *hdr)
11101121
{
@@ -1153,6 +1164,8 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
11531164
else
11541165
route.control = elem->control;
11551166

1167+
soc_tplg_add_route(tplg, &route);
1168+
11561169
/* add route, but keep going if some fail */
11571170
snd_soc_dapm_add_routes(dapm, &route, 1);
11581171
}

0 commit comments

Comments
 (0)