msm: camera: common: create a common root folder for debugfs
Create common root folder under debugfs root named camera at probe. Add utility functions to create subdirectories under the common camera root. CRs-Fixed: 3093049 Change-Id: Ia4cefb5d2263ecabf1b9d70deefa1ee624b04f07 Signed-off-by: Anand Ravi <quic_ananravi@quicinc.com>
This commit is contained in:
@@ -2916,8 +2916,11 @@ static int cam_cpas_util_create_debugfs(struct cam_cpas *cpas_core)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct dentry *dbgfileptr = NULL;
|
struct dentry *dbgfileptr = NULL;
|
||||||
|
|
||||||
dbgfileptr = debugfs_create_dir("camera_cpas", NULL);
|
if (!cam_debugfs_available())
|
||||||
if (!dbgfileptr) {
|
return 0;
|
||||||
|
|
||||||
|
rc = cam_debugfs_create_subdir("cpas", &dbgfileptr);
|
||||||
|
if (rc) {
|
||||||
CAM_ERR(CAM_CPAS,"DebugFS could not create directory!");
|
CAM_ERR(CAM_CPAS,"DebugFS could not create directory!");
|
||||||
rc = -ENOENT;
|
rc = -ENOENT;
|
||||||
goto end;
|
goto end;
|
||||||
@@ -3138,7 +3141,6 @@ int cam_cpas_hw_remove(struct cam_hw_intf *cpas_hw_intf)
|
|||||||
cam_cpas_util_unregister_bus_client(&cpas_core->ahb_bus_client);
|
cam_cpas_util_unregister_bus_client(&cpas_core->ahb_bus_client);
|
||||||
cam_cpas_util_client_cleanup(cpas_hw);
|
cam_cpas_util_client_cleanup(cpas_hw);
|
||||||
cam_cpas_soc_deinit_resources(&cpas_hw->soc_info);
|
cam_cpas_soc_deinit_resources(&cpas_hw->soc_info);
|
||||||
debugfs_remove_recursive(cpas_core->dentry);
|
|
||||||
cpas_core->dentry = NULL;
|
cpas_core->dentry = NULL;
|
||||||
flush_workqueue(cpas_core->work_queue);
|
flush_workqueue(cpas_core->work_queue);
|
||||||
destroy_workqueue(cpas_core->work_queue);
|
destroy_workqueue(cpas_core->work_queue);
|
||||||
|
@@ -2888,38 +2888,22 @@ DEFINE_DEBUGFS_ATTRIBUTE(cam_cre_debug_default_clk,
|
|||||||
|
|
||||||
static int cam_cre_create_debug_fs(void)
|
static int cam_cre_create_debug_fs(void)
|
||||||
{
|
{
|
||||||
struct dentry *dbgfileptr = NULL;
|
if (!cam_debugfs_available())
|
||||||
int rc = 0;
|
return 0;
|
||||||
cre_hw_mgr->dentry = debugfs_create_dir("camera_cre",
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
|
cam_debugfs_create_subdir("cre", &cre_hw_mgr->dentry);
|
||||||
if (!cre_hw_mgr->dentry) {
|
if (!cre_hw_mgr->dentry) {
|
||||||
CAM_ERR(CAM_CRE, "failed to create dentry");
|
CAM_ERR(CAM_CRE, "failed to create dentry");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!debugfs_create_bool("dump_req_data_enable",
|
debugfs_create_bool("dump_req_data_enable", 0644, cre_hw_mgr->dentry,
|
||||||
0644,
|
&cre_hw_mgr->dump_req_data_enable);
|
||||||
cre_hw_mgr->dentry,
|
|
||||||
&cre_hw_mgr->dump_req_data_enable)) {
|
|
||||||
CAM_ERR(CAM_CRE,
|
|
||||||
"failed to create dump_enable_debug");
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
dbgfileptr = debugfs_create_file("cre_debug_clk", 0644,
|
debugfs_create_file("cre_debug_clk", 0644, cre_hw_mgr->dentry,
|
||||||
cre_hw_mgr->dentry, NULL, &cam_cre_debug_default_clk);
|
NULL, &cam_cre_debug_default_clk);
|
||||||
|
|
||||||
if (IS_ERR(dbgfileptr)) {
|
|
||||||
if (PTR_ERR(dbgfileptr) == -ENODEV)
|
|
||||||
CAM_WARN(CAM_CRE, "DebugFS not enabled in kernel!");
|
|
||||||
else
|
|
||||||
rc = PTR_ERR(dbgfileptr);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
err:
|
|
||||||
debugfs_remove_recursive(cre_hw_mgr->dentry);
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int cam_cre_hw_mgr_init(struct device_node *of_node, void *hw_mgr,
|
int cam_cre_hw_mgr_init(struct device_node *of_node, void *hw_mgr,
|
||||||
|
@@ -1925,8 +1925,11 @@ static int cam_icp_hw_mgr_create_debugfs_entry(void)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct dentry *dbgfileptr = NULL;
|
struct dentry *dbgfileptr = NULL;
|
||||||
|
|
||||||
dbgfileptr = debugfs_create_dir("camera_icp", NULL);
|
if (!cam_debugfs_available())
|
||||||
if (!dbgfileptr) {
|
return 0;
|
||||||
|
|
||||||
|
rc = cam_debugfs_create_subdir("icp", &dbgfileptr);
|
||||||
|
if (rc) {
|
||||||
CAM_ERR(CAM_ICP,"DebugFS could not create directory!");
|
CAM_ERR(CAM_ICP,"DebugFS could not create directory!");
|
||||||
rc = -ENOENT;
|
rc = -ENOENT;
|
||||||
goto end;
|
goto end;
|
||||||
@@ -6613,7 +6616,6 @@ void cam_icp_hw_mgr_deinit(void)
|
|||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
debugfs_remove_recursive(icp_hw_mgr.dentry);
|
|
||||||
icp_hw_mgr.dentry = NULL;
|
icp_hw_mgr.dentry = NULL;
|
||||||
cam_icp_mgr_destroy_wq();
|
cam_icp_mgr_destroy_wq();
|
||||||
cam_icp_mgr_free_devs();
|
cam_icp_mgr_free_devs();
|
||||||
|
@@ -7239,12 +7239,15 @@ static int cam_isp_context_debug_register(void)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct dentry *dbgfileptr = NULL;
|
struct dentry *dbgfileptr = NULL;
|
||||||
|
|
||||||
dbgfileptr = debugfs_create_dir("camera_isp_ctx", NULL);
|
if (!cam_debugfs_available())
|
||||||
if (!dbgfileptr) {
|
return 0;
|
||||||
|
|
||||||
|
rc = cam_debugfs_create_subdir("isp_ctx", &dbgfileptr);
|
||||||
|
if (rc) {
|
||||||
CAM_ERR(CAM_ISP, "DebugFS could not create directory!");
|
CAM_ERR(CAM_ISP, "DebugFS could not create directory!");
|
||||||
rc = -ENOENT;
|
return rc;
|
||||||
goto end;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store parent inode for cleanup in caller */
|
/* Store parent inode for cleanup in caller */
|
||||||
isp_ctx_debug.dentry = dbgfileptr;
|
isp_ctx_debug.dentry = dbgfileptr;
|
||||||
|
|
||||||
@@ -7255,14 +7258,7 @@ static int cam_isp_context_debug_register(void)
|
|||||||
debugfs_create_bool("disable_internal_recovery", 0644,
|
debugfs_create_bool("disable_internal_recovery", 0644,
|
||||||
isp_ctx_debug.dentry, &isp_ctx_debug.disable_internal_recovery);
|
isp_ctx_debug.dentry, &isp_ctx_debug.disable_internal_recovery);
|
||||||
|
|
||||||
if (IS_ERR(dbgfileptr)) {
|
return 0;
|
||||||
if (PTR_ERR(dbgfileptr) == -ENODEV)
|
|
||||||
CAM_WARN(CAM_ISP, "DebugFS not enabled in kernel!");
|
|
||||||
else
|
|
||||||
rc = PTR_ERR(dbgfileptr);
|
|
||||||
}
|
|
||||||
end:
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int cam_isp_context_init(struct cam_isp_context *ctx,
|
int cam_isp_context_init(struct cam_isp_context *ctx,
|
||||||
@@ -7346,7 +7342,6 @@ int cam_isp_context_deinit(struct cam_isp_context *ctx)
|
|||||||
__cam_isp_ctx_substate_val_to_type(
|
__cam_isp_ctx_substate_val_to_type(
|
||||||
ctx->substate_activated));
|
ctx->substate_activated));
|
||||||
|
|
||||||
debugfs_remove_recursive(isp_ctx_debug.dentry);
|
|
||||||
isp_ctx_debug.dentry = NULL;
|
isp_ctx_debug.dentry = NULL;
|
||||||
memset(ctx, 0, sizeof(*ctx));
|
memset(ctx, 0, sizeof(*ctx));
|
||||||
|
|
||||||
|
@@ -13063,8 +13063,11 @@ static int cam_ife_hw_mgr_debug_register(void)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct dentry *dbgfileptr = NULL;
|
struct dentry *dbgfileptr = NULL;
|
||||||
|
|
||||||
dbgfileptr = debugfs_create_dir("camera_ife", NULL);
|
if (!cam_debugfs_available())
|
||||||
if (!dbgfileptr) {
|
return 0;
|
||||||
|
|
||||||
|
rc = cam_debugfs_create_subdir("ife", &dbgfileptr);
|
||||||
|
if (rc) {
|
||||||
CAM_ERR(CAM_ISP,"DebugFS could not create directory!");
|
CAM_ERR(CAM_ISP,"DebugFS could not create directory!");
|
||||||
rc = -ENOENT;
|
rc = -ENOENT;
|
||||||
goto end;
|
goto end;
|
||||||
@@ -13521,7 +13524,6 @@ void cam_ife_hw_mgr_deinit(void)
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
cam_req_mgr_workq_destroy(&g_ife_hw_mgr.workq);
|
cam_req_mgr_workq_destroy(&g_ife_hw_mgr.workq);
|
||||||
debugfs_remove_recursive(g_ife_hw_mgr.debug_cfg.dentry);
|
|
||||||
g_ife_hw_mgr.debug_cfg.dentry = NULL;
|
g_ife_hw_mgr.debug_cfg.dentry = NULL;
|
||||||
|
|
||||||
for (i = 0; i < CAM_IFE_CTX_MAX; i++) {
|
for (i = 0; i < CAM_IFE_CTX_MAX; i++) {
|
||||||
|
@@ -5732,14 +5732,16 @@ DEFINE_DEBUGFS_ATTRIBUTE(cam_tfe_camif_debug,
|
|||||||
cam_tfe_get_camif_debug,
|
cam_tfe_get_camif_debug,
|
||||||
cam_tfe_set_camif_debug, "%16llu");
|
cam_tfe_set_camif_debug, "%16llu");
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_DEBUG_FS)
|
|
||||||
static int cam_tfe_hw_mgr_debug_register(void)
|
static int cam_tfe_hw_mgr_debug_register(void)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct dentry *dbgfileptr = NULL;
|
struct dentry *dbgfileptr = NULL;
|
||||||
|
|
||||||
dbgfileptr = debugfs_create_dir("camera_tfe", NULL);
|
if (!cam_debugfs_available())
|
||||||
if (!dbgfileptr) {
|
goto end;
|
||||||
|
|
||||||
|
rc = cam_debugfs_create_subdir("tfe", &dbgfileptr);
|
||||||
|
if (rc) {
|
||||||
CAM_ERR(CAM_ISP,"DebugFS could not create directory!");
|
CAM_ERR(CAM_ISP,"DebugFS could not create directory!");
|
||||||
rc = -ENOENT;
|
rc = -ENOENT;
|
||||||
goto end;
|
goto end;
|
||||||
@@ -5773,14 +5775,6 @@ end:
|
|||||||
g_tfe_hw_mgr.debug_cfg.enable_recovery = 0;
|
g_tfe_hw_mgr.debug_cfg.enable_recovery = 0;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
static inline int cam_tfe_hw_mgr_debug_register(void)
|
|
||||||
{
|
|
||||||
g_tfe_hw_mgr.debug_cfg.enable_recovery = 0;
|
|
||||||
CAM_WARN(CAM_ISP, "DebugFS not enabled in kernel");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void cam_req_mgr_process_tfe_worker(struct work_struct *w)
|
static void cam_req_mgr_process_tfe_worker(struct work_struct *w)
|
||||||
{
|
{
|
||||||
@@ -5995,7 +5989,6 @@ void cam_tfe_hw_mgr_deinit(void)
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
cam_req_mgr_workq_destroy(&g_tfe_hw_mgr.workq);
|
cam_req_mgr_workq_destroy(&g_tfe_hw_mgr.workq);
|
||||||
debugfs_remove_recursive(g_tfe_hw_mgr.debug_cfg.dentry);
|
|
||||||
g_tfe_hw_mgr.debug_cfg.dentry = NULL;
|
g_tfe_hw_mgr.debug_cfg.dentry = NULL;
|
||||||
|
|
||||||
for (i = 0; i < CAM_TFE_CTX_MAX; i++) {
|
for (i = 0; i < CAM_TFE_CTX_MAX; i++) {
|
||||||
|
@@ -2127,28 +2127,23 @@ static int cam_jpeg_mgr_create_debugfs_entry(void)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct dentry *dbgfileptr = NULL;
|
struct dentry *dbgfileptr = NULL;
|
||||||
|
|
||||||
dbgfileptr = debugfs_create_dir("camera_jpeg", NULL);
|
if (!cam_debugfs_available())
|
||||||
if (!dbgfileptr) {
|
return 0;
|
||||||
|
|
||||||
|
rc = cam_debugfs_create_subdir("jpeg", &dbgfileptr);
|
||||||
|
if (rc) {
|
||||||
CAM_ERR(CAM_JPEG, "DebugFS could not create directory!");
|
CAM_ERR(CAM_JPEG, "DebugFS could not create directory!");
|
||||||
rc = -ENOENT;
|
return rc;
|
||||||
goto err;
|
|
||||||
}
|
}
|
||||||
/* Store parent inode for cleanup in caller */
|
/* Store parent inode for cleanup in caller */
|
||||||
g_jpeg_hw_mgr.dentry = dbgfileptr;
|
g_jpeg_hw_mgr.dentry = dbgfileptr;
|
||||||
|
|
||||||
dbgfileptr = debugfs_create_file("camnoc_misr_test", 0644,
|
debugfs_create_file("camnoc_misr_test", 0644, g_jpeg_hw_mgr.dentry,
|
||||||
g_jpeg_hw_mgr.dentry, NULL, &camnoc_misr_test);
|
NULL, &camnoc_misr_test);
|
||||||
|
|
||||||
dbgfileptr = debugfs_create_file("bug_on_misr_mismatch", 0644,
|
debugfs_create_file("bug_on_misr_mismatch", 0644, g_jpeg_hw_mgr.dentry,
|
||||||
g_jpeg_hw_mgr.dentry, NULL, &bug_on_misr_mismatch);
|
NULL, &bug_on_misr_mismatch);
|
||||||
|
|
||||||
if (IS_ERR(dbgfileptr)) {
|
|
||||||
if (PTR_ERR(dbgfileptr) == -ENODEV)
|
|
||||||
CAM_WARN(CAM_JPEG, "DebugFS not enabled in kernel!");
|
|
||||||
else
|
|
||||||
rc = PTR_ERR(dbgfileptr);
|
|
||||||
}
|
|
||||||
err:
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1022,27 +1022,21 @@ static int cam_lrme_mgr_create_debugfs_entry(void)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct dentry *dbgfileptr = NULL;
|
struct dentry *dbgfileptr = NULL;
|
||||||
|
|
||||||
dbgfileptr = debugfs_create_dir("camera_lrme", NULL);
|
if (!cam_debugfs_available())
|
||||||
if (!dbgfileptr) {
|
return 0;
|
||||||
|
|
||||||
|
rc = cam_debugfs_create_subdir("lrme", &dbgfileptr);
|
||||||
|
if (rc) {
|
||||||
CAM_ERR(CAM_ISP,"DebugFS could not create directory!");
|
CAM_ERR(CAM_ISP,"DebugFS could not create directory!");
|
||||||
rc = -ENOENT;
|
return -ENOENT;
|
||||||
goto err;
|
|
||||||
}
|
}
|
||||||
/* Store parent inode for cleanup in caller */
|
/* Store parent inode for cleanup in caller */
|
||||||
g_lrme_hw_mgr.debugfs_entry.dentry = dbgfileptr;
|
g_lrme_hw_mgr.debugfs_entry.dentry = dbgfileptr;
|
||||||
|
|
||||||
dbgfileptr = debugfs_create_bool("dump_register", 0644,
|
debugfs_create_bool("dump_register", 0644, g_lrme_hw_mgr.debugfs_entry.dentry,
|
||||||
g_lrme_hw_mgr.debugfs_entry.dentry,
|
|
||||||
&g_lrme_hw_mgr.debugfs_entry.dump_register);
|
&g_lrme_hw_mgr.debugfs_entry.dump_register);
|
||||||
if (IS_ERR(dbgfileptr)) {
|
|
||||||
if (PTR_ERR(dbgfileptr) == -ENODEV)
|
|
||||||
CAM_WARN(CAM_LRME, "DebugFS not enabled in kernel!");
|
|
||||||
else
|
|
||||||
rc = PTR_ERR(dbgfileptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
err:
|
return 0;
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cam_req_mgr_process_workq_cam_lrme_device_submit_worker(
|
static void cam_req_mgr_process_workq_cam_lrme_device_submit_worker(
|
||||||
@@ -1149,7 +1143,6 @@ int cam_lrme_mgr_deregister_device(int device_index)
|
|||||||
int cam_lrme_hw_mgr_deinit(void)
|
int cam_lrme_hw_mgr_deinit(void)
|
||||||
{
|
{
|
||||||
mutex_destroy(&g_lrme_hw_mgr.hw_mgr_mutex);
|
mutex_destroy(&g_lrme_hw_mgr.hw_mgr_mutex);
|
||||||
debugfs_remove_recursive(g_lrme_hw_mgr.debugfs_entry.dentry);
|
|
||||||
memset(&g_lrme_hw_mgr, 0x0, sizeof(g_lrme_hw_mgr));
|
memset(&g_lrme_hw_mgr, 0x0, sizeof(g_lrme_hw_mgr));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -3901,36 +3901,24 @@ cmd_work_failed:
|
|||||||
|
|
||||||
static int cam_ope_create_debug_fs(void)
|
static int cam_ope_create_debug_fs(void)
|
||||||
{
|
{
|
||||||
ope_hw_mgr->dentry = debugfs_create_dir("camera_ope",
|
int rc;
|
||||||
NULL);
|
|
||||||
|
|
||||||
if (!ope_hw_mgr->dentry) {
|
if (!cam_debugfs_available())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
rc = cam_debugfs_create_subdir("ope", &ope_hw_mgr->dentry);
|
||||||
|
if (rc) {
|
||||||
CAM_ERR(CAM_OPE, "failed to create dentry");
|
CAM_ERR(CAM_OPE, "failed to create dentry");
|
||||||
return -ENOMEM;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!debugfs_create_bool("frame_dump_enable",
|
debugfs_create_bool("frame_dump_enable", 0644, ope_hw_mgr->dentry,
|
||||||
0644,
|
&ope_hw_mgr->frame_dump_enable);
|
||||||
ope_hw_mgr->dentry,
|
|
||||||
&ope_hw_mgr->frame_dump_enable)) {
|
|
||||||
CAM_ERR(CAM_OPE,
|
|
||||||
"failed to create dump_enable_debug");
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!debugfs_create_bool("dump_req_data_enable",
|
debugfs_create_bool("dump_req_data_enable", 0644, ope_hw_mgr->dentry,
|
||||||
0644,
|
&ope_hw_mgr->dump_req_data_enable);
|
||||||
ope_hw_mgr->dentry,
|
|
||||||
&ope_hw_mgr->dump_req_data_enable)) {
|
|
||||||
CAM_ERR(CAM_OPE,
|
|
||||||
"failed to create dump_enable_debug");
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
err:
|
|
||||||
debugfs_remove_recursive(ope_hw_mgr->dentry);
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -30,6 +30,16 @@
|
|||||||
static struct cam_mem_table tbl;
|
static struct cam_mem_table tbl;
|
||||||
static atomic_t cam_mem_mgr_state = ATOMIC_INIT(CAM_MEM_MGR_UNINITIALIZED);
|
static atomic_t cam_mem_mgr_state = ATOMIC_INIT(CAM_MEM_MGR_UNINITIALIZED);
|
||||||
|
|
||||||
|
/* cam_mem_mgr_debug - global struct to keep track of debug settings for mem mgr
|
||||||
|
*
|
||||||
|
* @dentry : Directory entry to the mem mgr root folder
|
||||||
|
* @alloc_profile_enable : Whether to enable alloc profiling
|
||||||
|
*/
|
||||||
|
static struct {
|
||||||
|
struct dentry *dentry;
|
||||||
|
bool alloc_profile_enable;
|
||||||
|
} g_cam_mem_mgr_debug;
|
||||||
|
|
||||||
#if IS_REACHABLE(CONFIG_DMABUF_HEAPS)
|
#if IS_REACHABLE(CONFIG_DMABUF_HEAPS)
|
||||||
static void cam_mem_mgr_put_dma_heaps(void);
|
static void cam_mem_mgr_put_dma_heaps(void);
|
||||||
static int cam_mem_mgr_get_dma_heaps(void);
|
static int cam_mem_mgr_get_dma_heaps(void);
|
||||||
@@ -65,7 +75,7 @@ static unsigned long cam_mem_mgr_mini_dump_cb(void *dst, unsigned long len)
|
|||||||
md = (struct cam_mem_table_mini_dump *)dst;
|
md = (struct cam_mem_table_mini_dump *)dst;
|
||||||
memcpy(md->bufq, tbl.bufq, CAM_MEM_BUFQ_MAX * sizeof(struct cam_mem_buf_queue));
|
memcpy(md->bufq, tbl.bufq, CAM_MEM_BUFQ_MAX * sizeof(struct cam_mem_buf_queue));
|
||||||
md->dbg_buf_idx = tbl.dbg_buf_idx;
|
md->dbg_buf_idx = tbl.dbg_buf_idx;
|
||||||
md->alloc_profile_enable = tbl.alloc_profile_enable;
|
md->alloc_profile_enable = g_cam_mem_mgr_debug.alloc_profile_enable;
|
||||||
md->force_cache_allocs = tbl.force_cache_allocs;
|
md->force_cache_allocs = tbl.force_cache_allocs;
|
||||||
md->need_shared_buffer_padding = tbl.need_shared_buffer_padding;
|
md->need_shared_buffer_padding = tbl.need_shared_buffer_padding;
|
||||||
return sizeof(*md);
|
return sizeof(*md);
|
||||||
@@ -170,17 +180,20 @@ static int cam_mem_mgr_create_debug_fs(void)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct dentry *dbgfileptr = NULL;
|
struct dentry *dbgfileptr = NULL;
|
||||||
|
|
||||||
dbgfileptr = debugfs_create_dir("camera_memmgr", NULL);
|
if (!cam_debugfs_available() || g_cam_mem_mgr_debug.dentry)
|
||||||
if (!dbgfileptr) {
|
return 0;
|
||||||
|
|
||||||
|
rc = cam_debugfs_create_subdir("memmgr", &dbgfileptr);
|
||||||
|
if (rc) {
|
||||||
CAM_ERR(CAM_MEM, "DebugFS could not create directory!");
|
CAM_ERR(CAM_MEM, "DebugFS could not create directory!");
|
||||||
rc = -ENOENT;
|
rc = -ENOENT;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
/* Store parent inode for cleanup in caller */
|
|
||||||
tbl.dentry = dbgfileptr;
|
|
||||||
|
|
||||||
debugfs_create_bool("alloc_profile_enable", 0644,
|
g_cam_mem_mgr_debug.dentry = dbgfileptr;
|
||||||
tbl.dentry, &tbl.alloc_profile_enable);
|
|
||||||
|
debugfs_create_bool("alloc_profile_enable", 0644, g_cam_mem_mgr_debug.dentry,
|
||||||
|
&g_cam_mem_mgr_debug.alloc_profile_enable);
|
||||||
end:
|
end:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@@ -556,7 +569,7 @@ static int cam_mem_util_get_dma_buf(size_t len,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tbl.alloc_profile_enable)
|
if (g_cam_mem_mgr_debug.alloc_profile_enable)
|
||||||
CAM_GET_TIMESTAMP(ts1);
|
CAM_GET_TIMESTAMP(ts1);
|
||||||
|
|
||||||
if ((cam_flags & CAM_MEM_FLAG_CACHE) ||
|
if ((cam_flags & CAM_MEM_FLAG_CACHE) ||
|
||||||
@@ -667,7 +680,7 @@ static int cam_mem_util_get_dma_buf(size_t len,
|
|||||||
|
|
||||||
CAM_DBG(CAM_MEM, "Allocate success, len=%zu, *buf=%pK, i_ino=%lu", len, *buf, *i_ino);
|
CAM_DBG(CAM_MEM, "Allocate success, len=%zu, *buf=%pK, i_ino=%lu", len, *buf, *i_ino);
|
||||||
|
|
||||||
if (tbl.alloc_profile_enable) {
|
if (g_cam_mem_mgr_debug.alloc_profile_enable) {
|
||||||
CAM_GET_TIMESTAMP(ts2);
|
CAM_GET_TIMESTAMP(ts2);
|
||||||
CAM_GET_TIMESTAMP_DIFF_IN_MICRO(ts1, ts2, microsec);
|
CAM_GET_TIMESTAMP_DIFF_IN_MICRO(ts1, ts2, microsec);
|
||||||
trace_cam_log_event("IONAllocProfile", "size and time in micro",
|
trace_cam_log_event("IONAllocProfile", "size and time in micro",
|
||||||
@@ -696,7 +709,7 @@ static int cam_mem_util_get_dma_buf(size_t len,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tbl.alloc_profile_enable)
|
if (g_cam_mem_mgr_debug.alloc_profile_enable)
|
||||||
CAM_GET_TIMESTAMP(ts1);
|
CAM_GET_TIMESTAMP(ts1);
|
||||||
|
|
||||||
if ((cam_flags & CAM_MEM_FLAG_PROTECTED_MODE) &&
|
if ((cam_flags & CAM_MEM_FLAG_PROTECTED_MODE) &&
|
||||||
@@ -726,7 +739,7 @@ static int cam_mem_util_get_dma_buf(size_t len,
|
|||||||
|
|
||||||
*i_ino = file_inode((*buf)->file)->i_ino;
|
*i_ino = file_inode((*buf)->file)->i_ino;
|
||||||
|
|
||||||
if (tbl.alloc_profile_enable) {
|
if (g_cam_mem_mgr_debug.alloc_profile_enable) {
|
||||||
CAM_GET_TIMESTAMP(ts2);
|
CAM_GET_TIMESTAMP(ts2);
|
||||||
CAM_GET_TIMESTAMP_DIFF_IN_MICRO(ts1, ts2, microsec);
|
CAM_GET_TIMESTAMP_DIFF_IN_MICRO(ts1, ts2, microsec);
|
||||||
trace_cam_log_event("IONAllocProfile", "size and time in micro",
|
trace_cam_log_event("IONAllocProfile", "size and time in micro",
|
||||||
@@ -1318,7 +1331,6 @@ void cam_mem_mgr_deinit(void)
|
|||||||
{
|
{
|
||||||
atomic_set(&cam_mem_mgr_state, CAM_MEM_MGR_UNINITIALIZED);
|
atomic_set(&cam_mem_mgr_state, CAM_MEM_MGR_UNINITIALIZED);
|
||||||
cam_mem_mgr_cleanup_table();
|
cam_mem_mgr_cleanup_table();
|
||||||
debugfs_remove_recursive(tbl.dentry);
|
|
||||||
mutex_lock(&tbl.m_lock);
|
mutex_lock(&tbl.m_lock);
|
||||||
bitmap_zero(tbl.bitmap, tbl.bits);
|
bitmap_zero(tbl.bitmap, tbl.bits);
|
||||||
kfree(tbl.bitmap);
|
kfree(tbl.bitmap);
|
||||||
|
@@ -84,8 +84,6 @@ struct cam_mem_buf_queue {
|
|||||||
* @bitmap: bitmap of the mem mgr utility
|
* @bitmap: bitmap of the mem mgr utility
|
||||||
* @bits: max bits of the utility
|
* @bits: max bits of the utility
|
||||||
* @bufq: array of buffers
|
* @bufq: array of buffers
|
||||||
* @dentry: Debugfs entry
|
|
||||||
* @alloc_profile_enable: Whether to enable alloc profiling
|
|
||||||
* @dbg_buf_idx: debug buffer index to get usecases info
|
* @dbg_buf_idx: debug buffer index to get usecases info
|
||||||
* @force_cache_allocs: Force all internal buffer allocations with cache
|
* @force_cache_allocs: Force all internal buffer allocations with cache
|
||||||
* @need_shared_buffer_padding: Whether padding is needed for shared buffer
|
* @need_shared_buffer_padding: Whether padding is needed for shared buffer
|
||||||
@@ -101,8 +99,6 @@ struct cam_mem_table {
|
|||||||
void *bitmap;
|
void *bitmap;
|
||||||
size_t bits;
|
size_t bits;
|
||||||
struct cam_mem_buf_queue bufq[CAM_MEM_BUFQ_MAX];
|
struct cam_mem_buf_queue bufq[CAM_MEM_BUFQ_MAX];
|
||||||
struct dentry *dentry;
|
|
||||||
bool alloc_profile_enable;
|
|
||||||
size_t dbg_buf_idx;
|
size_t dbg_buf_idx;
|
||||||
bool force_cache_allocs;
|
bool force_cache_allocs;
|
||||||
bool need_shared_buffer_padding;
|
bool need_shared_buffer_padding;
|
||||||
|
@@ -117,8 +117,11 @@ int cam_req_mgr_debug_register(struct cam_req_mgr_core_device *core_dev)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct dentry *dbgfileptr = NULL;
|
struct dentry *dbgfileptr = NULL;
|
||||||
|
|
||||||
dbgfileptr = debugfs_create_dir("cam_req_mgr", NULL);
|
if (!cam_debugfs_available())
|
||||||
if (!dbgfileptr) {
|
return 0;
|
||||||
|
|
||||||
|
rc = cam_debugfs_create_subdir("req_mgr", &dbgfileptr);
|
||||||
|
if (rc) {
|
||||||
CAM_ERR(CAM_MEM,"DebugFS could not create directory!");
|
CAM_ERR(CAM_MEM,"DebugFS could not create directory!");
|
||||||
rc = -ENOENT;
|
rc = -ENOENT;
|
||||||
goto end;
|
goto end;
|
||||||
@@ -140,7 +143,6 @@ end:
|
|||||||
|
|
||||||
int cam_req_mgr_debug_unregister(void)
|
int cam_req_mgr_debug_unregister(void)
|
||||||
{
|
{
|
||||||
debugfs_remove_recursive(debugfs_root);
|
|
||||||
debugfs_root = NULL;
|
debugfs_root = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -405,44 +405,31 @@ DEFINE_DEBUGFS_ATTRIBUTE(cam_cci_debug,
|
|||||||
|
|
||||||
static int cam_cci_create_debugfs_entry(struct cci_device *cci_dev)
|
static int cam_cci_create_debugfs_entry(struct cci_device *cci_dev)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0, idx;
|
||||||
struct dentry *dbgfileptr = NULL;
|
struct dentry *dbgfileptr = NULL;
|
||||||
|
static char * const filename[] = { "en_dump_cci0", "en_dump_cci1", "en_dump_cci2"};
|
||||||
|
|
||||||
|
if (!cam_debugfs_available())
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (!debugfs_root) {
|
if (!debugfs_root) {
|
||||||
dbgfileptr = debugfs_create_dir("cam_cci", NULL);
|
rc = cam_debugfs_create_subdir("cci", &dbgfileptr);
|
||||||
if (!dbgfileptr) {
|
if (rc) {
|
||||||
CAM_ERR(CAM_CCI, "debugfs directory creation fail");
|
CAM_ERR(CAM_CCI, "debugfs directory creation fail");
|
||||||
rc = -ENOENT;
|
return rc;
|
||||||
goto end;
|
|
||||||
}
|
}
|
||||||
debugfs_root = dbgfileptr;
|
debugfs_root = dbgfileptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cci_dev->soc_info.index == 0) {
|
idx = cci_dev->soc_info.index;
|
||||||
dbgfileptr = debugfs_create_file("en_dump_cci0", 0644,
|
if (idx >= ARRAY_SIZE(filename)) {
|
||||||
debugfs_root, cci_dev, &cam_cci_debug);
|
CAM_ERR(CAM_CCI, "cci-dev %d invalid", idx);
|
||||||
if (IS_ERR(dbgfileptr)) {
|
return -ENODEV;
|
||||||
if (PTR_ERR(dbgfileptr) == -ENODEV)
|
|
||||||
CAM_WARN(CAM_CCI, "DebugFS not enabled");
|
|
||||||
else {
|
|
||||||
rc = PTR_ERR(dbgfileptr);
|
|
||||||
goto end;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
debugfs_create_file(filename[idx], 0644, debugfs_root, cci_dev, &cam_cci_debug);
|
||||||
dbgfileptr = debugfs_create_file("en_dump_cci1", 0644,
|
|
||||||
debugfs_root, cci_dev, &cam_cci_debug);
|
return 0;
|
||||||
if (IS_ERR(dbgfileptr)) {
|
|
||||||
if (PTR_ERR(dbgfileptr) == -ENODEV)
|
|
||||||
CAM_WARN(CAM_CCI, "DebugFS not enabled");
|
|
||||||
else {
|
|
||||||
rc = PTR_ERR(dbgfileptr);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end:
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cam_cci_component_bind(struct device *dev,
|
static int cam_cci_component_bind(struct device *dev,
|
||||||
@@ -547,7 +534,6 @@ static void cam_cci_component_unbind(struct device *dev,
|
|||||||
v4l2_get_subdevdata(subdev);
|
v4l2_get_subdevdata(subdev);
|
||||||
|
|
||||||
cam_cpas_unregister_client(cci_dev->cpas_handle);
|
cam_cpas_unregister_client(cci_dev->cpas_handle);
|
||||||
debugfs_remove_recursive(debugfs_root);
|
|
||||||
debugfs_root = NULL;
|
debugfs_root = NULL;
|
||||||
cam_cci_soc_remove(pdev, cci_dev);
|
cam_cci_soc_remove(pdev, cci_dev);
|
||||||
rc = cam_unregister_subdev(&(cci_dev->v4l2_dev_str));
|
rc = cam_unregister_subdev(&(cci_dev->v4l2_dev_str));
|
||||||
|
@@ -55,13 +55,16 @@ static int cam_csiphy_debug_register(struct csiphy_device *csiphy_dev)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!cam_debugfs_available())
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (!root_dentry) {
|
if (!root_dentry) {
|
||||||
root_dentry = debugfs_create_dir("camera_csiphy", NULL);
|
if (cam_debugfs_create_subdir("csiphy", &dbgfileptr)) {
|
||||||
if (IS_ERR(root_dentry)) {
|
CAM_ERR(CAM_CSIPHY,
|
||||||
CAM_ERR(CAM_CSIPHY, "Debugfs could not create root directory. rc: %ld",
|
"Debugfs could not create directory!");
|
||||||
root_dentry);
|
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
root_dentry = dbgfileptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the CSIPHY directory for this csiphy */
|
/* Create the CSIPHY directory for this csiphy */
|
||||||
@@ -88,7 +91,6 @@ static int cam_csiphy_debug_register(struct csiphy_device *csiphy_dev)
|
|||||||
|
|
||||||
static void cam_csiphy_debug_unregister(void)
|
static void cam_csiphy_debug_unregister(void)
|
||||||
{
|
{
|
||||||
debugfs_remove_recursive(root_dentry);
|
|
||||||
root_dentry = NULL;
|
root_dentry = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4450,8 +4450,11 @@ static int cam_smmu_create_debug_fs(void)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct dentry *dbgfileptr = NULL;
|
struct dentry *dbgfileptr = NULL;
|
||||||
|
|
||||||
dbgfileptr = debugfs_create_dir("camera_smmu", NULL);
|
if (!cam_debugfs_available())
|
||||||
if (!dbgfileptr) {
|
return 0;
|
||||||
|
|
||||||
|
rc = cam_debugfs_create_subdir("smmu", &dbgfileptr);
|
||||||
|
if (rc) {
|
||||||
CAM_ERR(CAM_SMMU,"DebugFS could not create directory!");
|
CAM_ERR(CAM_SMMU,"DebugFS could not create directory!");
|
||||||
rc = -ENOENT;
|
rc = -ENOENT;
|
||||||
goto end;
|
goto end;
|
||||||
@@ -4586,7 +4589,6 @@ static void cam_smmu_component_unbind(struct device *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cam_smmu_release_cb(pdev);
|
cam_smmu_release_cb(pdev);
|
||||||
debugfs_remove_recursive(iommu_cb_set.dentry);
|
|
||||||
iommu_cb_set.dentry = NULL;
|
iommu_cb_set.dentry = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1068,8 +1068,11 @@ static int cam_sync_create_debugfs(void)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct dentry *dbgfileptr = NULL;
|
struct dentry *dbgfileptr = NULL;
|
||||||
|
|
||||||
dbgfileptr = debugfs_create_dir("camera_sync", NULL);
|
if (!cam_debugfs_available())
|
||||||
if (!dbgfileptr) {
|
return 0;
|
||||||
|
|
||||||
|
rc = cam_debugfs_create_subdir("sync", &dbgfileptr);
|
||||||
|
if (rc) {
|
||||||
CAM_ERR(CAM_SYNC,"DebugFS could not create directory!");
|
CAM_ERR(CAM_SYNC,"DebugFS could not create directory!");
|
||||||
rc = -ENOENT;
|
rc = -ENOENT;
|
||||||
goto end;
|
goto end;
|
||||||
@@ -1263,7 +1266,6 @@ static void cam_sync_component_unbind(struct device *dev,
|
|||||||
#endif
|
#endif
|
||||||
video_unregister_device(sync_dev->vdev);
|
video_unregister_device(sync_dev->vdev);
|
||||||
video_device_release(sync_dev->vdev);
|
video_device_release(sync_dev->vdev);
|
||||||
debugfs_remove_recursive(sync_dev->dentry);
|
|
||||||
sync_dev->dentry = NULL;
|
sync_dev->dentry = NULL;
|
||||||
|
|
||||||
for (i = 0; i < CAM_SYNC_MAX_OBJS; i++)
|
for (i = 0; i < CAM_SYNC_MAX_OBJS; i++)
|
||||||
|
@@ -1,11 +1,12 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017-2021, The Linux Foundataion. All rights reserved.
|
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
#include <linux/debugfs.h>
|
||||||
#include "cam_trace.h"
|
#include "cam_trace.h"
|
||||||
|
|
||||||
#include "cam_debug_util.h"
|
#include "cam_debug_util.h"
|
||||||
@@ -22,6 +23,85 @@ module_param(debug_priority, uint, 0644);
|
|||||||
|
|
||||||
struct camera_debug_settings cam_debug;
|
struct camera_debug_settings cam_debug;
|
||||||
|
|
||||||
|
struct dentry *cam_debugfs_root;
|
||||||
|
|
||||||
|
void cam_debugfs_init(void)
|
||||||
|
{
|
||||||
|
struct dentry *tmp;
|
||||||
|
|
||||||
|
if (!cam_debugfs_available()) {
|
||||||
|
cam_debugfs_root = NULL;
|
||||||
|
CAM_DBG(CAM_UTIL, "debugfs not available");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cam_debugfs_root) {
|
||||||
|
CAM_WARN(CAM_UTIL, "already created debugfs root");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp = debugfs_create_dir("camera", NULL);
|
||||||
|
if (IS_ERR_VALUE(tmp)) {
|
||||||
|
CAM_ERR(CAM_UTIL, "failed to create debugfs root folder (rc=%d)", PTR_ERR(tmp));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cam_debugfs_root = tmp;
|
||||||
|
CAM_DBG(CAM_UTIL, "successfully created debugfs root");
|
||||||
|
}
|
||||||
|
|
||||||
|
void cam_debugfs_deinit(void)
|
||||||
|
{
|
||||||
|
if (!cam_debugfs_available())
|
||||||
|
return;
|
||||||
|
|
||||||
|
debugfs_remove_recursive(cam_debugfs_root);
|
||||||
|
cam_debugfs_root = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cam_debugfs_create_subdir(const char *name, struct dentry **subdir)
|
||||||
|
{
|
||||||
|
struct dentry *tmp;
|
||||||
|
|
||||||
|
if (!cam_debugfs_root) {
|
||||||
|
CAM_WARN(CAM_UTIL, "debugfs root not created");
|
||||||
|
*subdir = NULL;
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!subdir) {
|
||||||
|
CAM_ERR(CAM_UTIL, "invalid subdir pointer %pK", subdir);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp = debugfs_create_dir(name, cam_debugfs_root);
|
||||||
|
if (IS_ERR_VALUE(tmp)) {
|
||||||
|
CAM_ERR(CAM_UTIL, "failed to create debugfs subdir (name=%s, rc=%d)", name,
|
||||||
|
PTR_ERR(tmp));
|
||||||
|
return PTR_ERR(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
*subdir = tmp;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cam_debugfs_lookup_subdir(const char *name, struct dentry **subdir)
|
||||||
|
{
|
||||||
|
if (!cam_debugfs_root) {
|
||||||
|
CAM_WARN(CAM_UTIL, "debugfs root not created");
|
||||||
|
*subdir = NULL;
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!subdir) {
|
||||||
|
CAM_ERR(CAM_UTIL, "invalid subdir pointer %pK", subdir);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
*subdir = debugfs_lookup(name, cam_debugfs_root);
|
||||||
|
return (*subdir) ? 0 : -ENOENT;
|
||||||
|
}
|
||||||
|
|
||||||
const struct camera_debug_settings *cam_debug_get_settings()
|
const struct camera_debug_settings *cam_debug_get_settings()
|
||||||
{
|
{
|
||||||
return &cam_debug;
|
return &cam_debug;
|
||||||
|
@@ -360,4 +360,59 @@ const struct camera_debug_settings *cam_debug_get_settings(void);
|
|||||||
ssize_t cam_debug_sysfs_node_store(struct device *dev,
|
ssize_t cam_debug_sysfs_node_store(struct device *dev,
|
||||||
struct device_attribute *attr, const char *buf, size_t count);
|
struct device_attribute *attr, const char *buf, size_t count);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cam_debugfs_init()
|
||||||
|
*
|
||||||
|
* @brief: create camera debugfs root folder
|
||||||
|
*/
|
||||||
|
void cam_debugfs_init(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cam_debugfs_deinit()
|
||||||
|
*
|
||||||
|
* @brief: remove camera debugfs root folder
|
||||||
|
*/
|
||||||
|
void cam_debugfs_deinit(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cam_debugfs_create_subdir()
|
||||||
|
*
|
||||||
|
* @brief: create a directory within the camera debugfs root folder
|
||||||
|
*
|
||||||
|
* @name: name of the directory
|
||||||
|
* @subdir: pointer to the newly created directory entry
|
||||||
|
*
|
||||||
|
* @return: 0 on success, negative on failure
|
||||||
|
*/
|
||||||
|
int cam_debugfs_create_subdir(const char *name, struct dentry **subdir);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cam_debugfs_lookup_subdir()
|
||||||
|
*
|
||||||
|
* @brief: lookup a directory within the camera debugfs root folder
|
||||||
|
*
|
||||||
|
* @name: name of the directory
|
||||||
|
* @subdir: pointer to the successfully found directory entry
|
||||||
|
*
|
||||||
|
* @return: 0 on success, negative on failure
|
||||||
|
*/
|
||||||
|
int cam_debugfs_lookup_subdir(const char *name, struct dentry **subdir);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cam_debugfs_available()
|
||||||
|
*
|
||||||
|
* @brief: Check if debugfs is enabled for camera. Use this function before creating any
|
||||||
|
* debugfs entries.
|
||||||
|
*
|
||||||
|
* @return: true if enabled, false otherwise
|
||||||
|
*/
|
||||||
|
static inline bool cam_debugfs_available(void)
|
||||||
|
{
|
||||||
|
#if defined(CONFIG_DEBUG_FS)
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* _CAM_DEBUG_UTIL_H_ */
|
#endif /* _CAM_DEBUG_UTIL_H_ */
|
||||||
|
@@ -22,6 +22,8 @@
|
|||||||
#define CAM_SS_START_PRESIL 0x08c00000
|
#define CAM_SS_START_PRESIL 0x08c00000
|
||||||
#define CAM_SS_START 0x0ac00000
|
#define CAM_SS_START 0x0ac00000
|
||||||
|
|
||||||
|
#define CAM_CLK_DIRNAME "clk"
|
||||||
|
|
||||||
static uint skip_mmrm_set_rate;
|
static uint skip_mmrm_set_rate;
|
||||||
module_param(skip_mmrm_set_rate, uint, 0644);
|
module_param(skip_mmrm_set_rate, uint, 0644);
|
||||||
|
|
||||||
@@ -684,23 +686,32 @@ DEFINE_SIMPLE_ATTRIBUTE(cam_soc_util_clk_lvl_control,
|
|||||||
*/
|
*/
|
||||||
static int cam_soc_util_create_clk_lvl_debugfs(struct cam_hw_soc_info *soc_info)
|
static int cam_soc_util_create_clk_lvl_debugfs(struct cam_hw_soc_info *soc_info)
|
||||||
{
|
{
|
||||||
char debugfs_dir_name[64];
|
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct dentry *dbgfileptr = NULL;
|
struct dentry *dbgfileptr = NULL, *clkdirptr = NULL;
|
||||||
|
|
||||||
|
if (!cam_debugfs_available())
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (soc_info->dentry) {
|
if (soc_info->dentry) {
|
||||||
CAM_DBG(CAM_UTIL, "Debugfs entry for %s already exist",
|
CAM_DBG(CAM_UTIL, "Debugfs entry for %s already exists",
|
||||||
soc_info->dev_name);
|
soc_info->dev_name);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(debugfs_dir_name, 0, sizeof(debugfs_dir_name));
|
rc = cam_debugfs_lookup_subdir(CAM_CLK_DIRNAME, &clkdirptr);
|
||||||
strlcat(debugfs_dir_name, "clk_dir_", sizeof(debugfs_dir_name));
|
if (rc) {
|
||||||
strlcat(debugfs_dir_name, soc_info->dev_name, sizeof(debugfs_dir_name));
|
rc = cam_debugfs_create_subdir(CAM_CLK_DIRNAME, &clkdirptr);
|
||||||
|
if (rc) {
|
||||||
|
CAM_ERR(CAM_UTIL, "DebugFS could not create clk directory!");
|
||||||
|
rc = -ENOENT;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dbgfileptr = debugfs_create_dir(debugfs_dir_name, NULL);
|
dbgfileptr = debugfs_create_dir(soc_info->dev_name, clkdirptr);
|
||||||
if (!dbgfileptr) {
|
if (IS_ERR_OR_NULL(dbgfileptr)) {
|
||||||
CAM_ERR(CAM_UTIL,"DebugFS could not create directory!");
|
CAM_ERR(CAM_UTIL, "DebugFS could not create directory for dev:%s!",
|
||||||
|
soc_info->dev_name);
|
||||||
rc = -ENOENT;
|
rc = -ENOENT;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@@ -711,32 +722,11 @@ static int cam_soc_util_create_clk_lvl_debugfs(struct cam_hw_soc_info *soc_info)
|
|||||||
soc_info->dentry, soc_info, &cam_soc_util_clk_lvl_options);
|
soc_info->dentry, soc_info, &cam_soc_util_clk_lvl_options);
|
||||||
dbgfileptr = debugfs_create_file("clk_lvl_control", 0644,
|
dbgfileptr = debugfs_create_file("clk_lvl_control", 0644,
|
||||||
soc_info->dentry, soc_info, &cam_soc_util_clk_lvl_control);
|
soc_info->dentry, soc_info, &cam_soc_util_clk_lvl_control);
|
||||||
if (IS_ERR(dbgfileptr)) {
|
rc = PTR_ERR_OR_ZERO(dbgfileptr);
|
||||||
if (PTR_ERR(dbgfileptr) == -ENODEV)
|
|
||||||
CAM_WARN(CAM_UTIL, "DebugFS not enabled in kernel!");
|
|
||||||
else
|
|
||||||
rc = PTR_ERR(dbgfileptr);
|
|
||||||
}
|
|
||||||
end:
|
end:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* cam_soc_util_remove_clk_lvl_debugfs()
|
|
||||||
*
|
|
||||||
* @brief: Removes the debugfs files used to view/control
|
|
||||||
* device clk rates
|
|
||||||
*
|
|
||||||
* @soc_info: Device soc information
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static void cam_soc_util_remove_clk_lvl_debugfs(
|
|
||||||
struct cam_hw_soc_info *soc_info)
|
|
||||||
{
|
|
||||||
debugfs_remove_recursive(soc_info->dentry);
|
|
||||||
soc_info->dentry = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cam_soc_util_get_level_from_string(const char *string,
|
int cam_soc_util_get_level_from_string(const char *string,
|
||||||
enum cam_vote_level *level)
|
enum cam_vote_level *level)
|
||||||
{
|
{
|
||||||
@@ -2836,8 +2826,7 @@ int cam_soc_util_release_platform_resource(struct cam_hw_soc_info *soc_info)
|
|||||||
/* release for gpio */
|
/* release for gpio */
|
||||||
cam_soc_util_request_gpio_table(soc_info, false);
|
cam_soc_util_request_gpio_table(soc_info, false);
|
||||||
|
|
||||||
if (soc_info->clk_control_enable)
|
soc_info->dentry = NULL;
|
||||||
cam_soc_util_remove_clk_lvl_debugfs(soc_info);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -288,6 +288,8 @@ static int camera_init(void)
|
|||||||
if (rc)
|
if (rc)
|
||||||
goto end_init;
|
goto end_init;
|
||||||
|
|
||||||
|
cam_debugfs_init();
|
||||||
|
|
||||||
/* For Probing all available submodules */
|
/* For Probing all available submodules */
|
||||||
for (i = 0; i < ARRAY_SIZE(submodule_table); i++) {
|
for (i = 0; i < ARRAY_SIZE(submodule_table); i++) {
|
||||||
num_inits = submodule_table[i].num_component;
|
num_inits = submodule_table[i].num_component;
|
||||||
@@ -316,6 +318,7 @@ end_init:
|
|||||||
static void camera_exit(void)
|
static void camera_exit(void)
|
||||||
{
|
{
|
||||||
__camera_exit(ARRAY_SIZE(submodule_table), 0);
|
__camera_exit(ARRAY_SIZE(submodule_table), 0);
|
||||||
|
cam_debugfs_deinit();
|
||||||
|
|
||||||
CAM_INFO(CAM_UTIL, "Spectra camera driver exited!");
|
CAM_INFO(CAM_UTIL, "Spectra camera driver exited!");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user