Commit 4346a745 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: audio-graph: add graph_parse_mclk_fs()

It is parsing mclk_fs at many places, but it should be
same operation. This patch adds graph_parse_mclk_fs()
and parse it.

This patch also renames similar function graph_get_conversion()
to graph_parse_convert().
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent d2bf008a
...@@ -196,6 +196,24 @@ static void graph_parse_convert(struct device *dev, ...@@ -196,6 +196,24 @@ static void graph_parse_convert(struct device *dev,
of_node_put(node); of_node_put(node);
} }
static void graph_parse_mclk_fs(struct device_node *top,
struct device_node *ep,
struct graph_dai_props *props)
{
struct device_node *port = of_get_parent(ep);
struct device_node *ports = of_get_parent(port);
struct device_node *node = of_graph_get_port_parent(ep);
of_property_read_u32(top, "mclk-fs", &props->mclk_fs);
of_property_read_u32(ports, "mclk-fs", &props->mclk_fs);
of_property_read_u32(port, "mclk-fs", &props->mclk_fs);
of_property_read_u32(ep, "mclk-fs", &props->mclk_fs);
of_node_put(port);
of_node_put(ports);
of_node_put(node);
}
static int graph_dai_link_of_dpcm(struct graph_priv *priv, static int graph_dai_link_of_dpcm(struct graph_priv *priv,
struct device_node *cpu_ep, struct device_node *cpu_ep,
struct device_node *codec_ep, struct device_node *codec_ep,
...@@ -226,13 +244,6 @@ static int graph_dai_link_of_dpcm(struct graph_priv *priv, ...@@ -226,13 +244,6 @@ static int graph_dai_link_of_dpcm(struct graph_priv *priv,
dev_dbg(dev, "link_of DPCM (%pOF)\n", ep); dev_dbg(dev, "link_of DPCM (%pOF)\n", ep);
of_property_read_u32(top, "mclk-fs", &dai_props->mclk_fs);
of_property_read_u32(ports, "mclk-fs", &dai_props->mclk_fs);
of_property_read_u32(port, "mclk-fs", &dai_props->mclk_fs);
of_property_read_u32(ep, "mclk-fs", &dai_props->mclk_fs);
graph_parse_convert(dev, ep, &dai_props->adata);
of_node_put(ports); of_node_put(ports);
of_node_put(port); of_node_put(port);
of_node_put(node); of_node_put(node);
...@@ -311,6 +322,9 @@ static int graph_dai_link_of_dpcm(struct graph_priv *priv, ...@@ -311,6 +322,9 @@ static int graph_dai_link_of_dpcm(struct graph_priv *priv,
"prefix"); "prefix");
} }
graph_parse_convert(dev, ep, &dai_props->adata);
graph_parse_mclk_fs(top, ep, dai_props);
asoc_simple_card_canonicalize_platform(dai_link); asoc_simple_card_canonicalize_platform(dai_link);
ret = asoc_simple_card_of_parse_tdm(ep, dai); ret = asoc_simple_card_of_parse_tdm(ep, dai);
...@@ -339,10 +353,6 @@ static int graph_dai_link_of(struct graph_priv *priv, ...@@ -339,10 +353,6 @@ static int graph_dai_link_of(struct graph_priv *priv,
struct snd_soc_dai_link *dai_link = graph_priv_to_link(priv, li->link); struct snd_soc_dai_link *dai_link = graph_priv_to_link(priv, li->link);
struct graph_dai_props *dai_props = graph_priv_to_props(priv, li->link); struct graph_dai_props *dai_props = graph_priv_to_props(priv, li->link);
struct device_node *top = dev->of_node; struct device_node *top = dev->of_node;
struct device_node *cpu_port;
struct device_node *cpu_ports;
struct device_node *codec_port;
struct device_node *codec_ports;
struct asoc_simple_dai *cpu_dai; struct asoc_simple_dai *cpu_dai;
struct asoc_simple_dai *codec_dai; struct asoc_simple_dai *codec_dai;
int ret; int ret;
...@@ -351,11 +361,6 @@ static int graph_dai_link_of(struct graph_priv *priv, ...@@ -351,11 +361,6 @@ static int graph_dai_link_of(struct graph_priv *priv,
if (!li->cpu) if (!li->cpu)
return 0; return 0;
cpu_port = of_get_parent(cpu_ep);
cpu_ports = of_get_parent(cpu_port);
codec_port = of_get_parent(codec_ep);
codec_ports = of_get_parent(codec_port);
dev_dbg(dev, "link_of (%pOF)\n", cpu_ep); dev_dbg(dev, "link_of (%pOF)\n", cpu_ep);
li->link++; li->link++;
...@@ -366,17 +371,8 @@ static int graph_dai_link_of(struct graph_priv *priv, ...@@ -366,17 +371,8 @@ static int graph_dai_link_of(struct graph_priv *priv,
dai_props->codec_dai = &priv->dais[li->dais++]; dai_props->codec_dai = &priv->dais[li->dais++];
/* Factor to mclk, used in hw_params() */ /* Factor to mclk, used in hw_params() */
of_property_read_u32(top, "mclk-fs", &dai_props->mclk_fs); graph_parse_mclk_fs(top, cpu_ep, dai_props);
of_property_read_u32(cpu_ports, "mclk-fs", &dai_props->mclk_fs); graph_parse_mclk_fs(top, codec_ep, dai_props);
of_property_read_u32(codec_ports, "mclk-fs", &dai_props->mclk_fs);
of_property_read_u32(cpu_port, "mclk-fs", &dai_props->mclk_fs);
of_property_read_u32(codec_port, "mclk-fs", &dai_props->mclk_fs);
of_property_read_u32(cpu_ep, "mclk-fs", &dai_props->mclk_fs);
of_property_read_u32(codec_ep, "mclk-fs", &dai_props->mclk_fs);
of_node_put(cpu_port);
of_node_put(cpu_ports);
of_node_put(codec_port);
of_node_put(codec_ports);
ret = asoc_simple_card_parse_daifmt(dev, cpu_ep, codec_ep, ret = asoc_simple_card_parse_daifmt(dev, cpu_ep, codec_ep,
NULL, &dai_link->dai_fmt); NULL, &dai_link->dai_fmt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment