sound/soc/spear/spdif_in.c
Source file repositories/reference/linux-study-clean/sound/soc/spear/spdif_in.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/spear/spdif_in.c- Extension
.c- Size
- 6721 bytes
- Lines
- 273
- 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/clk.hlinux/delay.hlinux/device.hlinux/kernel.hlinux/init.hlinux/io.hlinux/ioport.hlinux/module.hlinux/platform_device.hsound/dmaengine_pcm.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/spear_dma.hsound/spear_spdif.hspdif_in_regs.hspear_pcm.h
Detected Declarations
struct spdif_in_paramsstruct spdif_in_devfunction spdif_in_configurefunction spdif_in_dai_probefunction spdif_in_shutdownfunction spdif_in_formatfunction spdif_in_hw_paramsfunction spdif_in_triggerfunction spdif_in_irqfunction spdif_in_probe
Annotated Snippet
struct spdif_in_params {
u32 format;
};
struct spdif_in_dev {
struct clk *clk;
struct spear_dma_data dma_params;
struct spdif_in_params saved_params;
void *io_base;
struct device *dev;
void (*reset_perip)(void);
int irq;
struct snd_dmaengine_dai_dma_data dma_params_rx;
struct snd_dmaengine_pcm_config config;
};
static void spdif_in_configure(struct spdif_in_dev *host)
{
u32 ctrl = SPDIF_IN_PRTYEN | SPDIF_IN_STATEN | SPDIF_IN_USREN |
SPDIF_IN_VALEN | SPDIF_IN_BLKEN;
ctrl |= SPDIF_MODE_16BIT | SPDIF_FIFO_THRES_16;
writel(ctrl, host->io_base + SPDIF_IN_CTRL);
writel(0xF, host->io_base + SPDIF_IN_IRQ_MASK);
}
static int spdif_in_dai_probe(struct snd_soc_dai *dai)
{
struct spdif_in_dev *host = snd_soc_dai_get_drvdata(dai);
host->dma_params_rx.filter_data = &host->dma_params;
dai->capture_dma_data = &host->dma_params_rx;
return 0;
}
static void spdif_in_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct spdif_in_dev *host = snd_soc_dai_get_drvdata(dai);
if (substream->stream != SNDRV_PCM_STREAM_CAPTURE)
return;
writel(0x0, host->io_base + SPDIF_IN_IRQ_MASK);
}
static void spdif_in_format(struct spdif_in_dev *host, u32 format)
{
u32 ctrl = readl(host->io_base + SPDIF_IN_CTRL);
switch (format) {
case SNDRV_PCM_FORMAT_S16_LE:
ctrl |= SPDIF_XTRACT_16BIT;
break;
case SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE:
ctrl &= ~SPDIF_XTRACT_16BIT;
break;
}
writel(ctrl, host->io_base + SPDIF_IN_CTRL);
}
static int spdif_in_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
struct spdif_in_dev *host = snd_soc_dai_get_drvdata(dai);
u32 format;
if (substream->stream != SNDRV_PCM_STREAM_CAPTURE)
return -EINVAL;
format = params_format(params);
host->saved_params.format = format;
return 0;
}
static int spdif_in_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_dai *dai)
{
struct spdif_in_dev *host = snd_soc_dai_get_drvdata(dai);
u32 ctrl;
int ret = 0;
if (substream->stream != SNDRV_PCM_STREAM_CAPTURE)
return -EINVAL;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/device.h`, `linux/kernel.h`, `linux/init.h`, `linux/io.h`, `linux/ioport.h`, `linux/module.h`.
- Detected declarations: `struct spdif_in_params`, `struct spdif_in_dev`, `function spdif_in_configure`, `function spdif_in_dai_probe`, `function spdif_in_shutdown`, `function spdif_in_format`, `function spdif_in_hw_params`, `function spdif_in_trigger`, `function spdif_in_irq`, `function spdif_in_probe`.
- 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.