Prechádzať zdrojové kódy

msm: camera: tfe: Add support last consumed address for tfe

Tfe hardware support the last consumed buf address.
Request port buf done verified with last consumed buffer
Address. Buf done irq delays can be handled through
last consumed address verification.

CRs-Fixed: 2784348
Change-Id: I4d629da44cf6f1b7755c7785eac11f72384c78c7
Signed-off-by: Ravikishore Pampana <[email protected]>
Ravikishore Pampana 4 rokov pred
rodič
commit
02f65e4927

+ 3 - 0
drivers/cam_isp/cam_isp_context.c

@@ -4534,6 +4534,9 @@ static int __cam_isp_ctx_acquire_hw_v1(struct cam_context *ctx,
 		goto free_res;
 	}
 
+	ctx_isp->support_consumed_addr =
+		param.support_consumed_addr;
+
 	/* Query the context has rdi only resource */
 	hw_cmd_args.ctxt_to_hw_map = param.ctxt_to_hw_map;
 	hw_cmd_args.cmd_type = CAM_HW_MGR_CMD_INTERNAL;

+ 13 - 27
drivers/cam_isp/isp_hw_mgr/cam_tfe_hw_mgr.c

@@ -1775,32 +1775,6 @@ void cam_tfe_cam_cdm_callback(uint32_t handle, void *userdata,
 	}
 }
 
-static bool cam_tfe_mgr_is_consumed_addr_supported(
-	struct cam_tfe_hw_mgr_ctx *ctx)
-{
-	bool support_consumed_addr            = false;
-	struct cam_isp_hw_mgr_res *isp_hw_res = NULL;
-	struct cam_hw_intf *hw_intf           = NULL;
-
-	isp_hw_res = &ctx->res_list_tfe_out[0];
-
-	if (!isp_hw_res || !isp_hw_res->hw_res[0]) {
-		CAM_ERR(CAM_ISP, "Invalid ife out res.");
-		goto end;
-	}
-
-	hw_intf = isp_hw_res->hw_res[0]->hw_intf;
-	if (hw_intf && hw_intf->hw_ops.process_cmd) {
-		hw_intf->hw_ops.process_cmd(hw_intf->hw_priv,
-			CAM_ISP_HW_CMD_IS_CONSUMED_ADDR_SUPPORT,
-			&support_consumed_addr,
-			sizeof(support_consumed_addr));
-	}
-
-end:
-	return support_consumed_addr;
-}
-
 /* entry function: acquire_hw */
 static int cam_tfe_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args)
 {
@@ -2011,7 +1985,7 @@ static int cam_tfe_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args)
 	tfe_ctx->num_reg_dump_buf = 0;
 
 	acquire_args->support_consumed_addr =
-		cam_tfe_mgr_is_consumed_addr_supported(tfe_ctx);
+		g_tfe_hw_mgr.support_consumed_addr;
 
 	cam_tfe_hw_mgr_put_ctx(&tfe_hw_mgr->used_ctx_list, &tfe_ctx);
 
@@ -5359,6 +5333,7 @@ static int cam_tfe_hw_mgr_handle_hw_buf_done(
 
 	buf_done_event_data.num_handles = 1;
 	buf_done_event_data.resource_handle[0] = event_info->res_id;
+	buf_done_event_data.last_consumed_addr[0] = event_info->reg_val;
 
 	if (atomic_read(&tfe_hw_mgr_ctx->overflow_pending))
 		return 0;
@@ -5558,6 +5533,7 @@ int cam_tfe_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl)
 	struct cam_iommu_handle cdm_handles;
 	struct cam_tfe_hw_mgr_ctx *ctx_pool;
 	struct cam_isp_hw_mgr_res *res_list_tfe_out;
+	bool support_consumed_addr = false;
 
 	CAM_DBG(CAM_ISP, "Enter");
 
@@ -5574,10 +5550,19 @@ int cam_tfe_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl)
 	for (i = 0, j = 0; i < CAM_TFE_HW_NUM_MAX; i++) {
 		rc = cam_tfe_hw_init(&g_tfe_hw_mgr.tfe_devices[i], i);
 		if (!rc) {
+			struct cam_hw_intf *tfe_device =
+				g_tfe_hw_mgr.tfe_devices[i]->hw_intf;
 			struct cam_hw_info *tfe_hw = (struct cam_hw_info *)
 				g_tfe_hw_mgr.tfe_devices[i]->hw_intf->hw_priv;
 			struct cam_hw_soc_info *soc_info = &tfe_hw->soc_info;
 
+			if (j == 0)
+				tfe_device->hw_ops.process_cmd(
+					tfe_hw,
+					CAM_ISP_HW_CMD_IS_CONSUMED_ADDR_SUPPORT,
+					&support_consumed_addr,
+					sizeof(support_consumed_addr));
+
 			j++;
 
 			g_tfe_hw_mgr.cdm_reg_map[i] = &soc_info->reg_map[0];
@@ -5594,6 +5579,7 @@ int cam_tfe_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl)
 		return -EINVAL;
 	}
 
+	g_tfe_hw_mgr.support_consumed_addr = support_consumed_addr;
 	/* fill csid hw intf information */
 	for (i = 0, j = 0; i < CAM_TFE_CSID_HW_NUM_MAX; i++) {
 		rc = cam_tfe_csid_hw_init(&g_tfe_hw_mgr.csid_devices[i], i);

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

@@ -147,6 +147,7 @@ struct cam_tfe_hw_mgr_ctx {
  * @tfe_dev_caps           tfe device capability per core
  * @work q                 work queue for TFE hw manager
  * @debug_cfg              debug configuration
+ * @support_consumed_addr  indicate whether hw supports last consumed address
  */
 struct cam_tfe_hw_mgr {
 	struct cam_isp_hw_mgr          mgr_common;
@@ -165,6 +166,7 @@ struct cam_tfe_hw_mgr {
 	struct cam_tfe_hw_get_hw_cap   tfe_dev_caps[CAM_TFE_HW_NUM_MAX];
 	struct cam_req_mgr_core_workq *workq;
 	struct cam_tfe_hw_mgr_debug    debug_cfg;
+	bool                           support_consumed_addr;
 };
 
 /**

+ 1 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_hw/cam_tfe_bus.c

@@ -1947,6 +1947,7 @@ static int cam_tfe_bus_update_wm(void *priv, void *cmd_args,
 			update_buf->wm_update->image_buf[i]);
 		CAM_DBG(CAM_ISP, "WM %d image address 0x%x",
 			wm_data->index, reg_val_pair[j-1]);
+		update_buf->wm_update->image_buf_offset[i] = 0;
 
 		CAM_TFE_ADD_REG_VAL_PAIR(reg_val_pair, j,
 			wm_data->hw_regs->frame_incr, frame_inc);