sound/soc/amd/acp/acp-platform.c
Source file repositories/reference/linux-study-clean/sound/soc/amd/acp/acp-platform.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/amd/acp/acp-platform.c- Extension
.c- Size
- 10563 bytes
- Lines
- 361
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/err.hlinux/io.hsound/pcm_params.hsound/soc.hsound/soc-dai.hlinux/dma-mapping.hamd.hacp-mach.h
Detected Declarations
struct snd_soc_dai_driverfunction config_pte_for_streamfunction config_acp_dmafunction acp_dma_openfunction acp_dma_hw_paramsfunction acp_dma_pointerfunction acp_dma_newfunction acp_dma_closefunction acp_platform_registerfunction acp_platform_unregister
Annotated Snippet
switch (stream->dai_id) {
case I2S_SP_INSTANCE:
if (stream->dir == SNDRV_PCM_STREAM_PLAYBACK)
val = 0x0;
else
val = 0x1000;
break;
case I2S_BT_INSTANCE:
if (stream->dir == SNDRV_PCM_STREAM_PLAYBACK)
val = 0x2000;
else
val = 0x3000;
break;
case I2S_HS_INSTANCE:
if (stream->dir == SNDRV_PCM_STREAM_PLAYBACK)
val = 0x4000;
else
val = 0x5000;
break;
case DMIC_INSTANCE:
val = 0x6000;
break;
default:
dev_err(chip->dev, "Invalid dai id %x\n", stream->dai_id);
return;
}
break;
default:
val = stream->pte_offset;
break;
}
for (page_idx = 0; page_idx < 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);
writel(low, chip->base + rsrc->scratch_reg_offset + val);
high |= BIT(31);
writel(high, chip->base + rsrc->scratch_reg_offset + val + 4);
/* Move to next physically contiguous page */
val += 8;
addr += PAGE_SIZE;
}
}
EXPORT_SYMBOL_NS_GPL(config_acp_dma, "SND_SOC_ACP_COMMON");
static int acp_dma_open(struct snd_soc_component *component, struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct device *dev = component->dev;
struct acp_chip_info *chip;
struct acp_stream *stream;
int ret;
stream = kzalloc_obj(*stream);
if (!stream)
return -ENOMEM;
stream->substream = substream;
chip = dev_get_drvdata(dev->parent);
switch (chip->acp_rev) {
case ACP63_PCI_ID:
case ACP70_PCI_ID:
case ACP71_PCI_ID:
case ACP72_PCI_ID:
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
runtime->hw = acp6x_pcm_hardware_playback;
else
runtime->hw = acp6x_pcm_hardware_capture;
break;
default:
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
runtime->hw = acp_pcm_hardware_playback;
else
runtime->hw = acp_pcm_hardware_capture;
break;
}
ret = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, DMA_SIZE);
if (ret) {
dev_err(component->dev, "set hw constraint HW_PARAM_PERIOD_BYTES failed\n");
kfree(stream);
return ret;
}
ret = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, DMA_SIZE);
if (ret) {
dev_err(component->dev, "set hw constraint HW_PARAM_BUFFER_BYTES failed\n");
kfree(stream);
Annotation
- Immediate include surface: `linux/platform_device.h`, `linux/module.h`, `linux/err.h`, `linux/io.h`, `sound/pcm_params.h`, `sound/soc.h`, `sound/soc-dai.h`, `linux/dma-mapping.h`.
- Detected declarations: `struct snd_soc_dai_driver`, `function config_pte_for_stream`, `function config_acp_dma`, `function acp_dma_open`, `function acp_dma_hw_params`, `function acp_dma_pointer`, `function acp_dma_new`, `function acp_dma_close`, `function acp_platform_register`, `function acp_platform_unregister`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.