aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2015-06-15 02:26:25 -0400
committerMark Brown <broonie@kernel.org>2015-06-16 07:34:04 -0400
commit9b99e9a7c5057684104178bb6c3815fcb2f13be4 (patch)
tree56924f8850820938a2a3c4d515ed1df13aafb46b
parent4e2639ff38d28dccdd8e7cf8f60181f0c17e10d3 (diff)
ASoC: rsnd: don't use rsnd_mod_to_io() on rsnd_dma_xxx()
Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths if it supports MIXer. In such case, mod <-> io is no longer 1:1 relationship. This patch removes rsnd_mod_to_io() from rsnd_dma_xxx() and related function Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/sh/rcar/core.c5
-rw-r--r--sound/soc/sh/rcar/dma.c102
-rw-r--r--sound/soc/sh/rcar/dvc.c3
-rw-r--r--sound/soc/sh/rcar/rsnd.h22
-rw-r--r--sound/soc/sh/rcar/src.c12
-rw-r--r--sound/soc/sh/rcar/ssi.c12
6 files changed, 85 insertions, 71 deletions
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index e1d1b22f324f..daa01e2aebb6 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -137,12 +137,13 @@ char *rsnd_mod_name(struct rsnd_mod *mod)
137 return mod->ops->name; 137 return mod->ops->name;
138} 138}
139 139
140struct dma_chan *rsnd_mod_dma_req(struct rsnd_mod *mod) 140struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,
141 struct rsnd_mod *mod)
141{ 142{
142 if (!mod || !mod->ops || !mod->ops->dma_req) 143 if (!mod || !mod->ops || !mod->ops->dma_req)
143 return NULL; 144 return NULL;
144 145
145 return mod->ops->dma_req(mod); 146 return mod->ops->dma_req(io, mod);
146} 147}
147 148
148int rsnd_mod_init(struct rsnd_priv *priv, 149int rsnd_mod_init(struct rsnd_priv *priv,
diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index 9034f951adfe..bdd99f582bb1 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -32,12 +32,10 @@ struct rsnd_dma_ctrl {
32/* 32/*
33 * Audio DMAC 33 * Audio DMAC
34 */ 34 */
35static void rsnd_dmaen_complete(void *data) 35static void __rsnd_dmaen_complete(struct rsnd_mod *mod,
36 struct rsnd_dai_stream *io)
36{ 37{
37 struct rsnd_dma *dma = (struct rsnd_dma *)data;
38 struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
39 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); 38 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
40 struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
41 bool elapsed = false; 39 bool elapsed = false;
42 unsigned long flags; 40 unsigned long flags;
43 41
@@ -54,7 +52,8 @@ static void rsnd_dmaen_complete(void *data)
54 */ 52 */
55 spin_lock_irqsave(&priv->lock, flags); 53 spin_lock_irqsave(&priv->lock, flags);
56 54
57 elapsed = rsnd_dai_pointer_update(io, io->byte_per_period); 55 if (rsnd_mod_is_working(mod))
56 elapsed = rsnd_dai_pointer_update(io, io->byte_per_period);
58 57
59 spin_unlock_irqrestore(&priv->lock, flags); 58 spin_unlock_irqrestore(&priv->lock, flags);
60 59
@@ -62,19 +61,25 @@ static void rsnd_dmaen_complete(void *data)
62 rsnd_dai_period_elapsed(io); 61 rsnd_dai_period_elapsed(io);
63} 62}
64 63
65static void rsnd_dmaen_stop(struct rsnd_dma *dma) 64static void rsnd_dmaen_complete(void *data)
65{
66 struct rsnd_mod *mod = data;
67
68 rsnd_mod_interrupt(mod, __rsnd_dmaen_complete);
69}
70
71static void rsnd_dmaen_stop(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
66{ 72{
67 struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(dma); 73 struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(dma);
68 74
69 dmaengine_terminate_all(dmaen->chan); 75 dmaengine_terminate_all(dmaen->chan);
70} 76}
71 77
72static void rsnd_dmaen_start(struct rsnd_dma *dma) 78static void rsnd_dmaen_start(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
73{ 79{
74 struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(dma); 80 struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(dma);
75 struct rsnd_mod *mod = rsnd_dma_to_mod(dma); 81 struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
76 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); 82 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
77 struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
78 struct snd_pcm_substream *substream = io->substream; 83 struct snd_pcm_substream *substream = io->substream;
79 struct device *dev = rsnd_priv_to_dev(priv); 84 struct device *dev = rsnd_priv_to_dev(priv);
80 struct dma_async_tx_descriptor *desc; 85 struct dma_async_tx_descriptor *desc;
@@ -93,7 +98,7 @@ static void rsnd_dmaen_start(struct rsnd_dma *dma)
93 } 98 }
94 99
95 desc->callback = rsnd_dmaen_complete; 100 desc->callback = rsnd_dmaen_complete;
96 desc->callback_param = dma; 101 desc->callback_param = mod;
97 102
98 if (dmaengine_submit(desc) < 0) { 103 if (dmaengine_submit(desc) < 0) {
99 dev_err(dev, "dmaengine_submit() fail\n"); 104 dev_err(dev, "dmaengine_submit() fail\n");
@@ -124,7 +129,8 @@ struct dma_chan *rsnd_dma_request_channel(struct device_node *of_node,
124 return chan; 129 return chan;
125} 130}
126 131
127static struct dma_chan *rsnd_dmaen_request_channel(struct rsnd_mod *mod_from, 132static struct dma_chan *rsnd_dmaen_request_channel(struct rsnd_dai_stream *io,
133 struct rsnd_mod *mod_from,
128 struct rsnd_mod *mod_to) 134 struct rsnd_mod *mod_to)
129{ 135{
130 if ((!mod_from && !mod_to) || 136 if ((!mod_from && !mod_to) ||
@@ -132,19 +138,19 @@ static struct dma_chan *rsnd_dmaen_request_channel(struct rsnd_mod *mod_from,
132 return NULL; 138 return NULL;
133 139
134 if (mod_from) 140 if (mod_from)
135 return rsnd_mod_dma_req(mod_from); 141 return rsnd_mod_dma_req(io, mod_from);
136 else 142 else
137 return rsnd_mod_dma_req(mod_to); 143 return rsnd_mod_dma_req(io, mod_to);
138} 144}
139 145
140static int rsnd_dmaen_init(struct rsnd_priv *priv, struct rsnd_dma *dma, int id, 146static int rsnd_dmaen_init(struct rsnd_dai_stream *io,
147 struct rsnd_dma *dma, int id,
141 struct rsnd_mod *mod_from, struct rsnd_mod *mod_to) 148 struct rsnd_mod *mod_from, struct rsnd_mod *mod_to)
142{ 149{
143 struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(dma); 150 struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(dma);
151 struct rsnd_priv *priv = rsnd_io_to_priv(io);
144 struct device *dev = rsnd_priv_to_dev(priv); 152 struct device *dev = rsnd_priv_to_dev(priv);
145 struct dma_slave_config cfg = {}; 153 struct dma_slave_config cfg = {};
146 struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
147 struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
148 int is_play = rsnd_io_is_play(io); 154 int is_play = rsnd_io_is_play(io);
149 int ret; 155 int ret;
150 156
@@ -154,7 +160,7 @@ static int rsnd_dmaen_init(struct rsnd_priv *priv, struct rsnd_dma *dma, int id,
154 } 160 }
155 161
156 if (dev->of_node) { 162 if (dev->of_node) {
157 dmaen->chan = rsnd_dmaen_request_channel(mod_from, mod_to); 163 dmaen->chan = rsnd_dmaen_request_channel(io, mod_from, mod_to);
158 } else { 164 } else {
159 dma_cap_mask_t mask; 165 dma_cap_mask_t mask;
160 166
@@ -185,7 +191,7 @@ static int rsnd_dmaen_init(struct rsnd_priv *priv, struct rsnd_dma *dma, int id,
185 return 0; 191 return 0;
186 192
187rsnd_dma_init_err: 193rsnd_dma_init_err:
188 rsnd_dma_quit(dma); 194 rsnd_dma_quit(io, dma);
189rsnd_dma_channel_err: 195rsnd_dma_channel_err:
190 196
191 /* 197 /*
@@ -197,7 +203,7 @@ rsnd_dma_channel_err:
197 return -EAGAIN; 203 return -EAGAIN;
198} 204}
199 205
200static void rsnd_dmaen_quit(struct rsnd_dma *dma) 206static void rsnd_dmaen_quit(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
201{ 207{
202 struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(dma); 208 struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(dma);
203 209
@@ -246,9 +252,9 @@ static const u8 gen2_id_table_cmd[] = {
246 0x38, /* SCU_CMD1 */ 252 0x38, /* SCU_CMD1 */
247}; 253};
248 254
249static u32 rsnd_dmapp_get_id(struct rsnd_mod *mod) 255static u32 rsnd_dmapp_get_id(struct rsnd_dai_stream *io,
256 struct rsnd_mod *mod)
250{ 257{
251 struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
252 struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io); 258 struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io);
253 struct rsnd_mod *src = rsnd_io_to_mod_src(io); 259 struct rsnd_mod *src = rsnd_io_to_mod_src(io);
254 struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io); 260 struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
@@ -276,11 +282,12 @@ static u32 rsnd_dmapp_get_id(struct rsnd_mod *mod)
276 return entry[id]; 282 return entry[id];
277} 283}
278 284
279static u32 rsnd_dmapp_get_chcr(struct rsnd_mod *mod_from, 285static u32 rsnd_dmapp_get_chcr(struct rsnd_dai_stream *io,
286 struct rsnd_mod *mod_from,
280 struct rsnd_mod *mod_to) 287 struct rsnd_mod *mod_to)
281{ 288{
282 return (rsnd_dmapp_get_id(mod_from) << 24) + 289 return (rsnd_dmapp_get_id(io, mod_from) << 24) +
283 (rsnd_dmapp_get_id(mod_to) << 16); 290 (rsnd_dmapp_get_id(io, mod_to) << 16);
284} 291}
285 292
286#define rsnd_dmapp_addr(dmac, dma, reg) \ 293#define rsnd_dmapp_addr(dmac, dma, reg) \
@@ -307,7 +314,7 @@ static u32 rsnd_dmapp_read(struct rsnd_dma *dma, u32 reg)
307 return ioread32(rsnd_dmapp_addr(dmac, dma, reg)); 314 return ioread32(rsnd_dmapp_addr(dmac, dma, reg));
308} 315}
309 316
310static void rsnd_dmapp_stop(struct rsnd_dma *dma) 317static void rsnd_dmapp_stop(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
311{ 318{
312 int i; 319 int i;
313 320
@@ -320,7 +327,7 @@ static void rsnd_dmapp_stop(struct rsnd_dma *dma)
320 } 327 }
321} 328}
322 329
323static void rsnd_dmapp_start(struct rsnd_dma *dma) 330static void rsnd_dmapp_start(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
324{ 331{
325 struct rsnd_dmapp *dmapp = rsnd_dma_to_dmapp(dma); 332 struct rsnd_dmapp *dmapp = rsnd_dma_to_dmapp(dma);
326 333
@@ -329,19 +336,21 @@ static void rsnd_dmapp_start(struct rsnd_dma *dma)
329 rsnd_dmapp_write(dma, dmapp->chcr, PDMACHCR); 336 rsnd_dmapp_write(dma, dmapp->chcr, PDMACHCR);
330} 337}
331 338
332static int rsnd_dmapp_init(struct rsnd_priv *priv, struct rsnd_dma *dma, int id, 339static int rsnd_dmapp_init(struct rsnd_dai_stream *io,
340 struct rsnd_dma *dma, int id,
333 struct rsnd_mod *mod_from, struct rsnd_mod *mod_to) 341 struct rsnd_mod *mod_from, struct rsnd_mod *mod_to)
334{ 342{
335 struct rsnd_dmapp *dmapp = rsnd_dma_to_dmapp(dma); 343 struct rsnd_dmapp *dmapp = rsnd_dma_to_dmapp(dma);
344 struct rsnd_priv *priv = rsnd_io_to_priv(io);
336 struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv); 345 struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv);
337 struct device *dev = rsnd_priv_to_dev(priv); 346 struct device *dev = rsnd_priv_to_dev(priv);
338 347
339 dmapp->dmapp_id = dmac->dmapp_num; 348 dmapp->dmapp_id = dmac->dmapp_num;
340 dmapp->chcr = rsnd_dmapp_get_chcr(mod_from, mod_to) | PDMACHCR_DE; 349 dmapp->chcr = rsnd_dmapp_get_chcr(io, mod_from, mod_to) | PDMACHCR_DE;
341 350
342 dmac->dmapp_num++; 351 dmac->dmapp_num++;
343 352
344 rsnd_dmapp_stop(dma); 353 rsnd_dmapp_stop(io, dma);
345 354
346 dev_dbg(dev, "id/src/dst/chcr = %d/%pad/%pad/%08x\n", 355 dev_dbg(dev, "id/src/dst/chcr = %d/%pad/%pad/%08x\n",
347 dmapp->dmapp_id, &dma->src_addr, &dma->dst_addr, dmapp->chcr); 356 dmapp->dmapp_id, &dma->src_addr, &dma->dst_addr, dmapp->chcr);
@@ -394,12 +403,12 @@ static struct rsnd_dma_ops rsnd_dmapp_ops = {
394#define RDMA_CMD_O_P(addr, i) (addr ##_reg - 0x001f8000 + (0x400 * i)) 403#define RDMA_CMD_O_P(addr, i) (addr ##_reg - 0x001f8000 + (0x400 * i))
395 404
396static dma_addr_t 405static dma_addr_t
397rsnd_gen2_dma_addr(struct rsnd_priv *priv, 406rsnd_gen2_dma_addr(struct rsnd_dai_stream *io,
398 struct rsnd_mod *mod, 407 struct rsnd_mod *mod,
399 int is_play, int is_from) 408 int is_play, int is_from)
400{ 409{
410 struct rsnd_priv *priv = rsnd_io_to_priv(io);
401 struct device *dev = rsnd_priv_to_dev(priv); 411 struct device *dev = rsnd_priv_to_dev(priv);
402 struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
403 phys_addr_t ssi_reg = rsnd_gen_get_phy_addr(priv, RSND_GEN2_SSI); 412 phys_addr_t ssi_reg = rsnd_gen_get_phy_addr(priv, RSND_GEN2_SSI);
404 phys_addr_t src_reg = rsnd_gen_get_phy_addr(priv, RSND_GEN2_SCU); 413 phys_addr_t src_reg = rsnd_gen_get_phy_addr(priv, RSND_GEN2_SCU);
405 int is_ssi = !!(rsnd_io_to_mod_ssi(io) == mod); 414 int is_ssi = !!(rsnd_io_to_mod_ssi(io) == mod);
@@ -454,10 +463,12 @@ rsnd_gen2_dma_addr(struct rsnd_priv *priv,
454 dma_addrs[is_ssi][is_play][use_src + use_dvc].in_addr; 463 dma_addrs[is_ssi][is_play][use_src + use_dvc].in_addr;
455} 464}
456 465
457static dma_addr_t rsnd_dma_addr(struct rsnd_priv *priv, 466static dma_addr_t rsnd_dma_addr(struct rsnd_dai_stream *io,
458 struct rsnd_mod *mod, 467 struct rsnd_mod *mod,
459 int is_play, int is_from) 468 int is_play, int is_from)
460{ 469{
470 struct rsnd_priv *priv = rsnd_io_to_priv(io);
471
461 /* 472 /*
462 * gen1 uses default DMA addr 473 * gen1 uses default DMA addr
463 */ 474 */
@@ -467,17 +478,17 @@ static dma_addr_t rsnd_dma_addr(struct rsnd_priv *priv,
467 if (!mod) 478 if (!mod)
468 return 0; 479 return 0;
469 480
470 return rsnd_gen2_dma_addr(priv, mod, is_play, is_from); 481 return rsnd_gen2_dma_addr(io, mod, is_play, is_from);
471} 482}
472 483
473#define MOD_MAX 4 /* MEM/SSI/SRC/DVC */ 484#define MOD_MAX 4 /* MEM/SSI/SRC/DVC */
474static void rsnd_dma_of_path(struct rsnd_dma *dma, 485static void rsnd_dma_of_path(struct rsnd_dma *dma,
486 struct rsnd_dai_stream *io,
475 int is_play, 487 int is_play,
476 struct rsnd_mod **mod_from, 488 struct rsnd_mod **mod_from,
477 struct rsnd_mod **mod_to) 489 struct rsnd_mod **mod_to)
478{ 490{
479 struct rsnd_mod *this = rsnd_dma_to_mod(dma); 491 struct rsnd_mod *this = rsnd_dma_to_mod(dma);
480 struct rsnd_dai_stream *io = rsnd_mod_to_io(this);
481 struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io); 492 struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io);
482 struct rsnd_mod *src = rsnd_io_to_mod_src(io); 493 struct rsnd_mod *src = rsnd_io_to_mod_src(io);
483 struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io); 494 struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
@@ -532,17 +543,17 @@ static void rsnd_dma_of_path(struct rsnd_dma *dma,
532 } 543 }
533} 544}
534 545
535void rsnd_dma_stop(struct rsnd_dma *dma) 546void rsnd_dma_stop(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
536{ 547{
537 dma->ops->stop(dma); 548 dma->ops->stop(io, dma);
538} 549}
539 550
540void rsnd_dma_start(struct rsnd_dma *dma) 551void rsnd_dma_start(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
541{ 552{
542 dma->ops->start(dma); 553 dma->ops->start(io, dma);
543} 554}
544 555
545void rsnd_dma_quit(struct rsnd_dma *dma) 556void rsnd_dma_quit(struct rsnd_dai_stream *io, struct rsnd_dma *dma)
546{ 557{
547 struct rsnd_mod *mod = rsnd_dma_to_mod(dma); 558 struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
548 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); 559 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
@@ -551,15 +562,14 @@ void rsnd_dma_quit(struct rsnd_dma *dma)
551 if (!dmac) 562 if (!dmac)
552 return; 563 return;
553 564
554 dma->ops->quit(dma); 565 dma->ops->quit(io, dma);
555} 566}
556 567
557int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, int id) 568int rsnd_dma_init(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id)
558{ 569{
559 struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
560 struct rsnd_mod *mod_from; 570 struct rsnd_mod *mod_from;
561 struct rsnd_mod *mod_to; 571 struct rsnd_mod *mod_to;
562 struct rsnd_dai_stream *io = rsnd_mod_to_io(mod); 572 struct rsnd_priv *priv = rsnd_io_to_priv(io);
563 struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv); 573 struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv);
564 int is_play = rsnd_io_is_play(io); 574 int is_play = rsnd_io_is_play(io);
565 575
@@ -572,10 +582,10 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, int id)
572 if (!dmac) 582 if (!dmac)
573 return -EAGAIN; 583 return -EAGAIN;
574 584
575 rsnd_dma_of_path(dma, is_play, &mod_from, &mod_to); 585 rsnd_dma_of_path(dma, io, is_play, &mod_from, &mod_to);
576 586
577 dma->src_addr = rsnd_dma_addr(priv, mod_from, is_play, 1); 587 dma->src_addr = rsnd_dma_addr(io, mod_from, is_play, 1);
578 dma->dst_addr = rsnd_dma_addr(priv, mod_to, is_play, 0); 588 dma->dst_addr = rsnd_dma_addr(io, mod_to, is_play, 0);
579 589
580 /* for Gen2 */ 590 /* for Gen2 */
581 if (mod_from && mod_to) 591 if (mod_from && mod_to)
@@ -587,7 +597,7 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, int id)
587 if (rsnd_is_gen1(priv)) 597 if (rsnd_is_gen1(priv))
588 dma->ops = &rsnd_dmaen_ops; 598 dma->ops = &rsnd_dmaen_ops;
589 599
590 return dma->ops->init(priv, dma, id, mod_from, mod_to); 600 return dma->ops->init(io, dma, id, mod_from, mod_to);
591} 601}
592 602
593int rsnd_dma_probe(struct platform_device *pdev, 603int rsnd_dma_probe(struct platform_device *pdev,
diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c
index 691bc632f0cb..3aac790534f0 100644
--- a/sound/soc/sh/rcar/dvc.c
+++ b/sound/soc/sh/rcar/dvc.c
@@ -265,7 +265,8 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
265 return 0; 265 return 0;
266} 266}
267 267
268static struct dma_chan *rsnd_dvc_dma_req(struct rsnd_mod *mod) 268static struct dma_chan *rsnd_dvc_dma_req(struct rsnd_dai_stream *io,
269 struct rsnd_mod *mod)
269{ 270{
270 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); 271 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
271 272
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index b40435d08757..19d0d8b2b9af 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -172,11 +172,11 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod, struct rsnd_dai_stream *io);
172 */ 172 */
173struct rsnd_dma; 173struct rsnd_dma;
174struct rsnd_dma_ops { 174struct rsnd_dma_ops {
175 void (*start)(struct rsnd_dma *dma); 175 void (*start)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
176 void (*stop)(struct rsnd_dma *dma); 176 void (*stop)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
177 int (*init)(struct rsnd_priv *priv, struct rsnd_dma *dma, int id, 177 int (*init)(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id,
178 struct rsnd_mod *mod_from, struct rsnd_mod *mod_to); 178 struct rsnd_mod *mod_from, struct rsnd_mod *mod_to);
179 void (*quit)(struct rsnd_dma *dma); 179 void (*quit)(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
180}; 180};
181 181
182struct rsnd_dmaen { 182struct rsnd_dmaen {
@@ -200,10 +200,10 @@ struct rsnd_dma {
200#define rsnd_dma_to_dmaen(dma) (&(dma)->dma.en) 200#define rsnd_dma_to_dmaen(dma) (&(dma)->dma.en)
201#define rsnd_dma_to_dmapp(dma) (&(dma)->dma.pp) 201#define rsnd_dma_to_dmapp(dma) (&(dma)->dma.pp)
202 202
203void rsnd_dma_start(struct rsnd_dma *dma); 203void rsnd_dma_start(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
204void rsnd_dma_stop(struct rsnd_dma *dma); 204void rsnd_dma_stop(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
205int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, int id); 205int rsnd_dma_init(struct rsnd_dai_stream *io, struct rsnd_dma *dma, int id);
206void rsnd_dma_quit(struct rsnd_dma *dma); 206void rsnd_dma_quit(struct rsnd_dai_stream *io, struct rsnd_dma *dma);
207int rsnd_dma_probe(struct platform_device *pdev, 207int rsnd_dma_probe(struct platform_device *pdev,
208 const struct rsnd_of_data *of_data, 208 const struct rsnd_of_data *of_data,
209 struct rsnd_priv *priv); 209 struct rsnd_priv *priv);
@@ -224,7 +224,8 @@ enum rsnd_mod_type {
224 224
225struct rsnd_mod_ops { 225struct rsnd_mod_ops {
226 char *name; 226 char *name;
227 struct dma_chan* (*dma_req)(struct rsnd_mod *mod); 227 struct dma_chan* (*dma_req)(struct rsnd_dai_stream *io,
228 struct rsnd_mod *mod);
228 int (*probe)(struct rsnd_mod *mod, 229 int (*probe)(struct rsnd_mod *mod,
229 struct rsnd_dai_stream *io, 230 struct rsnd_dai_stream *io,
230 struct rsnd_priv *priv); 231 struct rsnd_priv *priv);
@@ -326,7 +327,8 @@ int rsnd_mod_init(struct rsnd_priv *priv,
326void rsnd_mod_quit(struct rsnd_mod *mod); 327void rsnd_mod_quit(struct rsnd_mod *mod);
327char *rsnd_mod_name(struct rsnd_mod *mod); 328char *rsnd_mod_name(struct rsnd_mod *mod);
328int rsnd_mod_is_working(struct rsnd_mod *mod); 329int rsnd_mod_is_working(struct rsnd_mod *mod);
329struct dma_chan *rsnd_mod_dma_req(struct rsnd_mod *mod); 330struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,
331 struct rsnd_mod *mod);
330void rsnd_mod_interrupt(struct rsnd_mod *mod, 332void rsnd_mod_interrupt(struct rsnd_mod *mod,
331 void (*callback)(struct rsnd_mod *mod, 333 void (*callback)(struct rsnd_mod *mod,
332 struct rsnd_dai_stream *io)); 334 struct rsnd_dai_stream *io));
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index 5693bb5c420b..62216196af9c 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -117,10 +117,10 @@ struct rsnd_src {
117/* 117/*
118 * Gen1/Gen2 common functions 118 * Gen1/Gen2 common functions
119 */ 119 */
120static struct dma_chan *rsnd_src_dma_req(struct rsnd_mod *mod) 120static struct dma_chan *rsnd_src_dma_req(struct rsnd_dai_stream *io,
121 struct rsnd_mod *mod)
121{ 122{
122 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); 123 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
123 struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
124 int is_play = rsnd_io_is_play(io); 124 int is_play = rsnd_io_is_play(io);
125 125
126 return rsnd_dma_request_channel(rsnd_src_of_node(priv), 126 return rsnd_dma_request_channel(rsnd_src_of_node(priv),
@@ -810,7 +810,7 @@ static int rsnd_src_probe_gen2(struct rsnd_mod *mod,
810 return ret; 810 return ret;
811 } 811 }
812 812
813 ret = rsnd_dma_init(priv, 813 ret = rsnd_dma_init(io,
814 rsnd_mod_to_dma(mod), 814 rsnd_mod_to_dma(mod),
815 src->info->dma_id); 815 src->info->dma_id);
816 816
@@ -821,7 +821,7 @@ static int rsnd_src_remove_gen2(struct rsnd_mod *mod,
821 struct rsnd_dai_stream *io, 821 struct rsnd_dai_stream *io,
822 struct rsnd_priv *priv) 822 struct rsnd_priv *priv)
823{ 823{
824 rsnd_dma_quit(rsnd_mod_to_dma(mod)); 824 rsnd_dma_quit(io, rsnd_mod_to_dma(mod));
825 825
826 return 0; 826 return 0;
827} 827}
@@ -851,7 +851,7 @@ static int rsnd_src_start_gen2(struct rsnd_mod *mod,
851 struct rsnd_dai_stream *io, 851 struct rsnd_dai_stream *io,
852 struct rsnd_priv *priv) 852 struct rsnd_priv *priv)
853{ 853{
854 rsnd_dma_start(rsnd_mod_to_dma(mod)); 854 rsnd_dma_start(io, rsnd_mod_to_dma(mod));
855 855
856 return _rsnd_src_start_gen2(mod); 856 return _rsnd_src_start_gen2(mod);
857} 857}
@@ -864,7 +864,7 @@ static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
864 864
865 ret = _rsnd_src_stop_gen2(mod); 865 ret = _rsnd_src_stop_gen2(mod);
866 866
867 rsnd_dma_stop(rsnd_mod_to_dma(mod)); 867 rsnd_dma_stop(io, rsnd_mod_to_dma(mod));
868 868
869 return ret; 869 return ret;
870} 870}
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 564e8290375c..0a32544d6f75 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -533,7 +533,7 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
533 return ret; 533 return ret;
534 534
535 ret = rsnd_dma_init( 535 ret = rsnd_dma_init(
536 priv, rsnd_mod_to_dma(mod), 536 io, rsnd_mod_to_dma(mod),
537 dma_id); 537 dma_id);
538 538
539 return ret; 539 return ret;
@@ -547,7 +547,7 @@ static int rsnd_ssi_dma_remove(struct rsnd_mod *mod,
547 struct device *dev = rsnd_priv_to_dev(priv); 547 struct device *dev = rsnd_priv_to_dev(priv);
548 int irq = ssi->info->irq; 548 int irq = ssi->info->irq;
549 549
550 rsnd_dma_quit(rsnd_mod_to_dma(mod)); 550 rsnd_dma_quit(io, rsnd_mod_to_dma(mod));
551 551
552 /* PIO will request IRQ again */ 552 /* PIO will request IRQ again */
553 devm_free_irq(dev, irq, ssi); 553 devm_free_irq(dev, irq, ssi);
@@ -582,7 +582,7 @@ static int rsnd_ssi_dma_start(struct rsnd_mod *mod,
582{ 582{
583 struct rsnd_dma *dma = rsnd_mod_to_dma(mod); 583 struct rsnd_dma *dma = rsnd_mod_to_dma(mod);
584 584
585 rsnd_dma_start(dma); 585 rsnd_dma_start(io, dma);
586 586
587 rsnd_ssi_start(mod, io, priv); 587 rsnd_ssi_start(mod, io, priv);
588 588
@@ -597,15 +597,15 @@ static int rsnd_ssi_dma_stop(struct rsnd_mod *mod,
597 597
598 rsnd_ssi_stop(mod, io, priv); 598 rsnd_ssi_stop(mod, io, priv);
599 599
600 rsnd_dma_stop(dma); 600 rsnd_dma_stop(io, dma);
601 601
602 return 0; 602 return 0;
603} 603}
604 604
605static struct dma_chan *rsnd_ssi_dma_req(struct rsnd_mod *mod) 605static struct dma_chan *rsnd_ssi_dma_req(struct rsnd_dai_stream *io,
606 struct rsnd_mod *mod)
606{ 607{
607 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); 608 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
608 struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
609 int is_play = rsnd_io_is_play(io); 609 int is_play = rsnd_io_is_play(io);
610 char *name; 610 char *name;
611 611