Browse Source

msm: camera: isp: Update internal recovery scheme

When internal recovery is in progress skip notifying
SOF trigger to CRM. Also for AEB add a threshold check when
slave RDIs SOF is seen post IFE epoch, flag as fatal error
only on hitting this scenario on threshold number of
consecutive occasions.

CRs-Fixed: 3064736
Change-Id: Ibda10d3c42cff6ce128197221da298d2e88cb286
Signed-off-by: Karthik Anantha Ram <[email protected]>
Karthik Anantha Ram 3 năm trước cách đây
mục cha
commit
b1bb4920d5
2 tập tin đã thay đổi với 32 bổ sung2 xóa
  1. 26 2
      drivers/cam_isp/cam_isp_context.c
  2. 6 0
      drivers/cam_isp/cam_isp_context.h

+ 26 - 2
drivers/cam_isp/cam_isp_context.c

@@ -530,6 +530,15 @@ static int __cam_isp_ctx_notify_trigger_util(
 		return 0;
 	}
 
+	/* Skip CRM notify when recovery is in progress */
+	if (atomic_read(&ctx_isp->internal_recovery_set)) {
+		CAM_DBG(CAM_ISP,
+			"Internal recovery in progress skip notifying %s trigger point in ctx: %u on link: 0x%x",
+			__cam_isp_ctx_crm_trigger_point_to_string(trigger_type),
+			ctx->ctx_id, ctx->link_hdl);
+		return 0;
+	}
+
 	notify.link_hdl = ctx->link_hdl;
 	notify.dev_hdl = ctx->dev_hdl;
 	notify.frame_id = ctx_isp->frame_id;
@@ -1186,6 +1195,7 @@ static void __cam_isp_context_reset_internal_recovery_params(
 	atomic_set(&ctx_isp->internal_recovery_set, 0);
 	atomic_set(&ctx_isp->process_bubble, 0);
 	ctx_isp->recovery_req_id = 0;
+	ctx_isp->aeb_error_cnt = 0;
 }
 
 static int __cam_isp_context_try_internal_recovery(
@@ -3220,9 +3230,16 @@ static void __cam_isp_ctx_notify_aeb_error_for_sec_event(
 {
 	struct cam_context *ctx = ctx_isp->base;
 
+	if ((++ctx_isp->aeb_error_cnt) <= CAM_ISP_CONTEXT_AEB_ERROR_CNT_MAX) {
+		CAM_WARN(CAM_ISP,
+			"AEB slave RDI's current request's SOF seen after next req is applied for ctx: %u on link: 0x%x last_applied_req: %llu err_cnt: %u",
+			ctx->ctx_id, ctx->link_hdl, ctx_isp->last_applied_req_id, ctx_isp->aeb_error_cnt);
+		return;
+	}
+
 	CAM_ERR(CAM_ISP,
-		"AEB slave RDI's current request's SOF seen after next req is applied, EPOCH height need to be re-configured for ctx: %u on link: 0x%x",
-		ctx->ctx_id, ctx->link_hdl);
+		"Fatal - AEB slave RDI's current request's SOF seen after next req is applied, EPOCH height need to be re-configured for ctx: %u on link: 0x%x err_cnt: %u",
+		ctx->ctx_id, ctx->link_hdl, ctx_isp->aeb_error_cnt);
 
 	/* Pause CRM timer */
 	__cam_isp_ctx_pause_crm_timer(ctx);
@@ -3364,6 +3381,9 @@ static int __cam_isp_ctx_handle_secondary_events(
 			(ctx_isp->substate_activated ==
 			CAM_ISP_CTX_ACTIVATED_BUBBLE_APPLIED))
 			__cam_isp_ctx_notify_aeb_error_for_sec_event(ctx_isp);
+		else
+			/* Reset error count */
+			ctx_isp->aeb_error_cnt = 0;
 		break;
 	case CAM_ISP_HW_SEC_EVENT_EPOCH:
 		__cam_isp_ctx_update_state_monitor_array(ctx_isp,
@@ -6034,6 +6054,7 @@ static inline void __cam_isp_context_reset_ctx_params(
 	ctx_isp->reported_req_id = 0;
 	ctx_isp->bubble_frame_cnt = 0;
 	ctx_isp->recovery_req_id = 0;
+	ctx_isp->aeb_error_cnt = 0;
 }
 
 static int __cam_isp_ctx_start_dev_in_ready(struct cam_context *ctx,
@@ -6440,6 +6461,9 @@ static int __cam_isp_ctx_reset_and_recover(
 		goto end;
 	}
 
+	/* Block all events till HW is resumed */
+	ctx_isp->substate_activated = CAM_ISP_CTX_ACTIVATED_HALT;
+
 	req = list_first_entry(&ctx->pending_req_list,
 		struct cam_ctx_request, list);
 	req_isp = (struct cam_isp_ctx_req *) req->req_priv;

+ 6 - 0
drivers/cam_isp/cam_isp_context.h

@@ -55,6 +55,9 @@
 /* Maximum length of tag while dumping */
 #define CAM_ISP_CONTEXT_DUMP_TAG_MAX_LEN 32
 
+/* AEB error count threshold */
+#define CAM_ISP_CONTEXT_AEB_ERROR_CNT_MAX 3
+
 /* forward declaration */
 struct cam_isp_context;
 
@@ -256,6 +259,8 @@ struct cam_isp_context_event_record {
  * @recovery_req_id:           Req ID flagged for internal recovery
  * @last_sof_timestamp:        SOF timestamp of the last frame
  * @bubble_frame_cnt:          Count of the frame after bubble
+ * @aeb_error_cnt:             Count number of times a specific AEB error scenario is
+ *                             enountered
  * @state_monitor_head:        Write index to the state monitoring array
  * @req_info                   Request id information about last buf done
  * @cam_isp_ctx_state_monitor: State monitoring array
@@ -307,6 +312,7 @@ struct cam_isp_context {
 	uint64_t                         recovery_req_id;
 	uint64_t                         last_sof_timestamp;
 	uint32_t                         bubble_frame_cnt;
+	uint32_t                         aeb_error_cnt;
 	atomic64_t                       state_monitor_head;
 	struct cam_isp_context_state_monitor cam_isp_ctx_state_monitor[
 		CAM_ISP_CTX_STATE_MONITOR_MAX_ENTRIES];