瀏覽代碼

msm: camera: common: Remove division on uint64_t

Arm arch does not support dividing 64 bit integer, replacing it with
do_div call.
Fix variable type to work with both 32/64 bit arch.

CRs-Fixed: 2594541
Change-Id: I6b30f089bc998e98c7f2e20dc7fc11eedf6e6bc7
Signed-off-by: Chandan Kumar Jha <[email protected]>
Chandan Kumar Jha 5 年之前
父節點
當前提交
594b0acba5
共有 2 個文件被更改,包括 18 次插入13 次删除
  1. 1 1
      drivers/cam_isp/isp_hw_mgr/cam_tfe_hw_mgr.c
  2. 17 12
      drivers/cam_ope/ope_hw_mgr/cam_ope_hw_mgr.c

+ 1 - 1
drivers/cam_isp/isp_hw_mgr/cam_tfe_hw_mgr.c

@@ -4053,7 +4053,7 @@ static void cam_tfe_mgr_print_io_bufs(struct cam_packet *packet,
 					io_cfg[i].mem_handle[j]);
 				continue;
 			}
-			if (iova_addr >> 32) {
+			if ((iova_addr & 0xFFFFFFFF) != iova_addr) {
 				CAM_ERR(CAM_ISP, "Invalid mapped address");
 				rc = -EINVAL;
 				continue;

+ 17 - 12
drivers/cam_ope/ope_hw_mgr/cam_ope_hw_mgr.c

@@ -312,16 +312,21 @@ static int32_t cam_ope_process_request_timer(void *priv, void *data)
 
 	if (device_share_ratio > 1) {
 		for (i = 0; i < clk_update.axi_vote.num_paths; i++) {
-			clk_update.axi_vote.axi_path[i].camnoc_bw /=
-				device_share_ratio;
-			clk_update.axi_vote.axi_path[i].mnoc_ab_bw /=
-				device_share_ratio;
-			clk_update.axi_vote.axi_path[i].mnoc_ib_bw /=
-				device_share_ratio;
-			clk_update.axi_vote.axi_path[i].ddr_ab_bw /=
-				device_share_ratio;
-			clk_update.axi_vote.axi_path[i].ddr_ib_bw /=
-				device_share_ratio;
+			do_div(
+			clk_update.axi_vote.axi_path[i].camnoc_bw,
+				device_share_ratio);
+			do_div(
+			clk_update.axi_vote.axi_path[i].mnoc_ab_bw,
+				device_share_ratio);
+			do_div(
+			clk_update.axi_vote.axi_path[i].mnoc_ib_bw,
+				device_share_ratio);
+			do_div(
+			clk_update.axi_vote.axi_path[i].ddr_ab_bw,
+				device_share_ratio);
+			do_div(
+			clk_update.axi_vote.axi_path[i].ddr_ib_bw,
+				device_share_ratio);
 		}
 	}
 
@@ -637,10 +642,10 @@ static int cam_ope_calc_total_clk(struct cam_ope_hw_mgr *hw_mgr,
 static uint32_t cam_ope_mgr_calc_base_clk(uint32_t frame_cycles,
 	uint64_t budget)
 {
-	uint64_t base_clk;
 	uint64_t mul = 1000000000;
+	uint64_t base_clk = frame_cycles * mul;
 
-	base_clk = (frame_cycles * mul) / budget;
+	do_div(base_clk, budget);
 
 	CAM_DBG(CAM_OPE, "budget = %lld fc = %d ib = %lld base_clk = %lld",
 		budget, frame_cycles,