alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Mark Brown <broonie@kernel.org>
Subject: [PATCH v2 4/6] ASoC: topology: Add callback for DAPM route load/unload
Date: Tue, 27 Mar 2018 14:30:43 +0100	[thread overview]
Message-ID: <20180327133045.29351-5-liam.r.girdwood@linux.intel.com> (raw)
In-Reply-To: <20180327133045.29351-1-liam.r.girdwood@linux.intel.com>

Add a callback fro clients for notification about DAPM route loading and
unloading.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
---
 include/sound/soc-topology.h |  7 +++++++
 sound/soc/soc-topology.c     | 13 +++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/include/sound/soc-topology.h b/include/sound/soc-topology.h
index e1f265e21ee1..401ef2c45d6c 100644
--- a/include/sound/soc-topology.h
+++ b/include/sound/soc-topology.h
@@ -32,6 +32,7 @@ struct snd_kcontrol_new;
 struct snd_soc_dai_link;
 struct snd_soc_dai_driver;
 struct snd_soc_dai;
+struct snd_soc_dapm_route;
 
 /* object scan be loaded and unloaded in groups with identfying indexes */
 #define SND_SOC_TPLG_INDEX_ALL	0	/* ID that matches all FW objects */
@@ -116,6 +117,12 @@ struct snd_soc_tplg_ops {
 	int (*control_unload)(struct snd_soc_component *,
 		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 */
 	int (*widget_load)(struct snd_soc_component *, int index,
 		struct snd_soc_dapm_widget *,
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index c43515d218ea..b1970a05ba44 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1161,6 +1161,17 @@ static int soc_tplg_kcontrol_elems_load(struct soc_tplg *tplg,
 	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,
 	struct snd_soc_tplg_hdr *hdr)
 {
@@ -1209,6 +1220,8 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
 		else
 			route.control = elem->control;
 
+		soc_tplg_add_route(tplg, &route);
+
 		/* add route, but keep going if some fail */
 		snd_soc_dapm_add_routes(dapm, &route, 1);
 	}
-- 
2.14.1

  parent reply	other threads:[~2018-03-27 13:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-27 13:30 [PATCH v2 0/6] ASoC: SOF driver dependencies Liam Girdwood
2018-03-27 13:30 ` [PATCH v2 1/6] ASoC: core: Allow topology to override machine driver FE DAI link config Liam Girdwood
2018-04-17 17:09   ` Applied "ASoC: core: Allow topology to override machine driver FE DAI link config." to the asoc tree Mark Brown
2018-04-17 17:11   ` Mark Brown
2018-03-27 13:30 ` [PATCH v2 2/6] ASoC: core: Add name prefix for machines with topology rewrites Liam Girdwood
2018-03-27 13:30 ` [PATCH v2 3/6] ASoC: topology: Give more data to clients via callbacks Liam Girdwood
2018-04-17 17:09   ` Applied "ASoC: topology: Give more data to clients via callbacks" to the asoc tree Mark Brown
2018-04-17 17:11   ` Mark Brown
2018-03-27 13:30 ` Liam Girdwood [this message]
2018-04-17 17:09   ` Applied "ASoC: topology: Add callback for DAPM route load/unload" " Mark Brown
2018-04-17 17:11   ` Mark Brown
2018-06-18 12:00   ` Mark Brown
2018-03-27 13:30 ` [PATCH v2 5/6] ASoC: topology: Check widget kcontrols before deref Liam Girdwood
2018-04-17 17:09   ` Applied "ASoC: topology: Check widget kcontrols before deref" to the asoc tree Mark Brown
2018-04-17 17:11   ` Mark Brown
2018-04-26 11:50   ` Mark Brown
2018-03-27 13:30 ` [PATCH v2 6/6] ASoC: topology: Add support for compressed PCMs Liam Girdwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180327133045.29351-5-liam.r.girdwood@linux.intel.com \
    --to=liam.r.girdwood@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).