Browse Source

msm: camera: isp: Do internal recovery when meets back to back bubble request

Do internal recovery when a request meets back to back bubble.

CRs-Fixed: 3300029
Change-Id: I6b2dc3bffd5cd624cd3b32f3c5c96134e2120d06
Signed-off-by: mingpan <[email protected]>
mingpan 2 năm trước cách đây
mục cha
commit
fe9c1170c8

+ 20 - 0
drivers/cam_req_mgr/cam_req_mgr_core.c

@@ -762,6 +762,8 @@ static void __cam_req_mgr_flush_req_slot(
 
 		/* Reset input queue slot */
 		slot->req_id = -1;
+		slot->bubble_times = 0;
+		slot->internal_recovered = false;
 		slot->skip_idx = 1;
 		slot->recover = 0;
 		slot->additional_timeout = 0;
@@ -825,6 +827,8 @@ static void __cam_req_mgr_reset_req_slot(struct cam_req_mgr_core_link *link,
 
 	/* Reset input queue slot */
 	slot->req_id = -1;
+	slot->bubble_times = 0;
+	slot->internal_recovered = false;
 	slot->skip_idx = 0;
 	slot->recover = 0;
 	slot->additional_timeout = 0;
@@ -3423,6 +3427,7 @@ int cam_req_mgr_process_error(void *priv, void *data)
 			/* Bring processing pointer to bubbled req id */
 			__cam_req_mgr_tbl_set_all_skip_cnt(&link->req.l_tbl);
 			in_q->rd_idx = idx;
+			in_q->slot[idx].bubble_times++;
 			in_q->slot[idx].status = CRM_SLOT_STATUS_REQ_ADDED;
 			if (link->sync_link[0]) {
 				in_q->slot[idx].sync_mode = 0;
@@ -3431,6 +3436,21 @@ int cam_req_mgr_process_error(void *priv, void *data)
 				in_q->slot[idx].sync_mode = 0;
 			}
 
+			/*
+			 * We need do internal recovery for back to back bubble, but if
+			 * the request had been internal recovered, we won't recover
+			 * it again.
+			 */
+			if ((in_q->slot[idx].bubble_times >= REQ_MAXIMUM_BUBBLE_TIMES) &&
+				!in_q->slot[idx].internal_recovered) {
+				link->try_for_internal_recovery = true;
+				/* Notify all devices in the link about the error */
+				__cam_req_mgr_send_evt(err_info->req_id,
+					CAM_REQ_MGR_LINK_EVT_STALLED, CRM_KMD_ERR_FATAL, link);
+				in_q->slot[idx].internal_recovered = true;
+				link->try_for_internal_recovery = false;
+			}
+
 			/*
 			 * Reset till last applied, even if there are scheduling delays
 			 * we start fresh from the request on which bubble has

+ 7 - 0
drivers/cam_req_mgr/cam_req_mgr_core.h

@@ -45,6 +45,8 @@
 #define VERSION_2  2
 #define CAM_REQ_MGR_MAX_TRIGGERS   2
 
+#define REQ_MAXIMUM_BUBBLE_TIMES   2
+
 #define CAM_REQ_MGR_HALF_FRAME_DURATION(frame_duration) (frame_duration / 2)
 
 /**
@@ -287,6 +289,9 @@ struct cam_req_mgr_req_tbl {
  * @recovery_counter   : Internal recovery counter
  * @num_sync_links     : Num of sync links
  * @sync_link_hdls     : Array of sync link handles
+ * @bubble_times       : times of bubbles the req happended
+ * @internal_recovered : indicate if internal recover is already done for request
+ * of this slot
  */
 struct cam_req_mgr_slot {
 	int32_t               idx;
@@ -299,6 +304,8 @@ struct cam_req_mgr_slot {
 	int32_t               recovery_counter;
 	int32_t               num_sync_links;
 	int32_t               sync_link_hdls[MAXIMUM_LINKS_PER_SESSION - 1];
+	uint32_t              bubble_times;
+	bool                  internal_recovered;
 };
 
 /**