diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2016-08-08 02:01:43 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-08-08 06:35:51 -0400 |
commit | ae30a694da4c37b4d0c8b750c9a4104d8da749b3 (patch) | |
tree | a58f8341e9fa091010cc046035f4e0be81390ffd | |
parent | bb6fc620c2ed972f58a0174f64f8dbd22a5911b1 (diff) |
ASoC: simple-card-utils: add asoc_simple_card_parse_dai()
simple-card needs to get its dai name and endpoint node.
This patch makes it simple style standard
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | include/sound/simple_card_utils.h | 17 | ||||
-rw-r--r-- | sound/soc/generic/simple-card-utils.c | 37 |
2 files changed, 54 insertions, 0 deletions
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 1392eb56cf0e..62b392695d2d 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h | |||
@@ -41,4 +41,21 @@ int asoc_simple_card_parse_clk(struct device_node *node, | |||
41 | struct device_node *dai_of_node, | 41 | struct device_node *dai_of_node, |
42 | struct asoc_simple_dai *simple_dai); | 42 | struct asoc_simple_dai *simple_dai); |
43 | 43 | ||
44 | #define asoc_simple_card_parse_cpu(node, dai_link, \ | ||
45 | list_name, cells_name, is_single_link) \ | ||
46 | asoc_simple_card_parse_dai(node, &dai_link->cpu_of_node, \ | ||
47 | &dai_link->cpu_dai_name, list_name, cells_name, is_single_link) | ||
48 | #define asoc_simple_card_parse_codec(node, dai_link, list_name, cells_name) \ | ||
49 | asoc_simple_card_parse_dai(node, &dai_link->codec_of_node, \ | ||
50 | &dai_link->codec_dai_name, list_name, cells_name, NULL) | ||
51 | #define asoc_simple_card_parse_platform(node, dai_link, list_name, cells_name) \ | ||
52 | asoc_simple_card_parse_dai(node, &dai_link->platform_of_node, \ | ||
53 | NULL, list_name, cells_name, NULL) | ||
54 | int asoc_simple_card_parse_dai(struct device_node *node, | ||
55 | struct device_node **endpoint_np, | ||
56 | const char **dai_name, | ||
57 | const char *list_name, | ||
58 | const char *cells_name, | ||
59 | int *is_single_links); | ||
60 | |||
44 | #endif /* __SIMPLE_CARD_CORE_H */ | 61 | #endif /* __SIMPLE_CARD_CORE_H */ |
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 16f65f972d04..27e6d038a902 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c | |||
@@ -127,6 +127,43 @@ int asoc_simple_card_parse_clk(struct device_node *node, | |||
127 | } | 127 | } |
128 | EXPORT_SYMBOL_GPL(asoc_simple_card_parse_clk); | 128 | EXPORT_SYMBOL_GPL(asoc_simple_card_parse_clk); |
129 | 129 | ||
130 | int asoc_simple_card_parse_dai(struct device_node *node, | ||
131 | struct device_node **dai_of_node, | ||
132 | const char **dai_name, | ||
133 | const char *list_name, | ||
134 | const char *cells_name, | ||
135 | int *is_single_link) | ||
136 | { | ||
137 | struct of_phandle_args args; | ||
138 | int ret; | ||
139 | |||
140 | if (!node) | ||
141 | return 0; | ||
142 | |||
143 | /* | ||
144 | * Get node via "sound-dai = <&phandle port>" | ||
145 | * it will be used as xxx_of_node on soc_bind_dai_link() | ||
146 | */ | ||
147 | ret = of_parse_phandle_with_args(node, list_name, cells_name, 0, &args); | ||
148 | if (ret) | ||
149 | return ret; | ||
150 | |||
151 | /* Get dai->name */ | ||
152 | if (dai_name) { | ||
153 | ret = snd_soc_of_get_dai_name(node, dai_name); | ||
154 | if (ret < 0) | ||
155 | return ret; | ||
156 | } | ||
157 | |||
158 | *dai_of_node = args.np; | ||
159 | |||
160 | if (is_single_link) | ||
161 | *is_single_link = !args.args_count; | ||
162 | |||
163 | return 0; | ||
164 | } | ||
165 | EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dai); | ||
166 | |||
130 | /* Module information */ | 167 | /* Module information */ |
131 | MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>"); | 168 | MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>"); |
132 | MODULE_DESCRIPTION("ALSA SoC Simple Card Utils"); | 169 | MODULE_DESCRIPTION("ALSA SoC Simple Card Utils"); |