فهرست منبع

msm: camera: isp: Add debugfs parameter for state monitor dump

This change adds a debugfs parameter to enable isp context state
monitor dump rather than always print by default. This change
also changes isp context substate to HALT only after stop hw
is complete.

Change-Id: I1025a46e9be63b4ee5808c2eb44672687d901c2e
Signed-off-by: Venkat Chinta <[email protected]>
Jigarkumar Zala 6 سال پیش
والد
کامیت
2c55550c19
2فایلهای تغییر یافته به همراه49 افزوده شده و 7 حذف شده
  1. 37 7
      drivers/cam_isp/cam_isp_context.c
  2. 12 0
      drivers/cam_isp/cam_isp_context.h

+ 37 - 7
drivers/cam_isp/cam_isp_context.c

@@ -22,6 +22,8 @@
 
 static const char isp_dev_name[] = "cam-isp";
 
+static struct cam_isp_ctx_debug isp_ctx_debug;
+
 #define INC_STATE_MONITOR_HEAD(head) \
 	(atomic64_add_return(1, head) % \
 	CAM_ISP_CTX_STATE_MONITOR_MAX_ENTRIES)
@@ -3440,12 +3442,6 @@ static int __cam_isp_ctx_stop_dev_in_activated_unlock(
 		(struct cam_isp_context *) ctx->ctx_priv;
 	struct cam_isp_stop_args         stop_isp;
 
-	/* Mask off all the incoming hardware events */
-	spin_lock_bh(&ctx->lock);
-	ctx_isp->substate_activated = CAM_ISP_CTX_ACTIVATED_HALT;
-	spin_unlock_bh(&ctx->lock);
-	CAM_DBG(CAM_ISP, "next substate %d", ctx_isp->substate_activated);
-
 	/* stop hw first */
 	if (ctx_isp->hw_ctx) {
 		stop.ctxt_to_hw_map = ctx_isp->hw_ctx;
@@ -3462,6 +3458,12 @@ static int __cam_isp_ctx_stop_dev_in_activated_unlock(
 			&stop);
 	}
 
+	/* Mask off all the incoming hardware events */
+	spin_lock_bh(&ctx->lock);
+	ctx_isp->substate_activated = CAM_ISP_CTX_ACTIVATED_HALT;
+	spin_unlock_bh(&ctx->lock);
+	CAM_DBG(CAM_ISP, "next substate %d", ctx_isp->substate_activated);
+
 	while (!list_empty(&ctx->pending_req_list)) {
 		req = list_first_entry(&ctx->pending_req_list,
 				struct cam_ctx_request, list);
@@ -3725,7 +3727,8 @@ static int __cam_isp_ctx_handle_irq_in_activated(void *context,
 	} else {
 		CAM_DBG(CAM_ISP, "No handle function for substate %d",
 			ctx_isp->substate_activated);
-		__cam_isp_ctx_dump_state_monitor_array(ctx_isp);
+		if (isp_ctx_debug.enable_state_monitor_dump)
+			__cam_isp_ctx_dump_state_monitor_array(ctx_isp);
 	}
 
 	CAM_DBG(CAM_ISP, "Exit: State %d Substate %d",
@@ -3867,6 +3870,31 @@ static int cam_isp_context_dump_active_request(void *data, unsigned long iova,
 	return rc;
 }
 
+static int cam_isp_context_debug_register(void)
+{
+	isp_ctx_debug.dentry = debugfs_create_dir("camera_isp_ctx",
+		NULL);
+
+	if (!isp_ctx_debug.dentry) {
+		CAM_ERR(CAM_ISP, "failed to create dentry");
+		return -ENOMEM;
+	}
+
+	if (!debugfs_create_u32("enable_state_monitor_dump",
+		0644,
+		isp_ctx_debug.dentry,
+		&isp_ctx_debug.enable_state_monitor_dump)) {
+		CAM_ERR(CAM_ISP, "failed to create enable_state_monitor_dump");
+		goto err;
+	}
+
+	return 0;
+
+err:
+	debugfs_remove_recursive(isp_ctx_debug.dentry);
+	return -ENOMEM;
+}
+
 int cam_isp_context_init(struct cam_isp_context *ctx,
 	struct cam_context *ctx_base,
 	struct cam_req_mgr_kmd_ops *crm_node_intf,
@@ -3918,6 +3946,8 @@ int cam_isp_context_init(struct cam_isp_context *ctx,
 		CAM_ISP_CTX_ACTIVATED_MAX;
 	}
 	atomic64_set(&ctx->state_monitor_head, -1);
+
+	cam_isp_context_debug_register();
 err:
 	return rc;
 }

+ 12 - 0
drivers/cam_isp/cam_isp_context.h

@@ -70,6 +70,18 @@ enum cam_isp_state_change_trigger {
 	CAM_ISP_STATE_CHANGE_TRIGGER_MAX
 };
 
+/**
+ * struct cam_isp_ctx_debug -  Contains debug parameters
+ *
+ * @dentry:                    Debugfs entry
+ * @enable_state_monitor_dump: Enable isp state monitor dump
+ *
+ */
+struct cam_isp_ctx_debug {
+	struct dentry  *dentry;
+	uint32_t        enable_state_monitor_dump;
+};
+
 /**
  * struct cam_isp_ctx_irq_ops - Function table for handling IRQ callbacks
  *