• Home
  • Raw
  • Download

Lines Matching +full:ssiu +full:- +full:2

1 // SPDX-License-Identifier: GPL-2.0
3 // Renesas R-Car Audio DMAC support
52 #define rsnd_priv_to_dmac(p) ((struct rsnd_dma_ctrl *)(p)->dma)
54 #define rsnd_dma_to_dmaen(dma) (&(dma)->dma.en)
55 #define rsnd_dma_to_dmapp(dma) (&(dma)->dma.pp)
103 if (dmaen->chan) in rsnd_dmaen_stop()
104 dmaengine_terminate_all(dmaen->chan); in rsnd_dmaen_stop()
121 if (dmaen->chan) in rsnd_dmaen_cleanup()
122 dma_release_channel(dmaen->chan); in rsnd_dmaen_cleanup()
124 dmaen->chan = NULL; in rsnd_dmaen_cleanup()
138 if (dmaen->chan) in rsnd_dmaen_prepare()
146 dmaen->chan = rsnd_dmaen_request_channel(io, in rsnd_dmaen_prepare()
147 dma->mod_from, in rsnd_dmaen_prepare()
148 dma->mod_to); in rsnd_dmaen_prepare()
149 if (IS_ERR_OR_NULL(dmaen->chan)) { in rsnd_dmaen_prepare()
150 dmaen->chan = NULL; in rsnd_dmaen_prepare()
152 return -EIO; in rsnd_dmaen_prepare()
164 struct snd_pcm_substream *substream = io->substream; in rsnd_dmaen_start()
173 * in case of monaural data writing or reading through Audio-DMAC in rsnd_dmaen_start()
179 int bits = snd_pcm_format_physical_width(runtime->format); in rsnd_dmaen_start()
193 return -EINVAL; in rsnd_dmaen_start()
198 cfg.src_addr = dma->src_addr; in rsnd_dmaen_start()
199 cfg.dst_addr = dma->dst_addr; in rsnd_dmaen_start()
203 dev_dbg(dev, "%s %pad -> %pad\n", in rsnd_dmaen_start()
207 ret = dmaengine_slave_config(dmaen->chan, &cfg); in rsnd_dmaen_start()
211 desc = dmaengine_prep_dma_cyclic(dmaen->chan, in rsnd_dmaen_start()
212 substream->runtime->dma_addr, in rsnd_dmaen_start()
220 return -EIO; in rsnd_dmaen_start()
223 desc->callback = rsnd_dmaen_complete; in rsnd_dmaen_start()
224 desc->callback_param = rsnd_mod_get(dma); in rsnd_dmaen_start()
226 dmaen->dma_len = snd_pcm_lib_buffer_bytes(substream); in rsnd_dmaen_start()
228 dmaen->cookie = dmaengine_submit(desc); in rsnd_dmaen_start()
229 if (dmaen->cookie < 0) { in rsnd_dmaen_start()
231 return -EIO; in rsnd_dmaen_start()
234 dma_async_issue_pending(dmaen->chan); in rsnd_dmaen_start()
269 /* Let's follow when -EPROBE_DEFER case */ in rsnd_dmaen_attach()
270 if (PTR_ERR(chan) == -EPROBE_DEFER) in rsnd_dmaen_attach()
279 return -EAGAIN; in rsnd_dmaen_attach()
287 io->dmac_dev = chan->device->dev; in rsnd_dmaen_attach()
291 dmac->dmaen_num++; in rsnd_dmaen_attach()
307 status = dmaengine_tx_status(dmaen->chan, dmaen->cookie, &state); in rsnd_dmaen_pointer()
309 if (state.residue > 0 && state.residue <= dmaen->dma_len) in rsnd_dmaen_pointer()
310 pos = dmaen->dma_len - state.residue; in rsnd_dmaen_pointer()
373 struct rsnd_mod *ssiu = rsnd_io_to_mod_ssiu(io); in rsnd_dmapp_get_id() local
381 (mod == ssiu)) { in rsnd_dmapp_get_id()
382 int busif = rsnd_mod_id_sub(ssiu); in rsnd_dmapp_get_id()
402 /* use non-prohibited SRS number as error */ in rsnd_dmapp_get_id()
418 (dmac->base + 0x20 + reg + \
419 (0x10 * rsnd_dma_to_dmapp(dma)->dmapp_id))
470 return -EIO; in rsnd_dmapp_stop()
480 rsnd_dmapp_write(dma, dma->src_addr, PDMASAR); in rsnd_dmapp_start()
481 rsnd_dmapp_write(dma, dma->dst_addr, PDMADAR); in rsnd_dmapp_start()
482 rsnd_dmapp_write(dma, dmapp->chcr, PDMACHCR); in rsnd_dmapp_start()
496 dmapp->dmapp_id = dmac->dmapp_num; in rsnd_dmapp_attach()
497 dmapp->chcr = rsnd_dmapp_get_chcr(io, mod_from, mod_to) | PDMACHCR_DE; in rsnd_dmapp_attach()
499 dmac->dmapp_num++; in rsnd_dmapp_attach()
502 dmapp->dmapp_id, &dma->src_addr, &dma->dst_addr, dmapp->chcr); in rsnd_dmapp_attach()
508 .name = "audmac-pp",
527 * ex) R-Car H2 case
530 * SSIU: 0xec541000 / 0xec100000 / 0xec100000 / 0xec400000 / 0xec400000
534 #define RDMA_SSI_I_N(addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0x8)
535 #define RDMA_SSI_O_N(addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0xc)
537 …DMA_SSIU_I_N(addr, i, j) (addr ##_reg - 0x00441000 + (0x1000 * (i)) + (((j) / 4) * 0xA000) + (((j)…
540 …DMA_SSIU_I_P(addr, i, j) (addr ##_reg - 0x00141000 + (0x1000 * (i)) + (((j) / 4) * 0xA000) + (((j)…
543 #define RDMA_SRC_I_N(addr, i) (addr ##_reg - 0x00500000 + (0x400 * i))
544 #define RDMA_SRC_O_N(addr, i) (addr ##_reg - 0x004fc000 + (0x400 * i))
546 #define RDMA_SRC_I_P(addr, i) (addr ##_reg - 0x00200000 + (0x400 * i))
547 #define RDMA_SRC_O_P(addr, i) (addr ##_reg - 0x001fc000 + (0x400 * i))
549 #define RDMA_CMD_O_N(addr, i) (addr ##_reg - 0x004f8000 + (0x400 * i))
550 #define RDMA_CMD_O_P(addr, i) (addr ##_reg - 0x001f8000 + (0x400 * i))
572 } dma_addrs[3][2][3] = { in rsnd_gen2_dma_addr()
593 /* SSIU */ in rsnd_gen2_dma_addr()
607 * We can't support SSI9-4/5/6/7, because its address is in rsnd_gen2_dma_addr()
611 dev_err(dev, "This driver doesn't support SSI%d-%d, so far", in rsnd_gen2_dma_addr()
618 /* use SSIU or SSI ? */ in rsnd_gen2_dma_addr()
664 * It should use "rcar_sound,ssiu" on DT. in rsnd_dma_of_path()
667 * If it has "rcar_sound.ssiu", it will be used. in rsnd_dma_of_path()
674 struct rsnd_mod *ssiu = rsnd_io_to_mod_ssiu(io); in rsnd_dma_of_path() local
676 /* use SSIU */ in rsnd_dma_of_path()
677 ssi = ssiu; in rsnd_dma_of_path()
679 this = ssiu; in rsnd_dma_of_path()
695 * [S] -*-> [E] in rsnd_dma_of_path()
696 * [S] -*-> SRC -o-> [E] in rsnd_dma_of_path()
697 * [S] -*-> SRC -> DVC -o-> [E] in rsnd_dma_of_path()
698 * [S] -*-> SRC -> CTU -> MIX -> DVC -o-> [E] in rsnd_dma_of_path()
706 * -*-> Audio DMAC in rsnd_dma_of_path()
707 * -o-> Audio DMAC peri peri in rsnd_dma_of_path()
733 * -------------+-----+-----+ in rsnd_dma_of_path()
738 *mod_from = mod[idx - 1]; in rsnd_dma_of_path()
777 return -EAGAIN; in rsnd_dma_alloc()
785 dma_id = dmac->dmapp_num; in rsnd_dma_alloc()
790 dma_id = dmac->dmaen_num; in rsnd_dma_alloc()
798 dma_id = dmac->dmaen_num; in rsnd_dma_alloc()
804 return -ENOMEM; in rsnd_dma_alloc()
813 dev_dbg(dev, "%s %s -> %s\n", in rsnd_dma_alloc()
822 dma->src_addr = rsnd_dma_addr(io, mod_from, is_play, 1); in rsnd_dma_alloc()
823 dma->dst_addr = rsnd_dma_addr(io, mod_to, is_play, 0); in rsnd_dma_alloc()
824 dma->mod_from = mod_from; in rsnd_dma_alloc()
825 dma->mod_to = mod_to; in rsnd_dma_alloc()
840 return rsnd_dai_connect(*dma_mod, io, (*dma_mod)->type); in rsnd_dma_attach()
866 dmac->dmapp_num = 0; in rsnd_dma_probe()
867 dmac->base = devm_ioremap_resource(dev, res); in rsnd_dma_probe()
868 if (IS_ERR(dmac->base)) in rsnd_dma_probe()
869 return PTR_ERR(dmac->base); in rsnd_dma_probe()
871 priv->dma = dmac; in rsnd_dma_probe()