Re: [PATCH] media: venus: add debugfs support
Hi Malathi, Thank you for the patch! Yet something to improve: [auto build test ERROR on linuxtv-media/master] [also build test ERROR on next-20181224] [cannot apply to v4.20] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Malathi-Gottam/media-venus-add-debugfs-support/20181228-160258 base: git://linuxtv.org/media_tree.git master config: sh-allmodconfig (attached as .config) compiler: sh4-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=7.2.0 make.cross ARCH=sh All error/warnings (new ones prefixed by >>): In file included from include/linux/kernel.h:14:0, from include/linux/clk.h:16, from drivers/media/platform/qcom/venus/core.c:15: drivers/media/platform/qcom/venus/core.c: In function 'venus_debugfs_init_drv': >> drivers/media/platform/qcom/venus/core.c:56:9: error: '__name' undeclared >> (first use in this function); did you mean '__naked'? dir, __name); \ ^ include/linux/printk.h:315:34: note: in definition of macro 'pr_info' printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ^~~ >> drivers/media/platform/qcom/venus/core.c:55:3: note: in expansion of macro >> 'dprintk' dprintk(ERR, "Failed creating debugfs file '%pd/%s'\n", \ ^~~ >> drivers/media/platform/qcom/venus/core.c:63:2: note: in expansion of macro >> '__debugfs_create' __debugfs_create(x32, "debug_level", _debug); ^~~~ drivers/media/platform/qcom/venus/core.c:56:9: note: each undeclared identifier is reported only once for each function it appears in dir, __name); \ ^ include/linux/printk.h:315:34: note: in definition of macro 'pr_info' printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ^~~ >> drivers/media/platform/qcom/venus/core.c:55:3: note: in expansion of macro >> 'dprintk' dprintk(ERR, "Failed creating debugfs file '%pd/%s'\n", \ ^~~ >> drivers/media/platform/qcom/venus/core.c:63:2: note: in expansion of macro >> '__debugfs_create' __debugfs_create(x32, "debug_level", _debug); ^~~~ In file included from include/linux/printk.h:7:0, from include/linux/kernel.h:14, from include/linux/clk.h:16, from drivers/media/platform/qcom/venus/core.c:15: drivers/media/platform/qcom/venus/core.c: In function 'venus_clks_enable': >> include/linux/kern_levels.h:5:18: warning: format '%d' expects argument of >> type 'int', but argument 2 has type 'char *' [-Wformat=] #define KERN_SOH "\001" /* ASCII Start Of Header */ ^ include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH' #define KERN_INFO KERN_SOH "6" /* informational */ ^~~~ include/linux/printk.h:315:9: note: in expansion of macro 'KERN_INFO' printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ^ >> drivers/media/platform/qcom/venus/core.h:55:4: note: in expansion of macro >> 'pr_info' pr_info("venus:" fmt, \ ^~~ drivers/media/platform/qcom/venus/core.c:185:2: note: in expansion of macro 'dprintk' dprintk(ERR, "Failed to enable clk:%d\n", i); ^~~ drivers/media/platform/qcom/venus/core.c:185:38: note: format string is defined here dprintk(ERR, "Failed to enable clk:%d\n", i); ~^ %s In file included from include/linux/printk.h:7:0, from include/linux/kernel.h:14, from include/linux/clk.h:16, from drivers/media/platform/qcom/venus/core.c:15: include/linux/kern_levels.h:5:18: warning: too many arguments for format [-Wformat-extra-args] #define KERN_SOH "\001" /* ASCII Start Of Header */ ^ include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH' #define KERN_INFO KERN_SOH "6" /* informational */ ^~~~ include/linux/printk.h:315:9: note: in expansion of macro 'KERN_INFO' printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ^ >> drivers/media/platform/qcom/venus/core.h:55:4: note: in expansion of macro >> 'pr_info' pr_info("venus:" fmt, \ ^~~ drivers/media/platform/qcom/venus/core.c:185:2: note: in expansion of macro 'dprintk' dprintk(ERR, "Failed to enable clk:%d\n", i); ^~~ drivers/media/platform/qcom/venus/core.c: In function 'venus_probe':
Re: [PATCH] media: venus: add debugfs support
Hi Malathi, Thank you for the patch! Yet something to improve: [auto build test ERROR on linuxtv-media/master] [cannot apply to v4.20] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Malathi-Gottam/media-venus-add-debugfs-support/20181228-160258 base: git://linuxtv.org/media_tree.git master config: ia64-allmodconfig (attached as .config) compiler: ia64-linux-gcc (GCC) 8.1.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=8.1.0 make.cross ARCH=ia64 All errors (new ones prefixed by >>): In file included from include/linux/kernel.h:14, from include/linux/clk.h:16, from drivers/media//platform/qcom/venus/core.c:15: drivers/media//platform/qcom/venus/core.c: In function 'venus_debugfs_init_drv': >> drivers/media//platform/qcom/venus/core.c:56:9: error: '__name' undeclared >> (first use in this function); did you mean 'dev_name'? dir, __name); \ ^~ include/linux/printk.h:315:34: note: in definition of macro 'pr_info' printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ^~~ drivers/media//platform/qcom/venus/core.c:55:3: note: in expansion of macro 'dprintk' dprintk(ERR, "Failed creating debugfs file '%pd/%s'\n", \ ^~~ drivers/media//platform/qcom/venus/core.c:63:2: note: in expansion of macro '__debugfs_create' __debugfs_create(x32, "debug_level", _debug); ^~~~ drivers/media//platform/qcom/venus/core.c:56:9: note: each undeclared identifier is reported only once for each function it appears in dir, __name); \ ^~ include/linux/printk.h:315:34: note: in definition of macro 'pr_info' printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ^~~ drivers/media//platform/qcom/venus/core.c:55:3: note: in expansion of macro 'dprintk' dprintk(ERR, "Failed creating debugfs file '%pd/%s'\n", \ ^~~ drivers/media//platform/qcom/venus/core.c:63:2: note: in expansion of macro '__debugfs_create' __debugfs_create(x32, "debug_level", _debug); ^~~~ In file included from include/linux/printk.h:7, from include/linux/kernel.h:14, from include/linux/clk.h:16, from drivers/media//platform/qcom/venus/core.c:15: drivers/media//platform/qcom/venus/core.c: In function 'venus_clks_enable': include/linux/kern_levels.h:5:18: warning: format '%d' expects argument of type 'int', but argument 2 has type 'char *' [-Wformat=] #define KERN_SOH "\001" /* ASCII Start Of Header */ ^~ include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH' #define KERN_INFO KERN_SOH "6" /* informational */ ^~~~ include/linux/printk.h:315:9: note: in expansion of macro 'KERN_INFO' printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ^ drivers/media//platform/qcom/venus/core.h:55:4: note: in expansion of macro 'pr_info' pr_info("venus:" fmt, \ ^~~ drivers/media//platform/qcom/venus/core.c:185:2: note: in expansion of macro 'dprintk' dprintk(ERR, "Failed to enable clk:%d\n", i); ^~~ drivers/media//platform/qcom/venus/core.c:185:38: note: format string is defined here dprintk(ERR, "Failed to enable clk:%d\n", i); ~^ %s In file included from include/linux/printk.h:7, from include/linux/kernel.h:14, from include/linux/clk.h:16, from drivers/media//platform/qcom/venus/core.c:15: include/linux/kern_levels.h:5:18: warning: too many arguments for format [-Wformat-extra-args] #define KERN_SOH "\001" /* ASCII Start Of Header */ ^~ include/linux/kern_levels.h:14:19: note: in expansion of macro 'KERN_SOH' #define KERN_INFO KERN_SOH "6" /* informational */ ^~~~ include/linux/printk.h:315:9: note: in expansion of macro 'KERN_INFO' printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ^ drivers/media//platform/qcom/venus/core.h:55:4: note: in expansion of macro 'pr_info' pr_info("venus:" fmt, \ ^~~ drivers/media//platform/qcom/venus/core.c:185:2: note: in expansion of macro 'dprintk' dprintk(ERR, "Failed to enable clk:%d\n", i); ^~~ drivers/media//platform/qcom/venus/core.c: In function 'venus_probe': include/linux/kern_levels.h:5:18: warning: too many arguments
[PATCH] media: venus: add debugfs support
Enable logs in venus through debugfs to print debug information. Signed-off-by: Malathi Gottam --- drivers/media/platform/qcom/venus/core.c | 62 - drivers/media/platform/qcom/venus/core.h | 32 + drivers/media/platform/qcom/venus/firmware.c | 6 +- drivers/media/platform/qcom/venus/helpers.c| 51 +-- drivers/media/platform/qcom/venus/hfi.c| 93 ++--- drivers/media/platform/qcom/venus/hfi_cmds.c | 33 +++-- drivers/media/platform/qcom/venus/hfi_msgs.c | 5 + drivers/media/platform/qcom/venus/vdec.c | 185 +++-- drivers/media/platform/qcom/venus/vdec_ctrls.c | 7 +- drivers/media/platform/qcom/venus/venc.c | 139 +++ drivers/media/platform/qcom/venus/venc_ctrls.c | 9 +- 11 files changed, 512 insertions(+), 110 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index cb411eb..6531830 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -13,6 +13,7 @@ * */ #include +#include #include #include #include @@ -31,6 +32,50 @@ #include "venc.h" #include "firmware.h" +struct dentry *debugfs_root; +int venus_debug = ERR; +EXPORT_SYMBOL_GPL(venus_debug); + +static struct dentry *venus_debugfs_init_drv(void) +{ + bool ok = false; + struct dentry *dir = NULL; + + dir = debugfs_create_dir("venus", NULL); + if (IS_ERR_OR_NULL(dir)) { + dir = NULL; + pr_err("failed to create debug dir"); + goto failed_create_dir; + } + +#define __debugfs_create(__type, __fname, __value) ({ \ + struct dentry *f = debugfs_create_##__type(__fname, 0644, \ + dir, __value);\ + if (IS_ERR_OR_NULL(f)) { \ + dprintk(ERR, "Failed creating debugfs file '%pd/%s'\n", \ + dir, __name); \ + f = NULL; \ + } \ + f;\ +}) + + ok = + __debugfs_create(x32, "debug_level", _debug); + +#undef __debugfs_create + + if (!ok) + goto failed_create_dir; + + return dir; + +failed_create_dir: + if (dir) + debugfs_remove_recursive(debugfs_root); + + return NULL; +} + static void venus_event_notify(struct venus_core *core, u32 event) { struct venus_inst *inst; @@ -137,6 +182,7 @@ static int venus_clks_enable(struct venus_core *core) return 0; err: + dprintk(ERR, "Failed to enable clk:%d\n", i); while (i--) clk_disable_unprepare(core->clks[i]); @@ -236,6 +282,8 @@ static int venus_probe(struct platform_device *pdev) struct resource *r; int ret; + debugfs_root = venus_debugfs_init_drv(); + core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL); if (!core) return -ENOMEM; @@ -245,8 +293,10 @@ static int venus_probe(struct platform_device *pdev) r = platform_get_resource(pdev, IORESOURCE_MEM, 0); core->base = devm_ioremap_resource(dev, r); - if (IS_ERR(core->base)) + if (IS_ERR(core->base)) { + dprintk(ERR, "Failed to ioremap platform resources"); return PTR_ERR(core->base); + } core->irq = platform_get_irq(pdev, 0); if (core->irq < 0) @@ -297,8 +347,10 @@ static int venus_probe(struct platform_device *pdev) goto err_runtime_disable; ret = venus_firmware_init(core); - if (ret) + if (ret) { + dprintk(ERR, "Failed to init video firmware\n"); goto err_runtime_disable; + } ret = venus_boot(core); if (ret) @@ -321,8 +373,10 @@ static int venus_probe(struct platform_device *pdev) goto err_venus_shutdown; ret = v4l2_device_register(dev, >v4l2_dev); - if (ret) + if (ret) { + dprintk(ERR, "Failed to register v4l2 device\n"); goto err_core_deinit; + } ret = pm_runtime_put_sync(dev); if (ret) @@ -366,6 +420,8 @@ static int venus_remove(struct platform_device *pdev) v4l2_device_unregister(>v4l2_dev); + debugfs_remove_recursive(debugfs_root); + return ret; } diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 6382cea..c31d9e0 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -25,6 +25,38 @@ #define VIDC_CLKS_NUM_MAX 4 +extern int venus_debug;