瀏覽代碼

msm: camera: isp: Fix unimplemented axi vote reduction issue

If no valid axi BW request is found in 6 continuous requests, the axi
bw vote will remain unchanged, causing BW reduction fail to execute,
and error axi vote log will be printed per request. We need to vote
current request even it's zero to do reduction in this case.

CRs-Fixed: 3507989
Change-Id: Ibf81bc7098ae2599c0fc3d31537c58e18e781704
Signed-off-by: Stark Lin <[email protected]>
Stark Lin 2 年之前
父節點
當前提交
87913e552d

+ 5 - 13
drivers/cam_isp/isp_hw_mgr/isp_hw/sfe_hw/sfe_top/cam_sfe_top.c

@@ -395,15 +395,12 @@ static struct cam_axi_vote *cam_sfe_top_delay_bw_reduction(
 	uint64_t max_bw = 0;
 
 	for (i = 0; i < CAM_DELAY_CLK_BW_REDUCTION_NUM_REQ; i++) {
-		if (top_priv->last_total_bw_vote[i] > max_bw) {
+		if (top_priv->last_total_bw_vote[i] >= max_bw) {
 			vote_idx = i;
 			max_bw = top_priv->last_total_bw_vote[i];
 		}
 	}
 
-	if (vote_idx < 0)
-		return NULL;
-
 	*to_be_applied_bw = max_bw;
 
 	return &top_priv->last_bw_vote[vote_idx];
@@ -507,16 +504,12 @@ int cam_sfe_top_calc_axi_bw_vote(struct cam_sfe_top_priv *top_priv,
 			CAM_DELAY_CLK_BW_REDUCTION_NUM_REQ;
 	} else {
 		/*
-		 * Find max bw request in last few frames. This will the bw
+		 * Find max bw request in last few frames. This will be the bw
 		 * that we want to vote to CPAS now.
 		 */
 		final_bw_vote = cam_sfe_top_delay_bw_reduction(top_priv, total_bw_new_vote);
-		if (!final_bw_vote) {
-			CAM_ERR(CAM_PERF, "to_be_applied_axi_vote is NULL, req_id:%llu",
-				request_id);
-			top_priv->bw_state = CAM_CLK_BW_STATE_UNCHANGED;
-			return 0;
-		}
+		if (*total_bw_new_vote == 0)
+			CAM_DBG(CAM_PERF, "to_be_applied_axi_vote is 0, req_id:%llu", request_id);
 	}
 
 	for (i = 0; i < final_bw_vote->num_paths; i++) {
@@ -546,11 +539,10 @@ int cam_sfe_top_calc_axi_bw_vote(struct cam_sfe_top_priv *top_priv,
 		top_priv->bw_state = CAM_CLK_BW_STATE_DECREASE;
 	}
 
-
 	CAM_DBG(CAM_PERF,
 		"sfe[%d] : Delayed update: applied_total=%lld new_total=%lld, start_stop=%d bw_state=%s req_id=%ld",
 		top_priv->common_data.hw_intf->hw_idx, top_priv->total_bw_applied,
-		total_bw_new_vote, start_stop,
+		*total_bw_new_vote, start_stop,
 		cam_sfe_top_clk_bw_state_to_string(top_priv->bw_state),
 		(start_stop ? -1 : request_id));
 

+ 5 - 13
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_top_common.c

@@ -249,15 +249,12 @@ static struct cam_axi_vote *cam_vfe_top_delay_bw_reduction(
 	uint64_t max_bw = 0;
 
 	for (i = 0; i < CAM_DELAY_CLK_BW_REDUCTION_NUM_REQ; i++) {
-		if (top_common->last_total_bw_vote[i] > max_bw) {
+		if (top_common->last_total_bw_vote[i] >= max_bw) {
 			vote_idx = i;
 			max_bw = top_common->last_total_bw_vote[i];
 		}
 	}
 
-	if (vote_idx < 0)
-		return NULL;
-
 	*to_be_applied_bw = max_bw;
 
 	return &top_common->last_bw_vote[vote_idx];
@@ -363,17 +360,12 @@ static int cam_vfe_top_calc_axi_bw_vote(
 			CAM_DELAY_CLK_BW_REDUCTION_NUM_REQ;
 	} else {
 		/*
-		 * Find max bw request in last few frames. This will the bw
+		 * Find max bw request in last few frames. This will be the bw
 		 * that we want to vote to CPAS now.
 		 */
-		final_bw_vote =
-			cam_vfe_top_delay_bw_reduction(top_common,
-				total_bw_new_vote);
-		if (!final_bw_vote) {
-			CAM_ERR(CAM_PERF, "to_be_applied_axi_vote is NULL");
-			rc = -EINVAL;
-			goto end;
-		}
+		final_bw_vote = cam_vfe_top_delay_bw_reduction(top_common, total_bw_new_vote);
+		if (*total_bw_new_vote == 0)
+			CAM_WARN(CAM_PERF, "to_be_applied_axi_vote is 0, req_id:%llu", request_id);
 	}
 
 	for (i = 0; i < final_bw_vote->num_paths; i++) {