sound/soc/amd/renoir/acp3x-pdm-dma.c
Source file repositories/reference/linux-study-clean/sound/soc/amd/renoir/acp3x-pdm-dma.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/amd/renoir/acp3x-pdm-dma.c- Extension
.c- Size
- 13368 bytes
- Lines
- 507
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/platform_device.hlinux/module.hlinux/bitfield.hlinux/err.hlinux/io.hlinux/pm_runtime.hsound/pcm_params.hsound/soc.hsound/soc-dai.hrn_acp3x.h
Detected Declarations
function pdm_irq_handlerfunction init_pdm_ring_bufferfunction enable_pdm_clockfunction enable_pdm_interruptsfunction disable_pdm_interruptsfunction check_pdm_dma_statusfunction start_pdm_dmafunction stop_pdm_dmafunction config_acp_dmafunction acp_pdm_dma_openfunction acp_pdm_dma_hw_paramsfunction acp_pdm_get_byte_countfunction acp_pdm_dma_pointerfunction acp_pdm_dma_newfunction acp_pdm_dma_closefunction acp_pdm_dai_triggerfunction acp_pdm_audio_probefunction acp_pdm_audio_removefunction acp_pdm_resumefunction acp_pdm_runtime_suspendfunction acp_pdm_runtime_resume
Annotated Snippet
while (++timeout < ACP_COUNTER) {
pdm_dma_enable = rn_readl(acp_base +
ACP_WOV_PDM_DMA_ENABLE);
if ((pdm_dma_enable & 0x02) == 0x00)
break;
udelay(DELAY_US);
}
if (timeout == ACP_COUNTER)
return -ETIMEDOUT;
}
if (pdm_enable == ACP_PDM_ENABLE) {
pdm_enable = ACP_PDM_DISABLE;
rn_writel(pdm_enable, acp_base + ACP_WOV_PDM_ENABLE);
}
rn_writel(0x01, acp_base + ACP_WOV_PDM_FIFO_FLUSH);
return 0;
}
static void config_acp_dma(struct pdm_stream_instance *rtd, int direction)
{
u16 page_idx;
u32 low, high, val;
dma_addr_t addr;
addr = rtd->dma_addr;
val = 0;
/* Group Enable */
rn_writel(ACP_SRAM_PTE_OFFSET | BIT(31), rtd->acp_base +
ACPAXI2AXI_ATU_BASE_ADDR_GRP_1);
rn_writel(PAGE_SIZE_4K_ENABLE, rtd->acp_base +
ACPAXI2AXI_ATU_PAGE_SIZE_GRP_1);
for (page_idx = 0; page_idx < rtd->num_pages; page_idx++) {
/* Load the low address of page int ACP SRAM through SRBM */
low = lower_32_bits(addr);
high = upper_32_bits(addr);
rn_writel(low, rtd->acp_base + ACP_SCRATCH_REG_0 + val);
high |= BIT(31);
rn_writel(high, rtd->acp_base + ACP_SCRATCH_REG_0 + val + 4);
val += 8;
addr += PAGE_SIZE;
}
}
static int acp_pdm_dma_open(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime;
struct pdm_dev_data *adata;
struct pdm_stream_instance *pdm_data;
int ret;
runtime = substream->runtime;
adata = dev_get_drvdata(component->dev);
pdm_data = kzalloc_obj(*pdm_data);
if (!pdm_data)
return -EINVAL;
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
runtime->hw = acp_pdm_hardware_capture;
ret = snd_pcm_hw_constraint_integer(runtime,
SNDRV_PCM_HW_PARAM_PERIODS);
if (ret < 0) {
dev_err(component->dev, "set integer constraint failed\n");
kfree(pdm_data);
return ret;
}
enable_pdm_interrupts(adata->acp_base);
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
adata->capture_stream = substream;
pdm_data->acp_base = adata->acp_base;
runtime->private_data = pdm_data;
return ret;
}
static int acp_pdm_dma_hw_params(struct snd_soc_component *component,
struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct pdm_stream_instance *rtd;
size_t size, period_bytes;
rtd = substream->runtime->private_data;
if (!rtd)
Annotation
- Immediate include surface: `linux/platform_device.h`, `linux/module.h`, `linux/bitfield.h`, `linux/err.h`, `linux/io.h`, `linux/pm_runtime.h`, `sound/pcm_params.h`, `sound/soc.h`.
- Detected declarations: `function pdm_irq_handler`, `function init_pdm_ring_buffer`, `function enable_pdm_clock`, `function enable_pdm_interrupts`, `function disable_pdm_interrupts`, `function check_pdm_dma_status`, `function start_pdm_dma`, `function stop_pdm_dma`, `function config_acp_dma`, `function acp_pdm_dma_open`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.