ASoC: wcd934x-dsp-cntl: add debugfs node to perform debug dumps

Currently, for any WDSP errors, the driver collects the debug
dumps/information based on trigger from userspace. This is protected
under CONFIG_DEBUG_FS and should not be run unless stress tests are
executed and this functionality is explicitly enabled since
performing debug dumps could possible leave the WDSP in bad state.
Add debug node to control dumping debug information and not rely
only on CONFIG_DEBUG_FS

To enable debug dumps:
echo 1 > /sys/kernel/debug/wdsp0/debug_dump_enable

To disable debug dumps:
echo 0 > /sys/kernel/debug/wdsp0/debug_dump_enable

Change-Id: I67d8781839d9caee16e6bf6a5befd9010ccaafc0
Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
Signed-off-by: Xiaoyu Ye <benyxy@codeaurora.org>
此提交包含在:
Xiaoyu Ye
2018-08-15 18:13:19 -07:00
父節點 4d83b35b1b
當前提交 30765fcae3
共有 2 個檔案被更改,包括 16 行新增5 行删除

查看文件

@@ -757,7 +757,8 @@ static int wcd_cntl_do_boot(struct wcd_dsp_cntl *cntl)
if (!ret) {
dev_err(codec->dev, "%s: WDSP boot timed out\n",
__func__);
wcd_cntl_collect_debug_dumps(cntl, true);
if (cntl->dbg_dmp_enable)
wcd_cntl_collect_debug_dumps(cntl, true);
ret = -ETIMEDOUT;
goto err_boot;
} else {
@@ -976,6 +977,8 @@ static void wcd_cntl_debugfs_init(char *dir, struct wcd_dsp_cntl *cntl)
cntl->entry, &cntl->debug_mode);
debugfs_create_bool("ramdump_enable", 0644,
cntl->entry, &cntl->ramdump_enable);
debugfs_create_bool("debug_dump_enable", 0644,
cntl->entry, &cntl->dbg_dmp_enable);
done:
return;
}
@@ -1038,16 +1041,23 @@ static ssize_t wcd_miscdev_write(struct file *filep, const char __user *ubuf,
} else if (val[0] == '0') {
if (cntl->boot_reqs == 0) {
dev_err(cntl->codec->dev,
"%s: WDSP already disabled\n", __func__);
"%s: WDSP already disabled\n",
__func__);
ret = -EINVAL;
goto done;
}
cntl->boot_reqs--;
vote = false;
} else if (!strcmp(val, "DEBUG_DUMP")) {
dev_dbg(cntl->codec->dev,
"%s: Collect dumps for debug use\n", __func__);
wcd_cntl_collect_debug_dumps(cntl, false);
if (cntl->dbg_dmp_enable) {
dev_dbg(cntl->codec->dev,
"%s: Collect dumps for debug use\n", __func__);
wcd_cntl_collect_debug_dumps(cntl, false);
}
/*
* simply ignore the request from userspace
* if dbg_dump_enable is not set from debugfs
*/
goto done;
} else {
dev_err(cntl->codec->dev, "%s: Invalid value %s\n",