video: driver: use module_param for debug logs

Introduce module_param to enable debug logs.

For general debug, use below commad:
echo 0x103f101f > /sys/module/msm_video/parameters/msm_vidc_debug

To further print bus-related logs, use below command:
echo 0x103f103f > /sys/module/msm_video/parameters/msm_vidc_debug

Change-Id: Iab735d3e7157cd78a8e5d99c4cdbb290fb36421a
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
This commit is contained in:
Dikshita Agarwal
2021-02-25 10:47:28 +05:30
committed by Maheshwar Ajja
parent b1e339dc54
commit f3298d2fe6
2 changed files with 4 additions and 62 deletions

View File

@@ -9,6 +9,8 @@
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#ifndef VIDC_DBG_LABEL #ifndef VIDC_DBG_LABEL
#define VIDC_DBG_LABEL "msm_vidc" #define VIDC_DBG_LABEL "msm_vidc"
@@ -35,7 +37,7 @@ extern int msm_vidc_clock_voting;
/* To enable messages OR these values and /* To enable messages OR these values and
* echo the result to debugfs file. * echo the result to debugfs file.
* *
* To enable all messages set debug_level = 0x101F * To enable all messages set msm_vidc_debug = 0x101F
*/ */
enum vidc_msg_prio { enum vidc_msg_prio {

View File

@@ -15,7 +15,7 @@
#define MAX_DEBUG_LEVEL_STRING_LEN 15 #define MAX_DEBUG_LEVEL_STRING_LEN 15
int msm_vidc_debug = VIDC_ERR | VIDC_PRINTK | FW_ERROR | FW_FATAL; int msm_vidc_debug = VIDC_ERR | VIDC_PRINTK | FW_ERROR | FW_FATAL;
EXPORT_SYMBOL(msm_vidc_debug); module_param(msm_vidc_debug, int, 0644);
bool msm_vidc_lossless_encode = !true; bool msm_vidc_lossless_encode = !true;
EXPORT_SYMBOL(msm_vidc_lossless_encode); EXPORT_SYMBOL(msm_vidc_lossless_encode);
@@ -141,61 +141,6 @@ static const struct file_operations ssr_fops = {
.write = trigger_ssr_write, .write = trigger_ssr_write,
}; };
static ssize_t debug_level_write(struct file* filp, const char __user* buf,
size_t count, loff_t* ppos)
{
int rc = 0;
struct msm_vidc_core* core = filp->private_data;
char kbuf[MAX_DEBUG_LEVEL_STRING_LEN] = { 0 };
/* filter partial writes and invalid commands */
if (*ppos != 0 || count >= sizeof(kbuf) || count == 0) {
d_vpr_e("returning error - pos %d, count %d\n", *ppos, count);
rc = -EINVAL;
}
rc = simple_write_to_buffer(kbuf, sizeof(kbuf) - 1, ppos, buf, count);
if (rc < 0) {
d_vpr_e("%s: User memory fault\n", __func__);
rc = -EFAULT;
goto exit;
}
rc = kstrtoint(kbuf, 0, &msm_vidc_debug);
if (rc) {
d_vpr_e("returning error err %d\n", rc);
rc = -EINVAL;
goto exit;
}
rc = count;
if (core->capabilities) {
core->capabilities[HW_RESPONSE_TIMEOUT].value =
((msm_vidc_debug & 0xFF) >
(VIDC_ERR | VIDC_HIGH)) ? 1500 : 1000;
d_vpr_h("debug timeout updated to - %d ms\n",
core->capabilities[HW_RESPONSE_TIMEOUT].value);
}
exit:
return rc;
}
static ssize_t debug_level_read(struct file* file, char __user* buf,
size_t count, loff_t* ppos)
{
size_t len;
char kbuf[MAX_DEBUG_LEVEL_STRING_LEN];
len = scnprintf(kbuf, sizeof(kbuf), "0x%08x\n", msm_vidc_debug);
return simple_read_from_buffer(buf, count, ppos, kbuf, len);
}
static const struct file_operations debug_level_fops = {
.open = simple_open,
.write = debug_level_write,
.read = debug_level_read,
};
struct dentry* msm_vidc_debugfs_init_drv() struct dentry* msm_vidc_debugfs_init_drv()
{ {
struct dentry *dir = NULL; struct dentry *dir = NULL;
@@ -251,11 +196,6 @@ struct dentry *msm_vidc_debugfs_init_core(void *core_in)
d_vpr_e("debugfs_create_file: fail\n"); d_vpr_e("debugfs_create_file: fail\n");
goto failed_create_dir; goto failed_create_dir;
} }
if (!debugfs_create_file("debug_level", 0644,
parent, core, &debug_level_fops)) {
d_vpr_e("debugfs_create_file: fail\n");
goto failed_create_dir;
}
failed_create_dir: failed_create_dir:
return dir; return dir;
} }