Преглед на файлове

Merge "msm: camera: tfe: Add support RT CDM in TFE" into camera-kernel.lnx.7.0

Camera Software Integration преди 1 година
родител
ревизия
b68af30718

+ 4 - 2
drivers/cam_isp/isp_hw_mgr/cam_tfe_hw_mgr.c

@@ -2227,6 +2227,7 @@ static int cam_tfe_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args)
 	tfe_ctx->cdm_ops = cdm_acquire.ops;
 	atomic_set(&tfe_ctx->cdm_done, 1);
 	tfe_ctx->last_cdm_done_req = 0;
+	tfe_ctx->cdm_id = cdm_acquire.id;
 	tfe_ctx->current_mup = 0;
 	tfe_ctx->try_recovery_cnt = 0;
 	tfe_ctx->recovery_req_id = 0;
@@ -2495,6 +2496,7 @@ static int cam_tfe_mgr_acquire_dev(void *hw_mgr_priv, void *acquire_hw_args)
 	tfe_ctx->cdm_ops = cdm_acquire.ops;
 	atomic_set(&tfe_ctx->cdm_done, 1);
 	tfe_ctx->last_cdm_done_req = 0;
+	tfe_ctx->cdm_id = cdm_acquire.id;
 	tfe_ctx->current_mup = 0;
 
 	isp_resource = (struct cam_isp_resource *)acquire_args->acquire_info;
@@ -4897,7 +4899,7 @@ static int cam_tfe_mgr_prepare_hw_update(void *hw_mgr_priv,
 			i, ctx->base[i].idx);
 
 		change_base_info.base_idx = ctx->base[i].idx;
-		change_base_info.cdm_id = CAM_CDM_MAX;
+		change_base_info.cdm_id = ctx->cdm_id;
 
 		/* Add change base */
 		rc = cam_isp_add_change_base(prepare, &ctx->res_list_tfe_in,
@@ -5002,7 +5004,7 @@ static int cam_tfe_mgr_prepare_hw_update(void *hw_mgr_priv,
 	/* add reg update commands */
 	for (i = 0; i < ctx->num_base; i++) {
 		change_base_info.base_idx = ctx->base[i].idx;
-		change_base_info.cdm_id = CAM_CDM_MAX;
+		change_base_info.cdm_id = ctx->cdm_id;
 		/* Add change base */
 		rc = cam_isp_add_change_base(prepare, &ctx->res_list_tfe_in,
 			&change_base_info, &prepare_hw_data->kmd_cmd_buff_info);

+ 2 - 0
drivers/cam_isp/isp_hw_mgr/cam_tfe_hw_mgr.h

@@ -176,6 +176,8 @@ struct cam_tfe_hw_mgr_ctx {
 	uint32_t                        current_mup;
 	uint32_t                        try_recovery_cnt;
 	uint64_t                        recovery_req_id;
+	enum cam_cdm_id                 cdm_id;
+	bool                            is_shdr_slave;
 };
 
 /**

+ 17 - 2
drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_hw/cam_tfe_core.c

@@ -1407,6 +1407,7 @@ static int cam_tfe_top_get_base(struct cam_tfe_top_priv *top_priv,
 	uint32_t                          mem_base = 0;
 	struct cam_isp_hw_get_cmd_update *cdm_args  = cmd_args;
 	struct cam_cdm_utils_ops         *cdm_util_ops = NULL;
+	struct cam_tfe_soc_private       *soc_private;
 
 	if (arg_size != sizeof(struct cam_isp_hw_get_cmd_update)) {
 		CAM_ERR(CAM_ISP, "Error Invalid cmd size");
@@ -1419,6 +1420,12 @@ static int cam_tfe_top_get_base(struct cam_tfe_top_priv *top_priv,
 		return -EINVAL;
 	}
 
+	soc_private = top_priv->common_data.soc_info->soc_private;
+	if (!soc_private) {
+		CAM_ERR(CAM_ISP, "soc_private is null");
+		return -EINVAL;
+	}
+
 	cdm_util_ops =
 		(struct cam_cdm_utils_ops *)cdm_args->res->cdm_ops;
 
@@ -1443,8 +1450,16 @@ static int cam_tfe_top_get_base(struct cam_tfe_top_priv *top_priv,
 		return -EINVAL;
 	}
 
-	cdm_util_ops->cdm_write_changebase(
-	cdm_args->cmd.cmd_buf_addr, mem_base);
+	if (cdm_args->cdm_id == CAM_CDM_RT) {
+		if (!soc_private->rt_wrapper_base) {
+			CAM_ERR(CAM_ISP, "rt_wrapper_base_addr is null");
+			return -EINVAL;
+		}
+
+		mem_base -= soc_private->rt_wrapper_base;
+	}
+
+	cdm_util_ops->cdm_write_changebase(cdm_args->cmd.cmd_buf_addr, mem_base);
 	cdm_args->cmd.used_bytes = (size * 4);
 
 	return 0;

+ 9 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_hw/cam_tfe_soc.c

@@ -50,6 +50,15 @@ int cam_tfe_init_soc_resources(struct cam_hw_soc_info *soc_info,
 		strlen(soc_info->compatible)) != NULL)
 		soc_private->is_tfe_lite = true;
 
+	rc = of_property_read_u32(soc_info->pdev->dev.of_node, "rt-wrapper-base",
+		&soc_private->rt_wrapper_base);
+	if (rc) {
+		soc_private->rt_wrapper_base = 0;
+		CAM_DBG(CAM_ISP, "rc: %d Error reading rt_wrapper_base for core_idx: %u",
+			rc, soc_info->index);
+		rc = 0;
+	}
+
 	/* set some default values */
 	soc_private->num_pid = 0;
 

+ 1 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_hw/cam_tfe_soc.h

@@ -35,6 +35,7 @@ enum cam_cpas_handle_id {
 struct cam_tfe_soc_private {
 	uint32_t    cpas_handle;
 	uint32_t    cpas_version;
+	uint32_t    rt_wrapper_base;
 	int32_t     dsp_clk_index;
 	uint32_t    num_pid;
 	uint32_t    pid[CAM_ISP_HW_MAX_PID_VAL];