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.

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>

authored by

Cezary Rojewski and committed by
Mark Brown
85ac9c8c 870f6e5a

+28 -1
+26
sound/soc/intel/avs/debugfs.c
··· 71 71 .llseek = no_llseek, 72 72 }; 73 73 74 + static ssize_t debug_window_read(struct file *file, char __user *to, size_t count, loff_t *ppos) 75 + { 76 + struct avs_dev *adev = file->private_data; 77 + size_t size; 78 + char *buf; 79 + int ret; 80 + 81 + size = adev->hw_cfg.dsp_cores * AVS_WINDOW_CHUNK_SIZE; 82 + buf = kzalloc(size, GFP_KERNEL); 83 + if (!buf) 84 + return -ENOMEM; 85 + 86 + memcpy_fromio(buf, avs_sram_addr(adev, AVS_DEBUG_WINDOW), size); 87 + 88 + ret = simple_read_from_buffer(to, count, ppos, buf, size); 89 + kfree(buf); 90 + return ret; 91 + } 92 + 93 + static const struct file_operations debug_window_fops = { 94 + .open = simple_open, 95 + .read = debug_window_read, 96 + .llseek = no_llseek, 97 + }; 98 + 74 99 static ssize_t probe_points_read(struct file *file, char __user *to, size_t count, loff_t *ppos) 75 100 { 76 101 struct avs_dev *adev = file->private_data; ··· 418 393 debugfs_create_file("strace", 0444, adev->debugfs_root, adev, &strace_fops); 419 394 debugfs_create_file("trace_control", 0644, adev->debugfs_root, adev, &trace_control_fops); 420 395 debugfs_create_file("fw_regs", 0444, adev->debugfs_root, adev, &fw_regs_fops); 396 + debugfs_create_file("debug_window", 0444, adev->debugfs_root, adev, &debug_window_fops); 421 397 422 398 debugfs_create_u32("trace_aging_period", 0644, adev->debugfs_root, 423 399 &adev->aging_timer_period);
+2 -1
sound/soc/intel/avs/registers.h
··· 59 59 #define AVS_FW_REG_STATUS(adev) (AVS_FW_REG_BASE(adev) + 0x0) 60 60 #define AVS_FW_REG_ERROR_CODE(adev) (AVS_FW_REG_BASE(adev) + 0x4) 61 61 62 - #define AVS_FW_REGS_SIZE PAGE_SIZE 62 + #define AVS_WINDOW_CHUNK_SIZE PAGE_SIZE 63 + #define AVS_FW_REGS_SIZE AVS_WINDOW_CHUNK_SIZE 63 64 #define AVS_FW_REGS_WINDOW 0 64 65 /* DSP -> HOST communication window */ 65 66 #define AVS_UPLINK_WINDOW AVS_FW_REGS_WINDOW