summaryrefslogtreecommitdiff
path: root/include/sound
diff options
context:
space:
mode:
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>2017-10-12 18:38:02 -0500
committerMark Brown <broonie@kernel.org>2017-10-18 12:26:28 +0100
commit7c761b593e2c1dc6bc6c0c15ec338af1f00cabd7 (patch)
tree23a3e6e41846ed7f5fc9c7703aa069ed76a4f33a /include/sound
parent2bd6bf03f4c1c59381d62c61d03f6cc3fe71f66e (diff)
ASoC: Add helper to find codec_dai from dai_name
Create a helper function to remove duplicate code used in machine drivers Suggested-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/soc.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index d22de9712c45..deacbafbae17 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1720,6 +1720,20 @@ struct snd_soc_dai *snd_soc_find_dai(
#include <sound/soc-dai.h>
+static inline
+struct snd_soc_dai *snd_soc_card_get_codec_dai(struct snd_soc_card *card,
+ const char *dai_name)
+{
+ struct snd_soc_pcm_runtime *rtd;
+
+ list_for_each_entry(rtd, &card->rtd_list, list) {
+ if (!strcmp(rtd->codec_dai->name, dai_name))
+ return rtd->codec_dai;
+ }
+
+ return NULL;
+}
+
#ifdef CONFIG_DEBUG_FS
extern struct dentry *snd_soc_debugfs_root;
#endif