summaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2018-12-04 08:20:13 +0000
committerMark Brown <broonie@kernel.org>2018-12-11 01:10:54 +0000
commitdbd08fe59cf8c2f4bad0a72e912913c20db4774e (patch)
tree3e2cca24ef8ef48d3a8179b14a08218216c33c9a /sound/soc
parent4fb7f4df49d37a9a769b6e8ba517e453903142cc (diff)
downloadlinux-dbd08fe59cf8c2f4bad0a72e912913c20db4774e.tar.bz2
ASoC: simple-scu-card: tidyup asoc_simple_card_parse_daifmt() timing
Current simple-scu-card driver is parsing codec position for DPCM and consider DAI format. But, current operation is doing totally pointless, because it should be called for each CPU/Codec pair. Let's tidyup asoc_simple_card_parse_daifmt() timing. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/generic/simple-scu-card.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c
index 656abe2015e1..24099e61d1b1 100644
--- a/sound/soc/generic/simple-scu-card.c
+++ b/sound/soc/generic/simple-scu-card.c
@@ -92,17 +92,24 @@ static int asoc_simple_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
return 0;
}
-static int asoc_simple_card_dai_link_of(struct device_node *np,
+static int asoc_simple_card_dai_link_of(struct device_node *link,
+ struct device_node *np,
+ struct device_node *codec,
struct simple_card_data *priv,
- unsigned int daifmt,
- int idx, bool is_fe)
+ int idx, bool is_fe,
+ bool is_top_level_node)
{
struct device *dev = simple_priv_to_dev(priv);
struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx);
struct snd_soc_card *card = simple_priv_to_card(priv);
+ char *prefix = "";
int ret;
+ /* For single DAI link & old style of DT node */
+ if (is_top_level_node)
+ prefix = PREFIX;
+
if (is_fe) {
int is_single_links = 0;
struct snd_soc_dai_link_component *codecs;
@@ -178,7 +185,11 @@ static int asoc_simple_card_dai_link_of(struct device_node *np,
if (ret < 0)
return ret;
- dai_link->dai_fmt = daifmt;
+ ret = asoc_simple_card_parse_daifmt(dev, link, codec,
+ prefix, &dai_link->dai_fmt);
+ if (ret < 0)
+ return ret;
+
dai_link->dpcm_playback = 1;
dai_link->dpcm_capture = 1;
dai_link->ops = &asoc_simple_card_ops;
@@ -191,10 +202,10 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
{
struct device *dev = simple_priv_to_dev(priv);
+ struct device_node *node = dev->of_node;
struct device_node *np;
+ struct device_node *codec;
struct snd_soc_card *card = simple_priv_to_card(priv);
- struct device_node *node = dev->of_node;
- unsigned int daifmt = 0;
bool is_fe;
int ret, i;
@@ -211,22 +222,18 @@ static int asoc_simple_card_parse_of(struct simple_card_data *priv)
asoc_simple_card_parse_convert(dev, node, PREFIX, &priv->adata);
- /* find 1st codec */
- np = of_get_child_by_name(node, PREFIX "codec");
- if (!np)
+ i = 0;
+ codec = of_get_child_by_name(node, PREFIX "codec");
+ if (!codec)
return -ENODEV;
- ret = asoc_simple_card_parse_daifmt(dev, node, np, PREFIX, &daifmt);
- if (ret < 0)
- return ret;
-
- i = 0;
for_each_child_of_node(node, np) {
is_fe = false;
if (of_node_name_eq(np, PREFIX "cpu"))
is_fe = true;
- ret = asoc_simple_card_dai_link_of(np, priv, daifmt, i, is_fe);
+ ret = asoc_simple_card_dai_link_of(node, np, codec, priv,
+ i, is_fe, true);
if (ret < 0)
return ret;
i++;