sound/soc/renesas/rcar/dma.c
Source file repositories/reference/linux-study-clean/sound/soc/renesas/rcar/dma.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/renesas/rcar/dma.c- Extension
.c- Size
- 27905 bytes
- Lines
- 1060
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/of_dma.hsound/dmaengine_pcm.hrsnd.h
Detected Declarations
struct rsnd_dmaenstruct rsnd_dmappstruct rsnd_dmastruct rsnd_dma_ctrlstruct rsnd_dma_addrstruct rsnd_dma_addr_dirstruct rsnd_dma_addr_mapfunction rsnd_dmaen_stopfunction rsnd_dmaen_cleanupfunction rsnd_dmaen_preparefunction rsnd_dmaen_startfunction for_each_child_of_node_scopedfunction rsnd_dmaen_attachfunction rsnd_dmaen_pointerfunction rsnd_dmapp_get_idfunction rsnd_dmapp_get_chcrfunction rsnd_dmapp_writefunction rsnd_dmapp_readfunction rsnd_dmapp_bsetfunction rsnd_dmapp_stopfunction rsnd_dmapp_startfunction rsnd_dmapp_attachfunction rsnd_dmapp_debug_infofunction rsnd_dma_addr_lookupfunction rsnd_gen2_dma_addrfunction rsnd_rzg3e_dma_addrfunction rsnd_gen4_dma_addrfunction rsnd_dma_addrfunction rsnd_dma_of_pathfunction rsnd_ssiu_dma_reqfunction rsnd_dma_allocfunction rsnd_dma_attachfunction rsnd_dma_probefunction rsnd_dma_suspendfunction rsnd_dma_resume
Annotated Snippet
struct rsnd_dmaen {
struct dma_chan *chan;
};
struct rsnd_dmapp {
int dmapp_id;
u32 chcr;
};
struct rsnd_dma {
struct rsnd_mod mod;
struct rsnd_mod *mod_from;
struct rsnd_mod *mod_to;
dma_addr_t src_addr;
dma_addr_t dst_addr;
union {
struct rsnd_dmaen en;
struct rsnd_dmapp pp;
} dma;
};
struct rsnd_dma_ctrl {
void __iomem *ppbase;
phys_addr_t ppres;
int dmaen_num;
int dmapp_num;
/* RZ/G3E: Audio DMAC peri-peri clock and reset */
struct clk *audmapp_clk;
struct reset_control *audmapp_rstc;
};
#define rsnd_priv_to_dmac(p) ((struct rsnd_dma_ctrl *)(p)->dma)
#define rsnd_mod_to_dma(_mod) container_of((_mod), struct rsnd_dma, mod)
#define rsnd_dma_to_dmaen(dma) (&(dma)->dma.en)
#define rsnd_dma_to_dmapp(dma) (&(dma)->dma.pp)
/* for DEBUG */
static struct rsnd_mod_ops mem_ops = {
.name = "mem",
};
static struct rsnd_mod mem = {
};
/*
* Audio DMAC
*/
static struct dma_chan *rsnd_dmaen_request_channel(struct rsnd_dai_stream *io,
struct rsnd_mod *mod_from,
struct rsnd_mod *mod_to)
{
if ((!mod_from && !mod_to) ||
(mod_from && mod_to))
return NULL;
if (mod_from)
return rsnd_mod_dma_req(io, mod_from);
else
return rsnd_mod_dma_req(io, mod_to);
}
static int rsnd_dmaen_stop(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct rsnd_priv *priv)
{
return snd_dmaengine_pcm_trigger(io->substream, SNDRV_PCM_TRIGGER_STOP);
}
static int rsnd_dmaen_cleanup(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct rsnd_priv *priv)
{
struct rsnd_dma *dma = rsnd_mod_to_dma(mod);
struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(dma);
/*
* DMAEngine release uses mutex lock.
* Thus, it shouldn't be called under spinlock.
* Let's call it under prepare
*/
if (dmaen->chan)
snd_dmaengine_pcm_close_release_chan(io->substream);
dmaen->chan = NULL;
return 0;
}
static int rsnd_dmaen_prepare(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
Annotation
- Immediate include surface: `linux/delay.h`, `linux/of_dma.h`, `sound/dmaengine_pcm.h`, `rsnd.h`.
- Detected declarations: `struct rsnd_dmaen`, `struct rsnd_dmapp`, `struct rsnd_dma`, `struct rsnd_dma_ctrl`, `struct rsnd_dma_addr`, `struct rsnd_dma_addr_dir`, `struct rsnd_dma_addr_map`, `function rsnd_dmaen_stop`, `function rsnd_dmaen_cleanup`, `function rsnd_dmaen_prepare`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.