sound/soc/intel/catpt/pcm.c

Source file repositories/reference/linux-study-clean/sound/soc/intel/catpt/pcm.c

File Facts

System
Linux kernel
Corpus path
sound/soc/intel/catpt/pcm.c
Extension
.c
Size
29267 bytes
Lines
1091
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 catpt_stream_template {
	enum catpt_path_id path_id;
	enum catpt_stream_type type;
	u32 persistent_size;
	u8 num_entries;
	struct catpt_module_entry entries[];
};

static struct catpt_stream_template system_pb = {
	.path_id = CATPT_PATH_SSP0_OUT,
	.type = CATPT_STRM_TYPE_SYSTEM,
	.num_entries = 1,
	.entries = {{ CATPT_MODID_PCM_SYSTEM, 0 }},
};

static struct catpt_stream_template system_cp = {
	.path_id = CATPT_PATH_SSP0_IN,
	.type = CATPT_STRM_TYPE_CAPTURE,
	.num_entries = 1,
	.entries = {{ CATPT_MODID_PCM_CAPTURE, 0 }},
};

static struct catpt_stream_template offload_pb = {
	.path_id = CATPT_PATH_SSP0_OUT,
	.type = CATPT_STRM_TYPE_RENDER,
	.num_entries = 1,
	.entries = {{ CATPT_MODID_PCM, 0 }},
};

static struct catpt_stream_template loopback_cp = {
	.path_id = CATPT_PATH_SSP0_OUT,
	.type = CATPT_STRM_TYPE_LOOPBACK,
	.num_entries = 1,
	.entries = {{ CATPT_MODID_PCM_REFERENCE, 0 }},
};

static struct catpt_stream_template bluetooth_pb = {
	.path_id = CATPT_PATH_SSP1_OUT,
	.type = CATPT_STRM_TYPE_BLUETOOTH_RENDER,
	.num_entries = 1,
	.entries = {{ CATPT_MODID_BLUETOOTH_RENDER, 0 }},
};

static struct catpt_stream_template bluetooth_cp = {
	.path_id = CATPT_PATH_SSP1_IN,
	.type = CATPT_STRM_TYPE_BLUETOOTH_CAPTURE,
	.num_entries = 1,
	.entries = {{ CATPT_MODID_BLUETOOTH_CAPTURE, 0 }},
};

static struct catpt_stream_template *catpt_topology[] = {
	[CATPT_STRM_TYPE_RENDER]		= &offload_pb,
	[CATPT_STRM_TYPE_SYSTEM]		= &system_pb,
	[CATPT_STRM_TYPE_CAPTURE]		= &system_cp,
	[CATPT_STRM_TYPE_LOOPBACK]		= &loopback_cp,
	[CATPT_STRM_TYPE_BLUETOOTH_RENDER]	= &bluetooth_pb,
	[CATPT_STRM_TYPE_BLUETOOTH_CAPTURE]	= &bluetooth_cp,
};

static struct catpt_stream_template *
catpt_get_stream_template(struct snd_pcm_substream *substream)
{
	struct snd_soc_pcm_runtime *rtm = snd_soc_substream_to_rtd(substream);
	struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtm, 0);
	enum catpt_stream_type type;

	type = cpu_dai->driver->id;

	/* account for capture in bidirectional dais */
	switch (type) {
	case CATPT_STRM_TYPE_SYSTEM:
		if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
			type = CATPT_STRM_TYPE_CAPTURE;
		break;
	case CATPT_STRM_TYPE_BLUETOOTH_RENDER:
		if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
			type = CATPT_STRM_TYPE_BLUETOOTH_CAPTURE;
		break;
	default:
		break;
	}

	return catpt_topology[type];
}

/* Caller responsible for holding ->stream_mutex. */
struct catpt_stream_runtime *catpt_stream_find(struct catpt_dev *cdev, u8 stream_hw_id)
{
	struct catpt_stream_runtime *stream;

Annotation

Implementation Notes