Commit db1623fa authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: samsung: snow: use modern dai_link style

ASoC is now supporting modern style dai_link
(= snd_soc_dai_link_component) for CPU/Codec/Platform.
This patch switches to use it.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 3f609117
...@@ -14,6 +14,11 @@ ...@@ -14,6 +14,11 @@
#define FIN_PLL_RATE 24000000 #define FIN_PLL_RATE 24000000
SND_SOC_DAILINK_DEFS(links,
DAILINK_COMP_ARRAY(COMP_EMPTY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
struct snow_priv { struct snow_priv {
struct snd_soc_dai_link dai_link; struct snd_soc_dai_link dai_link;
struct clk *clk_i2s_bus; struct clk *clk_i2s_bus;
...@@ -141,6 +146,13 @@ static int snow_probe(struct platform_device *pdev) ...@@ -141,6 +146,13 @@ static int snow_probe(struct platform_device *pdev)
link->name = "Primary"; link->name = "Primary";
link->stream_name = link->name; link->stream_name = link->name;
link->cpus = links_cpus;
link->num_cpus = ARRAY_SIZE(links_cpus);
link->codecs = links_codecs;
link->num_codecs = ARRAY_SIZE(links_codecs);
link->platforms = links_platforms;
link->num_platforms = ARRAY_SIZE(links_platforms);
card->dai_link = link; card->dai_link = link;
card->num_links = 1; card->num_links = 1;
card->dev = dev; card->dev = dev;
...@@ -151,10 +163,10 @@ static int snow_probe(struct platform_device *pdev) ...@@ -151,10 +163,10 @@ static int snow_probe(struct platform_device *pdev)
if (cpu) { if (cpu) {
link->ops = &snow_card_ops; link->ops = &snow_card_ops;
link->cpu_of_node = of_parse_phandle(cpu, "sound-dai", 0); link->cpus->of_node = of_parse_phandle(cpu, "sound-dai", 0);
of_node_put(cpu); of_node_put(cpu);
if (!link->cpu_of_node) { if (!link->cpus->of_node) {
dev_err(dev, "Failed parsing cpu/sound-dai property\n"); dev_err(dev, "Failed parsing cpu/sound-dai property\n");
return -EINVAL; return -EINVAL;
} }
...@@ -164,38 +176,38 @@ static int snow_probe(struct platform_device *pdev) ...@@ -164,38 +176,38 @@ static int snow_probe(struct platform_device *pdev)
of_node_put(codec); of_node_put(codec);
if (ret < 0) { if (ret < 0) {
of_node_put(link->cpu_of_node); of_node_put(link->cpus->of_node);
dev_err(dev, "Failed parsing codec node\n"); dev_err(dev, "Failed parsing codec node\n");
return ret; return ret;
} }
priv->clk_i2s_bus = of_clk_get_by_name(link->cpu_of_node, priv->clk_i2s_bus = of_clk_get_by_name(link->cpus->of_node,
"i2s_opclk0"); "i2s_opclk0");
if (IS_ERR(priv->clk_i2s_bus)) { if (IS_ERR(priv->clk_i2s_bus)) {
snd_soc_of_put_dai_link_codecs(link); snd_soc_of_put_dai_link_codecs(link);
of_node_put(link->cpu_of_node); of_node_put(link->cpus->of_node);
return PTR_ERR(priv->clk_i2s_bus); return PTR_ERR(priv->clk_i2s_bus);
} }
} else { } else {
link->codec_dai_name = "HiFi", link->codecs->dai_name = "HiFi",
link->cpu_of_node = of_parse_phandle(dev->of_node, link->cpus->of_node = of_parse_phandle(dev->of_node,
"samsung,i2s-controller", 0); "samsung,i2s-controller", 0);
if (!link->cpu_of_node) { if (!link->cpus->of_node) {
dev_err(dev, "i2s-controller property parse error\n"); dev_err(dev, "i2s-controller property parse error\n");
return -EINVAL; return -EINVAL;
} }
link->codec_of_node = of_parse_phandle(dev->of_node, link->codecs->of_node = of_parse_phandle(dev->of_node,
"samsung,audio-codec", 0); "samsung,audio-codec", 0);
if (!link->codec_of_node) { if (!link->codecs->of_node) {
of_node_put(link->cpu_of_node); of_node_put(link->cpus->of_node);
dev_err(dev, "audio-codec property parse error\n"); dev_err(dev, "audio-codec property parse error\n");
return -EINVAL; return -EINVAL;
} }
} }
link->platform_of_node = link->cpu_of_node; link->platforms->of_node = link->cpus->of_node;
/* Update card-name if provided through DT, else use default name */ /* Update card-name if provided through DT, else use default name */
snd_soc_of_parse_card_name(card, "samsung,model"); snd_soc_of_parse_card_name(card, "samsung,model");
...@@ -216,8 +228,8 @@ static int snow_remove(struct platform_device *pdev) ...@@ -216,8 +228,8 @@ static int snow_remove(struct platform_device *pdev)
struct snow_priv *priv = platform_get_drvdata(pdev); struct snow_priv *priv = platform_get_drvdata(pdev);
struct snd_soc_dai_link *link = &priv->dai_link; struct snd_soc_dai_link *link = &priv->dai_link;
of_node_put(link->cpu_of_node); of_node_put(link->cpus->of_node);
of_node_put(link->codec_of_node); of_node_put(link->codecs->of_node);
snd_soc_of_put_dai_link_codecs(link); snd_soc_of_put_dai_link_codecs(link);
clk_put(priv->clk_i2s_bus); clk_put(priv->clk_i2s_bus);
......
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