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.
- 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.hlinux/build_bug.hlinux/firmware/cirrus/cs_dsp.hlinux/firmware/cirrus/cs_dsp_test_utils.hlinux/firmware/cirrus/wmfw.hlinux/list.hlinux/random.hlinux/regmap.h
Detected Declarations
struct cs_dsp_test_localstruct cs_dsp_ctl_rw_test_paramfunction _find_alg_entryfunction _get_alg_mem_base_wordsfunction cs_dsp_ctl_write_runningfunction cs_dsp_ctl_read_volatile_runningfunction cs_dsp_ctl_read_volatile_not_startedfunction cs_dsp_ctl_read_volatile_stoppedfunction cs_dsp_ctl_read_volatile_stopped_powered_downfunction cs_dsp_ctl_read_volatile_not_current_loaded_fwfunction cs_dsp_ctl_read_volatile_not_current_running_fwfunction cs_dsp_ctl_write_volatile_not_startedfunction cs_dsp_ctl_write_volatile_stoppedfunction cs_dsp_ctl_write_volatile_stopped_powered_downfunction cs_dsp_ctl_write_volatile_not_current_loaded_fwfunction cs_dsp_ctl_write_volatile_not_current_running_fwfunction cs_dsp_ctl_read_with_seekfunction cs_dsp_ctl_read_with_seekfunction cs_dsp_ctl_read_truncatedfunction cs_dsp_ctl_read_truncatedfunction cs_dsp_ctl_write_with_seekfunction cs_dsp_ctl_write_with_seekfunction cs_dsp_ctl_write_truncatedfunction cs_dsp_ctl_write_truncatedfunction cs_dsp_ctl_read_with_seek_oobfunction cs_dsp_ctl_read_with_length_overflowfunction cs_dsp_ctl_read_with_seek_and_length_oobfunction cs_dsp_ctl_write_with_seek_oobfunction cs_dsp_ctl_write_with_length_overflowfunction cs_dsp_ctl_write_with_seek_and_length_oobfunction cs_dsp_ctl_read_from_writeonlyfunction cs_dsp_ctl_write_to_readonlyfunction cs_dsp_ctl_rw_test_common_initfunction cs_dsp_ctl_rw_test_halo_initfunction cs_dsp_ctl_rw_test_adsp2_32bit_initfunction cs_dsp_ctl_rw_test_adsp2_32bit_wmfw1_initfunction cs_dsp_ctl_rw_test_adsp2_32bit_wmfw2_initfunction cs_dsp_ctl_rw_test_adsp2_16bit_initfunction cs_dsp_ctl_rw_test_adsp2_16bit_wmfw1_initfunction cs_dsp_ctl_rw_test_adsp2_16bit_wmfw2_initfunction cs_dsp_ctl_all_param_desc
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
- Immediate include surface: `kunit/device.h`, `kunit/resource.h`, `kunit/test.h`, `linux/build_bug.h`, `linux/firmware/cirrus/cs_dsp.h`, `linux/firmware/cirrus/cs_dsp_test_utils.h`, `linux/firmware/cirrus/wmfw.h`, `linux/list.h`.
- Detected declarations: `struct cs_dsp_test_local`, `struct cs_dsp_ctl_rw_test_param`, `function _find_alg_entry`, `function _get_alg_mem_base_words`, `function cs_dsp_ctl_write_running`, `function cs_dsp_ctl_read_volatile_running`, `function cs_dsp_ctl_read_volatile_not_started`, `function cs_dsp_ctl_read_volatile_stopped`, `function cs_dsp_ctl_read_volatile_stopped_powered_down`, `function cs_dsp_ctl_read_volatile_not_current_loaded_fw`.
- 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.