ASoC: rsnd: add struct rsnd_dai_platform_info
[linux-2.6-block.git] / sound / soc / sh / rcar / scu.c
CommitLineData
07539c1d
KM
1/*
2 * Renesas R-Car SCU support
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#include "rsnd.h"
12
13struct rsnd_scu {
14 struct rsnd_scu_platform_info *info; /* rcar_snd.h */
15 struct rsnd_mod mod;
ef749400 16 struct clk *clk;
07539c1d
KM
17};
18
ef749400 19#define RSND_SCU_NAME_SIZE 16
374a5281
KM
20
21/*
22 * ADINR
23 */
24#define OTBL_24 (0 << 16)
25#define OTBL_22 (2 << 16)
26#define OTBL_20 (4 << 16)
27#define OTBL_18 (6 << 16)
28#define OTBL_16 (8 << 16)
29
39cf3c40
KM
30#define rsnd_scu_mode_flags(p) ((p)->info->flags)
31#define rsnd_scu_convert_rate(p) ((p)->info->convert_rate)
32#define rsnd_mod_to_scu(_mod) \
33 container_of((_mod), struct rsnd_scu, mod)
96c7c0d6
KM
34#define rsnd_scu_hpbif_is_enable(scu) \
35 (rsnd_scu_mode_flags(scu) & RSND_SCU_USE_HPBIF)
629509c5
KM
36#define rsnd_scu_dma_available(scu) \
37 rsnd_dma_available(rsnd_mod_to_dma(&(scu)->mod))
39cf3c40
KM
38
39#define for_each_rsnd_scu(pos, priv, i) \
40 for ((i) = 0; \
41 ((i) < rsnd_scu_nr(priv)) && \
42 ((pos) = (struct rsnd_scu *)(priv)->scu + i); \
43 i++)
44
45
ef749400
KM
46/*
47 * image of SRC (Sampling Rate Converter)
48 *
49 * 96kHz <-> +-----+ 48kHz +-----+ 48kHz +-------+
50 * 48kHz <-> | SRC | <------> | SSI | <-----> | codec |
51 * 44.1kHz <-> +-----+ +-----+ +-------+
52 * ...
53 *
54 */
374a5281 55
c926b746
KM
56/*
57 * scu.c is caring...
58 *
59 * Gen1
60 *
61 * [mem] -> [SRU] -> [SSI]
62 * |--------|
63 *
64 * Gen2
65 *
66 * [mem] -> [SCU] -> [SSIU] -> [SSI]
67 * |-----------------|
68 */
69
41c6221c
KM
70/*
71 * How to use SRC bypass mode for debugging
72 *
73 * SRC has bypass mode, and it is useful for debugging.
74 * In Gen2 case,
75 * SRCm_MODE controls whether SRC is used or not
76 * SSI_MODE0 controls whether SSIU which receives SRC data
77 * is used or not.
78 * Both SRCm_MODE/SSI_MODE0 settings are needed if you use SRC,
79 * but SRC bypass mode needs SSI_MODE0 only.
80 *
81 * This driver request
82 * struct rsnd_scu_platform_info {
83 * u32 flags;
84 * u32 convert_rate;
85 * }
86 *
87 * rsnd_scu_hpbif_is_enable() will be true
88 * if flags had RSND_SCU_USE_HPBIF,
89 * and it controls whether SSIU is used or not.
90 *
91 * rsnd_scu_convert_rate() indicates
92 * above convert_rate, and it controls
93 * whether SRC is used or not.
94 *
95 * ex) doesn't use SRC
96 * struct rsnd_scu_platform_info info = {
97 * .flags = 0,
98 * .convert_rate = 0,
99 * };
100 *
101 * ex) uses SRC
102 * struct rsnd_scu_platform_info info = {
103 * .flags = RSND_SCU_USE_HPBIF,
104 * .convert_rate = 48000,
105 * };
106 *
107 * ex) uses SRC bypass mode
108 * struct rsnd_scu_platform_info info = {
109 * .flags = RSND_SCU_USE_HPBIF,
110 * .convert_rate = 0,
111 * };
112 *
113 */
114
1b7b08ef
KM
115/*
116 * Gen1/Gen2 common functions
117 */
7b5ce975
KM
118static int rsnd_scu_ssi_mode_init(struct rsnd_mod *mod,
119 struct rsnd_dai *rdai,
120 struct rsnd_dai_stream *io)
121{
122 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
96c7c0d6 123 struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
374e5426
KM
124 struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io);
125 int ssi_id = rsnd_mod_id(ssi_mod);
a2070fee
KM
126 u32 convert_rate = rsnd_scu_convert_rate(scu);
127
128 if (convert_rate && !rsnd_dai_is_clk_master(rdai)) {
129 struct device *dev = rsnd_priv_to_dev(priv);
130
131 dev_err(dev, "rsnd should be clk master when you rate convert\n");
132 return -EINVAL;
133 }
7b5ce975
KM
134
135 /*
136 * SSI_MODE0
137 */
374e5426
KM
138 rsnd_mod_bset(mod, SSI_MODE0, (1 << ssi_id),
139 rsnd_scu_hpbif_is_enable(scu) ? 0 : (1 << ssi_id));
7b5ce975
KM
140
141 /*
142 * SSI_MODE1
143 */
374e5426 144 if (rsnd_ssi_is_pin_sharing(ssi_mod)) {
7b5ce975 145 int shift = -1;
374e5426 146 switch (ssi_id) {
7b5ce975
KM
147 case 1:
148 shift = 0;
149 break;
150 case 2:
151 shift = 2;
152 break;
153 case 4:
154 shift = 16;
155 break;
156 }
157
158 if (shift >= 0)
159 rsnd_mod_bset(mod, SSI_MODE1,
160 0x3 << shift,
161 rsnd_dai_is_clk_master(rdai) ?
162 0x2 << shift : 0x1 << shift);
163 }
164
165 return 0;
166}
167
1b7b08ef 168unsigned int rsnd_scu_get_ssi_rate(struct rsnd_priv *priv,
374e5426 169 struct rsnd_dai_stream *io,
1b7b08ef
KM
170 struct snd_pcm_runtime *runtime)
171{
172 struct rsnd_scu *scu;
173 unsigned int rate;
174
374e5426 175 scu = rsnd_mod_to_scu(rsnd_io_to_mod_scu(io));
1b7b08ef
KM
176
177 /*
178 * return convert rate if SRC is used,
179 * otherwise, return runtime->rate as usual
180 */
181 rate = rsnd_scu_convert_rate(scu);
182 if (!rate)
183 rate = runtime->rate;
184
185 return rate;
186}
187
188static int rsnd_scu_set_convert_rate(struct rsnd_mod *mod,
189 struct rsnd_dai *rdai,
190 struct rsnd_dai_stream *io)
191{
192 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
193 struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
194 u32 convert_rate = rsnd_scu_convert_rate(scu);
195 u32 adinr = runtime->channels;
196 u32 fsrate = 0;
197
198 if (convert_rate)
199 fsrate = 0x0400000 / convert_rate * runtime->rate;
200
201 /* set/clear soft reset */
202 rsnd_mod_write(mod, SRC_SWRSR, 0);
203 rsnd_mod_write(mod, SRC_SWRSR, 1);
204
205 /*
206 * Initialize the operation of the SRC internal circuits
207 * see rsnd_scu_start()
208 */
209 rsnd_mod_write(mod, SRC_SRCIR, 1);
210
211 /* Set channel number and output bit length */
212 switch (runtime->sample_bits) {
213 case 16:
214 adinr |= OTBL_16;
215 break;
216 case 32:
217 adinr |= OTBL_24;
218 break;
219 default:
220 return -EIO;
221 }
222 rsnd_mod_write(mod, SRC_ADINR, adinr);
223
224 /* Enable the initial value of IFS */
225 if (fsrate) {
226 rsnd_mod_write(mod, SRC_IFSCR, 1);
227
228 /* Set initial value of IFS */
229 rsnd_mod_write(mod, SRC_IFSVR, fsrate);
230 }
231
232 /* use DMA transfer */
233 rsnd_mod_write(mod, SRC_BUSIF_MODE, 1);
234
235 return 0;
236}
237
238static int rsnd_scu_init(struct rsnd_mod *mod,
239 struct rsnd_dai *rdai,
240 struct rsnd_dai_stream *io)
241{
242 struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
243 int ret;
244
245 clk_enable(scu->clk);
246
247 ret = rsnd_scu_ssi_mode_init(mod, rdai, io);
248 if (ret < 0)
249 return ret;
250
251 return 0;
252}
253
254static int rsnd_scu_quit(struct rsnd_mod *mod,
255 struct rsnd_dai *rdai,
256 struct rsnd_dai_stream *io)
257{
258 struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
259
260 clk_disable(scu->clk);
261
262 return 0;
263}
264
265static int rsnd_scu_start(struct rsnd_mod *mod,
266 struct rsnd_dai *rdai,
267 struct rsnd_dai_stream *io)
268{
269 struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
270
271 /*
272 * Cancel the initialization and operate the SRC function
273 * see rsnd_scu_set_convert_rate()
274 */
275 rsnd_mod_write(mod, SRC_SRCIR, 0);
276
277 if (rsnd_scu_convert_rate(scu))
278 rsnd_mod_write(mod, SRC_ROUTE_MODE0, 1);
279
280 return 0;
281}
282
283
284static int rsnd_scu_stop(struct rsnd_mod *mod,
285 struct rsnd_dai *rdai,
286 struct rsnd_dai_stream *io)
287{
288 struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
289
290 if (rsnd_scu_convert_rate(scu))
291 rsnd_mod_write(mod, SRC_ROUTE_MODE0, 0);
292
293 return 0;
294}
295
296static struct rsnd_mod_ops rsnd_scu_non_ops = {
297 .name = "scu (non)",
298};
299
300/*
301 * Gen1 functions
302 */
303static int rsnd_src_set_route_gen1(struct rsnd_mod *mod,
304 struct rsnd_dai *rdai,
305 struct rsnd_dai_stream *io)
374a5281
KM
306{
307 struct scu_route_config {
308 u32 mask;
309 int shift;
310 } routes[] = {
311 { 0xF, 0, }, /* 0 */
312 { 0xF, 4, }, /* 1 */
313 { 0xF, 8, }, /* 2 */
314 { 0x7, 12, }, /* 3 */
315 { 0x7, 16, }, /* 4 */
316 { 0x7, 20, }, /* 5 */
317 { 0x7, 24, }, /* 6 */
318 { 0x3, 28, }, /* 7 */
319 { 0x3, 30, }, /* 8 */
320 };
374a5281
KM
321 u32 mask;
322 u32 val;
374a5281
KM
323 int id;
324
374a5281 325 id = rsnd_mod_id(mod);
b5f3d7af 326 if (id < 0 || id >= ARRAY_SIZE(routes))
374a5281
KM
327 return -EIO;
328
329 /*
330 * SRC_ROUTE_SELECT
331 */
332 val = rsnd_dai_is_play(rdai, io) ? 0x1 : 0x2;
333 val = val << routes[id].shift;
334 mask = routes[id].mask << routes[id].shift;
335
336 rsnd_mod_bset(mod, SRC_ROUTE_SEL, mask, val);
337
28dc4b63
KM
338 return 0;
339}
340
341static int rsnd_scu_set_convert_timing_gen1(struct rsnd_mod *mod,
342 struct rsnd_dai *rdai,
343 struct rsnd_dai_stream *io)
344{
345 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
346 struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
347 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
348 u32 convert_rate = rsnd_scu_convert_rate(scu);
349 u32 mask;
350 u32 val;
351 int shift;
352 int id = rsnd_mod_id(mod);
353 int ret;
354
374a5281
KM
355 /*
356 * SRC_TIMING_SELECT
357 */
358 shift = (id % 4) * 8;
359 mask = 0x1F << shift;
ef749400
KM
360
361 /*
362 * ADG is used as source clock if SRC was used,
363 * then, SSI WS is used as destination clock.
364 * SSI WS is used as source clock if SRC is not used
365 * (when playback, source/destination become reverse when capture)
366 */
28dc4b63
KM
367 ret = 0;
368 if (convert_rate) {
369 /* use ADG */
ef749400 370 val = 0;
28dc4b63
KM
371 ret = rsnd_adg_set_convert_clk_gen1(priv, mod,
372 runtime->rate,
373 convert_rate);
374 } else if (8 == id) {
375 /* use SSI WS, but SRU8 is special */
374a5281 376 val = id << shift;
28dc4b63
KM
377 } else {
378 /* use SSI WS */
374a5281 379 val = (id + 1) << shift;
28dc4b63
KM
380 }
381
382 if (ret < 0)
383 return ret;
374a5281
KM
384
385 switch (id / 4) {
386 case 0:
387 rsnd_mod_bset(mod, SRC_TMG_SEL0, mask, val);
388 break;
389 case 1:
390 rsnd_mod_bset(mod, SRC_TMG_SEL1, mask, val);
391 break;
392 case 2:
393 rsnd_mod_bset(mod, SRC_TMG_SEL2, mask, val);
394 break;
395 }
396
397 return 0;
398}
399
1b7b08ef
KM
400static int rsnd_scu_set_convert_rate_gen1(struct rsnd_mod *mod,
401 struct rsnd_dai *rdai,
402 struct rsnd_dai_stream *io)
374a5281 403{
1b7b08ef 404 int ret;
ef749400 405
1b7b08ef
KM
406 ret = rsnd_scu_set_convert_rate(mod, rdai, io);
407 if (ret < 0)
408 return ret;
ef749400 409
1b7b08ef
KM
410 /* Select SRC mode (fixed value) */
411 rsnd_mod_write(mod, SRC_SRCCR, 0x00010110);
ef749400 412
1b7b08ef
KM
413 /* Set the restriction value of the FS ratio (98%) */
414 rsnd_mod_write(mod, SRC_MNFSR,
415 rsnd_mod_read(mod, SRC_IFSVR) / 100 * 98);
ef749400 416
1b7b08ef 417 /* no SRC_BFSSR settings, since SRC_SRCCR::BUFMD is 0 */
ef749400 418
374a5281
KM
419 return 0;
420}
421
1b7b08ef
KM
422static int rsnd_scu_init_gen1(struct rsnd_mod *mod,
423 struct rsnd_dai *rdai,
424 struct rsnd_dai_stream *io)
07539c1d 425{
374a5281
KM
426 int ret;
427
1b7b08ef 428 ret = rsnd_scu_init(mod, rdai, io);
7b5ce975
KM
429 if (ret < 0)
430 return ret;
431
1b7b08ef 432 ret = rsnd_src_set_route_gen1(mod, rdai, io);
374a5281
KM
433 if (ret < 0)
434 return ret;
435
1b7b08ef 436 ret = rsnd_scu_set_convert_rate_gen1(mod, rdai, io);
374a5281
KM
437 if (ret < 0)
438 return ret;
07539c1d 439
28dc4b63
KM
440 ret = rsnd_scu_set_convert_timing_gen1(mod, rdai, io);
441 if (ret < 0)
442 return ret;
443
a204d90c
KM
444 return 0;
445}
446
1b7b08ef
KM
447static int rsnd_scu_start_gen1(struct rsnd_mod *mod,
448 struct rsnd_dai *rdai,
449 struct rsnd_dai_stream *io)
a204d90c 450{
1b7b08ef 451 int id = rsnd_mod_id(mod);
a204d90c 452
1b7b08ef 453 rsnd_mod_bset(mod, SRC_ROUTE_CTRL, (1 << id), (1 << id));
374a5281 454
1b7b08ef 455 return rsnd_scu_start(mod, rdai, io);
07539c1d
KM
456}
457
1b7b08ef
KM
458static int rsnd_scu_stop_gen1(struct rsnd_mod *mod,
459 struct rsnd_dai *rdai,
460 struct rsnd_dai_stream *io)
a204d90c 461{
e7ce74ea 462 int id = rsnd_mod_id(mod);
a204d90c 463
1b7b08ef 464 rsnd_mod_bset(mod, SRC_ROUTE_CTRL, (1 << id), 0);
e7ce74ea 465
1b7b08ef 466 return rsnd_scu_stop(mod, rdai, io);
a204d90c
KM
467}
468
1b7b08ef
KM
469static struct rsnd_mod_ops rsnd_scu_gen1_ops = {
470 .name = "sru (gen1)",
471 .init = rsnd_scu_init_gen1,
472 .quit = rsnd_scu_quit,
473 .start = rsnd_scu_start_gen1,
474 .stop = rsnd_scu_stop_gen1,
475};
e7ce74ea 476
1b7b08ef
KM
477static struct rsnd_mod_ops rsnd_scu_non_gen1_ops = {
478 .name = "non-sru (gen1)",
479 .init = rsnd_scu_ssi_mode_init,
480};
ef749400 481
1b7b08ef
KM
482/*
483 * Gen2 functions
484 */
629509c5
KM
485static int rsnd_scu_set_convert_rate_gen2(struct rsnd_mod *mod,
486 struct rsnd_dai *rdai,
487 struct rsnd_dai_stream *io)
488{
489 int ret;
490
491 ret = rsnd_scu_set_convert_rate(mod, rdai, io);
492 if (ret < 0)
493 return ret;
494
495 rsnd_mod_write(mod, SSI_BUSIF_ADINR, rsnd_mod_read(mod, SRC_ADINR));
496 rsnd_mod_write(mod, SSI_BUSIF_MODE, rsnd_mod_read(mod, SRC_BUSIF_MODE));
497
498 rsnd_mod_write(mod, SRC_SRCCR, 0x00011110);
499
500 rsnd_mod_write(mod, SRC_BSDSR, 0x01800000);
501 rsnd_mod_write(mod, SRC_BSISR, 0x00100060);
502
503 return 0;
504}
505
506static int rsnd_scu_set_convert_timing_gen2(struct rsnd_mod *mod,
507 struct rsnd_dai *rdai,
508 struct rsnd_dai_stream *io)
509{
510 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
511 struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
512 u32 convert_rate = rsnd_scu_convert_rate(scu);
513 int ret;
514
515 if (convert_rate)
516 ret = rsnd_adg_set_convert_clk_gen2(mod, rdai, io,
517 runtime->rate,
518 convert_rate);
519 else
520 ret = rsnd_adg_set_convert_timing_gen2(mod, rdai, io);
521
522 return ret;
523}
524
525static int rsnd_scu_init_gen2(struct rsnd_mod *mod,
526 struct rsnd_dai *rdai,
527 struct rsnd_dai_stream *io)
528{
529 int ret;
530
531 ret = rsnd_scu_init(mod, rdai, io);
532 if (ret < 0)
533 return ret;
534
535 ret = rsnd_scu_set_convert_rate_gen2(mod, rdai, io);
536 if (ret < 0)
537 return ret;
538
539 ret = rsnd_scu_set_convert_timing_gen2(mod, rdai, io);
540 if (ret < 0)
541 return ret;
542
543 return 0;
544}
545
546static int rsnd_scu_start_gen2(struct rsnd_mod *mod,
547 struct rsnd_dai *rdai,
548 struct rsnd_dai_stream *io)
549{
550 struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
551
552 rsnd_dma_start(rsnd_mod_to_dma(&scu->mod));
553
554 rsnd_mod_write(mod, SSI_CTRL, 0x1);
555 rsnd_mod_write(mod, SRC_CTRL, 0x11);
556
557 return rsnd_scu_start(mod, rdai, io);
558}
559
560static int rsnd_scu_stop_gen2(struct rsnd_mod *mod,
561 struct rsnd_dai *rdai,
562 struct rsnd_dai_stream *io)
563{
564 struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
565
566 rsnd_mod_write(mod, SSI_CTRL, 0);
567 rsnd_mod_write(mod, SRC_CTRL, 0);
568
569 rsnd_dma_stop(rsnd_mod_to_dma(&scu->mod));
570
571 return rsnd_scu_stop(mod, rdai, io);
572}
573
574static struct rsnd_mod_ops rsnd_scu_gen2_ops = {
575 .name = "scu (gen2)",
576 .init = rsnd_scu_init_gen2,
577 .quit = rsnd_scu_quit,
578 .start = rsnd_scu_start_gen2,
579 .stop = rsnd_scu_stop_gen2,
580};
581
1b7b08ef
KM
582static int rsnd_scu_start_non_gen2(struct rsnd_mod *mod,
583 struct rsnd_dai *rdai,
584 struct rsnd_dai_stream *io)
585{
374e5426
KM
586 struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io);
587
1b7b08ef 588 /* enable PIO interrupt */
374e5426 589 rsnd_mod_write(ssi_mod, INT_ENABLE, 0x0f000000);
ef749400 590
ef749400
KM
591 return 0;
592}
593
1b7b08ef
KM
594static struct rsnd_mod_ops rsnd_scu_non_gen2_ops = {
595 .name = "non-scu (gen2)",
7b5ce975 596 .init = rsnd_scu_ssi_mode_init,
1b7b08ef 597 .start = rsnd_scu_start_non_gen2,
013f38fe
KM
598};
599
07539c1d
KM
600struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id)
601{
8b14719b
TI
602 if (WARN_ON(id < 0 || id >= rsnd_scu_nr(priv)))
603 id = 0;
07539c1d
KM
604
605 return &((struct rsnd_scu *)(priv->scu) + id)->mod;
606}
607
608int rsnd_scu_probe(struct platform_device *pdev,
07539c1d
KM
609 struct rsnd_priv *priv)
610{
5da39cf3 611 struct rcar_snd_info *info = rsnd_priv_to_info(priv);
07539c1d
KM
612 struct device *dev = rsnd_priv_to_dev(priv);
613 struct rsnd_scu *scu;
013f38fe 614 struct rsnd_mod_ops *ops;
ef749400
KM
615 struct clk *clk;
616 char name[RSND_SCU_NAME_SIZE];
07539c1d
KM
617 int i, nr;
618
619 /*
620 * init SCU
621 */
622 nr = info->scu_info_nr;
623 scu = devm_kzalloc(dev, sizeof(*scu) * nr, GFP_KERNEL);
624 if (!scu) {
625 dev_err(dev, "SCU allocate failed\n");
626 return -ENOMEM;
627 }
628
629 priv->scu_nr = nr;
630 priv->scu = scu;
631
632 for_each_rsnd_scu(scu, priv, i) {
ef749400
KM
633 snprintf(name, RSND_SCU_NAME_SIZE, "scu.%d", i);
634
635 clk = devm_clk_get(dev, name);
636 if (IS_ERR(clk))
637 return PTR_ERR(clk);
638
07539c1d 639 scu->info = &info->scu_info[i];
ef749400 640 scu->clk = clk;
07539c1d 641
013f38fe 642 ops = &rsnd_scu_non_ops;
1b7b08ef
KM
643 if (rsnd_scu_hpbif_is_enable(scu)) {
644 if (rsnd_is_gen1(priv))
645 ops = &rsnd_scu_gen1_ops;
629509c5
KM
646 if (rsnd_is_gen2(priv)) {
647 struct rsnd_mod *ssi = rsnd_ssi_mod_get(priv, i);
648 int ret = rsnd_dma_init(priv,
649 rsnd_mod_to_dma(&scu->mod),
650 rsnd_ssi_is_play(ssi),
651 scu->info->dma_id);
652 if (ret < 0)
653 return ret;
654
655 ops = &rsnd_scu_gen2_ops;
656 }
1b7b08ef
KM
657 } else {
658 if (rsnd_is_gen1(priv))
659 ops = &rsnd_scu_non_gen1_ops;
660 if (rsnd_is_gen2(priv))
661 ops = &rsnd_scu_non_gen2_ops;
662 }
013f38fe 663
a126021d 664 rsnd_mod_init(priv, &scu->mod, ops, RSND_MOD_SCU, i);
013f38fe 665
374a5281
KM
666 dev_dbg(dev, "SCU%d probed\n", i);
667 }
07539c1d
KM
668
669 return 0;
670}
671
672void rsnd_scu_remove(struct platform_device *pdev,
673 struct rsnd_priv *priv)
674{
629509c5
KM
675 struct rsnd_scu *scu;
676 int i;
677
678 for_each_rsnd_scu(scu, priv, i) {
679 if (rsnd_scu_dma_available(scu))
680 rsnd_dma_quit(priv, rsnd_mod_to_dma(&scu->mod));
681 }
07539c1d 682}