aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/generic/simple-card.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index fd8b04588948..b63860ddb4fd 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -112,8 +112,10 @@ static int
112asoc_simple_card_sub_parse_of(struct device_node *np, 112asoc_simple_card_sub_parse_of(struct device_node *np,
113 struct asoc_simple_dai *dai, 113 struct asoc_simple_dai *dai,
114 struct device_node **p_node, 114 struct device_node **p_node,
115 const char **name) 115 const char **name,
116 int *args_count)
116{ 117{
118 struct of_phandle_args args;
117 struct device_node *node; 119 struct device_node *node;
118 struct clk *clk; 120 struct clk *clk;
119 u32 val; 121 u32 val;
@@ -123,10 +125,15 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
123 * get node via "sound-dai = <&phandle port>" 125 * get node via "sound-dai = <&phandle port>"
124 * it will be used as xxx_of_node on soc_bind_dai_link() 126 * it will be used as xxx_of_node on soc_bind_dai_link()
125 */ 127 */
126 node = of_parse_phandle(np, "sound-dai", 0); 128 ret = of_parse_phandle_with_args(np, "sound-dai",
127 if (!node) 129 "#sound-dai-cells", 0, &args);
128 return -ENODEV; 130 if (ret)
129 *p_node = node; 131 return ret;
132
133 *p_node = args.np;
134
135 if (args_count)
136 *args_count = args.args_count;
130 137
131 /* get dai->name */ 138 /* get dai->name */
132 ret = snd_soc_of_get_dai_name(np, name); 139 ret = snd_soc_of_get_dai_name(np, name);
@@ -176,7 +183,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
176 char *name; 183 char *name;
177 char prop[128]; 184 char prop[128];
178 char *prefix = ""; 185 char *prefix = "";
179 int ret; 186 int ret, cpu_args;
180 187
181 if (is_top_level_node) 188 if (is_top_level_node)
182 prefix = "simple-audio-card,"; 189 prefix = "simple-audio-card,";
@@ -195,7 +202,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
195 202
196 ret = asoc_simple_card_sub_parse_of(np, &dai_props->cpu_dai, 203 ret = asoc_simple_card_sub_parse_of(np, &dai_props->cpu_dai,
197 &dai_link->cpu_of_node, 204 &dai_link->cpu_of_node,
198 &dai_link->cpu_dai_name); 205 &dai_link->cpu_dai_name,
206 &cpu_args);
199 if (ret < 0) 207 if (ret < 0)
200 goto dai_link_of_err; 208 goto dai_link_of_err;
201 209
@@ -226,7 +234,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
226 234
227 ret = asoc_simple_card_sub_parse_of(np, &dai_props->codec_dai, 235 ret = asoc_simple_card_sub_parse_of(np, &dai_props->codec_dai,
228 &dai_link->codec_of_node, 236 &dai_link->codec_of_node,
229 &dai_link->codec_dai_name); 237 &dai_link->codec_dai_name, NULL);
230 if (ret < 0) 238 if (ret < 0)
231 goto dai_link_of_err; 239 goto dai_link_of_err;
232 240
@@ -290,12 +298,13 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
290 * soc_bind_dai_link() will check cpu name 298 * soc_bind_dai_link() will check cpu name
291 * after of_node matching if dai_link has cpu_dai_name. 299 * after of_node matching if dai_link has cpu_dai_name.
292 * but, it will never match if name was created by fmt_single_name() 300 * but, it will never match if name was created by fmt_single_name()
293 * remove cpu_dai_name to escape name matching. 301 * remove cpu_dai_name if cpu_args was 0.
294 * see 302 * see
295 * fmt_single_name() 303 * fmt_single_name()
296 * fmt_multiple_name() 304 * fmt_multiple_name()
297 */ 305 */
298 dai_link->cpu_dai_name = NULL; 306 if (!cpu_args)
307 dai_link->cpu_dai_name = NULL;
299 308
300dai_link_of_err: 309dai_link_of_err:
301 if (np) 310 if (np)