Commit 85ac9c8c authored by Cezary Rojewski's avatar Cezary Rojewski Committed by Mark Brown

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: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221202152841.672536-17-cezary.rojewski@intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 870f6e5a
...@@ -71,6 +71,31 @@ static const struct file_operations fw_regs_fops = { ...@@ -71,6 +71,31 @@ static const struct file_operations fw_regs_fops = {
.llseek = no_llseek, .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) 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; struct avs_dev *adev = file->private_data;
...@@ -393,6 +418,7 @@ void avs_debugfs_init(struct avs_dev *adev) ...@@ -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("strace", 0444, adev->debugfs_root, adev, &strace_fops);
debugfs_create_file("trace_control", 0644, adev->debugfs_root, adev, &trace_control_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("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, debugfs_create_u32("trace_aging_period", 0644, adev->debugfs_root,
&adev->aging_timer_period); &adev->aging_timer_period);
......
...@@ -59,7 +59,8 @@ ...@@ -59,7 +59,8 @@
#define AVS_FW_REG_STATUS(adev) (AVS_FW_REG_BASE(adev) + 0x0) #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_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 #define AVS_FW_REGS_WINDOW 0
/* DSP -> HOST communication window */ /* DSP -> HOST communication window */
#define AVS_UPLINK_WINDOW AVS_FW_REGS_WINDOW #define AVS_UPLINK_WINDOW AVS_FW_REGS_WINDOW
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment