Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

firmware: cs_dsp: Add a debugfs entry containing control details

The file named 'controls' in the DSP's debugfs root contains a
formatted table describing the controls defined within the loaded DSP
firmware, it is of the form

name: len region:offset addr fwname algid ctltype flags en dirty

Where flags is represented as a character for each flag if set, or '-',
enabled is whether the control is enabled or disabled and dirty is
whether the control value is set in the cache but not the hardware.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230328131018.6820-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Simon Trimmer and committed by
Mark Brown
7a3f924c a4d432e9

+31
+31
drivers/firmware/cirrus/cs_dsp.c
··· 14 14 #include <linux/delay.h> 15 15 #include <linux/module.h> 16 16 #include <linux/moduleparam.h> 17 + #include <linux/seq_file.h> 17 18 #include <linux/slab.h> 18 19 #include <linux/vmalloc.h> 19 20 ··· 458 457 }, 459 458 }; 460 459 460 + static int cs_dsp_coeff_base_reg(struct cs_dsp_coeff_ctl *ctl, unsigned int *reg, 461 + unsigned int off); 462 + 463 + static int cs_dsp_debugfs_read_controls_show(struct seq_file *s, void *ignored) 464 + { 465 + struct cs_dsp *dsp = s->private; 466 + struct cs_dsp_coeff_ctl *ctl; 467 + unsigned int reg; 468 + 469 + list_for_each_entry(ctl, &dsp->ctl_list, list) { 470 + cs_dsp_coeff_base_reg(ctl, &reg, 0); 471 + seq_printf(s, "%22.*s: %#8zx %s:%08x %#8x %s %#8x %#4x %c%c%c%c %s %s\n", 472 + ctl->subname_len, ctl->subname, ctl->len, 473 + cs_dsp_mem_region_name(ctl->alg_region.type), 474 + ctl->offset, reg, ctl->fw_name, ctl->alg_region.alg, ctl->type, 475 + ctl->flags & WMFW_CTL_FLAG_VOLATILE ? 'V' : '-', 476 + ctl->flags & WMFW_CTL_FLAG_SYS ? 'S' : '-', 477 + ctl->flags & WMFW_CTL_FLAG_READABLE ? 'R' : '-', 478 + ctl->flags & WMFW_CTL_FLAG_WRITEABLE ? 'W' : '-', 479 + ctl->enabled ? "enabled" : "disabled", 480 + ctl->set ? "dirty" : "clean"); 481 + } 482 + 483 + return 0; 484 + } 485 + DEFINE_SHOW_ATTRIBUTE(cs_dsp_debugfs_read_controls); 486 + 461 487 /** 462 488 * cs_dsp_init_debugfs() - Create and populate DSP representation in debugfs 463 489 * @dsp: pointer to DSP structure ··· 506 478 for (i = 0; i < ARRAY_SIZE(cs_dsp_debugfs_fops); ++i) 507 479 debugfs_create_file(cs_dsp_debugfs_fops[i].name, 0444, root, 508 480 dsp, &cs_dsp_debugfs_fops[i].fops); 481 + 482 + debugfs_create_file("controls", 0444, root, dsp, 483 + &cs_dsp_debugfs_read_controls_fops); 509 484 510 485 dsp->debugfs_root = root; 511 486 }