aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKuninori Morimoto <[email protected]>2023-07-10 10:20:06 +0900
committerMark Brown <[email protected]>2023-07-17 06:15:44 +0100
commit442ae56cf5c007faaf7440d4aa018c62e5761157 (patch)
treeb7bc36ed06231cb4f4d886ee6783821e12c4dd7b
parent45655ec69cb954d7fa594054bec33d6d5b99f8d5 (diff)
ASoC: soc-core.c: add snd_soc_get_dai_via_args()
To enable multi Component, Card driver need to get DAI via dai_args to identify it. This patch adds snd_soc_get_dai_via_args() for it. This is helper function for multi Component support. Signed-off-by: Kuninori Morimoto <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
-rw-r--r--include/sound/soc.h1
-rw-r--r--sound/soc/soc-core.c18
2 files changed, 19 insertions, 0 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index dda731795bd4..1b3c58fe14c4 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1336,6 +1336,7 @@ int snd_soc_add_pcm_runtimes(struct snd_soc_card *card,
void snd_soc_remove_pcm_runtime(struct snd_soc_card *card,
struct snd_soc_pcm_runtime *rtd);
+struct snd_soc_dai *snd_soc_get_dai_via_args(struct of_phandle_args *dai_args);
struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component,
struct snd_soc_dai_driver *dai_drv,
bool legacy_dai_naming);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 8487a4c12753..22a065f4c908 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3446,6 +3446,24 @@ int snd_soc_of_get_dai_name(struct device_node *of_node,
}
EXPORT_SYMBOL_GPL(snd_soc_of_get_dai_name);
+struct snd_soc_dai *snd_soc_get_dai_via_args(struct of_phandle_args *dai_args)
+{
+ struct snd_soc_dai *dai;
+ struct snd_soc_component *component;
+
+ mutex_lock(&client_mutex);
+ for_each_component(component) {
+ for_each_component_dais(component, dai)
+ if (snd_soc_is_match_dai_args(dai->driver->dai_args, dai_args))
+ goto found;
+ }
+ dai = NULL;
+found:
+ mutex_unlock(&client_mutex);
+ return dai;
+}
+EXPORT_SYMBOL_GPL(snd_soc_get_dai_via_args);
+
static void __snd_soc_of_put_component(struct snd_soc_dai_link_component *component)
{
if (component->of_node) {