diff options
| -rw-r--r-- | include/sound/soc.h | 8 | ||||
| -rw-r--r-- | sound/soc/soc-core.c | 35 |
2 files changed, 43 insertions, 0 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index 9a81e2e7d661..1dd7dc5f7d52 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #ifndef __LINUX_SND_SOC_H | 13 | #ifndef __LINUX_SND_SOC_H |
| 14 | #define __LINUX_SND_SOC_H | 14 | #define __LINUX_SND_SOC_H |
| 15 | 15 | ||
| 16 | #include <linux/of.h> | ||
| 16 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
| 17 | #include <linux/types.h> | 18 | #include <linux/types.h> |
| 18 | #include <linux/notifier.h> | 19 | #include <linux/notifier.h> |
| @@ -673,6 +674,11 @@ struct snd_soc_cache_ops { | |||
| 673 | /* component interface */ | 674 | /* component interface */ |
| 674 | struct snd_soc_component_driver { | 675 | struct snd_soc_component_driver { |
| 675 | const char *name; | 676 | const char *name; |
| 677 | |||
| 678 | /* DT */ | ||
| 679 | int (*of_xlate_dai_name)(struct snd_soc_component *component, | ||
| 680 | struct of_phandle_args *args, | ||
| 681 | const char **dai_name); | ||
| 676 | }; | 682 | }; |
| 677 | 683 | ||
| 678 | struct snd_soc_component { | 684 | struct snd_soc_component { |
| @@ -1206,6 +1212,8 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
| 1206 | const char *propname); | 1212 | const char *propname); |
| 1207 | unsigned int snd_soc_of_parse_daifmt(struct device_node *np, | 1213 | unsigned int snd_soc_of_parse_daifmt(struct device_node *np, |
| 1208 | const char *prefix); | 1214 | const char *prefix); |
| 1215 | int snd_soc_of_get_dai_name(struct device_node *of_node, | ||
| 1216 | const char **dai_name); | ||
| 1209 | 1217 | ||
| 1210 | #include <sound/soc-dai.h> | 1218 | #include <sound/soc-dai.h> |
| 1211 | 1219 | ||
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 014ac10267da..711bd362028d 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
| @@ -4590,6 +4590,41 @@ unsigned int snd_soc_of_parse_daifmt(struct device_node *np, | |||
| 4590 | } | 4590 | } |
| 4591 | EXPORT_SYMBOL_GPL(snd_soc_of_parse_daifmt); | 4591 | EXPORT_SYMBOL_GPL(snd_soc_of_parse_daifmt); |
| 4592 | 4592 | ||
| 4593 | int snd_soc_of_get_dai_name(struct device_node *of_node, | ||
| 4594 | const char **dai_name) | ||
| 4595 | { | ||
| 4596 | struct snd_soc_component *pos; | ||
| 4597 | struct of_phandle_args args; | ||
| 4598 | int ret; | ||
| 4599 | |||
| 4600 | ret = of_parse_phandle_with_args(of_node, "sound-dai", | ||
| 4601 | "#sound-dai-cells", 0, &args); | ||
| 4602 | if (ret) | ||
| 4603 | return ret; | ||
| 4604 | |||
| 4605 | ret = -EPROBE_DEFER; | ||
| 4606 | |||
| 4607 | mutex_lock(&client_mutex); | ||
| 4608 | list_for_each_entry(pos, &component_list, list) { | ||
| 4609 | if (pos->dev->of_node != args.np) | ||
| 4610 | continue; | ||
| 4611 | |||
| 4612 | if (!pos->driver->of_xlate_dai_name) { | ||
| 4613 | ret = -ENOSYS; | ||
| 4614 | break; | ||
| 4615 | } | ||
| 4616 | |||
| 4617 | ret = pos->driver->of_xlate_dai_name(pos, &args, dai_name); | ||
| 4618 | break; | ||
| 4619 | } | ||
| 4620 | mutex_unlock(&client_mutex); | ||
| 4621 | |||
| 4622 | of_node_put(args.np); | ||
| 4623 | |||
| 4624 | return ret; | ||
| 4625 | } | ||
| 4626 | EXPORT_SYMBOL_GPL(snd_soc_of_get_dai_name); | ||
| 4627 | |||
| 4593 | static int __init snd_soc_init(void) | 4628 | static int __init snd_soc_init(void) |
| 4594 | { | 4629 | { |
| 4595 | #ifdef CONFIG_DEBUG_FS | 4630 | #ifdef CONFIG_DEBUG_FS |
