Lines Matching +full:ssiu +full:-
1 // SPDX-License-Identifier: GPL-2.0
3 // Renesas R-Car Audio DMAC support
53 #define rsnd_priv_to_dmac(p) ((struct rsnd_dma_ctrl *)(p)->dma)
55 #define rsnd_dma_to_dmaen(dma) (&(dma)->dma.en)
56 #define rsnd_dma_to_dmapp(dma) (&(dma)->dma.pp)
104 if (dmaen->chan) in rsnd_dmaen_stop()
105 dmaengine_terminate_async(dmaen->chan); in rsnd_dmaen_stop()
122 if (dmaen->chan) in rsnd_dmaen_cleanup()
123 dma_release_channel(dmaen->chan); in rsnd_dmaen_cleanup()
125 dmaen->chan = NULL; in rsnd_dmaen_cleanup()
139 if (dmaen->chan) in rsnd_dmaen_prepare()
147 dmaen->chan = rsnd_dmaen_request_channel(io, in rsnd_dmaen_prepare()
148 dma->mod_from, in rsnd_dmaen_prepare()
149 dma->mod_to); in rsnd_dmaen_prepare()
150 if (IS_ERR_OR_NULL(dmaen->chan)) { in rsnd_dmaen_prepare()
151 dmaen->chan = NULL; in rsnd_dmaen_prepare()
153 return -EIO; in rsnd_dmaen_prepare()
165 struct snd_pcm_substream *substream = io->substream; in rsnd_dmaen_start()
174 * in case of monaural data writing or reading through Audio-DMAC in rsnd_dmaen_start()
180 int bits = snd_pcm_format_physical_width(runtime->format); in rsnd_dmaen_start()
194 return -EINVAL; in rsnd_dmaen_start()
199 cfg.src_addr = dma->src_addr; in rsnd_dmaen_start()
200 cfg.dst_addr = dma->dst_addr; in rsnd_dmaen_start()
204 dev_dbg(dev, "%s %pad -> %pad\n", in rsnd_dmaen_start()
208 ret = dmaengine_slave_config(dmaen->chan, &cfg); in rsnd_dmaen_start()
212 desc = dmaengine_prep_dma_cyclic(dmaen->chan, in rsnd_dmaen_start()
213 substream->runtime->dma_addr, in rsnd_dmaen_start()
221 return -EIO; in rsnd_dmaen_start()
224 desc->callback = rsnd_dmaen_complete; in rsnd_dmaen_start()
225 desc->callback_param = rsnd_mod_get(dma); in rsnd_dmaen_start()
227 dmaen->dma_len = snd_pcm_lib_buffer_bytes(substream); in rsnd_dmaen_start()
229 dmaen->cookie = dmaengine_submit(desc); in rsnd_dmaen_start()
230 if (dmaen->cookie < 0) { in rsnd_dmaen_start()
232 return -EIO; in rsnd_dmaen_start()
235 dma_async_issue_pending(dmaen->chan); in rsnd_dmaen_start()
279 /* Let's follow when -EPROBE_DEFER case */ in rsnd_dmaen_attach()
280 if (PTR_ERR(chan) == -EPROBE_DEFER) in rsnd_dmaen_attach()
289 return -EAGAIN; in rsnd_dmaen_attach()
297 io->dmac_dev = chan->device->dev; in rsnd_dmaen_attach()
301 dmac->dmaen_num++; in rsnd_dmaen_attach()
317 status = dmaengine_tx_status(dmaen->chan, dmaen->cookie, &state); in rsnd_dmaen_pointer()
319 if (state.residue > 0 && state.residue <= dmaen->dma_len) in rsnd_dmaen_pointer()
320 pos = dmaen->dma_len - state.residue; in rsnd_dmaen_pointer()
383 struct rsnd_mod *ssiu = rsnd_io_to_mod_ssiu(io); in rsnd_dmapp_get_id() local
391 (mod == ssiu)) { in rsnd_dmapp_get_id()
392 int busif = rsnd_mod_id_sub(ssiu); in rsnd_dmapp_get_id()
412 /* use non-prohibited SRS number as error */ in rsnd_dmapp_get_id()
428 (dmac->ppbase + 0x20 + reg + \
429 (0x10 * rsnd_dma_to_dmapp(dma)->dmapp_id))
480 return -EIO; in rsnd_dmapp_stop()
490 rsnd_dmapp_write(dma, dma->src_addr, PDMASAR); in rsnd_dmapp_start()
491 rsnd_dmapp_write(dma, dma->dst_addr, PDMADAR); in rsnd_dmapp_start()
492 rsnd_dmapp_write(dma, dmapp->chcr, PDMACHCR); in rsnd_dmapp_start()
506 dmapp->dmapp_id = dmac->dmapp_num; in rsnd_dmapp_attach()
507 dmapp->chcr = rsnd_dmapp_get_chcr(io, mod_from, mod_to) | PDMACHCR_DE; in rsnd_dmapp_attach()
509 dmac->dmapp_num++; in rsnd_dmapp_attach()
512 dmapp->dmapp_id, &dma->src_addr, &dma->dst_addr, dmapp->chcr); in rsnd_dmapp_attach()
527 rsnd_debugfs_reg_show(m, dmac->ppres, dmac->ppbase, in rsnd_dmapp_debug_info()
528 0x20 + 0x10 * dmapp->dmapp_id, 0x10); in rsnd_dmapp_debug_info()
536 .name = "audmac-pp",
556 * ex) R-Car H2 case
559 * SSIU: 0xec541000 / 0xec100000 / 0xec100000 / 0xec400000 / 0xec400000
563 #define RDMA_SSI_I_N(addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0x8)
564 #define RDMA_SSI_O_N(addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0xc)
566 …DMA_SSIU_I_N(addr, i, j) (addr ##_reg - 0x00441000 + (0x1000 * (i)) + (((j) / 4) * 0xA000) + (((j)…
569 …DMA_SSIU_I_P(addr, i, j) (addr ##_reg - 0x00141000 + (0x1000 * (i)) + (((j) / 4) * 0xA000) + (((j)…
572 #define RDMA_SRC_I_N(addr, i) (addr ##_reg - 0x00500000 + (0x400 * i))
573 #define RDMA_SRC_O_N(addr, i) (addr ##_reg - 0x004fc000 + (0x400 * i))
575 #define RDMA_SRC_I_P(addr, i) (addr ##_reg - 0x00200000 + (0x400 * i))
576 #define RDMA_SRC_O_P(addr, i) (addr ##_reg - 0x001fc000 + (0x400 * i))
578 #define RDMA_CMD_O_N(addr, i) (addr ##_reg - 0x004f8000 + (0x400 * i))
579 #define RDMA_CMD_O_P(addr, i) (addr ##_reg - 0x001f8000 + (0x400 * i))
622 /* SSIU */ in rsnd_gen2_dma_addr()
636 * We can't support SSI9-4/5/6/7, because its address is in rsnd_gen2_dma_addr()
640 dev_err(dev, "This driver doesn't support SSI%d-%d, so far", in rsnd_gen2_dma_addr()
647 /* use SSIU or SSI ? */ in rsnd_gen2_dma_addr()
693 * It should use "rcar_sound,ssiu" on DT. in rsnd_dma_of_path()
696 * If it has "rcar_sound.ssiu", it will be used. in rsnd_dma_of_path()
703 struct rsnd_mod *ssiu = rsnd_io_to_mod_ssiu(io); in rsnd_dma_of_path() local
705 /* use SSIU */ in rsnd_dma_of_path()
706 ssi = ssiu; in rsnd_dma_of_path()
708 this = ssiu; in rsnd_dma_of_path()
724 * [S] -*-> [E] in rsnd_dma_of_path()
725 * [S] -*-> SRC -o-> [E] in rsnd_dma_of_path()
726 * [S] -*-> SRC -> DVC -o-> [E] in rsnd_dma_of_path()
727 * [S] -*-> SRC -> CTU -> MIX -> DVC -o-> [E] in rsnd_dma_of_path()
735 * -*-> Audio DMAC in rsnd_dma_of_path()
736 * -o-> Audio DMAC peri peri in rsnd_dma_of_path()
762 * -------------+-----+-----+ in rsnd_dma_of_path()
767 *mod_from = mod[idx - 1]; in rsnd_dma_of_path()
806 return -EAGAIN; in rsnd_dma_alloc()
814 dma_id = dmac->dmapp_num; in rsnd_dma_alloc()
819 dma_id = dmac->dmaen_num; in rsnd_dma_alloc()
827 dma_id = dmac->dmaen_num; in rsnd_dma_alloc()
833 return -ENOMEM; in rsnd_dma_alloc()
842 dev_dbg(dev, "%s %s -> %s\n", in rsnd_dma_alloc()
851 dma->src_addr = rsnd_dma_addr(io, mod_from, is_play, 1); in rsnd_dma_alloc()
852 dma->dst_addr = rsnd_dma_addr(io, mod_to, is_play, 0); in rsnd_dma_alloc()
853 dma->mod_from = mod_from; in rsnd_dma_alloc()
854 dma->mod_to = mod_to; in rsnd_dma_alloc()
869 return rsnd_dai_connect(*dma_mod, io, (*dma_mod)->type); in rsnd_dma_attach()
895 dmac->dmapp_num = 0; in rsnd_dma_probe()
896 dmac->ppres = res->start; in rsnd_dma_probe()
897 dmac->ppbase = devm_ioremap_resource(dev, res); in rsnd_dma_probe()
898 if (IS_ERR(dmac->ppbase)) in rsnd_dma_probe()
899 return PTR_ERR(dmac->ppbase); in rsnd_dma_probe()
901 priv->dma = dmac; in rsnd_dma_probe()