sound/soc/cirrus/ep93xx-i2s.c
Source file repositories/reference/linux-study-clean/sound/soc/cirrus/ep93xx-i2s.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/cirrus/ep93xx-i2s.c- Extension
.c- Size
- 13633 bytes
- Lines
- 534
- 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/module.hlinux/init.hlinux/slab.hlinux/clk.hlinux/io.hlinux/of.hsound/core.hsound/dmaengine_pcm.hsound/pcm.hsound/pcm_params.hsound/initval.hsound/soc.hlinux/soc/cirrus/ep93xx.hep93xx-pcm.h
Detected Declarations
struct ep93xx_i2s_infofunction ep93xx_i2s_write_regfunction ep93xx_i2s_read_regfunction ep93xx_i2s_enablefunction ep93xx_i2s_disablefunction ep93xx_i2s_interruptfunction ep93xx_i2s_dai_probefunction ep93xx_i2s_startupfunction ep93xx_i2s_shutdownfunction ep93xx_i2s_set_dai_fmtfunction ep93xx_i2s_hw_paramsfunction ep93xx_i2s_set_sysclkfunction ep93xx_i2s_suspendfunction ep93xx_i2s_resumefunction ep93xx_i2s_probefunction ep93xx_i2s_remove
Annotated Snippet
struct ep93xx_i2s_info {
struct clk *mclk;
struct clk *sclk;
struct clk *lrclk;
void __iomem *regs;
struct snd_dmaengine_dai_dma_data dma_params_rx;
struct snd_dmaengine_dai_dma_data dma_params_tx;
};
static inline void ep93xx_i2s_write_reg(struct ep93xx_i2s_info *info,
unsigned reg, unsigned val)
{
__raw_writel(val, info->regs + reg);
}
static inline unsigned ep93xx_i2s_read_reg(struct ep93xx_i2s_info *info,
unsigned reg)
{
return __raw_readl(info->regs + reg);
}
static int ep93xx_i2s_enable(struct ep93xx_i2s_info *info, int stream)
{
unsigned base_reg;
int err;
if ((ep93xx_i2s_read_reg(info, EP93XX_I2S_TX0EN) & 0x1) == 0 &&
(ep93xx_i2s_read_reg(info, EP93XX_I2S_RX0EN) & 0x1) == 0) {
/* Enable clocks */
err = clk_prepare_enable(info->mclk);
if (err)
return err;
err = clk_prepare_enable(info->sclk);
if (err) {
clk_disable_unprepare(info->mclk);
return err;
}
err = clk_prepare_enable(info->lrclk);
if (err) {
clk_disable_unprepare(info->sclk);
clk_disable_unprepare(info->mclk);
return err;
}
/* Enable i2s */
ep93xx_i2s_write_reg(info, EP93XX_I2S_GLCTRL, 1);
}
/* Enable fifo */
if (stream == SNDRV_PCM_STREAM_PLAYBACK)
base_reg = EP93XX_I2S_TX0EN;
else
base_reg = EP93XX_I2S_RX0EN;
ep93xx_i2s_write_reg(info, base_reg, 1);
/* Enable TX IRQs (FIFO empty or underflow) */
if (IS_ENABLED(CONFIG_SND_EP93XX_SOC_I2S_WATCHDOG) &&
stream == SNDRV_PCM_STREAM_PLAYBACK)
ep93xx_i2s_write_reg(info, EP93XX_I2S_TXCTRL,
EP93XX_I2S_TXCTRL_TXEMPTY_LVL |
EP93XX_I2S_TXCTRL_TXUFIE);
return 0;
}
static void ep93xx_i2s_disable(struct ep93xx_i2s_info *info, int stream)
{
unsigned base_reg;
/* Disable IRQs */
if (IS_ENABLED(CONFIG_SND_EP93XX_SOC_I2S_WATCHDOG) &&
stream == SNDRV_PCM_STREAM_PLAYBACK)
ep93xx_i2s_write_reg(info, EP93XX_I2S_TXCTRL, 0);
/* Disable fifo */
if (stream == SNDRV_PCM_STREAM_PLAYBACK)
base_reg = EP93XX_I2S_TX0EN;
else
base_reg = EP93XX_I2S_RX0EN;
ep93xx_i2s_write_reg(info, base_reg, 0);
if ((ep93xx_i2s_read_reg(info, EP93XX_I2S_TX0EN) & 0x1) == 0 &&
(ep93xx_i2s_read_reg(info, EP93XX_I2S_RX0EN) & 0x1) == 0) {
/* Disable i2s */
ep93xx_i2s_write_reg(info, EP93XX_I2S_GLCTRL, 0);
/* Disable clocks */
clk_disable_unprepare(info->lrclk);
clk_disable_unprepare(info->sclk);
clk_disable_unprepare(info->mclk);
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/slab.h`, `linux/clk.h`, `linux/io.h`, `linux/of.h`, `sound/core.h`, `sound/dmaengine_pcm.h`.
- Detected declarations: `struct ep93xx_i2s_info`, `function ep93xx_i2s_write_reg`, `function ep93xx_i2s_read_reg`, `function ep93xx_i2s_enable`, `function ep93xx_i2s_disable`, `function ep93xx_i2s_interrupt`, `function ep93xx_i2s_dai_probe`, `function ep93xx_i2s_startup`, `function ep93xx_i2s_shutdown`, `function ep93xx_i2s_set_dai_fmt`.
- 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.