sound/soc/img/img-i2s-out.c
Source file repositories/reference/linux-study-clean/sound/soc/img/img-i2s-out.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/img/img-i2s-out.c- Extension
.c- Size
- 15742 bytes
- Lines
- 614
- 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.
- 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/init.hlinux/kernel.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/pm_runtime.hlinux/reset.hsound/core.hsound/dmaengine_pcm.hsound/initval.hsound/pcm.hsound/pcm_params.hsound/soc.h
Detected Declarations
struct img_i2s_outfunction img_i2s_out_runtime_suspendfunction img_i2s_out_runtime_resumefunction img_i2s_out_writelfunction img_i2s_out_readlfunction img_i2s_out_ch_writelfunction img_i2s_out_ch_readlfunction img_i2s_out_ch_disablefunction img_i2s_out_ch_enablefunction img_i2s_out_disablefunction img_i2s_out_enablefunction img_i2s_out_resetfunction img_i2s_out_triggerfunction img_i2s_out_hw_paramsfunction img_i2s_out_set_fmtfunction img_i2s_out_dai_probefunction img_i2s_out_dma_prepare_slave_configfunction img_i2s_out_probefunction img_i2s_out_dev_removefunction img_i2s_out_suspendfunction img_i2s_out_resume
Annotated Snippet
struct img_i2s_out {
void __iomem *base;
struct clk *clk_sys;
struct clk *clk_ref;
struct snd_dmaengine_dai_dma_data dma_data;
struct device *dev;
unsigned int max_i2s_chan;
void __iomem *channel_base;
bool force_clk_active;
unsigned int active_channels;
struct reset_control *rst;
struct snd_soc_dai_driver dai_driver;
u32 suspend_ctl;
u32 *suspend_ch_ctl;
};
static int img_i2s_out_runtime_suspend(struct device *dev)
{
struct img_i2s_out *i2s = dev_get_drvdata(dev);
clk_disable_unprepare(i2s->clk_ref);
clk_disable_unprepare(i2s->clk_sys);
return 0;
}
static int img_i2s_out_runtime_resume(struct device *dev)
{
struct img_i2s_out *i2s = dev_get_drvdata(dev);
int ret;
ret = clk_prepare_enable(i2s->clk_sys);
if (ret) {
dev_err(dev, "clk_enable failed: %d\n", ret);
return ret;
}
ret = clk_prepare_enable(i2s->clk_ref);
if (ret) {
dev_err(dev, "clk_enable failed: %d\n", ret);
clk_disable_unprepare(i2s->clk_sys);
return ret;
}
return 0;
}
static inline void img_i2s_out_writel(struct img_i2s_out *i2s, u32 val,
u32 reg)
{
writel(val, i2s->base + reg);
}
static inline u32 img_i2s_out_readl(struct img_i2s_out *i2s, u32 reg)
{
return readl(i2s->base + reg);
}
static inline void img_i2s_out_ch_writel(struct img_i2s_out *i2s,
u32 chan, u32 val, u32 reg)
{
writel(val, i2s->channel_base + (chan * IMG_I2S_OUT_CH_STRIDE) + reg);
}
static inline u32 img_i2s_out_ch_readl(struct img_i2s_out *i2s, u32 chan,
u32 reg)
{
return readl(i2s->channel_base + (chan * IMG_I2S_OUT_CH_STRIDE) + reg);
}
static inline void img_i2s_out_ch_disable(struct img_i2s_out *i2s, u32 chan)
{
u32 reg;
reg = img_i2s_out_ch_readl(i2s, chan, IMG_I2S_OUT_CH_CTL);
reg &= ~IMG_I2S_OUT_CHAN_CTL_ME_MASK;
img_i2s_out_ch_writel(i2s, chan, reg, IMG_I2S_OUT_CH_CTL);
}
static inline void img_i2s_out_ch_enable(struct img_i2s_out *i2s, u32 chan)
{
u32 reg;
reg = img_i2s_out_ch_readl(i2s, chan, IMG_I2S_OUT_CH_CTL);
reg |= IMG_I2S_OUT_CHAN_CTL_ME_MASK;
img_i2s_out_ch_writel(i2s, chan, reg, IMG_I2S_OUT_CH_CTL);
}
static inline void img_i2s_out_disable(struct img_i2s_out *i2s)
{
Annotation
- Immediate include surface: `linux/clk.h`, `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/pm_runtime.h`, `linux/reset.h`.
- Detected declarations: `struct img_i2s_out`, `function img_i2s_out_runtime_suspend`, `function img_i2s_out_runtime_resume`, `function img_i2s_out_writel`, `function img_i2s_out_readl`, `function img_i2s_out_ch_writel`, `function img_i2s_out_ch_readl`, `function img_i2s_out_ch_disable`, `function img_i2s_out_ch_enable`, `function img_i2s_out_disable`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
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.