Skip to content

Commit 870f6e5

Browse files
crojewsk-intelbroonie
authored andcommitted
ASoC: Intel: avs: Allow for dumping FW_REGS area
SRAM0 window begins with a block of memory, usually of size PAGE_SIZE, dedicated to the base firmware registers. When debugging firmware, it is desirable to be able to dump them at will. Signed-off-by: Cezary Rojewski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 34d27c7 commit 870f6e5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

sound/soc/intel/avs/debugfs.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,29 @@ void avs_dump_fw_log_wakeup(struct avs_dev *adev, const void __iomem *src, unsig
4848
wake_up(&adev->trace_waitq);
4949
}
5050

51+
static ssize_t fw_regs_read(struct file *file, char __user *to, size_t count, loff_t *ppos)
52+
{
53+
struct avs_dev *adev = file->private_data;
54+
char *buf;
55+
int ret;
56+
57+
buf = kzalloc(AVS_FW_REGS_SIZE, GFP_KERNEL);
58+
if (!buf)
59+
return -ENOMEM;
60+
61+
memcpy_fromio(buf, avs_sram_addr(adev, AVS_FW_REGS_WINDOW), AVS_FW_REGS_SIZE);
62+
63+
ret = simple_read_from_buffer(to, count, ppos, buf, AVS_FW_REGS_SIZE);
64+
kfree(buf);
65+
return ret;
66+
}
67+
68+
static const struct file_operations fw_regs_fops = {
69+
.open = simple_open,
70+
.read = fw_regs_read,
71+
.llseek = no_llseek,
72+
};
73+
5174
static ssize_t probe_points_read(struct file *file, char __user *to, size_t count, loff_t *ppos)
5275
{
5376
struct avs_dev *adev = file->private_data;
@@ -369,6 +392,7 @@ void avs_debugfs_init(struct avs_dev *adev)
369392

370393
debugfs_create_file("strace", 0444, adev->debugfs_root, adev, &strace_fops);
371394
debugfs_create_file("trace_control", 0644, adev->debugfs_root, adev, &trace_control_fops);
395+
debugfs_create_file("fw_regs", 0444, adev->debugfs_root, adev, &fw_regs_fops);
372396

373397
debugfs_create_u32("trace_aging_period", 0644, adev->debugfs_root,
374398
&adev->aging_timer_period);

0 commit comments

Comments
 (0)