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.
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
kunit/device.hkunit/resource.hkunit/test.hkunit/test-bug.hlinux/build_bug.hlinux/firmware/cirrus/cs_dsp.hlinux/firmware/cirrus/cs_dsp_test_utils.hlinux/firmware/cirrus/wmfw.hlinux/random.hlinux/regmap.hlinux/string.hlinux/vmalloc.h
Detected Declarations
struct cs_dsp_test_localstruct cs_dsp_callbacks_test_paramfunction cs_dsp_test_control_add_callbackfunction cs_dsp_test_control_remove_callbackfunction cs_dsp_test_pre_run_callbackfunction cs_dsp_test_post_run_callbackfunction cs_dsp_test_pre_stop_callbackfunction cs_dsp_test_post_stop_callbackfunction cs_dsp_test_watchdog_expired_callbackfunction cs_dsp_test_run_stop_callbacksfunction cs_dsp_test_ctl_v1_callbacksfunction cs_dsp_test_ctl_v2_callbacksfunction cs_dsp_test_no_callbacksfunction cs_dsp_test_adsp2v2_watchdog_callbackfunction cs_dsp_test_adsp2v2_watchdog_no_callbacksfunction cs_dsp_test_halo_watchdog_callbackfunction cs_dsp_test_halo_watchdog_no_callbacksfunction cs_dsp_callbacks_test_common_initfunction cs_dsp_callbacks_test_halo_initfunction cs_dsp_callbacks_test_adsp2_32bit_initfunction cs_dsp_callbacks_test_adsp2v2_32bit_initfunction cs_dsp_callbacks_test_adsp2v1_32bit_initfunction cs_dsp_callbacks_test_adsp2_16bit_initfunction cs_dsp_callbacks_param_desc
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
- Immediate include surface: `kunit/device.h`, `kunit/resource.h`, `kunit/test.h`, `kunit/test-bug.h`, `linux/build_bug.h`, `linux/firmware/cirrus/cs_dsp.h`, `linux/firmware/cirrus/cs_dsp_test_utils.h`, `linux/firmware/cirrus/wmfw.h`.
- Detected declarations: `struct cs_dsp_test_local`, `struct cs_dsp_callbacks_test_param`, `function cs_dsp_test_control_add_callback`, `function cs_dsp_test_control_remove_callback`, `function cs_dsp_test_pre_run_callback`, `function cs_dsp_test_post_run_callback`, `function cs_dsp_test_pre_stop_callback`, `function cs_dsp_test_post_stop_callback`, `function cs_dsp_test_watchdog_expired_callback`, `function cs_dsp_test_run_stop_callbacks`.
- Atlas domain: Driver Families / drivers/firmware.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.