Parcourir la source

msm: camera: isp: Clean up pending request list

Detecting for internal recovery and flush execute in two
different thread contexts, and the critical section protecting
the lists is small to avoid locking overhead. It is possible that flush
was triggered, but bh in ISP detected an error condition and triggers
a internal recovery moving the request in question to pending list.
At this point it is possible, that the flush context has cleared
the pending list, and internal recovery's addition to the pending list
is agnostic to the flushing thread. When there is a flush all, a reset
is issued to the HW and all the bh's are flushed as well. Post this
clearing the pending request list ensures no stale request entity is
left behind as opposed to cleaning up the pending list prior to the
HW stop sequence.

CRs-Fixed: 3669530
Change-Id: I58f024ec51cbc9c391d8aab1199098f314317b8a
Signed-off-by: Karthik Anantha Ram <[email protected]>
(cherry picked from commit 0d58af6cf25db3b3412bc6effc437474751bf700)
Karthik Anantha Ram il y a 1 an
Parent
commit
c3f62bf34a
1 fichiers modifiés avec 11 ajouts et 5 suppressions
  1. 11 5
      drivers/cam_isp/cam_isp_context.c

+ 11 - 5
drivers/cam_isp/cam_isp_context.c

@@ -5848,11 +5848,6 @@ static int __cam_isp_ctx_flush_req_in_top_state(
 
 	ctx_isp = (struct cam_isp_context *) ctx->ctx_priv;
 
-	CAM_DBG(CAM_ISP, "Flush pending list, ctx_idx: %u, link: 0x%x", ctx->ctx_id, ctx->link_hdl);
-	spin_lock_bh(&ctx->lock);
-	__cam_isp_ctx_flush_req(ctx, &ctx->pending_req_list, flush_req);
-	spin_unlock_bh(&ctx->lock);
-
 	/* Reset skipped_list for FCG config */
 	__cam_isp_ctx_reset_fcg_tracker(ctx);
 
@@ -5918,6 +5913,17 @@ static int __cam_isp_ctx_flush_req_in_top_state(
 		ctx_isp->init_received = false;
 	}
 
+	CAM_DBG(CAM_ISP, "Flush pending list, ctx_idx: %u, link: 0x%x", ctx->ctx_id, ctx->link_hdl);
+	/*
+	 * On occasions when we are doing a flush all, HW would get reset
+	 * shutting down any th/bh in the pipeline. If internal recovery
+	 * is triggered prior to flush, by clearing the pending list post
+	 * HW reset will ensure no stale request entities are left behind
+	 */
+	spin_lock_bh(&ctx->lock);
+	__cam_isp_ctx_flush_req(ctx, &ctx->pending_req_list, flush_req);
+	spin_unlock_bh(&ctx->lock);
+
 end:
 	ctx_isp->bubble_frame_cnt = 0;
 	ctx_isp->congestion_cnt = 0;