sound/pci/ctxfi/ctdaio.c

Source file repositories/reference/linux-study-clean/sound/pci/ctxfi/ctdaio.c

File Facts

System
Linux kernel
Corpus path
sound/pci/ctxfi/ctdaio.c
Extension
.c
Size
16660 bytes
Lines
744
Domain
Driver Families
Bucket
sound/pci
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 daio_usage {
	unsigned short data;
};

struct daio_rsc_idx {
	unsigned short left;
	unsigned short right;
};

static const struct daio_rsc_idx idx_20k1[NUM_DAIOTYP] = {
	[LINEO1] = {.left = 0x00, .right = 0x01},
	[LINEO2] = {.left = 0x18, .right = 0x19},
	[LINEO3] = {.left = 0x08, .right = 0x09},
	[LINEO4] = {.left = 0x10, .right = 0x11},
	[LINEIM] = {.left = 0x1b5, .right = 0x1bd},
	[SPDIFOO] = {.left = 0x20, .right = 0x21},
	[SPDIFIO] = {.left = 0x15, .right = 0x1d},
	[SPDIFI_BAY] = {.left = 0x95, .right = 0x9d},
};

static const struct daio_rsc_idx idx_20k2[NUM_DAIOTYP] = {
	[LINEO1] = {.left = 0x40, .right = 0x41},
	[LINEO2] = {.left = 0x60, .right = 0x61},
	[LINEO3] = {.left = 0x50, .right = 0x51},
	[LINEO4] = {.left = 0x70, .right = 0x71},
	[LINEIM] = {.left = 0x45, .right = 0xc5},
	[MIC]	 = {.left = 0x55, .right = 0xd5},
	[RCA]	 = {.left = 0x30, .right = 0x31},
	[SPDIFOO] = {.left = 0x00, .right = 0x01},
	[SPDIFIO] = {.left = 0x05, .right = 0x85},
};

static void daio_master(struct rsc *rsc)
{
	/* Actually, this is not the resource index of DAIO.
	 * For DAO, it is the input mapper index. And, for DAI,
	 * it is the output time-slot index. */
	rsc->conj = rsc->idx;
}

static int daio_index(const struct rsc *rsc)
{
	return rsc->conj;
}

static void daio_out_next_conj(struct rsc *rsc)
{
	rsc->conj += 2;
}

static void daio_in_next_conj_20k1(struct rsc *rsc)
{
	rsc->conj += 0x200;
}

static void daio_in_next_conj_20k2(struct rsc *rsc)
{
	rsc->conj += 0x100;
}

static const struct rsc_ops daio_out_rsc_ops = {
	.master		= daio_master,
	.next_conj	= daio_out_next_conj,
	.index		= daio_index,
	.output_slot	= NULL,
};

static const struct rsc_ops daio_in_rsc_ops_20k1 = {
	.master		= daio_master,
	.next_conj	= daio_in_next_conj_20k1,
	.index		= NULL,
	.output_slot	= daio_index,
};

static const struct rsc_ops daio_in_rsc_ops_20k2 = {
	.master		= daio_master,
	.next_conj	= daio_in_next_conj_20k2,
	.index		= NULL,
	.output_slot	= daio_index,
};

static int daio_device_index(enum DAIOTYP type, struct hw *hw)
{
	switch (hw->chip_type) {
	case ATC20K1:
		switch (type) {
		case SPDIFOO:	return 0;
		case SPDIFIO:	return 0;
		case SPDIFI_BAY:	return 1;
		case LINEO1:	return 4;

Annotation

Implementation Notes