aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisael Lopez Cruz2014-10-30 01:37:13 -0500
committerMisael Lopez Cruz2014-10-30 01:37:15 -0500
commit32ffb5f00a0fd4b84f9ef56c447c2be10fa61de9 (patch)
tree39344e24ae475c5b5fa8680f092e2448100d0488
parent265dbeb9913fe4d447437d677042b01be34209da (diff)
downloadkernel-audio-32ffb5f00a0fd4b84f9ef56c447c2be10fa61de9.tar.gz
kernel-audio-32ffb5f00a0fd4b84f9ef56c447c2be10fa61de9.tar.xz
kernel-audio-32ffb5f00a0fd4b84f9ef56c447c2be10fa61de9.zip
ASoC: dra7: dra7-evm: Add loopback DAI link
Add a test DAI link for McASP5 in loopback mode. For the sake of simplicity it reuses the same settings than the media DAI link. Change-Id: If82d77f66efc77a6f02686a79a04ad30790738cb Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
-rw-r--r--sound/soc/omap/dra7-evm.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/sound/soc/omap/dra7-evm.c b/sound/soc/omap/dra7-evm.c
index 2f5d1e87b0f9..6c5af2df8a8d 100644
--- a/sound/soc/omap/dra7-evm.c
+++ b/sound/soc/omap/dra7-evm.c
@@ -169,6 +169,10 @@ static int dra7_snd_media_hw_params(struct snd_pcm_substream *substream,
169 return ret; 169 return ret;
170 } 170 }
171 171
172 /* Skip settings for the dummy CODEC as it doesn't implement any DAI ops */
173 if (!strcmp(codec_dai->name, "snd-soc-dummy-dai"))
174 return 0;
175
172 ret = snd_soc_dai_set_fmt(codec_dai, fmt | SND_SOC_DAIFMT_NB_NF); 176 ret = snd_soc_dai_set_fmt(codec_dai, fmt | SND_SOC_DAIFMT_NB_NF);
173 if (ret < 0) { 177 if (ret < 0) {
174 dev_err(card->dev, "can't set CODEC DAI format %d\n", ret); 178 dev_err(card->dev, "can't set CODEC DAI format %d\n", ret);
@@ -481,6 +485,15 @@ static struct snd_soc_dai_link dra7_snd_dai[] = {
481 .codec_dai_name = "snd-soc-dummy-dai", 485 .codec_dai_name = "snd-soc-dummy-dai",
482 .ops = &dra7_snd_bt_ops, 486 .ops = &dra7_snd_bt_ops,
483 }, 487 },
488 {
489 /* Media: McASP5 in loopback mode */
490 .name = "Loopback",
491 .platform_name = "omap-pcm-audio",
492 .codec_name = "snd-soc-dummy",
493 .codec_dai_name = "snd-soc-dummy-dai",
494 .ops = &dra7_snd_media_ops,
495 .init = dra7_snd_media_init,
496 },
484}; 497};
485 498
486static int dra7_snd_bt_get_mode(struct snd_kcontrol *kcontrol, 499static int dra7_snd_bt_get_mode(struct snd_kcontrol *kcontrol,
@@ -554,14 +567,16 @@ static int dra7_snd_add_dai_link(struct snd_soc_card *card,
554 567
555 dai_link->cpu_of_node = dai_node; 568 dai_link->cpu_of_node = dai_node;
556 569
557 snprintf(prop, sizeof(prop), "%s-codec", prefix); 570 if (!dai_link->codec_name || !dai_link->codec_dai_name) {
558 dai_node = of_parse_phandle(node, prop, 0); 571 snprintf(prop, sizeof(prop), "%s-codec", prefix);
559 if (!dai_node) { 572 dai_node = of_parse_phandle(node, prop, 0);
560 dev_err(card->dev, "codec dai node is invalid\n"); 573 if (!dai_node) {
561 return -EINVAL; 574 dev_err(card->dev, "codec dai node is invalid\n");
562 } 575 return -EINVAL;
576 }
563 577
564 dai_link->codec_of_node = dai_node; 578 dai_link->codec_of_node = dai_node;
579 }
565 580
566 snprintf(prop, sizeof(prop), "%s-slots", prefix); 581 snprintf(prop, sizeof(prop), "%s-slots", prefix);
567 of_property_read_u32(node, prop, &card_data->media_slots); 582 of_property_read_u32(node, prop, &card_data->media_slots);
@@ -811,6 +826,10 @@ static int dra7_snd_probe(struct platform_device *pdev)
811 dev_err(card->dev, "failed to add bluetooth dai link %d\n", 826 dev_err(card->dev, "failed to add bluetooth dai link %d\n",
812 ret); 827 ret);
813 828
829 ret = dra7_snd_add_dai_link(card, &dra7_snd_dai[3], "ti,loopback");
830 if (ret)
831 dev_err(card->dev, "failed to add loopback dai link %d\n", ret);
832
814 ret = snd_soc_register_card(card); 833 ret = snd_soc_register_card(card);
815 if (ret) { 834 if (ret) {
816 dev_err(card->dev, "failed to register sound card %d\n", ret); 835 dev_err(card->dev, "failed to register sound card %d\n", ret);
@@ -830,6 +849,12 @@ static int dra7_snd_probe(struct platform_device *pdev)
830 goto err_reparent; 849 goto err_reparent;
831 } 850 }
832 851
852 ret = dra7_mcasp_reparent(card, "mcasp5_ahclkx_mux", "atl_clkin2_ck");
853 if (ret) {
854 dev_err(card->dev, "failed to reparent McASP5 %d\n", ret);
855 goto err_reparent;
856 }
857
833 ret = dra7_mcasp_reparent(card, "mcasp6_ahclkx_mux", "atl_clkin1_ck"); 858 ret = dra7_mcasp_reparent(card, "mcasp6_ahclkx_mux", "atl_clkin1_ck");
834 if (ret) { 859 if (ret) {
835 dev_err(card->dev, "failed to reparent McASP6 %d\n", ret); 860 dev_err(card->dev, "failed to reparent McASP6 %d\n", ret);