sound/soc/kirkwood/kirkwood-dma.c
Source file repositories/reference/linux-study-clean/sound/soc/kirkwood/kirkwood-dma.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/kirkwood/kirkwood-dma.c- Extension
.c- Size
- 7371 bytes
- Lines
- 266
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/module.hlinux/device.hlinux/io.hlinux/slab.hlinux/interrupt.hlinux/dma-mapping.hlinux/mbus.hsound/soc.hkirkwood.h
Detected Declarations
function kirkwood_dma_irqfunction kirkwood_dma_conf_mbus_windowsfunction kirkwood_dma_openfunction kirkwood_dma_closefunction kirkwood_dma_hw_paramsfunction kirkwood_dma_preparefunction kirkwood_dma_pointerfunction kirkwood_dma_new
Annotated Snippet
if ((cs->base & 0xffff0000) < (dma & 0xffff0000)) {
writel(cs->base & 0xffff0000,
base + KIRKWOOD_AUDIO_WIN_BASE_REG(win));
writel(((cs->size - 1) & 0xffff0000) |
(cs->mbus_attr << 8) |
(dram->mbus_dram_target_id << 4) | 1,
base + KIRKWOOD_AUDIO_WIN_CTRL_REG(win));
}
}
}
static int kirkwood_dma_open(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
int err;
struct snd_pcm_runtime *runtime = substream->runtime;
struct kirkwood_dma_data *priv = kirkwood_priv(substream);
snd_soc_set_runtime_hwparams(substream, &kirkwood_dma_snd_hw);
/* Ensure that all constraints linked to dma burst are fulfilled */
err = snd_pcm_hw_constraint_minmax(runtime,
SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
priv->burst * 2,
KIRKWOOD_AUDIO_BUF_MAX-1);
if (err < 0)
return err;
err = snd_pcm_hw_constraint_step(runtime, 0,
SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
priv->burst);
if (err < 0)
return err;
err = snd_pcm_hw_constraint_step(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
priv->burst);
if (err < 0)
return err;
if (!priv->substream_play && !priv->substream_rec) {
err = request_irq(priv->irq, kirkwood_dma_irq, IRQF_SHARED,
"kirkwood-i2s", priv);
if (err)
return err;
/*
* Enable Error interrupts. We're only ack'ing them but
* it's useful for diagnostics
*/
writel((unsigned int)-1, priv->io + KIRKWOOD_ERR_MASK);
}
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
if (priv->substream_play)
return -EBUSY;
priv->substream_play = substream;
} else {
if (priv->substream_rec)
return -EBUSY;
priv->substream_rec = substream;
}
return 0;
}
static int kirkwood_dma_close(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
struct kirkwood_dma_data *priv = kirkwood_priv(substream);
if (!priv)
return 0;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
priv->substream_play = NULL;
else
priv->substream_rec = NULL;
if (!priv->substream_play && !priv->substream_rec) {
writel(0, priv->io + KIRKWOOD_ERR_MASK);
free_irq(priv->irq, priv);
}
return 0;
}
static int kirkwood_dma_hw_params(struct snd_soc_component *component,
struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
Annotation
- Immediate include surface: `linux/init.h`, `linux/module.h`, `linux/device.h`, `linux/io.h`, `linux/slab.h`, `linux/interrupt.h`, `linux/dma-mapping.h`, `linux/mbus.h`.
- Detected declarations: `function kirkwood_dma_irq`, `function kirkwood_dma_conf_mbus_windows`, `function kirkwood_dma_open`, `function kirkwood_dma_close`, `function kirkwood_dma_hw_params`, `function kirkwood_dma_prepare`, `function kirkwood_dma_pointer`, `function kirkwood_dma_new`.
- 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.