drivers/firmware/cirrus/test/cs_dsp_test_control_rw.c

Source file repositories/reference/linux-study-clean/drivers/firmware/cirrus/test/cs_dsp_test_control_rw.c

File Facts

System
Linux kernel
Corpus path
drivers/firmware/cirrus/test/cs_dsp_test_control_rw.c
Extension
.c
Size
101680 bytes
Lines
2675
Domain
Driver Families
Bucket
drivers/firmware
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 cs_dsp_test_local {
	struct cs_dsp_mock_xm_header *xm_header;
	struct cs_dsp_mock_wmfw_builder *wmfw_builder;
	int wmfw_version;
};

struct cs_dsp_ctl_rw_test_param {
	int mem_type;
	int alg_id;
	unsigned int offs_words;
	unsigned int len_bytes;
	u16 ctl_type;
	u16 flags;
};

static const struct cs_dsp_mock_alg_def cs_dsp_ctl_rw_test_algs[] = {
	{
		.id = 0xfafa,
		.ver = 0x100000,
		.xm_base_words = 60,
		.xm_size_words = 1000,
		.ym_base_words = 0,
		.ym_size_words = 1000,
		.zm_base_words = 0,
		.zm_size_words = 1000,
	},
	{
		.id = 0xb,
		.ver = 0x100001,
		.xm_base_words = 1060,
		.xm_size_words = 1000,
		.ym_base_words = 1000,
		.ym_size_words = 1000,
		.zm_base_words = 1000,
		.zm_size_words = 1000,
	},
	{
		.id = 0x9f1234,
		.ver = 0x100500,
		.xm_base_words = 2060,
		.xm_size_words = 32,
		.ym_base_words = 2000,
		.ym_size_words = 32,
		.zm_base_words = 2000,
		.zm_size_words = 32,
	},
	{
		.id = 0xff00ff,
		.ver = 0x300113,
		.xm_base_words = 2100,
		.xm_size_words = 32,
		.ym_base_words = 2032,
		.ym_size_words = 32,
		.zm_base_words = 2032,
		.zm_size_words = 32,
	},
};

static const struct cs_dsp_mock_coeff_def mock_coeff_template = {
	.shortname = "Dummy Coeff",
	.type = WMFW_CTL_TYPE_BYTES,
	.mem_type = WMFW_ADSP2_YM,
	.flags = WMFW_CTL_FLAG_READABLE | WMFW_CTL_FLAG_WRITEABLE,
	.length_bytes = 4,
};

static int _find_alg_entry(struct kunit *test, unsigned int alg_id)
{
	int i;

	for (i = 0; i < ARRAY_SIZE(cs_dsp_ctl_rw_test_algs); ++i) {
		if (cs_dsp_ctl_rw_test_algs[i].id == alg_id)
			break;
	}

	KUNIT_ASSERT_LT(test, i, ARRAY_SIZE(cs_dsp_ctl_rw_test_algs));

	return i;
}

static int _get_alg_mem_base_words(struct kunit *test, int alg_index, int mem_type)
{
	switch (mem_type) {
	case WMFW_ADSP2_XM:
		return cs_dsp_ctl_rw_test_algs[alg_index].xm_base_words;
	case WMFW_ADSP2_YM:
		return cs_dsp_ctl_rw_test_algs[alg_index].ym_base_words;
	case WMFW_ADSP2_ZM:
		return cs_dsp_ctl_rw_test_algs[alg_index].zm_base_words;
	default:

Annotation

Implementation Notes