drivers/firmware/cirrus/test/cs_dsp_test_callbacks.c

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

File Facts

System
Linux kernel
Corpus path
drivers/firmware/cirrus/test/cs_dsp_test_callbacks.c
Extension
.c
Size
21312 bytes
Lines
690
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_wmfw_builder *wmfw_builder;

	int num_control_add;
	int num_control_remove;
	int num_pre_run;
	int num_post_run;
	int num_pre_stop;
	int num_post_stop;
	int num_watchdog_expired;

	struct cs_dsp_coeff_ctl *passed_ctl[16];
	struct cs_dsp *passed_dsp;
};

struct cs_dsp_callbacks_test_param {
	const struct cs_dsp_client_ops *ops;
	const char *case_name;
};

static const struct cs_dsp_mock_alg_def cs_dsp_callbacks_test_mock_algs[] = {
	{
		.id = 0xfafa,
		.ver = 0x100000,
		.xm_size_words = 164,
		.ym_size_words = 164,
		.zm_size_words = 164,
	},
};

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_VOLATILE,
	.length_bytes = 4,
};

static int cs_dsp_test_control_add_callback(struct cs_dsp_coeff_ctl *ctl)
{
	struct kunit *test = kunit_get_current_test();
	struct cs_dsp_test *priv = test->priv;
	struct cs_dsp_test_local *local = priv->local;

	local->passed_ctl[local->num_control_add] = ctl;
	local->num_control_add++;

	return 0;
}

static void cs_dsp_test_control_remove_callback(struct cs_dsp_coeff_ctl *ctl)
{
	struct kunit *test = kunit_get_current_test();
	struct cs_dsp_test *priv = test->priv;
	struct cs_dsp_test_local *local = priv->local;

	local->passed_ctl[local->num_control_remove] = ctl;
	local->num_control_remove++;
}

static int cs_dsp_test_pre_run_callback(struct cs_dsp *dsp)
{
	struct kunit *test = kunit_get_current_test();
	struct cs_dsp_test *priv = test->priv;
	struct cs_dsp_test_local *local = priv->local;

	local->passed_dsp = dsp;
	local->num_pre_run++;

	return 0;
}

static int cs_dsp_test_post_run_callback(struct cs_dsp *dsp)
{
	struct kunit *test = kunit_get_current_test();
	struct cs_dsp_test *priv = test->priv;
	struct cs_dsp_test_local *local = priv->local;

	local->passed_dsp = dsp;
	local->num_post_run++;

	return 0;
}

static void cs_dsp_test_pre_stop_callback(struct cs_dsp *dsp)
{
	struct kunit *test = kunit_get_current_test();
	struct cs_dsp_test *priv = test->priv;
	struct cs_dsp_test_local *local = priv->local;

Annotation

Implementation Notes