summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorCezary Rojewski <cezary.rojewski@intel.com>2022-12-02 16:28:41 +0100
committerMark Brown <broonie@kernel.org>2022-12-05 14:05:33 +0000
commit85ac9c8c8eed76e8a320a9e017c6d36e2a52745b (patch)
tree01536d38f58562ec2ca39e00ec844f4c760bb284 /sound
parent870f6e5abba95ac78e750b61cf8f3f15be96796f (diff)
downloadlinux-stable-85ac9c8c8eed76e8a320a9e017c6d36e2a52745b.tar.gz
linux-stable-85ac9c8c8eed76e8a320a9e017c6d36e2a52745b.tar.bz2
linux-stable-85ac9c8c8eed76e8a320a9e017c6d36e2a52745b.zip
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>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/intel/avs/debugfs.c26
-rw-r--r--sound/soc/intel/avs/registers.h3
2 files changed, 28 insertions, 1 deletions
diff --git a/sound/soc/intel/avs/debugfs.c b/sound/soc/intel/avs/debugfs.c
index e9042d4328c4..bdd388ec01ea 100644
--- a/sound/soc/intel/avs/debugfs.c
+++ b/sound/soc/intel/avs/debugfs.c
@@ -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);
diff --git a/sound/soc/intel/avs/registers.h b/sound/soc/intel/avs/registers.h
index 95be86148cf3..2b464e466ed5 100644
--- a/sound/soc/intel/avs/registers.h
+++ b/sound/soc/intel/avs/registers.h
@@ -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