aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisael Lopez Cruz <misael.lopez@ti.com>2014-03-21 11:27:27 -0400
committerMark Brown <broonie@linaro.org>2014-04-14 15:37:25 -0400
commit2436a723f3e1fbca517c9318efe9af5ecf7cbcbb (patch)
treea73e3de0db23c8c12ea7544c8f3e75477e7ac3fe
parentb0aa88af23155b18efb8c18ace963fa75778561a (diff)
ASoC: core: Add helper for DAI widgets linking
Add a helper for DAI widgets linking in preparation for DAI-multicodec support. No functional change. Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com> [fparent@baylibre.com: Adapt to 3.14+] Signed-off-by: Fabien Parent <fparent@baylibre.com> Signed-off-by: Benoit Cousson <bcousson@baylibre.com> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--sound/soc/soc-core.c64
1 files changed, 40 insertions, 24 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 1e4945d614a4..4c0f7dccbd83 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1413,6 +1413,42 @@ static int soc_probe_codec_dai(struct snd_soc_card *card,
1413 return 0; 1413 return 0;
1414} 1414}
1415 1415
1416static int soc_link_dai_widgets(struct snd_soc_card *card,
1417 struct snd_soc_dai_link *dai_link,
1418 struct snd_soc_dai *cpu_dai,
1419 struct snd_soc_dai *codec_dai)
1420{
1421 struct snd_soc_dapm_widget *play_w, *capture_w;
1422 int ret;
1423
1424 /* link the DAI widgets */
1425 play_w = codec_dai->playback_widget;
1426 capture_w = cpu_dai->capture_widget;
1427 if (play_w && capture_w) {
1428 ret = snd_soc_dapm_new_pcm(card, dai_link->params,
1429 capture_w, play_w);
1430 if (ret != 0) {
1431 dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
1432 play_w->name, capture_w->name, ret);
1433 return ret;
1434 }
1435 }
1436
1437 play_w = cpu_dai->playback_widget;
1438 capture_w = codec_dai->capture_widget;
1439 if (play_w && capture_w) {
1440 ret = snd_soc_dapm_new_pcm(card, dai_link->params,
1441 capture_w, play_w);
1442 if (ret != 0) {
1443 dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
1444 play_w->name, capture_w->name, ret);
1445 return ret;
1446 }
1447 }
1448
1449 return 0;
1450}
1451
1416static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order) 1452static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
1417{ 1453{
1418 struct snd_soc_dai_link *dai_link = &card->dai_link[num]; 1454 struct snd_soc_dai_link *dai_link = &card->dai_link[num];
@@ -1421,7 +1457,6 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
1421 struct snd_soc_platform *platform = rtd->platform; 1457 struct snd_soc_platform *platform = rtd->platform;
1422 struct snd_soc_dai *codec_dai = rtd->codec_dai; 1458 struct snd_soc_dai *codec_dai = rtd->codec_dai;
1423 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 1459 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
1424 struct snd_soc_dapm_widget *play_w, *capture_w;
1425 int ret; 1460 int ret;
1426 1461
1427 dev_dbg(card->dev, "ASoC: probe %s dai link %d late %d\n", 1462 dev_dbg(card->dev, "ASoC: probe %s dai link %d late %d\n",
@@ -1502,29 +1537,10 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
1502 codec2codec_close_delayed_work); 1537 codec2codec_close_delayed_work);
1503 1538
1504 /* link the DAI widgets */ 1539 /* link the DAI widgets */
1505 play_w = codec_dai->playback_widget; 1540 ret = soc_link_dai_widgets(card, dai_link,
1506 capture_w = cpu_dai->capture_widget; 1541 cpu_dai, codec_dai);
1507 if (play_w && capture_w) { 1542 if (ret)
1508 ret = snd_soc_dapm_new_pcm(card, dai_link->params, 1543 return ret;
1509 capture_w, play_w);
1510 if (ret != 0) {
1511 dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
1512 play_w->name, capture_w->name, ret);
1513 return ret;
1514 }
1515 }
1516
1517 play_w = cpu_dai->playback_widget;
1518 capture_w = codec_dai->capture_widget;
1519 if (play_w && capture_w) {
1520 ret = snd_soc_dapm_new_pcm(card, dai_link->params,
1521 capture_w, play_w);
1522 if (ret != 0) {
1523 dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
1524 play_w->name, capture_w->name, ret);
1525 return ret;
1526 }
1527 }
1528 } 1544 }
1529 } 1545 }
1530 1546