summaryrefslogtreecommitdiffstats
path: root/sound/soc/meson
diff options
context:
space:
mode:
authorJerome Brunet <jbrunet@baylibre.com>2019-05-15 09:18:54 -0400
committerMark Brown <broonie@kernel.org>2019-05-16 07:12:59 -0400
commit1b74211011eb064914b8155a77a8aaae61cd27eb (patch)
treeeece41e6a262b6bce611983c034b9fccc26acc1a /sound/soc/meson
parentcf61f5b01531a2b64b875894fa97aa891d39e871 (diff)
ASoC: meson: axg-card: set link name based on link node name
So far the link names of the axg sound card was derived from the cpu name of the link. Since the dai link must be unique, it works as long as a device does not provide more than one cpu dai. However, the 'tohdmitx' does provide 2 dais used as cpu on codec-to-codec links Instead of cpu name, use the node name of the dai link. DT already enforce the uniqueness of this name Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Tested-by: Neil Armstrong <narmstrong@baylibre.com> Tested-by: Kevin Hilman <khilman@baylibre.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/meson')
-rw-r--r--sound/soc/meson/axg-card.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sound/soc/meson/axg-card.c b/sound/soc/meson/axg-card.c
index aa54d2c612c9..5c8deee8d512 100644
--- a/sound/soc/meson/axg-card.c
+++ b/sound/soc/meson/axg-card.c
@@ -80,10 +80,11 @@ static int axg_card_parse_dai(struct snd_soc_card *card,
80 80
81static int axg_card_set_link_name(struct snd_soc_card *card, 81static int axg_card_set_link_name(struct snd_soc_card *card,
82 struct snd_soc_dai_link *link, 82 struct snd_soc_dai_link *link,
83 struct device_node *node,
83 const char *prefix) 84 const char *prefix)
84{ 85{
85 char *name = devm_kasprintf(card->dev, GFP_KERNEL, "%s.%s", 86 char *name = devm_kasprintf(card->dev, GFP_KERNEL, "%s.%s",
86 prefix, link->cpu_of_node->full_name); 87 prefix, node->full_name);
87 if (!name) 88 if (!name)
88 return -ENOMEM; 89 return -ENOMEM;
89 90
@@ -474,7 +475,7 @@ static int axg_card_set_be_link(struct snd_soc_card *card,
474 codec++; 475 codec++;
475 } 476 }
476 477
477 ret = axg_card_set_link_name(card, link, "be"); 478 ret = axg_card_set_link_name(card, link, node, "be");
478 if (ret) 479 if (ret)
479 dev_err(card->dev, "error setting %pOFn link name\n", np); 480 dev_err(card->dev, "error setting %pOFn link name\n", np);
480 481
@@ -483,6 +484,7 @@ static int axg_card_set_be_link(struct snd_soc_card *card,
483 484
484static int axg_card_set_fe_link(struct snd_soc_card *card, 485static int axg_card_set_fe_link(struct snd_soc_card *card,
485 struct snd_soc_dai_link *link, 486 struct snd_soc_dai_link *link,
487 struct device_node *node,
486 bool is_playback) 488 bool is_playback)
487{ 489{
488 link->dynamic = 1; 490 link->dynamic = 1;
@@ -497,7 +499,7 @@ static int axg_card_set_fe_link(struct snd_soc_card *card,
497 else 499 else
498 link->dpcm_capture = 1; 500 link->dpcm_capture = 1;
499 501
500 return axg_card_set_link_name(card, link, "fe"); 502 return axg_card_set_link_name(card, link, node, "fe");
501} 503}
502 504
503static int axg_card_cpu_is_capture_fe(struct device_node *np) 505static int axg_card_cpu_is_capture_fe(struct device_node *np)
@@ -527,9 +529,9 @@ static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np,
527 return ret; 529 return ret;
528 530
529 if (axg_card_cpu_is_playback_fe(dai_link->cpu_of_node)) 531 if (axg_card_cpu_is_playback_fe(dai_link->cpu_of_node))
530 ret = axg_card_set_fe_link(card, dai_link, true); 532 ret = axg_card_set_fe_link(card, dai_link, np, true);
531 else if (axg_card_cpu_is_capture_fe(dai_link->cpu_of_node)) 533 else if (axg_card_cpu_is_capture_fe(dai_link->cpu_of_node))
532 ret = axg_card_set_fe_link(card, dai_link, false); 534 ret = axg_card_set_fe_link(card, dai_link, np, false);
533 else 535 else
534 ret = axg_card_set_be_link(card, dai_link, np); 536 ret = axg_card_set_be_link(card, dai_link, np);
535 537