aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2014-03-03 23:51:21 -0500
committerMark Brown <broonie@linaro.org>2014-03-05 01:07:53 -0500
commitba9c949f797aa3af56303445812a452144c61c35 (patch)
tree014ec31ed244192b98f1b2b2f18f291d60ddec90 /sound
parent9524be0e761edd9f3c020344677d914ed249d010 (diff)
ASoC: rsnd: rename scu to src
R-Car sound has SCU unit which has SRC/CTU/MIX/DVC, and current rsnd driver has scu.c and scu module. Current scu.c has SRC support only. My first concept was control these feature on scu.c but, it become difficult and un-understandable now. This patch rename scu to src Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/sh/rcar/Makefile2
-rw-r--r--sound/soc/sh/rcar/core.c26
-rw-r--r--sound/soc/sh/rcar/rsnd.h24
-rw-r--r--sound/soc/sh/rcar/src.c (renamed from sound/soc/sh/rcar/scu.c)265
-rw-r--r--sound/soc/sh/rcar/ssi.c6
5 files changed, 164 insertions, 159 deletions
diff --git a/sound/soc/sh/rcar/Makefile b/sound/soc/sh/rcar/Makefile
index 0ff492df7929..7d0051ced838 100644
--- a/sound/soc/sh/rcar/Makefile
+++ b/sound/soc/sh/rcar/Makefile
@@ -1,2 +1,2 @@
1snd-soc-rcar-objs := core.o gen.o scu.o adg.o ssi.o 1snd-soc-rcar-objs := core.o gen.o src.o adg.o ssi.o
2obj-$(CONFIG_SND_SOC_RCAR) += snd-soc-rcar.o \ No newline at end of file 2obj-$(CONFIG_SND_SOC_RCAR) += snd-soc-rcar.o \ No newline at end of file
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index ceb4e8bd4970..6a1b45df8101 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -73,13 +73,13 @@
73 * | +- ssi[2] 73 * | +- ssi[2]
74 * | ... 74 * | ...
75 * | 75 * |
76 * | ** these control scu 76 * | ** these control src
77 * | 77 * |
78 * +- scu 78 * +- src
79 * | 79 * |
80 * +- scu[0] 80 * +- src[0]
81 * +- scu[1] 81 * +- src[1]
82 * +- scu[2] 82 * +- src[2]
83 * ... 83 * ...
84 * 84 *
85 * 85 *
@@ -572,7 +572,7 @@ static int rsnd_path_init(struct rsnd_priv *priv,
572 struct rsnd_dai_platform_info *dai_info = rdai->info; 572 struct rsnd_dai_platform_info *dai_info = rdai->info;
573 int ret; 573 int ret;
574 int ssi_id = -1; 574 int ssi_id = -1;
575 int scu_id = -1; 575 int src_id = -1;
576 576
577 /* 577 /*
578 * Gen1 is created by SRU/SSI, and this SRU is base module of 578 * Gen1 is created by SRU/SSI, and this SRU is base module of
@@ -587,8 +587,8 @@ static int rsnd_path_init(struct rsnd_priv *priv,
587 if (dai_info) { 587 if (dai_info) {
588 if (rsnd_is_enable_path(io, ssi)) 588 if (rsnd_is_enable_path(io, ssi))
589 ssi_id = rsnd_info_id(priv, io, ssi); 589 ssi_id = rsnd_info_id(priv, io, ssi);
590 if (rsnd_is_enable_path(io, scu)) 590 if (rsnd_is_enable_path(io, src))
591 scu_id = rsnd_info_id(priv, io, scu); 591 src_id = rsnd_info_id(priv, io, src);
592 } else { 592 } else {
593 /* get SSI's ID */ 593 /* get SSI's ID */
594 mod = rsnd_ssi_mod_get_frm_dai(priv, 594 mod = rsnd_ssi_mod_get_frm_dai(priv,
@@ -596,14 +596,14 @@ static int rsnd_path_init(struct rsnd_priv *priv,
596 rsnd_dai_is_play(rdai, io)); 596 rsnd_dai_is_play(rdai, io));
597 if (!mod) 597 if (!mod)
598 return 0; 598 return 0;
599 ssi_id = scu_id = rsnd_mod_id(mod); 599 ssi_id = src_id = rsnd_mod_id(mod);
600 } 600 }
601 601
602 ret = 0; 602 ret = 0;
603 603
604 /* SCU */ 604 /* SRC */
605 if (scu_id >= 0) { 605 if (src_id >= 0) {
606 mod = rsnd_scu_mod_get(priv, scu_id); 606 mod = rsnd_src_mod_get(priv, src_id);
607 ret = rsnd_dai_connect(mod, io); 607 ret = rsnd_dai_connect(mod, io);
608 if (ret < 0) 608 if (ret < 0)
609 return ret; 609 return ret;
@@ -806,7 +806,7 @@ static int rsnd_probe(struct platform_device *pdev)
806 struct rsnd_priv *priv) = { 806 struct rsnd_priv *priv) = {
807 rsnd_gen_probe, 807 rsnd_gen_probe,
808 rsnd_ssi_probe, 808 rsnd_ssi_probe,
809 rsnd_scu_probe, 809 rsnd_src_probe,
810 rsnd_adg_probe, 810 rsnd_adg_probe,
811 rsnd_dai_probe, 811 rsnd_dai_probe,
812 }; 812 };
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 878dc6e20ff2..c46e0afa54ae 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -160,7 +160,7 @@ void rsnd_dma_quit(struct rsnd_priv *priv,
160 * R-Car sound mod 160 * R-Car sound mod
161 */ 161 */
162enum rsnd_mod_type { 162enum rsnd_mod_type {
163 RSND_MOD_SCU = 0, 163 RSND_MOD_SRC = 0,
164 RSND_MOD_SSI, 164 RSND_MOD_SSI,
165 RSND_MOD_MAX, 165 RSND_MOD_MAX,
166}; 166};
@@ -224,7 +224,7 @@ struct rsnd_dai_stream {
224 int next_period_byte; 224 int next_period_byte;
225}; 225};
226#define rsnd_io_to_mod_ssi(io) ((io)->mod[RSND_MOD_SSI]) 226#define rsnd_io_to_mod_ssi(io) ((io)->mod[RSND_MOD_SSI])
227#define rsnd_io_to_mod_scu(io) ((io)->mod[RSND_MOD_SCU]) 227#define rsnd_io_to_mod_src(io) ((io)->mod[RSND_MOD_SRC])
228 228
229struct rsnd_dai { 229struct rsnd_dai {
230 char name[RSND_DAI_NAME_SIZE]; 230 char name[RSND_DAI_NAME_SIZE];
@@ -302,10 +302,10 @@ struct rsnd_priv {
302 void *gen; 302 void *gen;
303 303
304 /* 304 /*
305 * below value will be filled on rsnd_scu_probe() 305 * below value will be filled on rsnd_src_probe()
306 */ 306 */
307 void *scu; 307 void *src;
308 int scu_nr; 308 int src_nr;
309 309
310 /* 310 /*
311 * below value will be filled on rsnd_adg_probe() 311 * below value will be filled on rsnd_adg_probe()
@@ -345,22 +345,22 @@ struct rsnd_priv {
345}) 345})
346 346
347/* 347/*
348 * R-Car SCU 348 * R-Car SRC
349 */ 349 */
350int rsnd_scu_probe(struct platform_device *pdev, 350int rsnd_src_probe(struct platform_device *pdev,
351 struct rsnd_priv *priv); 351 struct rsnd_priv *priv);
352struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id); 352struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id);
353unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv, 353unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
354 struct rsnd_dai_stream *io, 354 struct rsnd_dai_stream *io,
355 struct snd_pcm_runtime *runtime); 355 struct snd_pcm_runtime *runtime);
356int rsnd_scu_ssi_mode_init(struct rsnd_mod *ssi_mod, 356int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
357 struct rsnd_dai *rdai, 357 struct rsnd_dai *rdai,
358 struct rsnd_dai_stream *io); 358 struct rsnd_dai_stream *io);
359int rsnd_scu_enable_ssi_irq(struct rsnd_mod *ssi_mod, 359int rsnd_src_enable_ssi_irq(struct rsnd_mod *ssi_mod,
360 struct rsnd_dai *rdai, 360 struct rsnd_dai *rdai,
361 struct rsnd_dai_stream *io); 361 struct rsnd_dai_stream *io);
362 362
363#define rsnd_scu_nr(priv) ((priv)->scu_nr) 363#define rsnd_src_nr(priv) ((priv)->src_nr)
364 364
365/* 365/*
366 * R-Car SSI 366 * R-Car SSI
diff --git a/sound/soc/sh/rcar/scu.c b/sound/soc/sh/rcar/src.c
index 3526a5c2f608..ea6a214985d0 100644
--- a/sound/soc/sh/rcar/scu.c
+++ b/sound/soc/sh/rcar/src.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Renesas R-Car SCU support 2 * Renesas R-Car SRC support
3 * 3 *
4 * Copyright (C) 2013 Renesas Solutions Corp. 4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> 5 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
@@ -10,13 +10,13 @@
10 */ 10 */
11#include "rsnd.h" 11#include "rsnd.h"
12 12
13struct rsnd_scu { 13struct rsnd_src {
14 struct rsnd_scu_platform_info *info; /* rcar_snd.h */ 14 struct rsnd_src_platform_info *info; /* rcar_snd.h */
15 struct rsnd_mod mod; 15 struct rsnd_mod mod;
16 struct clk *clk; 16 struct clk *clk;
17}; 17};
18 18
19#define RSND_SCU_NAME_SIZE 16 19#define RSND_SRC_NAME_SIZE 16
20 20
21/* 21/*
22 * ADINR 22 * ADINR
@@ -27,19 +27,19 @@ struct rsnd_scu {
27#define OTBL_18 (6 << 16) 27#define OTBL_18 (6 << 16)
28#define OTBL_16 (8 << 16) 28#define OTBL_16 (8 << 16)
29 29
30#define rsnd_scu_mode_flags(p) ((p)->info->flags) 30#define rsnd_src_mode_flags(p) ((p)->info->flags)
31#define rsnd_scu_convert_rate(p) ((p)->info->convert_rate) 31#define rsnd_src_convert_rate(p) ((p)->info->convert_rate)
32#define rsnd_mod_to_scu(_mod) \ 32#define rsnd_mod_to_src(_mod) \
33 container_of((_mod), struct rsnd_scu, mod) 33 container_of((_mod), struct rsnd_src, mod)
34#define rsnd_scu_hpbif_is_enable(scu) \ 34#define rsnd_src_hpbif_is_enable(src) \
35 (rsnd_scu_mode_flags(scu) & RSND_SCU_USE_HPBIF) 35 (rsnd_src_mode_flags(src) & RSND_SCU_USE_HPBIF)
36#define rsnd_scu_dma_available(scu) \ 36#define rsnd_src_dma_available(src) \
37 rsnd_dma_available(rsnd_mod_to_dma(&(scu)->mod)) 37 rsnd_dma_available(rsnd_mod_to_dma(&(src)->mod))
38 38
39#define for_each_rsnd_scu(pos, priv, i) \ 39#define for_each_rsnd_src(pos, priv, i) \
40 for ((i) = 0; \ 40 for ((i) = 0; \
41 ((i) < rsnd_scu_nr(priv)) && \ 41 ((i) < rsnd_src_nr(priv)) && \
42 ((pos) = (struct rsnd_scu *)(priv)->scu + i); \ 42 ((pos) = (struct rsnd_src *)(priv)->src + i); \
43 i++) 43 i++)
44 44
45 45
@@ -54,7 +54,7 @@ struct rsnd_scu {
54 */ 54 */
55 55
56/* 56/*
57 * scu.c is caring... 57 * src.c is caring...
58 * 58 *
59 * Gen1 59 * Gen1
60 * 60 *
@@ -63,7 +63,7 @@ struct rsnd_scu {
63 * 63 *
64 * Gen2 64 * Gen2
65 * 65 *
66 * [mem] -> [SCU] -> [SSIU] -> [SSI] 66 * [mem] -> [SRC] -> [SSIU] -> [SSI]
67 * |-----------------| 67 * |-----------------|
68 */ 68 */
69 69
@@ -79,34 +79,34 @@ struct rsnd_scu {
79 * but SRC bypass mode needs SSI_MODE0 only. 79 * but SRC bypass mode needs SSI_MODE0 only.
80 * 80 *
81 * This driver request 81 * This driver request
82 * struct rsnd_scu_platform_info { 82 * struct rsnd_src_platform_info {
83 * u32 flags; 83 * u32 flags;
84 * u32 convert_rate; 84 * u32 convert_rate;
85 * } 85 * }
86 * 86 *
87 * rsnd_scu_hpbif_is_enable() will be true 87 * rsnd_src_hpbif_is_enable() will be true
88 * if flags had RSND_SCU_USE_HPBIF, 88 * if flags had RSND_SRC_USE_HPBIF,
89 * and it controls whether SSIU is used or not. 89 * and it controls whether SSIU is used or not.
90 * 90 *
91 * rsnd_scu_convert_rate() indicates 91 * rsnd_src_convert_rate() indicates
92 * above convert_rate, and it controls 92 * above convert_rate, and it controls
93 * whether SRC is used or not. 93 * whether SRC is used or not.
94 * 94 *
95 * ex) doesn't use SRC 95 * ex) doesn't use SRC
96 * struct rsnd_scu_platform_info info = { 96 * struct rsnd_src_platform_info info = {
97 * .flags = 0, 97 * .flags = 0,
98 * .convert_rate = 0, 98 * .convert_rate = 0,
99 * }; 99 * };
100 * 100 *
101 * ex) uses SRC 101 * ex) uses SRC
102 * struct rsnd_scu_platform_info info = { 102 * struct rsnd_src_platform_info info = {
103 * .flags = RSND_SCU_USE_HPBIF, 103 * .flags = RSND_SRC_USE_HPBIF,
104 * .convert_rate = 48000, 104 * .convert_rate = 48000,
105 * }; 105 * };
106 * 106 *
107 * ex) uses SRC bypass mode 107 * ex) uses SRC bypass mode
108 * struct rsnd_scu_platform_info info = { 108 * struct rsnd_src_platform_info info = {
109 * .flags = RSND_SCU_USE_HPBIF, 109 * .flags = RSND_SRC_USE_HPBIF,
110 * .convert_rate = 0, 110 * .convert_rate = 0,
111 * }; 111 * };
112 * 112 *
@@ -115,28 +115,28 @@ struct rsnd_scu {
115/* 115/*
116 * Gen1/Gen2 common functions 116 * Gen1/Gen2 common functions
117 */ 117 */
118int rsnd_scu_ssi_mode_init(struct rsnd_mod *ssi_mod, 118int rsnd_src_ssi_mode_init(struct rsnd_mod *ssi_mod,
119 struct rsnd_dai *rdai, 119 struct rsnd_dai *rdai,
120 struct rsnd_dai_stream *io) 120 struct rsnd_dai_stream *io)
121{ 121{
122 struct rsnd_priv *priv = rsnd_mod_to_priv(ssi_mod); 122 struct rsnd_priv *priv = rsnd_mod_to_priv(ssi_mod);
123 struct rsnd_mod *scu_mod = rsnd_io_to_mod_scu(io); 123 struct rsnd_mod *src_mod = rsnd_io_to_mod_src(io);
124 struct rcar_snd_info *info = rsnd_priv_to_info(priv); 124 struct rcar_snd_info *info = rsnd_priv_to_info(priv);
125 int ssi_id = rsnd_mod_id(ssi_mod); 125 int ssi_id = rsnd_mod_id(ssi_mod);
126 int has_scu = 0; 126 int has_src = 0;
127 127
128 /* 128 /*
129 * SSI_MODE0 129 * SSI_MODE0
130 */ 130 */
131 if (info->dai_info) { 131 if (info->dai_info) {
132 has_scu = !!scu_mod; 132 has_src = !!src_mod;
133 } else { 133 } else {
134 struct rsnd_scu *scu = rsnd_mod_to_scu(scu_mod); 134 struct rsnd_src *src = rsnd_mod_to_src(src_mod);
135 has_scu = rsnd_scu_hpbif_is_enable(scu); 135 has_src = rsnd_src_hpbif_is_enable(src);
136 } 136 }
137 137
138 rsnd_mod_bset(ssi_mod, SSI_MODE0, (1 << ssi_id), 138 rsnd_mod_bset(ssi_mod, SSI_MODE0, (1 << ssi_id),
139 has_scu ? 0 : (1 << ssi_id)); 139 has_src ? 0 : (1 << ssi_id));
140 140
141 /* 141 /*
142 * SSI_MODE1 142 * SSI_MODE1
@@ -165,7 +165,7 @@ int rsnd_scu_ssi_mode_init(struct rsnd_mod *ssi_mod,
165 return 0; 165 return 0;
166} 166}
167 167
168int rsnd_scu_enable_ssi_irq(struct rsnd_mod *ssi_mod, 168int rsnd_src_enable_ssi_irq(struct rsnd_mod *ssi_mod,
169 struct rsnd_dai *rdai, 169 struct rsnd_dai *rdai,
170 struct rsnd_dai_stream *io) 170 struct rsnd_dai_stream *io)
171{ 171{
@@ -178,33 +178,33 @@ int rsnd_scu_enable_ssi_irq(struct rsnd_mod *ssi_mod,
178 return 0; 178 return 0;
179} 179}
180 180
181unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv, 181unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv,
182 struct rsnd_dai_stream *io, 182 struct rsnd_dai_stream *io,
183 struct snd_pcm_runtime *runtime) 183 struct snd_pcm_runtime *runtime)
184{ 184{
185 struct rsnd_scu *scu; 185 struct rsnd_src *src;
186 unsigned int rate; 186 unsigned int rate;
187 187
188 scu = rsnd_mod_to_scu(rsnd_io_to_mod_scu(io)); 188 src = rsnd_mod_to_src(rsnd_io_to_mod_src(io));
189 189
190 /* 190 /*
191 * return convert rate if SRC is used, 191 * return convert rate if SRC is used,
192 * otherwise, return runtime->rate as usual 192 * otherwise, return runtime->rate as usual
193 */ 193 */
194 rate = rsnd_scu_convert_rate(scu); 194 rate = rsnd_src_convert_rate(src);
195 if (!rate) 195 if (!rate)
196 rate = runtime->rate; 196 rate = runtime->rate;
197 197
198 return rate; 198 return rate;
199} 199}
200 200
201static int rsnd_scu_set_convert_rate(struct rsnd_mod *mod, 201static int rsnd_src_set_convert_rate(struct rsnd_mod *mod,
202 struct rsnd_dai *rdai, 202 struct rsnd_dai *rdai,
203 struct rsnd_dai_stream *io) 203 struct rsnd_dai_stream *io)
204{ 204{
205 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); 205 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
206 struct rsnd_scu *scu = rsnd_mod_to_scu(mod); 206 struct rsnd_src *src = rsnd_mod_to_src(mod);
207 u32 convert_rate = rsnd_scu_convert_rate(scu); 207 u32 convert_rate = rsnd_src_convert_rate(src);
208 u32 adinr = runtime->channels; 208 u32 adinr = runtime->channels;
209 u32 fsrate = 0; 209 u32 fsrate = 0;
210 210
@@ -217,7 +217,7 @@ static int rsnd_scu_set_convert_rate(struct rsnd_mod *mod,
217 217
218 /* 218 /*
219 * Initialize the operation of the SRC internal circuits 219 * Initialize the operation of the SRC internal circuits
220 * see rsnd_scu_start() 220 * see rsnd_src_start()
221 */ 221 */
222 rsnd_mod_write(mod, SRC_SRCIR, 1); 222 rsnd_mod_write(mod, SRC_SRCIR, 1);
223 223
@@ -248,61 +248,61 @@ static int rsnd_scu_set_convert_rate(struct rsnd_mod *mod,
248 return 0; 248 return 0;
249} 249}
250 250
251static int rsnd_scu_init(struct rsnd_mod *mod, 251static int rsnd_src_init(struct rsnd_mod *mod,
252 struct rsnd_dai *rdai, 252 struct rsnd_dai *rdai,
253 struct rsnd_dai_stream *io) 253 struct rsnd_dai_stream *io)
254{ 254{
255 struct rsnd_scu *scu = rsnd_mod_to_scu(mod); 255 struct rsnd_src *src = rsnd_mod_to_src(mod);
256 256
257 clk_enable(scu->clk); 257 clk_enable(src->clk);
258 258
259 return 0; 259 return 0;
260} 260}
261 261
262static int rsnd_scu_quit(struct rsnd_mod *mod, 262static int rsnd_src_quit(struct rsnd_mod *mod,
263 struct rsnd_dai *rdai, 263 struct rsnd_dai *rdai,
264 struct rsnd_dai_stream *io) 264 struct rsnd_dai_stream *io)
265{ 265{
266 struct rsnd_scu *scu = rsnd_mod_to_scu(mod); 266 struct rsnd_src *src = rsnd_mod_to_src(mod);
267 267
268 clk_disable(scu->clk); 268 clk_disable(src->clk);
269 269
270 return 0; 270 return 0;
271} 271}
272 272
273static int rsnd_scu_start(struct rsnd_mod *mod, 273static int rsnd_src_start(struct rsnd_mod *mod,
274 struct rsnd_dai *rdai, 274 struct rsnd_dai *rdai,
275 struct rsnd_dai_stream *io) 275 struct rsnd_dai_stream *io)
276{ 276{
277 struct rsnd_scu *scu = rsnd_mod_to_scu(mod); 277 struct rsnd_src *src = rsnd_mod_to_src(mod);
278 278
279 /* 279 /*
280 * Cancel the initialization and operate the SRC function 280 * Cancel the initialization and operate the SRC function
281 * see rsnd_scu_set_convert_rate() 281 * see rsnd_src_set_convert_rate()
282 */ 282 */
283 rsnd_mod_write(mod, SRC_SRCIR, 0); 283 rsnd_mod_write(mod, SRC_SRCIR, 0);
284 284
285 if (rsnd_scu_convert_rate(scu)) 285 if (rsnd_src_convert_rate(src))
286 rsnd_mod_write(mod, SRC_ROUTE_MODE0, 1); 286 rsnd_mod_write(mod, SRC_ROUTE_MODE0, 1);
287 287
288 return 0; 288 return 0;
289} 289}
290 290
291 291
292static int rsnd_scu_stop(struct rsnd_mod *mod, 292static int rsnd_src_stop(struct rsnd_mod *mod,
293 struct rsnd_dai *rdai, 293 struct rsnd_dai *rdai,
294 struct rsnd_dai_stream *io) 294 struct rsnd_dai_stream *io)
295{ 295{
296 struct rsnd_scu *scu = rsnd_mod_to_scu(mod); 296 struct rsnd_src *src = rsnd_mod_to_src(mod);
297 297
298 if (rsnd_scu_convert_rate(scu)) 298 if (rsnd_src_convert_rate(src))
299 rsnd_mod_write(mod, SRC_ROUTE_MODE0, 0); 299 rsnd_mod_write(mod, SRC_ROUTE_MODE0, 0);
300 300
301 return 0; 301 return 0;
302} 302}
303 303
304static struct rsnd_mod_ops rsnd_scu_non_ops = { 304static struct rsnd_mod_ops rsnd_src_non_ops = {
305 .name = "scu (non)", 305 .name = "src (non)",
306}; 306};
307 307
308/* 308/*
@@ -312,7 +312,7 @@ static int rsnd_src_set_route_gen1(struct rsnd_mod *mod,
312 struct rsnd_dai *rdai, 312 struct rsnd_dai *rdai,
313 struct rsnd_dai_stream *io) 313 struct rsnd_dai_stream *io)
314{ 314{
315 struct scu_route_config { 315 struct src_route_config {
316 u32 mask; 316 u32 mask;
317 int shift; 317 int shift;
318 } routes[] = { 318 } routes[] = {
@@ -346,14 +346,14 @@ static int rsnd_src_set_route_gen1(struct rsnd_mod *mod,
346 return 0; 346 return 0;
347} 347}
348 348
349static int rsnd_scu_set_convert_timing_gen1(struct rsnd_mod *mod, 349static int rsnd_src_set_convert_timing_gen1(struct rsnd_mod *mod,
350 struct rsnd_dai *rdai, 350 struct rsnd_dai *rdai,
351 struct rsnd_dai_stream *io) 351 struct rsnd_dai_stream *io)
352{ 352{
353 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); 353 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
354 struct rsnd_scu *scu = rsnd_mod_to_scu(mod); 354 struct rsnd_src *src = rsnd_mod_to_src(mod);
355 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); 355 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
356 u32 convert_rate = rsnd_scu_convert_rate(scu); 356 u32 convert_rate = rsnd_src_convert_rate(src);
357 u32 mask; 357 u32 mask;
358 u32 val; 358 u32 val;
359 int shift; 359 int shift;
@@ -405,13 +405,13 @@ static int rsnd_scu_set_convert_timing_gen1(struct rsnd_mod *mod,
405 return 0; 405 return 0;
406} 406}
407 407
408static int rsnd_scu_set_convert_rate_gen1(struct rsnd_mod *mod, 408static int rsnd_src_set_convert_rate_gen1(struct rsnd_mod *mod,
409 struct rsnd_dai *rdai, 409 struct rsnd_dai *rdai,
410 struct rsnd_dai_stream *io) 410 struct rsnd_dai_stream *io)
411{ 411{
412 int ret; 412 int ret;
413 413
414 ret = rsnd_scu_set_convert_rate(mod, rdai, io); 414 ret = rsnd_src_set_convert_rate(mod, rdai, io);
415 if (ret < 0) 415 if (ret < 0)
416 return ret; 416 return ret;
417 417
@@ -427,13 +427,13 @@ static int rsnd_scu_set_convert_rate_gen1(struct rsnd_mod *mod,
427 return 0; 427 return 0;
428} 428}
429 429
430static int rsnd_scu_init_gen1(struct rsnd_mod *mod, 430static int rsnd_src_init_gen1(struct rsnd_mod *mod,
431 struct rsnd_dai *rdai, 431 struct rsnd_dai *rdai,
432 struct rsnd_dai_stream *io) 432 struct rsnd_dai_stream *io)
433{ 433{
434 int ret; 434 int ret;
435 435
436 ret = rsnd_scu_init(mod, rdai, io); 436 ret = rsnd_src_init(mod, rdai, io);
437 if (ret < 0) 437 if (ret < 0)
438 return ret; 438 return ret;
439 439
@@ -441,18 +441,18 @@ static int rsnd_scu_init_gen1(struct rsnd_mod *mod,
441 if (ret < 0) 441 if (ret < 0)
442 return ret; 442 return ret;
443 443
444 ret = rsnd_scu_set_convert_rate_gen1(mod, rdai, io); 444 ret = rsnd_src_set_convert_rate_gen1(mod, rdai, io);
445 if (ret < 0) 445 if (ret < 0)
446 return ret; 446 return ret;
447 447
448 ret = rsnd_scu_set_convert_timing_gen1(mod, rdai, io); 448 ret = rsnd_src_set_convert_timing_gen1(mod, rdai, io);
449 if (ret < 0) 449 if (ret < 0)
450 return ret; 450 return ret;
451 451
452 return 0; 452 return 0;
453} 453}
454 454
455static int rsnd_scu_start_gen1(struct rsnd_mod *mod, 455static int rsnd_src_start_gen1(struct rsnd_mod *mod,
456 struct rsnd_dai *rdai, 456 struct rsnd_dai *rdai,
457 struct rsnd_dai_stream *io) 457 struct rsnd_dai_stream *io)
458{ 458{
@@ -460,10 +460,10 @@ static int rsnd_scu_start_gen1(struct rsnd_mod *mod,
460 460
461 rsnd_mod_bset(mod, SRC_ROUTE_CTRL, (1 << id), (1 << id)); 461 rsnd_mod_bset(mod, SRC_ROUTE_CTRL, (1 << id), (1 << id));
462 462
463 return rsnd_scu_start(mod, rdai, io); 463 return rsnd_src_start(mod, rdai, io);
464} 464}
465 465
466static int rsnd_scu_stop_gen1(struct rsnd_mod *mod, 466static int rsnd_src_stop_gen1(struct rsnd_mod *mod,
467 struct rsnd_dai *rdai, 467 struct rsnd_dai *rdai,
468 struct rsnd_dai_stream *io) 468 struct rsnd_dai_stream *io)
469{ 469{
@@ -471,27 +471,27 @@ static int rsnd_scu_stop_gen1(struct rsnd_mod *mod,
471 471
472 rsnd_mod_bset(mod, SRC_ROUTE_CTRL, (1 << id), 0); 472 rsnd_mod_bset(mod, SRC_ROUTE_CTRL, (1 << id), 0);
473 473
474 return rsnd_scu_stop(mod, rdai, io); 474 return rsnd_src_stop(mod, rdai, io);
475} 475}
476 476
477static struct rsnd_mod_ops rsnd_scu_gen1_ops = { 477static struct rsnd_mod_ops rsnd_src_gen1_ops = {
478 .name = "sru (gen1)", 478 .name = "sru (gen1)",
479 .init = rsnd_scu_init_gen1, 479 .init = rsnd_src_init_gen1,
480 .quit = rsnd_scu_quit, 480 .quit = rsnd_src_quit,
481 .start = rsnd_scu_start_gen1, 481 .start = rsnd_src_start_gen1,
482 .stop = rsnd_scu_stop_gen1, 482 .stop = rsnd_src_stop_gen1,
483}; 483};
484 484
485/* 485/*
486 * Gen2 functions 486 * Gen2 functions
487 */ 487 */
488static int rsnd_scu_set_convert_rate_gen2(struct rsnd_mod *mod, 488static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod,
489 struct rsnd_dai *rdai, 489 struct rsnd_dai *rdai,
490 struct rsnd_dai_stream *io) 490 struct rsnd_dai_stream *io)
491{ 491{
492 int ret; 492 int ret;
493 493
494 ret = rsnd_scu_set_convert_rate(mod, rdai, io); 494 ret = rsnd_src_set_convert_rate(mod, rdai, io);
495 if (ret < 0) 495 if (ret < 0)
496 return ret; 496 return ret;
497 497
@@ -506,13 +506,13 @@ static int rsnd_scu_set_convert_rate_gen2(struct rsnd_mod *mod,
506 return 0; 506 return 0;
507} 507}
508 508
509static int rsnd_scu_set_convert_timing_gen2(struct rsnd_mod *mod, 509static int rsnd_src_set_convert_timing_gen2(struct rsnd_mod *mod,
510 struct rsnd_dai *rdai, 510 struct rsnd_dai *rdai,
511 struct rsnd_dai_stream *io) 511 struct rsnd_dai_stream *io)
512{ 512{
513 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); 513 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
514 struct rsnd_scu *scu = rsnd_mod_to_scu(mod); 514 struct rsnd_src *src = rsnd_mod_to_src(mod);
515 u32 convert_rate = rsnd_scu_convert_rate(scu); 515 u32 convert_rate = rsnd_src_convert_rate(src);
516 int ret; 516 int ret;
517 517
518 if (convert_rate) 518 if (convert_rate)
@@ -525,34 +525,34 @@ static int rsnd_scu_set_convert_timing_gen2(struct rsnd_mod *mod,
525 return ret; 525 return ret;
526} 526}
527 527
528static int rsnd_scu_probe_gen2(struct rsnd_mod *mod, 528static int rsnd_src_probe_gen2(struct rsnd_mod *mod,
529 struct rsnd_dai *rdai, 529 struct rsnd_dai *rdai,
530 struct rsnd_dai_stream *io) 530 struct rsnd_dai_stream *io)
531{ 531{
532 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); 532 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
533 struct rcar_snd_info *info = rsnd_priv_to_info(priv); 533 struct rcar_snd_info *info = rsnd_priv_to_info(priv);
534 struct rsnd_scu *scu = rsnd_mod_to_scu(mod); 534 struct rsnd_src *src = rsnd_mod_to_src(mod);
535 struct rsnd_mod *ssi = rsnd_ssi_mod_get(priv, rsnd_mod_id(mod)); 535 struct rsnd_mod *ssi = rsnd_ssi_mod_get(priv, rsnd_mod_id(mod));
536 struct device *dev = rsnd_priv_to_dev(priv); 536 struct device *dev = rsnd_priv_to_dev(priv);
537 int ret; 537 int ret;
538 int is_play; 538 int is_play;
539 539
540 if (info->dai_info) 540 if (info->dai_info)
541 is_play = rsnd_info_is_playback(priv, scu); 541 is_play = rsnd_info_is_playback(priv, src);
542 else 542 else
543 is_play = rsnd_ssi_is_play(ssi); 543 is_play = rsnd_ssi_is_play(ssi);
544 544
545 ret = rsnd_dma_init(priv, 545 ret = rsnd_dma_init(priv,
546 rsnd_mod_to_dma(mod), 546 rsnd_mod_to_dma(mod),
547 is_play, 547 is_play,
548 scu->info->dma_id); 548 src->info->dma_id);
549 if (ret < 0) 549 if (ret < 0)
550 dev_err(dev, "SCU DMA failed\n"); 550 dev_err(dev, "SRC DMA failed\n");
551 551
552 return ret; 552 return ret;
553} 553}
554 554
555static int rsnd_scu_remove_gen2(struct rsnd_mod *mod, 555static int rsnd_src_remove_gen2(struct rsnd_mod *mod,
556 struct rsnd_dai *rdai, 556 struct rsnd_dai *rdai,
557 struct rsnd_dai_stream *io) 557 struct rsnd_dai_stream *io)
558{ 558{
@@ -561,121 +561,126 @@ static int rsnd_scu_remove_gen2(struct rsnd_mod *mod,
561 return 0; 561 return 0;
562} 562}
563 563
564static int rsnd_scu_init_gen2(struct rsnd_mod *mod, 564static int rsnd_src_init_gen2(struct rsnd_mod *mod,
565 struct rsnd_dai *rdai, 565 struct rsnd_dai *rdai,
566 struct rsnd_dai_stream *io) 566 struct rsnd_dai_stream *io)
567{ 567{
568 int ret; 568 int ret;
569 569
570 ret = rsnd_scu_init(mod, rdai, io); 570 ret = rsnd_src_init(mod, rdai, io);
571 if (ret < 0) 571 if (ret < 0)
572 return ret; 572 return ret;
573 573
574 ret = rsnd_scu_set_convert_rate_gen2(mod, rdai, io); 574 ret = rsnd_src_set_convert_rate_gen2(mod, rdai, io);
575 if (ret < 0) 575 if (ret < 0)
576 return ret; 576 return ret;
577 577
578 ret = rsnd_scu_set_convert_timing_gen2(mod, rdai, io); 578 ret = rsnd_src_set_convert_timing_gen2(mod, rdai, io);
579 if (ret < 0) 579 if (ret < 0)
580 return ret; 580 return ret;
581 581
582 return 0; 582 return 0;
583} 583}
584 584
585static int rsnd_scu_start_gen2(struct rsnd_mod *mod, 585static int rsnd_src_start_gen2(struct rsnd_mod *mod,
586 struct rsnd_dai *rdai, 586 struct rsnd_dai *rdai,
587 struct rsnd_dai_stream *io) 587 struct rsnd_dai_stream *io)
588{ 588{
589 struct rsnd_scu *scu = rsnd_mod_to_scu(mod); 589 struct rsnd_src *src = rsnd_mod_to_src(mod);
590 590
591 rsnd_dma_start(rsnd_mod_to_dma(&scu->mod)); 591 rsnd_dma_start(rsnd_mod_to_dma(&src->mod));
592 592
593 rsnd_mod_write(mod, SSI_CTRL, 0x1); 593 rsnd_mod_write(mod, SSI_CTRL, 0x1);
594 rsnd_mod_write(mod, SRC_CTRL, 0x11); 594 rsnd_mod_write(mod, SRC_CTRL, 0x11);
595 595
596 return rsnd_scu_start(mod, rdai, io); 596 return rsnd_src_start(mod, rdai, io);
597} 597}
598 598
599static int rsnd_scu_stop_gen2(struct rsnd_mod *mod, 599static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
600 struct rsnd_dai *rdai, 600 struct rsnd_dai *rdai,
601 struct rsnd_dai_stream *io) 601 struct rsnd_dai_stream *io)
602{ 602{
603 struct rsnd_scu *scu = rsnd_mod_to_scu(mod); 603 struct rsnd_src *src = rsnd_mod_to_src(mod);
604 604
605 rsnd_mod_write(mod, SSI_CTRL, 0); 605 rsnd_mod_write(mod, SSI_CTRL, 0);
606 rsnd_mod_write(mod, SRC_CTRL, 0); 606 rsnd_mod_write(mod, SRC_CTRL, 0);
607 607
608 rsnd_dma_stop(rsnd_mod_to_dma(&scu->mod)); 608 rsnd_dma_stop(rsnd_mod_to_dma(&src->mod));
609 609
610 return rsnd_scu_stop(mod, rdai, io); 610 return rsnd_src_stop(mod, rdai, io);
611} 611}
612 612
613static struct rsnd_mod_ops rsnd_scu_gen2_ops = { 613static struct rsnd_mod_ops rsnd_src_gen2_ops = {
614 .name = "scu (gen2)", 614 .name = "src (gen2)",
615 .probe = rsnd_scu_probe_gen2, 615 .probe = rsnd_src_probe_gen2,
616 .remove = rsnd_scu_remove_gen2, 616 .remove = rsnd_src_remove_gen2,
617 .init = rsnd_scu_init_gen2, 617 .init = rsnd_src_init_gen2,
618 .quit = rsnd_scu_quit, 618 .quit = rsnd_src_quit,
619 .start = rsnd_scu_start_gen2, 619 .start = rsnd_src_start_gen2,
620 .stop = rsnd_scu_stop_gen2, 620 .stop = rsnd_src_stop_gen2,
621}; 621};
622 622
623struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id) 623struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id)
624{ 624{
625 if (WARN_ON(id < 0 || id >= rsnd_scu_nr(priv))) 625 if (WARN_ON(id < 0 || id >= rsnd_src_nr(priv)))
626 id = 0; 626 id = 0;
627 627
628 return &((struct rsnd_scu *)(priv->scu) + id)->mod; 628 return &((struct rsnd_src *)(priv->src) + id)->mod;
629} 629}
630 630
631int rsnd_scu_probe(struct platform_device *pdev, 631int rsnd_src_probe(struct platform_device *pdev,
632 struct rsnd_priv *priv) 632 struct rsnd_priv *priv)
633{ 633{
634 struct rcar_snd_info *info = rsnd_priv_to_info(priv); 634 struct rcar_snd_info *info = rsnd_priv_to_info(priv);
635 struct device *dev = rsnd_priv_to_dev(priv); 635 struct device *dev = rsnd_priv_to_dev(priv);
636 struct rsnd_scu *scu; 636 struct rsnd_src *src;
637 struct rsnd_mod_ops *ops; 637 struct rsnd_mod_ops *ops;
638 struct clk *clk; 638 struct clk *clk;
639 char name[RSND_SCU_NAME_SIZE]; 639 char name[RSND_SRC_NAME_SIZE];
640 int i, nr; 640 int i, nr;
641 641
642 /* 642 /*
643 * init SCU 643 * init SRC
644 */ 644 */
645 nr = info->scu_info_nr; 645 nr = info->src_info_nr;
646 if (!nr) 646 if (!nr)
647 return 0; 647 return 0;
648 648
649 scu = devm_kzalloc(dev, sizeof(*scu) * nr, GFP_KERNEL); 649 src = devm_kzalloc(dev, sizeof(*src) * nr, GFP_KERNEL);
650 if (!scu) { 650 if (!src) {
651 dev_err(dev, "SCU allocate failed\n"); 651 dev_err(dev, "SRC allocate failed\n");
652 return -ENOMEM; 652 return -ENOMEM;
653 } 653 }
654 654
655 priv->scu_nr = nr; 655 priv->src_nr = nr;
656 priv->scu = scu; 656 priv->src = src;
657 657
658 for_each_rsnd_scu(scu, priv, i) { 658 for_each_rsnd_src(src, priv, i) {
659 snprintf(name, RSND_SCU_NAME_SIZE, "scu.%d", i); 659 snprintf(name, RSND_SRC_NAME_SIZE, "src.%d", i);
660 660
661 clk = devm_clk_get(dev, name); 661 clk = devm_clk_get(dev, name);
662 if (IS_ERR(clk)) {
663 snprintf(name, RSND_SRC_NAME_SIZE, "scu.%d", i);
664 clk = devm_clk_get(dev, name);
665 }
666
662 if (IS_ERR(clk)) 667 if (IS_ERR(clk))
663 return PTR_ERR(clk); 668 return PTR_ERR(clk);
664 669
665 scu->info = &info->scu_info[i]; 670 src->info = &info->src_info[i];
666 scu->clk = clk; 671 src->clk = clk;
667 672
668 ops = &rsnd_scu_non_ops; 673 ops = &rsnd_src_non_ops;
669 if (rsnd_scu_hpbif_is_enable(scu)) { 674 if (rsnd_src_hpbif_is_enable(src)) {
670 if (rsnd_is_gen1(priv)) 675 if (rsnd_is_gen1(priv))
671 ops = &rsnd_scu_gen1_ops; 676 ops = &rsnd_src_gen1_ops;
672 if (rsnd_is_gen2(priv)) 677 if (rsnd_is_gen2(priv))
673 ops = &rsnd_scu_gen2_ops; 678 ops = &rsnd_src_gen2_ops;
674 } 679 }
675 680
676 rsnd_mod_init(priv, &scu->mod, ops, RSND_MOD_SCU, i); 681 rsnd_mod_init(priv, &src->mod, ops, RSND_MOD_SRC, i);
677 682
678 dev_dbg(dev, "SCU%d probed\n", i); 683 dev_dbg(dev, "SRC%d probed\n", i);
679 } 684 }
680 685
681 return 0; 686 return 0;
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 45f828ded935..633b23d209b9 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -121,7 +121,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_ssi *ssi,
121 1, 2, 4, 8, 16, 6, 12, 121 1, 2, 4, 8, 16, 6, 12,
122 }; 122 };
123 unsigned int main_rate; 123 unsigned int main_rate;
124 unsigned int rate = rsnd_scu_get_ssi_rate(priv, io, runtime); 124 unsigned int rate = rsnd_src_get_ssi_rate(priv, io, runtime);
125 125
126 /* 126 /*
127 * Find best clock, and try to start ADG 127 * Find best clock, and try to start ADG
@@ -287,7 +287,7 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
287 ssi->cr_own = cr; 287 ssi->cr_own = cr;
288 ssi->err = -1; /* ignore 1st error */ 288 ssi->err = -1; /* ignore 1st error */
289 289
290 rsnd_scu_ssi_mode_init(mod, rdai, io); 290 rsnd_src_ssi_mode_init(mod, rdai, io);
291 291
292 return 0; 292 return 0;
293} 293}
@@ -387,7 +387,7 @@ static int rsnd_ssi_pio_start(struct rsnd_mod *mod,
387 /* enable PIO IRQ */ 387 /* enable PIO IRQ */
388 ssi->cr_etc = UIEN | OIEN | DIEN; 388 ssi->cr_etc = UIEN | OIEN | DIEN;
389 389
390 rsnd_scu_enable_ssi_irq(mod, rdai, io); 390 rsnd_src_enable_ssi_irq(mod, rdai, io);
391 391
392 rsnd_ssi_hw_start(ssi, rdai, io); 392 rsnd_ssi_hw_start(ssi, rdai, io);
393 393