drivers/firmware/cirrus/cs_dsp.c
Source file repositories/reference/linux-study-clean/drivers/firmware/cirrus/cs_dsp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/cirrus/cs_dsp.c- Extension
.c- Size
- 102286 bytes
- Lines
- 3838
- Domain
- Driver Families
- Bucket
- drivers/firmware
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/static_stub.hkunit/visibility.hlinux/cleanup.hlinux/ctype.hlinux/debugfs.hlinux/delay.hlinux/math.hlinux/minmax.hlinux/module.hlinux/moduleparam.hlinux/ratelimit.hlinux/seq_file.hlinux/slab.hlinux/vmalloc.hlinux/firmware/cirrus/cs_dsp.hlinux/firmware/cirrus/wmfw.hcs_dsp.h
Detected Declarations
struct cs_dsp_opsstruct cs_dsp_alg_region_list_itemstruct cs_dsp_coeff_parsed_algstruct cs_dsp_coeff_parsed_coeffstruct cs_dsp_wseq_opfunction Copyrightfunction cs_dsp_mem_region_namefunction cs_dsp_debugfs_save_wmfwnamefunction cs_dsp_debugfs_save_binnamefunction cs_dsp_debugfs_clearfunction cs_dsp_debugfs_string_readfunction scoped_guardfunction cs_dsp_debugfs_wmfw_readfunction cs_dsp_debugfs_bin_readfunction cs_dsp_debugfs_read_controls_showfunction list_for_each_entryfunction cs_dsp_init_debugfsfunction cs_dsp_cleanup_debugfsfunction cs_dsp_init_debugfsfunction cs_dsp_cleanup_debugfsfunction cs_dsp_debugfs_save_wmfwnamefunction cs_dsp_region_to_regfunction cs_dsp_halo_region_to_regfunction cs_dsp_read_fw_statusfunction cs_dsp_adsp2_show_fw_statusfunction cs_dsp_adsp2v2_show_fw_statusfunction cs_dsp_halo_show_fw_statusfunction cs_dsp_coeff_base_regfunction cs_dsp_coeff_write_acked_controlfunction cs_dsp_coeff_write_ctrl_rawfunction cs_dsp_coeff_write_ctrlfunction cs_dsp_coeff_lock_and_write_ctrlfunction cs_dsp_coeff_read_ctrl_rawfunction cs_dsp_coeff_read_ctrlfunction cs_dsp_coeff_lock_and_read_ctrlfunction cs_dsp_coeff_init_control_cachesfunction list_for_each_entryfunction cs_dsp_coeff_sync_controlsfunction list_for_each_entryfunction cs_dsp_signal_event_controlsfunction list_for_each_entryfunction cs_dsp_free_ctl_blkfunction cs_dsp_create_controlfunction list_for_each_entryfunction cs_dsp_hibernatefunction cs_dsp_coeff_parse_stringfunction cs_dsp_coeff_parse_intfunction cs_dsp_coeff_parse_alg
Annotated Snippet
const struct file_operations fops;
} cs_dsp_debugfs_fops[] = {
{
.name = "wmfw_file_name",
.fops = {
.open = simple_open,
.read = cs_dsp_debugfs_wmfw_read,
},
},
{
.name = "bin_file_name",
.fops = {
.open = simple_open,
.read = cs_dsp_debugfs_bin_read,
},
},
};
static int cs_dsp_coeff_base_reg(struct cs_dsp_coeff_ctl *ctl, unsigned int *reg,
unsigned int off);
static int cs_dsp_debugfs_read_controls_show(struct seq_file *s, void *ignored)
{
struct cs_dsp *dsp = s->private;
struct cs_dsp_coeff_ctl *ctl;
unsigned int reg;
guard(mutex)(&dsp->pwr_lock);
list_for_each_entry(ctl, &dsp->ctl_list, list) {
cs_dsp_coeff_base_reg(ctl, ®, 0);
seq_printf(s, "%22.*s: %#8x %s:%08x %#8x %s %#8x %#4x %c%c%c%c %s %s\n",
ctl->subname_len, ctl->subname, ctl->len,
cs_dsp_mem_region_name(ctl->alg_region.type),
ctl->offset, reg, ctl->fw_name, ctl->alg_region.alg, ctl->type,
ctl->flags & WMFW_CTL_FLAG_VOLATILE ? 'V' : '-',
ctl->flags & WMFW_CTL_FLAG_SYS ? 'S' : '-',
ctl->flags & WMFW_CTL_FLAG_READABLE ? 'R' : '-',
ctl->flags & WMFW_CTL_FLAG_WRITEABLE ? 'W' : '-',
ctl->enabled ? "enabled" : "disabled",
ctl->set ? "dirty" : "clean");
}
return 0;
}
DEFINE_SHOW_ATTRIBUTE(cs_dsp_debugfs_read_controls);
/**
* cs_dsp_init_debugfs() - Create and populate DSP representation in debugfs
* @dsp: pointer to DSP structure
* @debugfs_root: pointer to debugfs directory in which to create this DSP
* representation
*/
void cs_dsp_init_debugfs(struct cs_dsp *dsp, struct dentry *debugfs_root)
{
struct dentry *root = NULL;
int i;
root = debugfs_create_dir(dsp->name, debugfs_root);
debugfs_create_bool("booted", 0444, root, &dsp->booted);
debugfs_create_bool("running", 0444, root, &dsp->running);
debugfs_create_bool("hibernating", 0444, root, &dsp->hibernating);
debugfs_create_x32("fw_id", 0444, root, &dsp->fw_id);
debugfs_create_x32("fw_version", 0444, root, &dsp->fw_id_version);
for (i = 0; i < ARRAY_SIZE(cs_dsp_debugfs_fops); ++i)
debugfs_create_file(cs_dsp_debugfs_fops[i].name, 0444, root,
dsp, &cs_dsp_debugfs_fops[i].fops);
debugfs_create_file("controls", 0444, root, dsp,
&cs_dsp_debugfs_read_controls_fops);
dsp->debugfs_root = root;
}
EXPORT_SYMBOL_NS_GPL(cs_dsp_init_debugfs, "FW_CS_DSP");
/**
* cs_dsp_cleanup_debugfs() - Removes DSP representation from debugfs
* @dsp: pointer to DSP structure
*/
void cs_dsp_cleanup_debugfs(struct cs_dsp *dsp)
{
cs_dsp_debugfs_clear(dsp);
debugfs_remove_recursive(dsp->debugfs_root);
dsp->debugfs_root = ERR_PTR(-ENODEV);
}
EXPORT_SYMBOL_NS_GPL(cs_dsp_cleanup_debugfs, "FW_CS_DSP");
#else
void cs_dsp_init_debugfs(struct cs_dsp *dsp, struct dentry *debugfs_root)
Annotation
- Immediate include surface: `kunit/static_stub.h`, `kunit/visibility.h`, `linux/cleanup.h`, `linux/ctype.h`, `linux/debugfs.h`, `linux/delay.h`, `linux/math.h`, `linux/minmax.h`.
- Detected declarations: `struct cs_dsp_ops`, `struct cs_dsp_alg_region_list_item`, `struct cs_dsp_coeff_parsed_alg`, `struct cs_dsp_coeff_parsed_coeff`, `struct cs_dsp_wseq_op`, `function Copyright`, `function cs_dsp_mem_region_name`, `function cs_dsp_debugfs_save_wmfwname`, `function cs_dsp_debugfs_save_binname`, `function cs_dsp_debugfs_clear`.
- Atlas domain: Driver Families / drivers/firmware.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.