[alsa-devel] [PATCH v2 06/13] ASoC: Add add_dai_link ops for a soc card

mengdong.lin at linux.intel.com mengdong.lin at linux.intel.com
Thu Nov 5 10:59:11 CET 2015


From: Mengdong Lin <mengdong.lin at linux.intel.com>

When a new DAI link is added, the ASoC core will call this ops to notify
a machine driver for extra intialization.

Signed-off-by: Mengdong Lin <mengdong.lin at linux.intel.com>

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 60e5fda..9a0e0e8 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1103,6 +1103,9 @@ struct snd_soc_card {
 				   struct snd_soc_dapm_context *dapm,
 				   enum snd_soc_bias_level level);
 
+	int (*add_dai_link)(struct snd_soc_card *,
+			    struct snd_soc_dai_link *link);
+
 	long pmdown_time;
 
 	/* CPU <--> Codec DAI links  */
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index c855e30..24e0c50 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1243,6 +1243,10 @@ static int soc_init_dai_link(struct snd_soc_card *card,
 void snd_soc_add_dai_link(struct snd_soc_card *card,
 		struct snd_soc_dai_link *dai_link)
 {
+	/* Notify the machine driver for extra initialization. */
+	if (card && card->add_dai_link)
+		card->add_dai_link(card, dai_link);
+
 	lockdep_assert_held(&client_mutex);
 	list_add_tail(&dai_link->list, &card->dai_link_list);
 	card->num_dai_links++;
-- 
1.9.1



More information about the Alsa-devel mailing list