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

ASoC: rsnd: remove platform boot support from ctu.c

No board is using Renesas sound driver via platform boot now.
This means all user is using DT boot. Platform boot support is
no longer needed. But, it strongly depends on platform boot style.
This patch removes platform boot support from ctu.c
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent adf6a681
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#define CTU_NAME "ctu" #define CTU_NAME "ctu"
struct rsnd_ctu { struct rsnd_ctu {
struct rsnd_ctu_platform_info *info; /* rcar_snd.h */
struct rsnd_mod mod; struct rsnd_mod mod;
}; };
...@@ -24,6 +23,7 @@ struct rsnd_ctu { ...@@ -24,6 +23,7 @@ struct rsnd_ctu {
((pos) = (struct rsnd_ctu *)(priv)->ctu + i); \ ((pos) = (struct rsnd_ctu *)(priv)->ctu + i); \
i++) i++)
#define rsnd_ctu_get(priv, id) ((struct rsnd_ctu *)(priv->ctu) + id)
#define rsnd_ctu_initialize_lock(mod) __rsnd_ctu_initialize_lock(mod, 1) #define rsnd_ctu_initialize_lock(mod) __rsnd_ctu_initialize_lock(mod, 1)
#define rsnd_ctu_initialize_unlock(mod) __rsnd_ctu_initialize_lock(mod, 0) #define rsnd_ctu_initialize_unlock(mod) __rsnd_ctu_initialize_lock(mod, 0)
static void __rsnd_ctu_initialize_lock(struct rsnd_mod *mod, u32 enable) static void __rsnd_ctu_initialize_lock(struct rsnd_mod *mod, u32 enable)
...@@ -74,51 +74,15 @@ struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id) ...@@ -74,51 +74,15 @@ struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id)
if (WARN_ON(id < 0 || id >= rsnd_ctu_nr(priv))) if (WARN_ON(id < 0 || id >= rsnd_ctu_nr(priv)))
id = 0; id = 0;
return rsnd_mod_get((struct rsnd_ctu *)(priv->ctu) + id); return rsnd_mod_get(rsnd_ctu_get(priv, id));
}
static void rsnd_of_parse_ctu(struct platform_device *pdev,
const struct rsnd_of_data *of_data,
struct rsnd_priv *priv)
{
struct device_node *node;
struct rsnd_ctu_platform_info *ctu_info;
struct rcar_snd_info *info = rsnd_priv_to_info(priv);
struct device *dev = &pdev->dev;
int nr;
if (!of_data)
return;
node = rsnd_ctu_of_node(priv);
if (!node)
return;
nr = of_get_child_count(node);
if (!nr)
goto rsnd_of_parse_ctu_end;
ctu_info = devm_kzalloc(dev,
sizeof(struct rsnd_ctu_platform_info) * nr,
GFP_KERNEL);
if (!ctu_info) {
dev_err(dev, "ctu info allocation error\n");
goto rsnd_of_parse_ctu_end;
}
info->ctu_info = ctu_info;
info->ctu_info_nr = nr;
rsnd_of_parse_ctu_end:
of_node_put(node);
} }
int rsnd_ctu_probe(struct platform_device *pdev, int rsnd_ctu_probe(struct platform_device *pdev,
const struct rsnd_of_data *of_data, const struct rsnd_of_data *of_data,
struct rsnd_priv *priv) struct rsnd_priv *priv)
{ {
struct rcar_snd_info *info = rsnd_priv_to_info(priv); struct device_node *node;
struct device_node *np;
struct device *dev = rsnd_priv_to_dev(priv); struct device *dev = rsnd_priv_to_dev(priv);
struct rsnd_ctu *ctu; struct rsnd_ctu *ctu;
struct clk *clk; struct clk *clk;
...@@ -129,20 +93,29 @@ int rsnd_ctu_probe(struct platform_device *pdev, ...@@ -129,20 +93,29 @@ int rsnd_ctu_probe(struct platform_device *pdev,
if (rsnd_is_gen1(priv)) if (rsnd_is_gen1(priv))
return 0; return 0;
rsnd_of_parse_ctu(pdev, of_data, priv); node = rsnd_ctu_of_node(priv);
if (!node)
return 0; /* not used is not error */
nr = info->ctu_info_nr; nr = of_get_child_count(node);
if (!nr) if (!nr) {
return 0; ret = -EINVAL;
goto rsnd_ctu_probe_done;
}
ctu = devm_kzalloc(dev, sizeof(*ctu) * nr, GFP_KERNEL); ctu = devm_kzalloc(dev, sizeof(*ctu) * nr, GFP_KERNEL);
if (!ctu) if (!ctu) {
return -ENOMEM; ret = -ENOMEM;
goto rsnd_ctu_probe_done;
}
priv->ctu_nr = nr; priv->ctu_nr = nr;
priv->ctu = ctu; priv->ctu = ctu;
for_each_rsnd_ctu(ctu, priv, i) { i = 0;
for_each_child_of_node(node, np) {
ctu = rsnd_ctu_get(priv, i);
/* /*
* CTU00, CTU01, CTU02, CTU03 => CTU0 * CTU00, CTU01, CTU02, CTU03 => CTU0
* CTU10, CTU11, CTU12, CTU13 => CTU1 * CTU10, CTU11, CTU12, CTU13 => CTU1
...@@ -151,18 +124,24 @@ int rsnd_ctu_probe(struct platform_device *pdev, ...@@ -151,18 +124,24 @@ int rsnd_ctu_probe(struct platform_device *pdev,
CTU_NAME, i / 4); CTU_NAME, i / 4);
clk = devm_clk_get(dev, name); clk = devm_clk_get(dev, name);
if (IS_ERR(clk)) if (IS_ERR(clk)) {
return PTR_ERR(clk); ret = PTR_ERR(clk);
goto rsnd_ctu_probe_done;
ctu->info = &info->ctu_info[i]; }
ret = rsnd_mod_init(priv, rsnd_mod_get(ctu), &rsnd_ctu_ops, ret = rsnd_mod_init(priv, rsnd_mod_get(ctu), &rsnd_ctu_ops,
clk, RSND_MOD_CTU, i); clk, RSND_MOD_CTU, i);
if (ret) if (ret)
return ret; goto rsnd_ctu_probe_done;
i++;
} }
return 0;
rsnd_ctu_probe_done:
of_node_put(node);
return ret;
} }
void rsnd_ctu_remove(struct platform_device *pdev, void rsnd_ctu_remove(struct platform_device *pdev,
......
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