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.

Dependency Surface

Detected Declarations

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

Implementation Notes