Forráskód Böngészése

msm: camera: isp: Update last applied MUP for scratch

In case of sHDR dynamic switch, for a frame on which we are
configuring scratch buffer, use MUP from the last applied
valid request as opposed to global reference of MUP held
by the CSID driver. The global reference could have been
updated by a future request, it would be incorrect to use
that when that request has not even been applied.

CRs-Fixed: 3038703
Change-Id: I9369dba80fa258925ab4ae573b33931352318334
Signed-off-by: Karthik Anantha Ram <[email protected]>
Karthik Anantha Ram 3 éve
szülő
commit
54f158a4fe

+ 3 - 2
drivers/cam_isp/cam_isp_context.c

@@ -679,13 +679,14 @@ static int __cam_isp_ctx_enqueue_init_request(
 					req_update_new->num_reg_dump_buf;
 			}
 
-			/* Update frame header params for EPCR */
+			/* Update HW update params for ePCR */
 			hw_update_data = &req_isp_new->hw_update_data;
 			req_isp_old->hw_update_data.frame_header_res_id =
 				req_isp_new->hw_update_data.frame_header_res_id;
 			req_isp_old->hw_update_data.frame_header_cpu_addr =
 				hw_update_data->frame_header_cpu_addr;
-
+			req_isp_old->hw_update_data.mup_en = req_isp_new->hw_update_data.mup_en;
+			req_isp_old->hw_update_data.mup_val = req_isp_new->hw_update_data.mup_val;
 			req_old->request_id = req->request_id;
 
 			list_add_tail(&req->list, &ctx->free_req_list);

+ 12 - 5
drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c

@@ -5850,17 +5850,21 @@ static int cam_ife_mgr_config_hw(void *hw_mgr_priv,
 					cam_cdm_dump_debug_registers(
 						ctx->cdm_handle);
 				rc = -ETIMEDOUT;
-			} else
+			} else {
 				CAM_DBG(CAM_ISP,
 					"config done Success for req_id=%llu ctx_index %d",
 					cfg->request_id, ctx->ctx_index);
-			hw_update_data->mup_en = false;
+				/* Update last applied MUP */
+				if (hw_update_data->mup_en)
+					ctx->current_mup = hw_update_data->mup_val;
+				hw_update_data->mup_en = false;
+			}
 		}
 	} else {
 		CAM_ERR(CAM_ISP, "No commands to config");
 	}
-	CAM_DBG(CAM_ISP, "Exit: Config Done: %llu",  cfg->request_id);
 
+	CAM_DBG(CAM_ISP, "Exit: Config Done: %llu",  cfg->request_id);
 	return rc;
 }
 
@@ -6126,6 +6130,7 @@ static int cam_ife_mgr_stop_hw(void *hw_mgr_priv, void *stop_hw_args)
 		memset(ctx->sfe_info.scratch_config, 0,
 			sizeof(struct cam_sfe_scratch_buf_cfg));
 	ctx->sfe_info.skip_scratch_cfg_streamon = false;
+	ctx->current_mup = 0;
 
 	cam_ife_mgr_pause_hw(ctx);
 
@@ -7653,6 +7658,7 @@ static int cam_isp_blob_csid_dynamic_switch_update(
 	prepare_hw_data = (struct cam_isp_prepare_hw_update_data  *)
 			prepare->priv;
 	prepare_hw_data->mup_en = true;
+	prepare_hw_data->mup_val = mup_config->mup;
 
 	csid_mup_upd_args.mup_args.mup = mup_config->mup;
 	for (i = 0; i < ctx->num_base; i++) {
@@ -10615,6 +10621,7 @@ int cam_isp_config_csid_rup_aup(
 		rup_args[i].cmd.cmd_buf_addr = NULL;
 		rup_args[i].cmd.size = 0;
 		rup_args[i].reg_write = true;
+		rup_args[i].last_applied_mup = ctx->current_mup;
 		res = rup_args[i].res[0];
 
 		rc = res->hw_intf->hw_ops.process_cmd(
@@ -10625,8 +10632,8 @@ int cam_isp_config_csid_rup_aup(
 			return rc;
 
 		CAM_DBG(CAM_ISP,
-			"Reg update for res %d hw_id %d ",
-			res->res_id, res->hw_intf->hw_idx);
+			"Reg update for CSID: %u mup: %u",
+			res->hw_intf->hw_idx, ctx->current_mup);
 	}
 
 	return rc;

+ 3 - 0
drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.h

@@ -239,6 +239,8 @@ struct cam_ife_cdm_user_data {
  * @flags                   Flags pertainting to this ctx
  * @bw_config_version       BW Config version
  * @recovery_id:            Unique ID of the current valid scheduled recovery
+ * @current_mup:            Current MUP val, scratch will then apply the same as previously
+ *                          applied request
  *
  */
 struct cam_ife_hw_mgr_ctx {
@@ -294,6 +296,7 @@ struct cam_ife_hw_mgr_ctx {
 	struct cam_ife_cdm_user_data      cdm_userdata;
 	uint32_t                          bw_config_version;
 	atomic_t                          recovery_id;
+	uint32_t                          current_mup;
 };
 
 /**

+ 3 - 1
drivers/cam_isp/isp_hw_mgr/include/cam_isp_hw_mgr_intf.h

@@ -193,6 +193,7 @@ struct cam_isp_bw_clk_config_info {
  * @reg_dump_buf_desc:     cmd buffer descriptors for reg dump
  * @num_reg_dump_buf:      Count of descriptors in reg_dump_buf_desc
  * @packet                 CSL packet from user mode driver
+ * @mup_val:               MUP value if configured
  * @mup_en                 Flag if dynamic sensor switch is enabled
  *
  */
@@ -206,7 +207,8 @@ struct cam_isp_prepare_hw_update_data {
 	struct cam_cmd_buf_desc               reg_dump_buf_desc[
 						CAM_REG_DUMP_MAX_BUF_ENTRIES];
 	uint32_t                              num_reg_dump_buf;
-	struct cam_packet                     *packet;
+	struct cam_packet                    *packet;
+	uint32_t                              mup_val;
 	bool                                  mup_en;
 };
 

+ 10 - 4
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c

@@ -4487,12 +4487,18 @@ static int cam_ife_csid_ver2_reg_update(
 	reg_val_pair[0] = csid_reg->cmn_reg->rup_aup_cmd_addr;
 	reg_val_pair[1] = rup_aup_mask;
 
-	reg_val_pair[1] |= csid_hw->rx_cfg.mup <<
-			csid_reg->cmn_reg->mup_shift_val;
+	/* If not an actual request, configure last applied MUP */
+	if (rup_args->reg_write)
+		reg_val_pair[1] |= (rup_args->last_applied_mup <<
+			csid_reg->cmn_reg->mup_shift_val);
+	else
+		reg_val_pair[1] |= (csid_hw->rx_cfg.mup <<
+			csid_reg->cmn_reg->mup_shift_val);
 
-	CAM_DBG(CAM_ISP, "CSID:%d reg_update_cmd 0x%X offset 0x%X",
+	CAM_DBG(CAM_ISP, "CSID:%d configure rup_aup_mup: 0x%x offset: 0x%x via %s",
 		csid_hw->hw_intf->hw_idx,
-		reg_val_pair[1], reg_val_pair[0]);
+		reg_val_pair[1], reg_val_pair[0],
+		(rup_args->reg_write ? "AHB" : "CDM"));
 
 	if (rup_args->reg_write) {
 		soc_info = &csid_hw->hw_info->soc_info;

+ 6 - 4
drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_ife_csid_hw_intf.h

@@ -361,15 +361,17 @@ struct cam_ife_csid_dual_sync_args {
 /*
  * struct cam_isp_csid_reg_update_args:
  *
- * @cmd:           cmd buf update args
- * @node_res:      Node res pointer
- * @num_res:       Num of resources
- * @reg_write:     if set use AHB to config rup/aup
+ * @cmd:              cmd buf update args
+ * @node_res:         Node res pointer
+ * @num_res:          Num of resources
+ * @last_applied_mup: last applied MUP
+ * @reg_write:        if set use AHB to config rup/aup
  */
 struct cam_isp_csid_reg_update_args {
 	struct cam_isp_hw_cmd_buf_update  cmd;
 	struct cam_isp_resource_node     *res[CAM_IFE_PIX_PATH_RES_MAX];
 	uint32_t                          num_res;
+	uint32_t                          last_applied_mup;
 	bool                              reg_write;
 };