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.

Dependency Surface

Detected Declarations

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, &reg, 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

Implementation Notes