msm: camera: cdm: Add CDM hang detect and debug registers dump support

Add support to dump the cdm core debug registers and CDM hang detect
support for better debugging purpose in case of cdm timeout at config
ife. Add a debugfs for CDM command buffer dump for cdm hang events.
Fix the possible NULL derefernce while dumping the cdm registers.
Turn on debugfs using following command in adb shell:
echo 1 >> /sys/kernel/debug/camera_isp_ctx/enable_cdm_cmd_buffer_dump.

CRs-Fixed: 2748715, 2782720, 2770565
Change-Id: Ibb9aa1d232d742ca1b6e64c16e9718bfc0bc8624
Signed-off-by: Jigar Agrawal <jigar@codeaurora.org>
This commit is contained in:
Jigar Agrawal
2020-09-01 18:12:19 -07:00
parent 6f7608c0a2
commit d74902f0cf
9 changed files with 142 additions and 85 deletions

View File

@@ -5033,9 +5033,11 @@ static int __cam_isp_ctx_start_dev_in_ready(struct cam_context *ctx,
/* HW failure. user need to clean up the resource */
CAM_ERR(CAM_ISP, "Start HW failed");
ctx->state = CAM_CTX_READY;
trace_cam_context_state("ISP", ctx);
if (rc == -ETIMEDOUT)
if ((rc == -ETIMEDOUT) &&
(isp_ctx_debug.enable_cdm_cmd_buff_dump))
rc = cam_isp_ctx_dump_req(req_isp, 0, 0, NULL, false);
trace_cam_context_state("ISP", ctx);
list_del_init(&req->list);
list_add(&req->list, &ctx->pending_req_list);
goto end;
@@ -5628,7 +5630,7 @@ static int cam_isp_context_debug_register(void)
dbgfileptr = debugfs_create_dir("camera_isp_ctx", NULL);
if (!dbgfileptr) {
CAM_ERR(CAM_ICP,"DebugFS could not create directory!");
CAM_ERR(CAM_ISP, "DebugFS could not create directory!");
rc = -ENOENT;
goto end;
}
@@ -5637,9 +5639,11 @@ static int cam_isp_context_debug_register(void)
dbgfileptr = debugfs_create_u32("enable_state_monitor_dump", 0644,
isp_ctx_debug.dentry, &isp_ctx_debug.enable_state_monitor_dump);
dbgfileptr = debugfs_create_u8("enable_cdm_cmd_buffer_dump", 0644,
isp_ctx_debug.dentry, &isp_ctx_debug.enable_cdm_cmd_buff_dump);
if (IS_ERR(dbgfileptr)) {
if (PTR_ERR(dbgfileptr) == -ENODEV)
CAM_WARN(CAM_ICP, "DebugFS not enabled in kernel!");
CAM_WARN(CAM_ISP, "DebugFS not enabled in kernel!");
else
rc = PTR_ERR(dbgfileptr);
}