aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/sh
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2015-11-10 00:12:13 -0500
committerMark Brown <broonie@kernel.org>2015-11-18 13:08:16 -0500
commitcfe7c0390ac24c30bf8c79a6a05e637db56e3090 (patch)
treee9d4b4afbd02e96fa9cdc46cbe17c0878c2745b9 /sound/soc/sh
parentadf6a6815952c6c6092ae15e27c1b782fd96c6a3 (diff)
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sh')
-rw-r--r--sound/soc/sh/rcar/ctu.c85
1 files changed, 32 insertions, 53 deletions
diff --git a/sound/soc/sh/rcar/ctu.c b/sound/soc/sh/rcar/ctu.c
index daa1017c8890..9506db4958bc 100644
--- a/sound/soc/sh/rcar/ctu.c
+++ b/sound/soc/sh/rcar/ctu.c
@@ -13,7 +13,6 @@
13#define CTU_NAME "ctu" 13#define CTU_NAME "ctu"
14 14
15struct rsnd_ctu { 15struct rsnd_ctu {
16 struct rsnd_ctu_platform_info *info; /* rcar_snd.h */
17 struct rsnd_mod mod; 16 struct rsnd_mod mod;
18}; 17};
19 18
@@ -24,6 +23,7 @@ struct rsnd_ctu {
24 ((pos) = (struct rsnd_ctu *)(priv)->ctu + i); \ 23 ((pos) = (struct rsnd_ctu *)(priv)->ctu + i); \
25 i++) 24 i++)
26 25
26#define rsnd_ctu_get(priv, id) ((struct rsnd_ctu *)(priv->ctu) + id)
27#define rsnd_ctu_initialize_lock(mod) __rsnd_ctu_initialize_lock(mod, 1) 27#define rsnd_ctu_initialize_lock(mod) __rsnd_ctu_initialize_lock(mod, 1)
28#define rsnd_ctu_initialize_unlock(mod) __rsnd_ctu_initialize_lock(mod, 0) 28#define rsnd_ctu_initialize_unlock(mod) __rsnd_ctu_initialize_lock(mod, 0)
29static void __rsnd_ctu_initialize_lock(struct rsnd_mod *mod, u32 enable) 29static 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 if (WARN_ON(id < 0 || id >= rsnd_ctu_nr(priv))) 74 if (WARN_ON(id < 0 || id >= rsnd_ctu_nr(priv)))
75 id = 0; 75 id = 0;
76 76
77 return rsnd_mod_get((struct rsnd_ctu *)(priv->ctu) + id); 77 return rsnd_mod_get(rsnd_ctu_get(priv, id));
78}
79
80static void rsnd_of_parse_ctu(struct platform_device *pdev,
81 const struct rsnd_of_data *of_data,
82 struct rsnd_priv *priv)
83{
84 struct device_node *node;
85 struct rsnd_ctu_platform_info *ctu_info;
86 struct rcar_snd_info *info = rsnd_priv_to_info(priv);
87 struct device *dev = &pdev->dev;
88 int nr;
89
90 if (!of_data)
91 return;
92
93 node = rsnd_ctu_of_node(priv);
94 if (!node)
95 return;
96
97 nr = of_get_child_count(node);
98 if (!nr)
99 goto rsnd_of_parse_ctu_end;
100
101 ctu_info = devm_kzalloc(dev,
102 sizeof(struct rsnd_ctu_platform_info) * nr,
103 GFP_KERNEL);
104 if (!ctu_info) {
105 dev_err(dev, "ctu info allocation error\n");
106 goto rsnd_of_parse_ctu_end;
107 }
108
109 info->ctu_info = ctu_info;
110 info->ctu_info_nr = nr;
111
112rsnd_of_parse_ctu_end:
113 of_node_put(node);
114
115} 78}
116 79
117int rsnd_ctu_probe(struct platform_device *pdev, 80int rsnd_ctu_probe(struct platform_device *pdev,
118 const struct rsnd_of_data *of_data, 81 const struct rsnd_of_data *of_data,
119 struct rsnd_priv *priv) 82 struct rsnd_priv *priv)
120{ 83{
121 struct rcar_snd_info *info = rsnd_priv_to_info(priv); 84 struct device_node *node;
85 struct device_node *np;
122 struct device *dev = rsnd_priv_to_dev(priv); 86 struct device *dev = rsnd_priv_to_dev(priv);
123 struct rsnd_ctu *ctu; 87 struct rsnd_ctu *ctu;
124 struct clk *clk; 88 struct clk *clk;
@@ -129,20 +93,29 @@ int rsnd_ctu_probe(struct platform_device *pdev,
129 if (rsnd_is_gen1(priv)) 93 if (rsnd_is_gen1(priv))
130 return 0; 94 return 0;
131 95
132 rsnd_of_parse_ctu(pdev, of_data, priv); 96 node = rsnd_ctu_of_node(priv);
97 if (!node)
98 return 0; /* not used is not error */
133 99
134 nr = info->ctu_info_nr; 100 nr = of_get_child_count(node);
135 if (!nr) 101 if (!nr) {
136 return 0; 102 ret = -EINVAL;
103 goto rsnd_ctu_probe_done;
104 }
137 105
138 ctu = devm_kzalloc(dev, sizeof(*ctu) * nr, GFP_KERNEL); 106 ctu = devm_kzalloc(dev, sizeof(*ctu) * nr, GFP_KERNEL);
139 if (!ctu) 107 if (!ctu) {
140 return -ENOMEM; 108 ret = -ENOMEM;
109 goto rsnd_ctu_probe_done;
110 }
141 111
142 priv->ctu_nr = nr; 112 priv->ctu_nr = nr;
143 priv->ctu = ctu; 113 priv->ctu = ctu;
144 114
145 for_each_rsnd_ctu(ctu, priv, i) { 115 i = 0;
116 for_each_child_of_node(node, np) {
117 ctu = rsnd_ctu_get(priv, i);
118
146 /* 119 /*
147 * CTU00, CTU01, CTU02, CTU03 => CTU0 120 * CTU00, CTU01, CTU02, CTU03 => CTU0
148 * CTU10, CTU11, CTU12, CTU13 => CTU1 121 * CTU10, CTU11, CTU12, CTU13 => CTU1
@@ -151,18 +124,24 @@ int rsnd_ctu_probe(struct platform_device *pdev,
151 CTU_NAME, i / 4); 124 CTU_NAME, i / 4);
152 125
153 clk = devm_clk_get(dev, name); 126 clk = devm_clk_get(dev, name);
154 if (IS_ERR(clk)) 127 if (IS_ERR(clk)) {
155 return PTR_ERR(clk); 128 ret = PTR_ERR(clk);
156 129 goto rsnd_ctu_probe_done;
157 ctu->info = &info->ctu_info[i]; 130 }
158 131
159 ret = rsnd_mod_init(priv, rsnd_mod_get(ctu), &rsnd_ctu_ops, 132 ret = rsnd_mod_init(priv, rsnd_mod_get(ctu), &rsnd_ctu_ops,
160 clk, RSND_MOD_CTU, i); 133 clk, RSND_MOD_CTU, i);
161 if (ret) 134 if (ret)
162 return ret; 135 goto rsnd_ctu_probe_done;
136
137 i++;
163 } 138 }
164 139
165 return 0; 140
141rsnd_ctu_probe_done:
142 of_node_put(node);
143
144 return ret;
166} 145}
167 146
168void rsnd_ctu_remove(struct platform_device *pdev, 147void rsnd_ctu_remove(struct platform_device *pdev,