瀏覽代碼

msm: camera: isp: Move the mup info to per request update data

Sometimes, maybe two continuous mup update request comes too
close, then the mup value will be overridden in CSID side. This
change moves the mup info to per request update data.

CRs-Fixed: 3425088
Change-Id: I90f6608c1bf79180f8d70d9053136c2e9c7fd397
Signed-off-by: Depeng Shao <[email protected]>
Depeng Shao 2 年之前
父節點
當前提交
31266f210b

+ 14 - 9
drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c

@@ -8807,7 +8807,6 @@ static int cam_isp_blob_csid_dynamic_switch_update(
 	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++) {
 		if (ctx->base[i].hw_type != CAM_ISP_HW_TYPE_CSID)
 			continue;
@@ -11577,17 +11576,21 @@ static int cam_ife_mgr_csid_add_reg_update(struct cam_ife_hw_mgr_ctx *ctx,
 	struct cam_hw_prepare_update_args *prepare,
 	struct cam_kmd_buf_info *kmd_buf)
 {
-	int                                   i;
-	int                                   rc = 0;
-	uint32_t                              hw_idx;
-	struct cam_ife_hw_mgr                *hw_mgr;
-	struct cam_isp_hw_mgr_res            *hw_mgr_res;
-	struct cam_ife_csid_hw_caps          *csid_caps;
-	struct cam_isp_resource_node         *res;
-	struct cam_isp_change_base_args       change_base_info = {0};
+	int                                     i;
+	int                                     rc = 0;
+	uint32_t                                hw_idx;
+	struct cam_ife_hw_mgr                  *hw_mgr;
+	struct cam_isp_hw_mgr_res              *hw_mgr_res;
+	struct cam_ife_csid_hw_caps            *csid_caps;
+	struct cam_isp_resource_node           *res;
+	struct cam_isp_prepare_hw_update_data  *prepare_hw_data = NULL;
+	struct cam_isp_change_base_args         change_base_info = {0};
 	struct cam_isp_csid_reg_update_args
 			rup_args[CAM_IFE_CSID_HW_NUM_MAX]  = {0};
 
+	prepare_hw_data = (struct cam_isp_prepare_hw_update_data  *)
+		prepare->priv;
+
 	hw_mgr = ctx->hw_mgr;
 	list_for_each_entry(hw_mgr_res, &ctx->res_list_ife_csid, list) {
 
@@ -11608,6 +11611,8 @@ static int cam_ife_mgr_csid_add_reg_update(struct cam_ife_hw_mgr_ctx *ctx,
 
 			rup_args[hw_idx].res[rup_args[hw_idx].num_res] = res;
 			rup_args[hw_idx].num_res++;
+			rup_args[hw_idx].mup_en = prepare_hw_data->mup_en;
+			rup_args[hw_idx].mup_val = prepare_hw_data->mup_val;
 
 			CAM_DBG(CAM_ISP,
 				"Reg update queued for res %d hw_id %d, ctx_idx: %u",

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

@@ -5549,6 +5549,12 @@ 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;
 
+	if (rup_args->mup_en) {
+		csid_hw->rx_cfg.mup = rup_args->mup_val;
+		CAM_DBG(CAM_ISP, "CSID[%u] MUP %u",
+			csid_hw->hw_intf->hw_idx, csid_hw->rx_cfg.mup);
+	}
+
 	/* If not an actual request, configure last applied MUP */
 	if (rup_args->reg_write)
 		reg_val_pair[1] |= (rup_args->last_applied_mup <<
@@ -5791,10 +5797,6 @@ static int cam_ife_csid_ver2_set_dynamic_switch_config(
 	switch_update =
 		(struct cam_ife_csid_mode_switch_update_args *)cmd_args;
 
-	csid_hw->rx_cfg.mup = switch_update->mup_args.mup;
-	CAM_DBG(CAM_ISP, "CSID[%u] MUP %u",
-		csid_hw->hw_intf->hw_idx, csid_hw->rx_cfg.mup);
-
 	/* Handle number of frames to initially drop based on num starting exposures */
 	if (switch_update->exp_update_args.reset_discard_cfg) {
 		struct cam_ife_csid_discard_frame_cfg_update *exp_update_args;

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

@@ -439,6 +439,8 @@ struct cam_ife_csid_dual_sync_args {
  * @num_res:          Num of resources
  * @last_applied_mup: last applied MUP
  * @reg_write:        if set use AHB to config rup/aup
+ * @mup_val:          MUP value if configured
+ * @mup_en:           Flag if dynamic sensor switch is enabled
  */
 struct cam_isp_csid_reg_update_args {
 	struct cam_isp_hw_cmd_buf_update  cmd;
@@ -446,6 +448,8 @@ struct cam_isp_csid_reg_update_args {
 	uint32_t                          num_res;
 	uint32_t                          last_applied_mup;
 	bool                              reg_write;
+	uint32_t                          mup_val;
+	uint32_t                          mup_en;
 };
 
 /*
@@ -459,15 +463,6 @@ struct cam_ife_csid_offline_cmd_update_args {
 	struct cam_isp_resource_node     *res;
 };
 
-/*
- * struct cam_ife_csid_mup_update_args:
- *
- * @mup:                MUP for incoming VC of next frame
- */
-struct cam_ife_csid_mup_update_args {
-	uint32_t mup;
-};
-
 /*
  * struct cam_ife_csid_discard_frame_cfg_update:
  *
@@ -487,7 +482,6 @@ struct cam_ife_csid_discard_frame_cfg_update {
  * @exp_update_args:  Exposure update arguments
  */
 struct cam_ife_csid_mode_switch_update_args {
-	struct cam_ife_csid_mup_update_args          mup_args;
 	struct cam_ife_csid_discard_frame_cfg_update exp_update_args;
 };