ASoC: Intel: avs: Allow for dumping debug window snapshot
Add new read-only debugfs entry which dumps entire content of the SRAM window 2 i.e.: the debug window. Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20221202152841.672536-17-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
870f6e5abb
commit
85ac9c8c8e
@ -71,6 +71,31 @@ static const struct file_operations fw_regs_fops = {
|
||||
.llseek = no_llseek,
|
||||
};
|
||||
|
||||
static ssize_t debug_window_read(struct file *file, char __user *to, size_t count, loff_t *ppos)
|
||||
{
|
||||
struct avs_dev *adev = file->private_data;
|
||||
size_t size;
|
||||
char *buf;
|
||||
int ret;
|
||||
|
||||
size = adev->hw_cfg.dsp_cores * AVS_WINDOW_CHUNK_SIZE;
|
||||
buf = kzalloc(size, GFP_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
|
||||
memcpy_fromio(buf, avs_sram_addr(adev, AVS_DEBUG_WINDOW), size);
|
||||
|
||||
ret = simple_read_from_buffer(to, count, ppos, buf, size);
|
||||
kfree(buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct file_operations debug_window_fops = {
|
||||
.open = simple_open,
|
||||
.read = debug_window_read,
|
||||
.llseek = no_llseek,
|
||||
};
|
||||
|
||||
static ssize_t probe_points_read(struct file *file, char __user *to, size_t count, loff_t *ppos)
|
||||
{
|
||||
struct avs_dev *adev = file->private_data;
|
||||
@ -393,6 +418,7 @@ void avs_debugfs_init(struct avs_dev *adev)
|
||||
debugfs_create_file("strace", 0444, adev->debugfs_root, adev, &strace_fops);
|
||||
debugfs_create_file("trace_control", 0644, adev->debugfs_root, adev, &trace_control_fops);
|
||||
debugfs_create_file("fw_regs", 0444, adev->debugfs_root, adev, &fw_regs_fops);
|
||||
debugfs_create_file("debug_window", 0444, adev->debugfs_root, adev, &debug_window_fops);
|
||||
|
||||
debugfs_create_u32("trace_aging_period", 0644, adev->debugfs_root,
|
||||
&adev->aging_timer_period);
|
||||
|
@ -59,7 +59,8 @@
|
||||
#define AVS_FW_REG_STATUS(adev) (AVS_FW_REG_BASE(adev) + 0x0)
|
||||
#define AVS_FW_REG_ERROR_CODE(adev) (AVS_FW_REG_BASE(adev) + 0x4)
|
||||
|
||||
#define AVS_FW_REGS_SIZE PAGE_SIZE
|
||||
#define AVS_WINDOW_CHUNK_SIZE PAGE_SIZE
|
||||
#define AVS_FW_REGS_SIZE AVS_WINDOW_CHUNK_SIZE
|
||||
#define AVS_FW_REGS_WINDOW 0
|
||||
/* DSP -> HOST communication window */
|
||||
#define AVS_UPLINK_WINDOW AVS_FW_REGS_WINDOW
|
||||
|
Loading…
Reference in New Issue
Block a user