All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ASoC: topology: Add callback for DAPM route load/unload
@ 2018-06-14 19:53 Liam Girdwood
  2018-06-19  4:47 ` Vinod
  0 siblings, 1 reply; 2+ messages in thread
From: Liam Girdwood @ 2018-06-14 19:53 UTC (permalink / raw)
  To: alsa-devel; +Cc: Liam Girdwood, Mark Brown

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

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
---

Changes since V1:
 - Fixed merge conflict with recent component model update.

---
 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 a30bb94fc800..ed8c00b43ef9 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1105,6 +1105,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)
 {
@@ -1153,6 +1164,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.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] ASoC: topology: Add callback for DAPM route load/unload
  2018-06-14 19:53 [PATCH v2] ASoC: topology: Add callback for DAPM route load/unload Liam Girdwood
@ 2018-06-19  4:47 ` Vinod
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod @ 2018-06-19  4:47 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, Mark Brown

On 14-06-18, 20:53, Liam Girdwood wrote:
> Add a callback fro clients for notification about DAPM route loading and

/s/fro/for ?

> unloading.

It would help to add motivation for callback, how is this useful and
user as well

> 
> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
> ---
> 
> Changes since V1:
>  - Fixed merge conflict with recent component model update.
> 
> ---
>  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 a30bb94fc800..ed8c00b43ef9 100644
> --- a/sound/soc/soc-topology.c
> +++ b/sound/soc/soc-topology.c
> @@ -1105,6 +1105,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)

Align with preceding please

> +{
> +	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)
>  {
> @@ -1153,6 +1164,8 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
>  		else
>  			route.control = elem->control;
>  
> +		soc_tplg_add_route(tplg, &route);

it is not really add_route right, so notify_load or something?

-- 
~Vinod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-19  4:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-14 19:53 [PATCH v2] ASoC: topology: Add callback for DAPM route load/unload Liam Girdwood
2018-06-19  4:47 ` Vinod

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.