Skip to content

Commit

Permalink
ASoC: meson: axg-card: set link name based on link node name
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jbrun3t authored and broonie committed May 16, 2019
1 parent cf61f5b commit 1b74211
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions sound/soc/meson/axg-card.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ static int axg_card_parse_dai(struct snd_soc_card *card,

static int axg_card_set_link_name(struct snd_soc_card *card,
struct snd_soc_dai_link *link,
struct device_node *node,
const char *prefix)
{
char *name = devm_kasprintf(card->dev, GFP_KERNEL, "%s.%s",
prefix, link->cpu_of_node->full_name);
prefix, node->full_name);
if (!name)
return -ENOMEM;

Expand Down Expand Up @@ -474,7 +475,7 @@ static int axg_card_set_be_link(struct snd_soc_card *card,
codec++;
}

ret = axg_card_set_link_name(card, link, "be");
ret = axg_card_set_link_name(card, link, node, "be");
if (ret)
dev_err(card->dev, "error setting %pOFn link name\n", np);

Expand All @@ -483,6 +484,7 @@ static int axg_card_set_be_link(struct snd_soc_card *card,

static int axg_card_set_fe_link(struct snd_soc_card *card,
struct snd_soc_dai_link *link,
struct device_node *node,
bool is_playback)
{
link->dynamic = 1;
Expand All @@ -497,7 +499,7 @@ static int axg_card_set_fe_link(struct snd_soc_card *card,
else
link->dpcm_capture = 1;

return axg_card_set_link_name(card, link, "fe");
return axg_card_set_link_name(card, link, node, "fe");
}

static int axg_card_cpu_is_capture_fe(struct device_node *np)
Expand Down Expand Up @@ -527,9 +529,9 @@ static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np,
return ret;

if (axg_card_cpu_is_playback_fe(dai_link->cpu_of_node))
ret = axg_card_set_fe_link(card, dai_link, true);
ret = axg_card_set_fe_link(card, dai_link, np, true);
else if (axg_card_cpu_is_capture_fe(dai_link->cpu_of_node))
ret = axg_card_set_fe_link(card, dai_link, false);
ret = axg_card_set_fe_link(card, dai_link, np, false);
else
ret = axg_card_set_be_link(card, dai_link, np);

Expand Down

0 comments on commit 1b74211

Please sign in to comment.