diff options
-rw-r--r-- | sound/soc/generic/simple-card.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index b63860ddb4fd..e0abe772c040 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c | |||
@@ -185,6 +185,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, | |||
185 | char *prefix = ""; | 185 | char *prefix = ""; |
186 | int ret, cpu_args; | 186 | int ret, cpu_args; |
187 | 187 | ||
188 | /* For single DAI link & old style of DT node */ | ||
188 | if (is_top_level_node) | 189 | if (is_top_level_node) |
189 | prefix = "simple-audio-card,"; | 190 | prefix = "simple-audio-card,"; |
190 | 191 | ||
@@ -318,14 +319,16 @@ dai_link_of_err: | |||
318 | 319 | ||
319 | static int asoc_simple_card_parse_of(struct device_node *node, | 320 | static int asoc_simple_card_parse_of(struct device_node *node, |
320 | struct simple_card_data *priv, | 321 | struct simple_card_data *priv, |
321 | struct device *dev, | 322 | struct device *dev) |
322 | int multi) | ||
323 | { | 323 | { |
324 | struct snd_soc_dai_link *dai_link = priv->snd_card.dai_link; | 324 | struct snd_soc_dai_link *dai_link = priv->snd_card.dai_link; |
325 | struct simple_dai_props *dai_props = priv->dai_props; | 325 | struct simple_dai_props *dai_props = priv->dai_props; |
326 | u32 val; | 326 | u32 val; |
327 | int ret; | 327 | int ret; |
328 | 328 | ||
329 | if (!node) | ||
330 | return -EINVAL; | ||
331 | |||
329 | /* parsing the card name from DT */ | 332 | /* parsing the card name from DT */ |
330 | snd_soc_of_parse_card_name(&priv->snd_card, "simple-audio-card,name"); | 333 | snd_soc_of_parse_card_name(&priv->snd_card, "simple-audio-card,name"); |
331 | 334 | ||
@@ -353,7 +356,8 @@ static int asoc_simple_card_parse_of(struct device_node *node, | |||
353 | dev_dbg(dev, "New simple-card: %s\n", priv->snd_card.name ? | 356 | dev_dbg(dev, "New simple-card: %s\n", priv->snd_card.name ? |
354 | priv->snd_card.name : ""); | 357 | priv->snd_card.name : ""); |
355 | 358 | ||
356 | if (multi) { | 359 | /* Single/Muti DAI link(s) & New style of DT node */ |
360 | if (of_get_child_by_name(node, "simple-audio-card,dai-link")) { | ||
357 | struct device_node *np = NULL; | 361 | struct device_node *np = NULL; |
358 | int i = 0; | 362 | int i = 0; |
359 | 363 | ||
@@ -370,6 +374,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, | |||
370 | i++; | 374 | i++; |
371 | } | 375 | } |
372 | } else { | 376 | } else { |
377 | /* For single DAI link & old style of DT node */ | ||
373 | ret = asoc_simple_card_dai_link_of(node, dev, | 378 | ret = asoc_simple_card_dai_link_of(node, dev, |
374 | dai_link, dai_props, true); | 379 | dai_link, dai_props, true); |
375 | if (ret < 0) | 380 | if (ret < 0) |
@@ -409,16 +414,13 @@ static int asoc_simple_card_probe(struct platform_device *pdev) | |||
409 | struct snd_soc_dai_link *dai_link; | 414 | struct snd_soc_dai_link *dai_link; |
410 | struct device_node *np = pdev->dev.of_node; | 415 | struct device_node *np = pdev->dev.of_node; |
411 | struct device *dev = &pdev->dev; | 416 | struct device *dev = &pdev->dev; |
412 | int num_links, multi, ret; | 417 | int num_links, ret; |
413 | 418 | ||
414 | /* get the number of DAI links */ | 419 | /* get the number of DAI links */ |
415 | if (np && of_get_child_by_name(np, "simple-audio-card,dai-link")) { | 420 | if (np && of_get_child_by_name(np, "simple-audio-card,dai-link")) |
416 | num_links = of_get_child_count(np); | 421 | num_links = of_get_child_count(np); |
417 | multi = 1; | 422 | else |
418 | } else { | ||
419 | num_links = 1; | 423 | num_links = 1; |
420 | multi = 0; | ||
421 | } | ||
422 | 424 | ||
423 | /* allocate the private data and the DAI link array */ | 425 | /* allocate the private data and the DAI link array */ |
424 | priv = devm_kzalloc(dev, | 426 | priv = devm_kzalloc(dev, |
@@ -445,7 +447,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev) | |||
445 | 447 | ||
446 | if (np && of_device_is_available(np)) { | 448 | if (np && of_device_is_available(np)) { |
447 | 449 | ||
448 | ret = asoc_simple_card_parse_of(np, priv, dev, multi); | 450 | ret = asoc_simple_card_parse_of(np, priv, dev); |
449 | if (ret < 0) { | 451 | if (ret < 0) { |
450 | if (ret != -EPROBE_DEFER) | 452 | if (ret != -EPROBE_DEFER) |
451 | dev_err(dev, "parse error %d\n", ret); | 453 | dev_err(dev, "parse error %d\n", ret); |