sound/soc/renesas/siu_dai.c
Source file repositories/reference/linux-study-clean/sound/soc/renesas/siu_dai.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/renesas/siu_dai.c- Extension
.c- Size
- 19676 bytes
- Lines
- 801
- 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/delay.hlinux/firmware.hlinux/pm_runtime.hlinux/slab.hlinux/module.hasm/clock.hasm/siu.hsound/control.hsound/soc.hsiu.h
Detected Declarations
struct format_flagstruct port_flagfunction siu_dai_startfunction siu_dai_stopfunction siu_dai_spbAselectfunction siu_dai_spbBselectfunction siu_dai_openfunction siu_dai_pcmdatapackfunction siu_dai_spbstartfunction siu_dai_spbstopfunction siu_dai_info_volumefunction siu_dai_get_volumefunction siu_dai_put_volumefunction siu_init_portfunction siu_free_portfunction siu_dai_startupfunction siu_dai_shutdownfunction siu_dai_preparefunction siu_dai_set_fmtfunction siu_dai_set_sysclkfunction siu_probefunction siu_remove
Annotated Snippet
struct format_flag {
u32 i2s;
u32 pcm;
u32 spdif;
u32 mask;
};
struct port_flag {
struct format_flag playback;
struct format_flag capture;
};
struct siu_info *siu_i2s_data;
static struct port_flag siu_flags[SIU_PORT_NUM] = {
[SIU_PORT_A] = {
.playback = {
.i2s = 0x50000000,
.pcm = 0x40000000,
.spdif = 0x80000000, /* not on all SIU versions */
.mask = 0xd0000000,
},
.capture = {
.i2s = 0x05000000,
.pcm = 0x04000000,
.spdif = 0x08000000,
.mask = 0x0d000000,
},
},
[SIU_PORT_B] = {
.playback = {
.i2s = 0x00500000,
.pcm = 0x00400000,
.spdif = 0, /* impossible - turn off */
.mask = 0x00500000,
},
.capture = {
.i2s = 0x00050000,
.pcm = 0x00040000,
.spdif = 0, /* impossible - turn off */
.mask = 0x00050000,
},
},
};
static void siu_dai_start(struct siu_port *port_info)
{
struct siu_info *info = siu_i2s_data;
u32 __iomem *base = info->reg;
dev_dbg(port_info->pcm->card->dev, "%s\n", __func__);
/* Issue software reset to siu */
siu_write32(base + SIU_SRCTL, 0);
/* Wait for the reset to take effect */
udelay(1);
port_info->stfifo = 0;
port_info->trdat = 0;
/* portA, portB, SIU operate */
siu_write32(base + SIU_SRCTL, 0x301);
/* portA=256fs, portB=256fs */
siu_write32(base + SIU_CKCTL, 0x40400000);
/* portA's BRG does not divide SIUCKA */
siu_write32(base + SIU_BRGASEL, 0);
siu_write32(base + SIU_BRRA, 0);
/* portB's BRG divides SIUCKB by half */
siu_write32(base + SIU_BRGBSEL, 1);
siu_write32(base + SIU_BRRB, 0);
siu_write32(base + SIU_IFCTL, 0x44440000);
/* portA: 32 bit/fs, master; portB: 32 bit/fs, master */
siu_write32(base + SIU_SFORM, 0x0c0c0000);
/*
* Volume levels: looks like the DSP firmware implements volume controls
* differently from what's described in the datasheet
*/
siu_write32(base + SIU_SBDVCA, port_info->playback.volume);
siu_write32(base + SIU_SBDVCB, port_info->capture.volume);
}
static void siu_dai_stop(struct siu_port *port_info)
{
Annotation
- Immediate include surface: `linux/delay.h`, `linux/firmware.h`, `linux/pm_runtime.h`, `linux/slab.h`, `linux/module.h`, `asm/clock.h`, `asm/siu.h`, `sound/control.h`.
- Detected declarations: `struct format_flag`, `struct port_flag`, `function siu_dai_start`, `function siu_dai_stop`, `function siu_dai_spbAselect`, `function siu_dai_spbBselect`, `function siu_dai_open`, `function siu_dai_pcmdatapack`, `function siu_dai_spbstart`, `function siu_dai_spbstop`.
- 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.