diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2016-07-18 22:53:13 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-08-05 07:31:37 -0400 |
commit | 28abd99b6e40741cd0e75be20817f23a3044d338 (patch) | |
tree | 8ad7ab7dda8f2b8de8ce8ad8d62a41303862ce3e /sound | |
parent | e7ca8fcd15049b1e48ae2ef1434a68a51ef0ead5 (diff) |
ASoC: simple-card: use asoc_simple_card_parse_clk()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/generic/simple-card.c | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 43295f024982..b37c81b09203 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c | |||
@@ -244,8 +244,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np, | |||
244 | int *args_count) | 244 | int *args_count) |
245 | { | 245 | { |
246 | struct of_phandle_args args; | 246 | struct of_phandle_args args; |
247 | struct clk *clk; | ||
248 | u32 val; | ||
249 | int ret; | 247 | int ret; |
250 | 248 | ||
251 | if (!np) | 249 | if (!np) |
@@ -282,29 +280,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np, | |||
282 | if (ret) | 280 | if (ret) |
283 | return ret; | 281 | return ret; |
284 | 282 | ||
285 | /* | ||
286 | * Parse dai->sysclk come from "clocks = <&xxx>" | ||
287 | * (if system has common clock) | ||
288 | * or "system-clock-frequency = <xxx>" | ||
289 | * or device's module clock. | ||
290 | */ | ||
291 | if (of_property_read_bool(np, "clocks")) { | ||
292 | clk = of_clk_get(np, 0); | ||
293 | if (IS_ERR(clk)) { | ||
294 | ret = PTR_ERR(clk); | ||
295 | return ret; | ||
296 | } | ||
297 | |||
298 | dai->sysclk = clk_get_rate(clk); | ||
299 | dai->clk = clk; | ||
300 | } else if (!of_property_read_u32(np, "system-clock-frequency", &val)) { | ||
301 | dai->sysclk = val; | ||
302 | } else { | ||
303 | clk = of_clk_get(args.np, 0); | ||
304 | if (!IS_ERR(clk)) | ||
305 | dai->sysclk = clk_get_rate(clk); | ||
306 | } | ||
307 | |||
308 | return 0; | 283 | return 0; |
309 | } | 284 | } |
310 | 285 | ||
@@ -316,6 +291,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, | |||
316 | struct device *dev = simple_priv_to_dev(priv); | 291 | struct device *dev = simple_priv_to_dev(priv); |
317 | struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx); | 292 | struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx); |
318 | struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx); | 293 | struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx); |
294 | struct asoc_simple_dai *cpu_dai = &dai_props->cpu_dai; | ||
295 | struct asoc_simple_dai *codec_dai = &dai_props->codec_dai; | ||
319 | struct device_node *cpu = NULL; | 296 | struct device_node *cpu = NULL; |
320 | struct device_node *plat = NULL; | 297 | struct device_node *plat = NULL; |
321 | struct device_node *codec = NULL; | 298 | struct device_node *codec = NULL; |
@@ -370,6 +347,14 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, | |||
370 | if (ret < 0) | 347 | if (ret < 0) |
371 | goto dai_link_of_err; | 348 | goto dai_link_of_err; |
372 | 349 | ||
350 | ret = asoc_simple_card_parse_clk_cpu(cpu, dai_link, cpu_dai); | ||
351 | if (ret < 0) | ||
352 | goto dai_link_of_err; | ||
353 | |||
354 | ret = asoc_simple_card_parse_clk_codec(codec, dai_link, codec_dai); | ||
355 | if (ret < 0) | ||
356 | goto dai_link_of_err; | ||
357 | |||
373 | if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) { | 358 | if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) { |
374 | ret = -EINVAL; | 359 | ret = -EINVAL; |
375 | goto dai_link_of_err; | 360 | goto dai_link_of_err; |