Procházet zdrojové kódy

Merge "msm: camera: ife: Optimize the IFE CDM Acquire" into camera-kernel.lnx.4.0

Haritha Chintalapati před 5 roky
rodič
revize
82c16fb39a

+ 90 - 140
drivers/cam_isp/cam_isp_context.c

@@ -314,71 +314,62 @@ static int cam_isp_ctx_dump_req(
 	size_t                  *offset,
 	bool                     dump_to_buff)
 {
-	int i, j, rc = 0;
+	int i, rc = 0;
 	size_t len = 0;
 	uint32_t *buf_addr;
 	uint32_t *buf_start, *buf_end;
 	size_t remain_len = 0;
 	struct cam_cdm_cmd_buf_dump_info dump_info;
-	uint32_t num_cfg;
-	struct cam_hw_update_entry *cfg;
-
-	for (j = 0; j < CAM_IFE_HW_NUM_MAX; j++) {
-		num_cfg = req_isp->cfg_info[j].num_hw_entries;
-		cfg = req_isp->cfg_info[j].hw_entries;
-		for (i = 0; i < num_cfg; i++) {
-			rc = cam_packet_util_get_cmd_mem_addr(
-				cfg[i].handle, &buf_addr, &len);
-			if (rc) {
-				CAM_ERR_RATE_LIMIT(CAM_ISP,
-					"Failed to get_cmd_mem_addr, rc=%d",
-					rc);
-			} else {
-				if (cfg[i].offset >= ((uint32_t)len)) {
-					CAM_ERR(CAM_ISP,
-						"Invalid offset exp %u actual %u",
-						cfg[i].offset, (uint32_t)len);
-					return -EINVAL;
-				}
-				remain_len = len - cfg[i].offset;
-
-				if (req_isp->cfg_info[j].hw_entries[i].len >
-					((uint32_t)remain_len)) {
-					CAM_ERR(CAM_ISP,
-						"Invalid len exp %u remain_len %u",
-						cfg[i].len,
-						(uint32_t)remain_len);
-					return -EINVAL;
-				}
 
-				buf_start = (uint32_t *)((uint8_t *) buf_addr +
-					cfg[i].offset);
-				buf_end = (uint32_t *)((uint8_t *) buf_start +
-					cfg[i].len - 1);
-
-				if (dump_to_buff) {
-					if (!cpu_addr || !offset || !buf_len) {
-						CAM_ERR(CAM_ISP,
-							"Invalid args");
-						break;
-					}
-					dump_info.src_start = buf_start;
-					dump_info.src_end =   buf_end;
-					dump_info.dst_start = cpu_addr;
-					dump_info.dst_offset = *offset;
-					dump_info.dst_max_size = buf_len;
-					rc = cam_cdm_util_dump_cmd_bufs_v2(
-						&dump_info);
-					*offset = dump_info.dst_offset;
-					if (rc)
-						return rc;
-				} else
-					cam_cdm_util_dump_cmd_buf(buf_start,
-						buf_end);
+	for (i = 0; i < req_isp->num_cfg; i++) {
+		rc = cam_packet_util_get_cmd_mem_addr(
+			req_isp->cfg[i].handle, &buf_addr, &len);
+		if (rc) {
+			CAM_ERR_RATE_LIMIT(CAM_ISP,
+				"Failed to get_cmd_mem_addr, rc=%d",
+				rc);
+		} else {
+			if (req_isp->cfg[i].offset >= ((uint32_t)len)) {
+				CAM_ERR(CAM_ISP,
+					"Invalid offset exp %u actual %u",
+					req_isp->cfg[i].offset, (uint32_t)len);
+				return -EINVAL;
 			}
+			remain_len = len - req_isp->cfg[i].offset;
+
+			if (req_isp->cfg[i].len >
+				((uint32_t)remain_len)) {
+				CAM_ERR(CAM_ISP,
+					"Invalid len exp %u remain_len %u",
+					req_isp->cfg[i].len,
+					(uint32_t)remain_len);
+				return -EINVAL;
+			}
+
+			buf_start = (uint32_t *)((uint8_t *) buf_addr +
+				req_isp->cfg[i].offset);
+			buf_end = (uint32_t *)((uint8_t *) buf_start +
+				req_isp->cfg[i].len - 1);
+
+			if (dump_to_buff) {
+				if (!cpu_addr || !offset || !buf_len) {
+					CAM_ERR(CAM_ISP, "Invalid args");
+					break;
+				}
+				dump_info.src_start = buf_start;
+				dump_info.src_end =   buf_end;
+				dump_info.dst_start = cpu_addr;
+				dump_info.dst_offset = *offset;
+				dump_info.dst_max_size = buf_len;
+				rc = cam_cdm_util_dump_cmd_bufs_v2(
+					&dump_info);
+				*offset = dump_info.dst_offset;
+				if (rc)
+					return rc;
+			} else
+				cam_cdm_util_dump_cmd_buf(buf_start, buf_end);
 		}
 	}
-
 	return rc;
 }
 
@@ -429,17 +420,13 @@ static int __cam_isp_ctx_enqueue_request_in_order(
 static int __cam_isp_ctx_enqueue_init_request(
 	struct cam_context *ctx, struct cam_ctx_request *req)
 {
-	int rc = 0, i = 0;
+	int rc = 0;
 	struct cam_ctx_request                *req_old;
 	struct cam_isp_ctx_req                *req_isp_old;
 	struct cam_isp_ctx_req                *req_isp_new;
 	struct cam_isp_prepare_hw_update_data *req_update_old;
 	struct cam_isp_prepare_hw_update_data *req_update_new;
 	struct cam_isp_prepare_hw_update_data *hw_update_data;
-	struct cam_hw_update_entry            *cfg_old;
-	struct cam_hw_update_entry            *cfg_new;
-	uint32_t                               num_cfg_old;
-	uint32_t                               num_cfg_new;
 
 	spin_lock_bh(&ctx->lock);
 	if (list_empty(&ctx->pending_req_list)) {
@@ -455,12 +442,12 @@ static int __cam_isp_ctx_enqueue_init_request(
 	req_isp_new = (struct cam_isp_ctx_req *) req->req_priv;
 	if (req_isp_old->hw_update_data.packet_opcode_type ==
 		CAM_ISP_PACKET_INIT_DEV) {
-		if ((req_isp_old->total_num_cfg + req_isp_new->total_num_cfg) >=
+		if ((req_isp_old->num_cfg + req_isp_new->num_cfg) >=
 			CAM_ISP_CTX_CFG_MAX) {
 			CAM_WARN(CAM_ISP,
-				"Can not merge INIT pkt total_num_cfgs = %d",
-				(req_isp_old->total_num_cfg +
-					req_isp_new->total_num_cfg));
+				"Can not merge INIT pkt num_cfgs = %d",
+				(req_isp_old->num_cfg +
+					req_isp_new->num_cfg));
 			rc = -ENOMEM;
 		}
 
@@ -485,19 +472,11 @@ static int __cam_isp_ctx_enqueue_init_request(
 			req_isp_old->num_fence_map_in =
 				req_isp_new->num_fence_map_in;
 
-			for (i = 0; i < CAM_IFE_HW_NUM_MAX; i++) {
-				cfg_old = req_isp_old->cfg_info[i].hw_entries;
-				cfg_new = req_isp_new->cfg_info[i].hw_entries;
-				num_cfg_old =
-					req_isp_old->cfg_info[i].num_hw_entries;
-				num_cfg_new =
-					req_isp_new->cfg_info[i].num_hw_entries;
-				memcpy(&cfg_old[num_cfg_old],
-					cfg_new,
-					sizeof(cfg_new[0]) * num_cfg_new);
-				req_isp_old->cfg_info[i].num_hw_entries
-					+= num_cfg_new;
-			}
+			memcpy(&req_isp_old->cfg[req_isp_old->num_cfg],
+				req_isp_new->cfg,
+				sizeof(req_isp_new->cfg[0]) *
+				req_isp_new->num_cfg);
+			req_isp_old->num_cfg += req_isp_new->num_cfg;
 
 			memcpy(&req_old->pf_data, &req->pf_data,
 				sizeof(struct cam_hw_mgr_dump_pf_data));
@@ -1088,12 +1067,12 @@ static int __cam_isp_ctx_handle_buf_done_in_activated_state(
 static int __cam_isp_ctx_apply_req_offline(
 	void *priv, void *data)
 {
-	int rc = 0, i = 0;
+	int rc = 0;
 	struct cam_context *ctx = NULL;
 	struct cam_isp_context *ctx_isp = priv;
 	struct cam_ctx_request *req;
 	struct cam_isp_ctx_req *req_isp;
-	struct cam_isp_hw_config_args cfg;
+	struct cam_hw_config_args cfg;
 
 	if (!ctx_isp) {
 		CAM_ERR(CAM_ISP, "Invalid ctx_isp:%pK", ctx);
@@ -1129,12 +1108,8 @@ static int __cam_isp_ctx_apply_req_offline(
 
 	cfg.ctxt_to_hw_map = ctx_isp->hw_ctx;
 	cfg.request_id = req->request_id;
-	for (i = 0; i < CAM_IFE_HW_NUM_MAX; i++) {
-		cfg.hw_update_info[i].num_hw_entries =
-			req_isp->cfg_info[i].num_hw_entries;
-		cfg.hw_update_info[i].hw_entries =
-				req_isp->cfg_info[i].hw_entries;
-	}
+	cfg.hw_update_entries = req_isp->cfg;
+	cfg.num_hw_update_entries = req_isp->num_cfg;
 	cfg.priv  = &req_isp->hw_update_data;
 	cfg.init_packet = 0;
 
@@ -2511,13 +2486,13 @@ static int __cam_isp_ctx_apply_req_in_activated_state(
 	struct cam_context *ctx, struct cam_req_mgr_apply_request *apply,
 	enum cam_isp_ctx_activated_substate next_state)
 {
-	int rc = 0, i;
+	int rc = 0;
 	struct cam_ctx_request          *req;
 	struct cam_ctx_request          *active_req = NULL;
 	struct cam_isp_ctx_req          *req_isp;
 	struct cam_isp_ctx_req          *active_req_isp;
 	struct cam_isp_context          *ctx_isp = NULL;
-	struct cam_isp_hw_config_args    isp_cfg;
+	struct cam_hw_config_args        cfg = {0};
 
 	if (list_empty(&ctx->pending_req_list)) {
 		CAM_ERR(CAM_ISP, "No available request for Apply id %lld",
@@ -2603,22 +2578,16 @@ static int __cam_isp_ctx_apply_req_in_activated_state(
 	}
 	req_isp->bubble_report = apply->report_if_bubble;
 
-	memset(&isp_cfg, 0, sizeof(isp_cfg));
-
-	isp_cfg.ctxt_to_hw_map = ctx_isp->hw_ctx;
-	isp_cfg.request_id = req->request_id;
-	for (i = 0; i < CAM_IFE_HW_NUM_MAX; i++) {
-		isp_cfg.hw_update_info[i].num_hw_entries =
-			req_isp->cfg_info[i].num_hw_entries;
-		isp_cfg.hw_update_info[i].hw_entries =
-			req_isp->cfg_info[i].hw_entries;
-	}
-	isp_cfg.priv  = &req_isp->hw_update_data;
-	isp_cfg.init_packet = 0;
-	isp_cfg.reapply = req_isp->reapply;
+	cfg.ctxt_to_hw_map = ctx_isp->hw_ctx;
+	cfg.request_id = req->request_id;
+	cfg.hw_update_entries = req_isp->cfg;
+	cfg.num_hw_update_entries = req_isp->num_cfg;
+	cfg.priv  = &req_isp->hw_update_data;
+	cfg.init_packet = 0;
+	cfg.reapply = req_isp->reapply;
 
 	rc = ctx->hw_mgr_intf->hw_config(ctx->hw_mgr_intf->hw_mgr_priv,
-		&isp_cfg);
+		&cfg);
 	if (rc) {
 		CAM_ERR_RATE_LIMIT(CAM_ISP, "Can not apply the configuration");
 	} else {
@@ -3838,7 +3807,7 @@ static int __cam_isp_ctx_config_dev_in_top_state(
 	struct cam_packet                *packet;
 	size_t                            len = 0;
 	size_t                            remain_len = 0;
-	struct cam_isp_hw_update_args     isp_cfg;
+	struct cam_hw_prepare_update_args cfg = {0};
 	struct cam_req_mgr_add_request    add_req;
 	struct cam_isp_context           *ctx_isp =
 		(struct cam_isp_context *) ctx->ctx_priv;
@@ -3918,44 +3887,31 @@ static int __cam_isp_ctx_config_dev_in_top_state(
 		goto free_req;
 	}
 
-	/* preprocess the configuration */
-	memset(&isp_cfg, 0, sizeof(isp_cfg));
-
-	isp_cfg.packet = packet;
-	isp_cfg.remain_len = remain_len;
-	isp_cfg.ctxt_to_hw_map = ctx_isp->hw_ctx;
-	isp_cfg.max_hw_update_entries = CAM_ISP_CTX_CFG_MAX;
-	isp_cfg.max_out_map_entries = CAM_ISP_CTX_RES_MAX;
-	isp_cfg.max_in_map_entries = CAM_ISP_CTX_RES_MAX;
-	isp_cfg.out_map_entries = req_isp->fence_map_out;
-	isp_cfg.in_map_entries = req_isp->fence_map_in;
-	isp_cfg.priv  = &req_isp->hw_update_data;
-	isp_cfg.pf_data = &(req->pf_data);
-
-	for (i = 0; i < CAM_IFE_HW_NUM_MAX; i++)
-		isp_cfg.hw_update_info[i].hw_entries
-			= req_isp->cfg_info[i].hw_entries;
+	cfg.packet = packet;
+	cfg.remain_len = remain_len;
+	cfg.ctxt_to_hw_map = ctx_isp->hw_ctx;
+	cfg.max_hw_update_entries = CAM_ISP_CTX_CFG_MAX;
+	cfg.hw_update_entries = req_isp->cfg;
+	cfg.max_out_map_entries = CAM_ISP_CTX_RES_MAX;
+	cfg.max_in_map_entries = CAM_ISP_CTX_RES_MAX;
+	cfg.out_map_entries = req_isp->fence_map_out;
+	cfg.in_map_entries = req_isp->fence_map_in;
+	cfg.priv  = &req_isp->hw_update_data;
+	cfg.pf_data = &(req->pf_data);
 
 	CAM_DBG(CAM_ISP, "try to prepare config packet......");
 
 	rc = ctx->hw_mgr_intf->hw_prepare_update(
-		ctx->hw_mgr_intf->hw_mgr_priv, &isp_cfg);
+		ctx->hw_mgr_intf->hw_mgr_priv, &cfg);
 	if (rc != 0) {
 		CAM_ERR(CAM_ISP, "Prepare config packet failed in HW layer");
 		rc = -EFAULT;
 		goto free_req;
 	}
 
-	req_isp->total_num_cfg = 0;
-	for (i = 0; i < CAM_IFE_HW_NUM_MAX; i++) {
-		req_isp->cfg_info[i].num_hw_entries
-			= isp_cfg.hw_update_info[i].num_hw_entries;
-		req_isp->total_num_cfg +=
-			req_isp->cfg_info[i].num_hw_entries;
-	}
-
-	req_isp->num_fence_map_out = isp_cfg.num_out_map_entries;
-	req_isp->num_fence_map_in = isp_cfg.num_in_map_entries;
+	req_isp->num_cfg = cfg.num_hw_update_entries;
+	req_isp->num_fence_map_out = cfg.num_out_map_entries;
+	req_isp->num_fence_map_in = cfg.num_in_map_entries;
 	req_isp->num_acked = 0;
 	req_isp->bubble_detected = false;
 
@@ -3969,7 +3925,7 @@ static int __cam_isp_ctx_config_dev_in_top_state(
 	}
 
 	CAM_DBG(CAM_ISP, "num_entry: %d, num fence out: %d, num fence in: %d",
-		req_isp->total_num_cfg, req_isp->num_fence_map_out,
+		req_isp->num_cfg, req_isp->num_fence_map_out,
 		req_isp->num_fence_map_in);
 
 	req->request_id = packet->header.request_id;
@@ -4704,14 +4660,8 @@ static int __cam_isp_ctx_start_dev_in_ready(struct cam_context *ctx,
 
 	start_isp.hw_config.ctxt_to_hw_map = ctx_isp->hw_ctx;
 	start_isp.hw_config.request_id = req->request_id;
-
-	for (i = 0; i < CAM_IFE_HW_NUM_MAX; i++) {
-		start_isp.hw_config.hw_update_info[i].hw_entries
-			= req_isp->cfg_info[i].hw_entries;
-		start_isp.hw_config.hw_update_info[i].num_hw_entries =
-			req_isp->cfg_info[i].num_hw_entries;
-	}
-
+	start_isp.hw_config.hw_update_entries = req_isp->cfg;
+	start_isp.hw_config.num_hw_update_entries = req_isp->num_cfg;
 	start_isp.hw_config.priv  = &req_isp->hw_update_data;
 	start_isp.hw_config.init_packet = 1;
 	start_isp.hw_config.reapply = 0;

+ 4 - 4
drivers/cam_isp/cam_isp_context.h

@@ -135,8 +135,8 @@ struct cam_isp_ctx_irq_ops {
  * struct cam_isp_ctx_req - ISP context request object
  *
  * @base:                  Common request object ponter
- * @cfg_info:              ISP hardware configuration array
- * @total_num_cfg:         Number of ISP hardware configuration entries
+ * @cfg:                   ISP hardware configuration array
+ * @num_cfg:               Number of ISP hardware configuration entries
  * @fence_map_out:         Output fence mapping array
  * @num_fence_map_out:     Number of the output fence map
  * @fence_map_in:          Input fence mapping array
@@ -153,8 +153,8 @@ struct cam_isp_ctx_irq_ops {
  */
 struct cam_isp_ctx_req {
 	struct cam_ctx_request               *base;
-	struct cam_isp_hw_update_info         cfg_info[CAM_IFE_HW_NUM_MAX];
-	uint32_t                              total_num_cfg;
+	struct cam_hw_update_entry            cfg[CAM_ISP_CTX_CFG_MAX];
+	uint32_t                              num_cfg;
 	struct cam_hw_fence_map_entry         fence_map_out
 						[CAM_ISP_CTX_RES_MAX];
 	uint32_t                              num_fence_map_out;

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 189 - 418
drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c


+ 2 - 12
drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.h

@@ -15,14 +15,6 @@
 #include "cam_tasklet_util.h"
 #include "cam_cdm_intf_api.h"
 
-/* enum cam_ife_res_master_slave - HW resource master/slave */
-enum cam_ife_res_master_slave {
-	CAM_IFE_RES_NONE,
-	CAM_IFE_RES_MASTER,
-	CAM_IFE_RES_SLAVE,
-	CAM_IFE_RES_MAX,
-};
-
 /* IFE resource constants */
 #define CAM_IFE_HW_IN_RES_MAX            (CAM_ISP_IFE_IN_RES_MAX & 0xFF)
 #define CAM_IFE_HW_OUT_RES_MAX           (CAM_ISP_IFE_OUT_RES_MAX & 0xFF)
@@ -134,7 +126,7 @@ struct cam_ife_hw_mgr_ctx {
 	uint32_t                        irq_status1_mask[CAM_IFE_HW_NUM_MAX];
 	struct cam_isp_ctx_base_info    base[CAM_IFE_HW_NUM_MAX];
 	uint32_t                        num_base;
-	uint32_t                        cdm_handle[CAM_IFE_HW_NUM_MAX];
+	uint32_t                        cdm_handle;
 	struct cam_cdm_utils_ops       *cdm_ops;
 	struct cam_cdm_bl_request      *cdm_cmd;
 
@@ -144,9 +136,7 @@ struct cam_ife_hw_mgr_ctx {
 	atomic_t                        overflow_pending;
 	atomic_t                        cdm_done;
 	uint32_t                        is_rdi_only_context;
-	struct completion               config_done_complete[
-						CAM_IFE_HW_NUM_MAX];
-	enum cam_ife_res_master_slave   master_slave[CAM_IFE_HW_NUM_MAX];
+	struct completion               config_done_complete;
 	uint32_t                        hw_version;
 	struct cam_cmd_buf_desc         reg_dump_buf_desc[
 						CAM_REG_DUMP_MAX_BUF_ENTRIES];

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

@@ -10,7 +10,6 @@
 #include "cam_isp_hw_mgr_intf.h"
 #include "cam_tasklet_util.h"
 #include "cam_isp_hw.h"
-#include "cam_cdm_intf_api.h"
 
 #define CAM_ISP_HW_NUM_MAX                       7
 
@@ -91,6 +90,5 @@ struct cam_isp_hw_mgr_res {
 struct cam_isp_ctx_base_info {
 	uint32_t                       idx;
 	enum cam_isp_hw_split_id       split_id;
-	enum cam_cdm_id                cdm_id;
 };
 #endif /* _CAM_ISP_HW_MGR_H_ */

+ 85 - 108
drivers/cam_isp/isp_hw_mgr/cam_tfe_hw_mgr.c

@@ -1768,8 +1768,6 @@ static int cam_tfe_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args)
 		goto err;
 	}
 
-	memset(&tfe_ctx->cdm_handle, 0, sizeof(tfe_ctx->cdm_handle));
-
 	tfe_ctx->common.cb_priv = acquire_args->context_data;
 	for (i = 0; i < CAM_ISP_HW_EVENT_MAX; i++)
 		tfe_ctx->common.event_cb[i] = acquire_args->event_cb;
@@ -2003,8 +2001,6 @@ static int cam_tfe_mgr_acquire_dev(void *hw_mgr_priv, void *acquire_hw_args)
 		goto err;
 	}
 
-	memset(&tfe_ctx->cdm_handle, 0, sizeof(tfe_ctx->cdm_handle));
-
 	tfe_ctx->common.cb_priv = acquire_args->context_data;
 	for (i = 0; i < CAM_ISP_HW_EVENT_MAX; i++)
 		tfe_ctx->common.event_cb[i] = acquire_args->event_cb;
@@ -2335,14 +2331,12 @@ static int cam_isp_tfe_blob_bw_update(
 static int cam_tfe_mgr_config_hw(void *hw_mgr_priv,
 	void *config_hw_args)
 {
-	int rc = -EINVAL, i, j, k = 0, skip = 0;
-	struct cam_isp_hw_config_args *cfg;
+	int rc = -EINVAL, i, skip = 0;
+	struct cam_hw_config_args *cfg;
 	struct cam_hw_update_entry *cmd;
 	struct cam_cdm_bl_request *cdm_cmd;
 	struct cam_tfe_hw_mgr_ctx *ctx;
 	struct cam_isp_prepare_hw_update_data *hw_update_data;
-	uint32_t num_ent;
-	struct cam_hw_update_entry *cfg_info;
 
 	if (!hw_mgr_priv || !config_hw_args) {
 		CAM_ERR(CAM_ISP, "Invalid arguments");
@@ -2387,80 +2381,74 @@ static int cam_tfe_mgr_config_hw(void *hw_mgr_priv,
 		}
 	}
 
-	CAM_DBG(CAM_ISP, "Enter ctx id:%d request id: %llu",
-		ctx->ctx_index, cfg->request_id);
+	CAM_DBG(CAM_ISP,
+		"Enter ctx id:%d num_hw_upd_entries %d request id: %llu",
+		ctx->ctx_index, cfg->num_hw_update_entries, cfg->request_id);
+
+	if (cfg->num_hw_update_entries > 0) {
+		cdm_cmd                       = ctx->cdm_cmd;
+		cdm_cmd->cmd_arrary_count     = cfg->num_hw_update_entries;
+		cdm_cmd->type                 = CAM_CDM_BL_CMD_TYPE_MEM_HANDLE;
+		cdm_cmd->flag                 = true;
+		cdm_cmd->userdata             = hw_update_data;
+		cdm_cmd->cookie               = cfg->request_id;
+		cdm_cmd->gen_irq_arb          = false;
+
+		for (i = 0; i < cfg->num_hw_update_entries; i++) {
+			cmd = cfg->hw_update_entries + i;
+			if (cfg->reapply && cmd->flags == CAM_ISP_IQ_BL) {
+				skip++;
+				continue;
+			}
 
-	cdm_cmd                              = ctx->cdm_cmd;
-	cdm_cmd->type                        = CAM_CDM_BL_CMD_TYPE_MEM_HANDLE;
-	cdm_cmd->flag                        = true;
-	cdm_cmd->userdata                    = hw_update_data;
-	cdm_cmd->cookie                      = cfg->request_id;
-	cdm_cmd->gen_irq_arb                 = false;
-	cdm_cmd->cmd_arrary_count            = 0;
+			if (cmd->flags == CAM_ISP_UNUSED_BL ||
+				cmd->flags >= CAM_ISP_BL_MAX)
+				CAM_ERR(CAM_ISP, "Unexpected BL type %d",
+					cmd->flags);
 
-	for (i = 0; i < ctx->num_base; i++) {
-		num_ent = cfg->hw_update_info[ctx->base[i].idx].num_hw_entries;
-		cfg_info = cfg->hw_update_info[ctx->base[i].idx].hw_entries;
-		if (num_ent > 0) {
-			for (j = 0 ; j < num_ent; j++) {
-				cmd = (cfg_info + j);
-
-				if (cfg->reapply &&
-					cmd->flags == CAM_ISP_IQ_BL) {
-					skip++;
-					continue;
-				}
-
-				if (cmd->flags == CAM_ISP_UNUSED_BL ||
-					cmd->flags >= CAM_ISP_BL_MAX)
-					CAM_ERR(CAM_ISP,
-						"Unexpected BL type %d",
-						cmd->flags);
-
-				cdm_cmd->cmd[j - skip + k].bl_addr.mem_handle =
-					cmd->handle;
-				cdm_cmd->cmd[j - skip + k].offset = cmd->offset;
-				cdm_cmd->cmd[j - skip + k].len = cmd->len;
-				cdm_cmd->cmd[j - skip + k].arbitrate = false;
-			}
-			cdm_cmd->cmd_arrary_count += num_ent - skip;
-			k = cdm_cmd->cmd_arrary_count;
+			cdm_cmd->cmd[i - skip].bl_addr.mem_handle = cmd->handle;
+			cdm_cmd->cmd[i - skip].offset = cmd->offset;
+			cdm_cmd->cmd[i - skip].len = cmd->len;
+			cdm_cmd->cmd[i - skip].arbitrate = false;
 		}
-	}
+		cdm_cmd->cmd_arrary_count = cfg->num_hw_update_entries - skip;
+		reinit_completion(&ctx->config_done_complete);
+		ctx->applied_req_id = cfg->request_id;
+		CAM_DBG(CAM_ISP, "Submit to CDM");
 
-	ctx->applied_req_id = cfg->request_id;
-	CAM_DBG(CAM_ISP, "Submit to CDM");
-
-	atomic_set(&ctx->cdm_done, 0);
-	reinit_completion(&ctx->config_done_complete);
-	rc = cam_cdm_submit_bls(ctx->cdm_handle, cdm_cmd);
-	if (rc) {
-		CAM_ERR(CAM_ISP,
-			"Failed to apply the configs for req %llu, rc %d",
-			cfg->request_id, rc);
-		return rc;
-	}
+		atomic_set(&ctx->cdm_done, 0);
 
-	if (cfg->init_packet) {
-		rc = wait_for_completion_timeout(
-			&ctx->config_done_complete,
-			msecs_to_jiffies(
-			CAM_TFE_HW_CONFIG_TIMEOUT));
-		if (rc <= 0) {
+		rc = cam_cdm_submit_bls(ctx->cdm_handle, cdm_cmd);
+		if (rc) {
 			CAM_ERR(CAM_ISP,
-				"config done completion timeout for req_id=%llu rc=%d ctx_index %d",
-				cfg->request_id, rc,
-				ctx->ctx_index);
-			if (rc == 0)
-				rc = -ETIMEDOUT;
-		} else {
-			rc = 0;
-			CAM_DBG(CAM_ISP,
-				"config done Success for req_id=%llu ctx_index %d",
-				cfg->request_id,
-				ctx->ctx_index);
+				"Failed to apply the configs for req %llu, rc %d",
+				cfg->request_id, rc);
+			return rc;
 		}
+
+		if (cfg->init_packet) {
+			rc = wait_for_completion_timeout(
+				&ctx->config_done_complete,
+				msecs_to_jiffies(CAM_TFE_HW_CONFIG_TIMEOUT));
+			if (rc <= 0) {
+				CAM_ERR(CAM_ISP,
+					"config done completion timeout for req_id=%llu rc=%d ctx_index %d",
+					cfg->request_id, rc,
+					ctx->ctx_index);
+				if (rc == 0)
+					rc = -ETIMEDOUT;
+			} else {
+				rc = 0;
+				CAM_DBG(CAM_ISP,
+					"config done Success for req_id=%llu ctx_index %d",
+					cfg->request_id,
+					ctx->ctx_index);
+			}
+		}
+	} else {
+		CAM_ERR(CAM_ISP, "No commands to config");
 	}
+
 	CAM_DBG(CAM_ISP, "Exit: Config Done: %llu",  cfg->request_id);
 
 	return rc;
@@ -3257,14 +3245,13 @@ static int cam_isp_tfe_blob_hfr_update(
 	uint32_t                                  blob_type,
 	struct cam_isp_generic_blob_info         *blob_info,
 	struct cam_isp_tfe_resource_hfr_config   *hfr_config,
-	struct cam_isp_hw_update_args             *prepare)
+	struct cam_hw_prepare_update_args        *prepare)
 {
 	struct cam_isp_tfe_port_hfr_config    *port_hfr_config;
 	struct cam_kmd_buf_info               *kmd_buf_info;
 	struct cam_tfe_hw_mgr_ctx             *ctx = NULL;
 	struct cam_isp_hw_mgr_res             *hw_mgr_res;
-	struct cam_hw_update_entry            *hw_entry;
-	uint32_t                               res_id_out, i, slot_idx = 0;
+	uint32_t                               res_id_out, i;
 	uint32_t                               total_used_bytes = 0;
 	uint32_t                               kmd_buf_remain_size;
 	uint32_t                              *cmd_buf_addr;
@@ -3274,15 +3261,11 @@ static int cam_isp_tfe_blob_hfr_update(
 	ctx = prepare->ctxt_to_hw_map;
 	CAM_DBG(CAM_ISP, "num_ports= %d", hfr_config->num_ports);
 
-	slot_idx = blob_info->base_info->idx;
-	hw_entry = prepare->hw_update_info[slot_idx].hw_entries;
-	num_ent = prepare->hw_update_info[slot_idx].num_hw_entries;
-
 	/* Max one hw entries required for hfr config update */
-	if (prepare->hw_update_info[slot_idx].num_hw_entries + 1 >=
+	if (prepare->num_hw_update_entries + 1 >=
 			prepare->max_hw_update_entries) {
 		CAM_ERR(CAM_ISP, "Insufficient  HW entries :%d %d",
-			prepare->hw_update_info[slot_idx].num_hw_entries,
+			prepare->num_hw_update_entries,
 			prepare->max_hw_update_entries);
 		return -EINVAL;
 	}
@@ -3338,17 +3321,16 @@ static int cam_isp_tfe_blob_hfr_update(
 
 	if (total_used_bytes) {
 		/* Update the HW entries */
-		hw_entry[num_ent].handle =
+		num_ent = prepare->num_hw_update_entries;
+		prepare->hw_update_entries[num_ent].handle =
 			kmd_buf_info->handle;
-		hw_entry[num_ent].len =
-			total_used_bytes;
-		hw_entry[num_ent].offset =
+		prepare->hw_update_entries[num_ent].len = total_used_bytes;
+		prepare->hw_update_entries[num_ent].offset =
 			kmd_buf_info->offset;
 		num_ent++;
 		kmd_buf_info->used_bytes += total_used_bytes;
 		kmd_buf_info->offset     += total_used_bytes;
-		prepare->hw_update_info[slot_idx].num_hw_entries
-			= num_ent;
+		prepare->num_hw_update_entries = num_ent;
 	}
 
 	return rc;
@@ -3358,7 +3340,7 @@ static int cam_isp_tfe_blob_csid_clock_update(
 	uint32_t                                   blob_type,
 	struct cam_isp_generic_blob_info          *blob_info,
 	struct cam_isp_tfe_csid_clock_config      *clock_config,
-	struct cam_isp_hw_update_args             *prepare)
+	struct cam_hw_prepare_update_args         *prepare)
 {
 	struct cam_tfe_hw_mgr_ctx             *ctx = NULL;
 	struct cam_isp_hw_mgr_res             *hw_mgr_res;
@@ -3422,7 +3404,7 @@ static int cam_isp_tfe_blob_clock_update(
 	uint32_t                               blob_type,
 	struct cam_isp_generic_blob_info      *blob_info,
 	struct cam_isp_tfe_clock_config       *clock_config,
-	struct cam_isp_hw_update_args         *prepare)
+	struct cam_hw_prepare_update_args     *prepare)
 {
 	struct cam_tfe_hw_mgr_ctx             *ctx = NULL;
 	struct cam_isp_hw_mgr_res             *hw_mgr_res;
@@ -3511,7 +3493,7 @@ static int cam_isp_tfe_packet_generic_blob_handler(void *user_data,
 {
 	int rc = 0;
 	struct cam_isp_generic_blob_info  *blob_info = user_data;
-	struct cam_isp_hw_update_args     *prepare = NULL;
+	struct cam_hw_prepare_update_args *prepare = NULL;
 
 	if (!blob_data || (blob_size == 0) || !blob_info) {
 		CAM_ERR(CAM_ISP, "Invalid args data %pK size %d info %pK",
@@ -3713,7 +3695,6 @@ static int cam_isp_tfe_packet_generic_blob_handler(void *user_data,
 }
 
 static int cam_tfe_update_dual_config(
-	struct cam_isp_hw_update_args      *prepare,
 	struct cam_cmd_buf_desc            *cmd_desc,
 	uint32_t                            split_id,
 	uint32_t                            base_idx,
@@ -3822,7 +3803,7 @@ end:
 }
 
 int cam_tfe_add_command_buffers(
-	struct cam_isp_hw_update_args      *prepare,
+	struct cam_hw_prepare_update_args  *prepare,
 	struct cam_kmd_buf_info            *kmd_buf_info,
 	struct cam_isp_ctx_base_info       *base_info,
 	cam_packet_generic_blob_handler     blob_handler_cb,
@@ -3835,12 +3816,10 @@ int cam_tfe_add_command_buffers(
 	enum cam_isp_hw_split_id           split_id;
 	struct cam_cmd_buf_desc           *cmd_desc = NULL;
 	struct cam_hw_update_entry        *hw_entry = NULL;
-	struct cam_isp_hw_update_entry_info *hw_info;
 
 	split_id = base_info->split_id;
 	base_idx = base_info->idx;
-	hw_entry = prepare->hw_update_info[base_idx].hw_entries;
-	hw_info = prepare->hw_update_info;
+	hw_entry = prepare->hw_update_entries;
 	/*
 	 * set the cmd_desc to point the first command descriptor in the
 	 * packet
@@ -3853,7 +3832,7 @@ int cam_tfe_add_command_buffers(
 		split_id, prepare->packet->num_cmd_buf);
 
 	for (i = 0; i < prepare->packet->num_cmd_buf; i++) {
-		num_ent = prepare->hw_update_info[base_idx].num_hw_entries;
+		num_ent = prepare->num_hw_update_entries;
 		if (!cmd_desc[i].length)
 			continue;
 
@@ -3928,9 +3907,8 @@ int cam_tfe_add_command_buffers(
 			break;
 		case CAM_ISP_TFE_PACKET_META_DUAL_CONFIG:
 
-			rc = cam_tfe_update_dual_config(prepare,
-				&cmd_desc[i], split_id, base_idx,
-				res_list_isp_out, size_isp_out);
+			rc = cam_tfe_update_dual_config(&cmd_desc[i], split_id,
+				base_idx, res_list_isp_out, size_isp_out);
 
 			if (rc)
 				return rc;
@@ -3938,8 +3916,7 @@ int cam_tfe_add_command_buffers(
 		case CAM_ISP_TFE_PACKET_META_GENERIC_BLOB_COMMON: {
 			struct cam_isp_generic_blob_info   blob_info;
 
-			prepare->hw_update_info[base_idx].num_hw_entries =
-				num_ent;
+			prepare->num_hw_update_entries = num_ent;
 			blob_info.prepare = prepare;
 			blob_info.base_info = base_info;
 			blob_info.kmd_buf_info = kmd_buf_info;
@@ -3954,7 +3931,7 @@ int cam_tfe_add_command_buffers(
 				return rc;
 			}
 			hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
-			num_ent = hw_info[base_idx].num_hw_entries;
+			num_ent = prepare->num_hw_update_entries;
 		}
 			break;
 		case CAM_ISP_TFE_PACKET_META_REG_DUMP_ON_FLUSH:
@@ -3983,8 +3960,7 @@ int cam_tfe_add_command_buffers(
 				cmd_meta_data);
 			return -EINVAL;
 		}
-		prepare->hw_update_info[base_idx].num_hw_entries
-			= num_ent;
+		prepare->num_hw_update_entries = num_ent;
 	}
 
 	return rc;
@@ -3994,8 +3970,8 @@ static int cam_tfe_mgr_prepare_hw_update(void *hw_mgr_priv,
 	void *prepare_hw_update_args)
 {
 	int rc = 0;
-	struct cam_isp_hw_update_args           *prepare =
-		(struct cam_isp_hw_update_args *) prepare_hw_update_args;
+	struct cam_hw_prepare_update_args       *prepare =
+		(struct cam_hw_prepare_update_args *) prepare_hw_update_args;
 	struct cam_tfe_hw_mgr_ctx               *ctx;
 	struct cam_tfe_hw_mgr                   *hw_mgr;
 	struct cam_kmd_buf_info                  kmd_buf;
@@ -4036,6 +4012,7 @@ static int cam_tfe_mgr_prepare_hw_update(void *hw_mgr_priv,
 		return rc;
 	}
 
+	prepare->num_hw_update_entries = 0;
 	prepare->num_in_map_entries = 0;
 	prepare->num_out_map_entries = 0;
 	prepare->num_reg_dump_buf = 0;

+ 85 - 108
drivers/cam_isp/isp_hw_mgr/hw_utils/cam_isp_packet_parser.c

@@ -13,7 +13,7 @@
 #include "cam_isp_hw_mgr_intf.h"
 
 int cam_isp_add_change_base(
-	struct cam_isp_hw_update_args          *prepare,
+	struct cam_hw_prepare_update_args      *prepare,
 	struct list_head                       *res_list_isp_src,
 	uint32_t                                base_idx,
 	struct cam_kmd_buf_info                *kmd_buf_info)
@@ -25,8 +25,8 @@ int cam_isp_add_change_base(
 	struct cam_hw_update_entry      *hw_entry;
 	uint32_t                         num_ent, i;
 
-	hw_entry = prepare->hw_update_info[base_idx].hw_entries;
-	num_ent = prepare->hw_update_info[base_idx].num_hw_entries;
+	hw_entry = prepare->hw_update_entries;
+	num_ent = prepare->num_hw_update_entries;
 
 	/* Max one hw entries required for each base */
 	if (num_ent + 1 >= prepare->max_hw_update_entries) {
@@ -77,8 +77,7 @@ int cam_isp_add_change_base(
 			kmd_buf_info->used_bytes += get_base.cmd.used_bytes;
 			kmd_buf_info->offset     += get_base.cmd.used_bytes;
 			num_ent++;
-			prepare->hw_update_info[base_idx].num_hw_entries
-				= num_ent;
+			prepare->num_hw_update_entries = num_ent;
 
 			/* return success */
 			return 0;
@@ -89,7 +88,6 @@ int cam_isp_add_change_base(
 }
 
 static int cam_isp_update_dual_config(
-	struct cam_isp_hw_update_args      *prepare,
 	struct cam_cmd_buf_desc            *cmd_desc,
 	uint32_t                            split_id,
 	uint32_t                            base_idx,
@@ -243,7 +241,7 @@ int cam_isp_add_cmd_buf_update(
 }
 
 int cam_isp_add_command_buffers(
-	struct cam_isp_hw_update_args      *prepare,
+	struct cam_hw_prepare_update_args      *prepare,
 	struct cam_kmd_buf_info            *kmd_buf_info,
 	struct cam_isp_ctx_base_info       *base_info,
 	cam_packet_generic_blob_handler     blob_handler_cb,
@@ -256,12 +254,11 @@ int cam_isp_add_command_buffers(
 	enum cam_isp_hw_split_id           split_id;
 	struct cam_cmd_buf_desc           *cmd_desc = NULL;
 	struct cam_hw_update_entry        *hw_entry = NULL;
-	struct cam_isp_hw_update_entry_info *hw_info;
 
 	split_id = base_info->split_id;
 	base_idx = base_info->idx;
-	hw_entry = prepare->hw_update_info[base_idx].hw_entries;
-	hw_info = prepare->hw_update_info;
+	hw_entry = prepare->hw_update_entries;
+
 	/*
 	 * set the cmd_desc to point the first command descriptor in the
 	 * packet
@@ -274,8 +271,7 @@ int cam_isp_add_command_buffers(
 		split_id, prepare->packet->num_cmd_buf);
 
 	for (i = 0; i < prepare->packet->num_cmd_buf; i++) {
-		num_ent =
-			prepare->hw_update_info[base_idx].num_hw_entries;
+		num_ent = prepare->num_hw_update_entries;
 		if (!cmd_desc[i].length)
 			continue;
 
@@ -351,8 +347,8 @@ int cam_isp_add_command_buffers(
 			num_ent++;
 			break;
 		case CAM_ISP_PACKET_META_DUAL_CONFIG:
-			rc = cam_isp_update_dual_config(prepare,
-				&cmd_desc[i], split_id, base_idx,
+			rc = cam_isp_update_dual_config(&cmd_desc[i],
+				split_id, base_idx,
 				res_list_isp_out, size_isp_out);
 
 			if (rc)
@@ -362,8 +358,7 @@ int cam_isp_add_command_buffers(
 			if (split_id == CAM_ISP_HW_SPLIT_LEFT) {
 				struct cam_isp_generic_blob_info   blob_info;
 
-				prepare->hw_update_info[base_idx].num_hw_entries
-					= num_ent;
+				prepare->num_hw_update_entries = num_ent;
 				blob_info.prepare = prepare;
 				blob_info.base_info = base_info;
 				blob_info.kmd_buf_info = kmd_buf_info;
@@ -379,15 +374,14 @@ int cam_isp_add_command_buffers(
 					return rc;
 				}
 				hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
-				num_ent = hw_info[base_idx].num_hw_entries;
+				num_ent = prepare->num_hw_update_entries;
 			}
 			break;
 		case CAM_ISP_PACKET_META_GENERIC_BLOB_RIGHT:
 			if (split_id == CAM_ISP_HW_SPLIT_RIGHT) {
 				struct cam_isp_generic_blob_info   blob_info;
 
-				prepare->hw_update_info[base_idx].num_hw_entries
-					= num_ent;
+				prepare->num_hw_update_entries = num_ent;
 				blob_info.prepare = prepare;
 				blob_info.base_info = base_info;
 				blob_info.kmd_buf_info = kmd_buf_info;
@@ -403,14 +397,13 @@ int cam_isp_add_command_buffers(
 					return rc;
 				}
 				hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
-				num_ent = hw_info[base_idx].num_hw_entries;
+				num_ent = prepare->num_hw_update_entries;
 			}
 			break;
 		case CAM_ISP_PACKET_META_GENERIC_BLOB_COMMON: {
 			struct cam_isp_generic_blob_info   blob_info;
 
-			prepare->hw_update_info[base_idx].num_hw_entries =
-				num_ent;
+			prepare->num_hw_update_entries = num_ent;
 			blob_info.prepare = prepare;
 			blob_info.base_info = base_info;
 			blob_info.kmd_buf_info = kmd_buf_info;
@@ -425,7 +418,7 @@ int cam_isp_add_command_buffers(
 				return rc;
 			}
 			hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
-			num_ent = hw_info[base_idx].num_hw_entries;
+			num_ent = prepare->num_hw_update_entries;
 		}
 			break;
 		case CAM_ISP_PACKET_META_REG_DUMP_ON_FLUSH:
@@ -455,8 +448,7 @@ int cam_isp_add_command_buffers(
 				cmd_meta_data);
 			return -EINVAL;
 		}
-		prepare->hw_update_info[base_idx].num_hw_entries
-			= num_ent;
+		prepare->num_hw_update_entries = num_ent;
 	}
 
 	return rc;
@@ -465,7 +457,7 @@ int cam_isp_add_command_buffers(
 int cam_isp_add_io_buffers(
 	int                                   iommu_hdl,
 	int                                   sec_iommu_hdl,
-	struct cam_isp_hw_update_args        *prepare,
+	struct cam_hw_prepare_update_args    *prepare,
 	uint32_t                              base_idx,
 	struct cam_kmd_buf_info              *kmd_buf_info,
 	struct cam_isp_hw_mgr_res            *res_list_isp_out,
@@ -481,7 +473,6 @@ int cam_isp_add_io_buffers(
 	struct cam_isp_hw_mgr_res          *hw_mgr_res;
 	struct cam_isp_hw_get_cmd_update    update_buf;
 	struct cam_isp_hw_get_wm_update     wm_update;
-	struct cam_hw_update_entry         *hw_entry;
 	struct cam_isp_hw_get_wm_update     bus_rd_update;
 	struct cam_hw_fence_map_entry      *out_map_entries;
 	struct cam_hw_fence_map_entry      *in_map_entries;
@@ -504,14 +495,12 @@ int cam_isp_add_io_buffers(
 	num_in_buf  = 0;
 	io_cfg_used_bytes = 0;
 	prepare->pf_data->packet = prepare->packet;
-	hw_entry = prepare->hw_update_info[base_idx].hw_entries;
-	num_ent = prepare->hw_update_info[base_idx].num_hw_entries;
 
 	/* Max one hw entries required for each base */
-	if (num_ent + 1 >=
+	if (prepare->num_hw_update_entries + 1 >=
 			prepare->max_hw_update_entries) {
 		CAM_ERR(CAM_ISP, "Insufficient  HW entries :%d %d",
-			prepare->hw_update_info[base_idx].num_hw_entries,
+			prepare->num_hw_update_entries,
 			prepare->max_hw_update_entries);
 		return -EINVAL;
 	}
@@ -863,21 +852,25 @@ int cam_isp_add_io_buffers(
 		io_cfg_used_bytes, fill_fence);
 	if (io_cfg_used_bytes) {
 		/* Update the HW entries */
-		hw_entry[num_ent].handle = kmd_buf_info->handle;
-		hw_entry[num_ent].len = io_cfg_used_bytes;
-		hw_entry[num_ent].offset = kmd_buf_info->offset;
-		hw_entry[num_ent].flags = CAM_ISP_IOCFG_BL;
+		num_ent = prepare->num_hw_update_entries;
+		prepare->hw_update_entries[num_ent].handle =
+			kmd_buf_info->handle;
+		prepare->hw_update_entries[num_ent].len =
+			io_cfg_used_bytes;
+		prepare->hw_update_entries[num_ent].offset =
+			kmd_buf_info->offset;
+		prepare->hw_update_entries[num_ent].flags = CAM_ISP_IOCFG_BL;
 		CAM_DBG(CAM_ISP,
 			"num_ent=%d handle=0x%x, len=%u, offset=%u",
 			num_ent,
-			hw_entry[num_ent].handle,
-			hw_entry[num_ent].len,
-			hw_entry[num_ent].offset);
+			prepare->hw_update_entries[num_ent].handle,
+			prepare->hw_update_entries[num_ent].len,
+			prepare->hw_update_entries[num_ent].offset);
 		num_ent++;
 
 		kmd_buf_info->used_bytes += io_cfg_used_bytes;
 		kmd_buf_info->offset     += io_cfg_used_bytes;
-		prepare->hw_update_info[base_idx].num_hw_entries = num_ent;
+		prepare->num_hw_update_entries = num_ent;
 	}
 
 	if (fill_fence) {
@@ -889,7 +882,7 @@ int cam_isp_add_io_buffers(
 }
 
 int cam_isp_add_reg_update(
-	struct cam_isp_hw_update_args        *prepare,
+	struct cam_hw_prepare_update_args    *prepare,
 	struct list_head                     *res_list_isp_src,
 	uint32_t                              base_idx,
 	struct cam_kmd_buf_info              *kmd_buf_info)
@@ -897,17 +890,14 @@ int cam_isp_add_reg_update(
 	int rc = -EINVAL;
 	struct cam_isp_resource_node         *res;
 	struct cam_isp_hw_mgr_res            *hw_mgr_res;
-	struct cam_hw_update_entry           *hw_entry;
 	struct cam_isp_hw_get_cmd_update      get_regup;
 	uint32_t kmd_buf_remain_size, num_ent, i, reg_update_size;
 
-	hw_entry = prepare->hw_update_info[base_idx].hw_entries;
-	num_ent = prepare->hw_update_info[base_idx].num_hw_entries;
-
 	/* Max one hw entries required for each base */
-	if (num_ent + 1 >= prepare->max_hw_update_entries) {
+	if (prepare->num_hw_update_entries + 1 >=
+		prepare->max_hw_update_entries) {
 		CAM_ERR(CAM_ISP, "Insufficient  HW entries :%d %d",
-			num_ent,
+			prepare->num_hw_update_entries,
 			prepare->max_hw_update_entries);
 		return -EINVAL;
 	}
@@ -962,23 +952,26 @@ int cam_isp_add_reg_update(
 
 	if (reg_update_size) {
 		/* Update the HW entries */
-		hw_entry[num_ent].handle = kmd_buf_info->handle;
-		hw_entry[num_ent].len = reg_update_size;
-		hw_entry[num_ent].offset = kmd_buf_info->offset;
+		num_ent = prepare->num_hw_update_entries;
+		prepare->hw_update_entries[num_ent].handle =
+			kmd_buf_info->handle;
+		prepare->hw_update_entries[num_ent].len = reg_update_size;
+		prepare->hw_update_entries[num_ent].offset =
+			kmd_buf_info->offset;
 
 		/* Marking reg update as IOCFG to reapply on bubble */
-		hw_entry[num_ent].flags = CAM_ISP_IOCFG_BL;
+		prepare->hw_update_entries[num_ent].flags = CAM_ISP_IOCFG_BL;
 		CAM_DBG(CAM_ISP,
 			"num_ent=%d handle=0x%x, len=%u, offset=%u",
 			num_ent,
-			hw_entry[num_ent].handle,
-			hw_entry[num_ent].len,
-			hw_entry[num_ent].offset);
+			prepare->hw_update_entries[num_ent].handle,
+			prepare->hw_update_entries[num_ent].len,
+			prepare->hw_update_entries[num_ent].offset);
 		num_ent++;
 
 		kmd_buf_info->used_bytes += reg_update_size;
 		kmd_buf_info->offset     += reg_update_size;
-		prepare->hw_update_info[base_idx].num_hw_entries = num_ent;
+		prepare->num_hw_update_entries = num_ent;
 		/* reg update is success return status 0 */
 		rc = 0;
 	}
@@ -987,7 +980,7 @@ int cam_isp_add_reg_update(
 }
 
 int cam_isp_add_go_cmd(
-	struct cam_isp_hw_update_args        *prepare,
+	struct cam_hw_prepare_update_args    *prepare,
 	struct list_head                     *res_list_isp_rd,
 	uint32_t                              base_idx,
 	struct cam_kmd_buf_info              *kmd_buf_info)
@@ -995,17 +988,14 @@ int cam_isp_add_go_cmd(
 	int rc = -EINVAL;
 	struct cam_isp_resource_node         *res;
 	struct cam_isp_hw_mgr_res            *hw_mgr_res;
-	struct cam_hw_update_entry           *hw_entry;
 	struct cam_isp_hw_get_cmd_update      get_regup;
 	uint32_t kmd_buf_remain_size, num_ent, i, reg_update_size;
 
-	hw_entry = prepare->hw_update_info[base_idx].hw_entries;
-	num_ent = prepare->hw_update_info[base_idx].num_hw_entries;
-
 	/* Max one hw entries required for each base */
-	if (num_ent + 1 >= prepare->max_hw_update_entries) {
+	if (prepare->num_hw_update_entries + 1 >=
+		prepare->max_hw_update_entries) {
 		CAM_ERR(CAM_ISP, "Insufficient  HW entries :%d %d",
-			num_ent,
+			prepare->num_hw_update_entries,
 			prepare->max_hw_update_entries);
 		return -EINVAL;
 	}
@@ -1058,22 +1048,24 @@ int cam_isp_add_go_cmd(
 
 	if (reg_update_size) {
 		/* Update the HW entries */
-		hw_entry[num_ent].handle = kmd_buf_info->handle;
-		hw_entry[num_ent].len = reg_update_size;
-		hw_entry[num_ent].offset = kmd_buf_info->offset;
-
-		hw_entry[num_ent].flags = CAM_ISP_IOCFG_BL;
+		num_ent = prepare->num_hw_update_entries;
+		prepare->hw_update_entries[num_ent].handle =
+			kmd_buf_info->handle;
+		prepare->hw_update_entries[num_ent].len = reg_update_size;
+		prepare->hw_update_entries[num_ent].offset =
+			kmd_buf_info->offset;
+		prepare->hw_update_entries[num_ent].flags = CAM_ISP_IOCFG_BL;
 		CAM_DBG(CAM_ISP,
 			"num_ent=%d handle=0x%x, len=%u, offset=%u",
 			num_ent,
-			hw_entry[num_ent].handle,
-			hw_entry[num_ent].len,
-			hw_entry[num_ent].offset);
+			prepare->hw_update_entries[num_ent].handle,
+			prepare->hw_update_entries[num_ent].len,
+			prepare->hw_update_entries[num_ent].offset);
 		num_ent++;
 
 		kmd_buf_info->used_bytes += reg_update_size;
 		kmd_buf_info->offset     += reg_update_size;
-		prepare->hw_update_info[base_idx].num_hw_entries = num_ent;
+		prepare->num_hw_update_entries = num_ent;
 
 		rc = 0;
 	}
@@ -1082,24 +1074,20 @@ int cam_isp_add_go_cmd(
 }
 
 int cam_isp_add_comp_wait(
-	struct cam_isp_hw_update_args        *prepare,
+	struct cam_hw_prepare_update_args    *prepare,
 	struct list_head                     *res_list_isp_src,
 	uint32_t                              base_idx,
 	struct cam_kmd_buf_info              *kmd_buf_info)
 {
 	int rc = -EINVAL;
 	struct cam_isp_hw_mgr_res            *hw_mgr_res;
-	struct cam_hw_update_entry           *hw_entry;
 	struct cam_isp_hw_get_cmd_update      add_wait;
 	struct cam_hw_intf                   *hw_intf;
 	bool                                  hw_res_valid = false;
 	uint32_t kmd_buf_remain_size, num_ent, add_wait_size;
 
-	hw_entry = prepare->hw_update_info[base_idx].hw_entries;
-	num_ent = prepare->hw_update_info[base_idx].num_hw_entries;
-
 	/* Max one hw entries required for each base */
-	if (num_ent >= prepare->max_hw_update_entries) {
+	if (prepare->num_hw_update_entries >= prepare->max_hw_update_entries) {
 		CAM_ERR(CAM_ISP, "Insufficient  HW entries");
 		return -EINVAL;
 	}
@@ -1157,25 +1145,24 @@ int cam_isp_add_comp_wait(
 	add_wait_size += add_wait.cmd.used_bytes;
 	if (add_wait_size) {
 		/* Update the HW entries */
-		hw_entry[num_ent].handle =
+		num_ent = prepare->num_hw_update_entries;
+		prepare->hw_update_entries[num_ent].handle =
 			kmd_buf_info->handle;
-		hw_entry[num_ent].len =
-			add_wait_size;
-		hw_entry[num_ent].offset =
+		prepare->hw_update_entries[num_ent].len = add_wait_size;
+		prepare->hw_update_entries[num_ent].offset =
 			kmd_buf_info->offset;
-		hw_entry[num_ent].flags = CAM_ISP_IOCFG_BL;
+		prepare->hw_update_entries[num_ent].flags = CAM_ISP_IOCFG_BL;
 		CAM_DBG(CAM_ISP,
 			"num_ent=%d handle=0x%x, len=%u, offset=%u",
 			num_ent,
-			hw_entry[num_ent].handle,
-			hw_entry[num_ent].len,
-			hw_entry[num_ent].offset);
+			prepare->hw_update_entries[num_ent].handle,
+			prepare->hw_update_entries[num_ent].len,
+			prepare->hw_update_entries[num_ent].offset);
 		num_ent++;
 
 		kmd_buf_info->used_bytes += add_wait_size;
 		kmd_buf_info->offset     += add_wait_size;
-		prepare->hw_update_info[base_idx].num_hw_entries
-			= num_ent;
+		prepare->num_hw_update_entries = num_ent;
 		/* add wait_comp_event is success return status 0 */
 		rc = 0;
 	}
@@ -1184,7 +1171,7 @@ int cam_isp_add_comp_wait(
 }
 
 int cam_isp_add_wait_trigger(
-	struct cam_isp_hw_update_args        *prepare,
+	struct cam_hw_prepare_update_args    *prepare,
 	struct list_head                     *res_list_isp_src,
 	uint32_t                              base_idx,
 	struct cam_kmd_buf_info              *kmd_buf_info,
@@ -1192,19 +1179,15 @@ int cam_isp_add_wait_trigger(
 {
 	int rc = -EINVAL;
 	struct cam_isp_hw_mgr_res            *hw_mgr_res;
-	struct cam_hw_update_entry           *hw_entry;
 	struct cam_isp_hw_get_cmd_update      add_trigger;
 	struct cam_hw_intf                   *hw_intf;
 	bool                                  hw_res_valid = false;
 	uint32_t kmd_buf_remain_size, num_ent, add_trigger_size;
 
-	hw_entry = prepare->hw_update_info[base_idx].hw_entries;
-	num_ent = prepare->hw_update_info[base_idx].num_hw_entries;
-
 	/* Max one hw entries required for each base */
-	if (num_ent + 1 >=
+	if (prepare->num_hw_update_entries + 1 >=
 				prepare->max_hw_update_entries) {
-		CAM_ERR(CAM_ISP, "Insufficient  HW entries :%d %d");
+		CAM_ERR(CAM_ISP, "Insufficient  HW entries");
 		return -EINVAL;
 	}
 
@@ -1247,11 +1230,6 @@ int cam_isp_add_wait_trigger(
 	add_trigger.cmd_type = CAM_ISP_HW_CMD_ADD_WAIT_TRIGGER;
 	add_trigger.res = hw_mgr_res->hw_res[CAM_ISP_HW_SPLIT_RIGHT];
 
-	if (trigger_cdm_en)
-		add_trigger.trigger_cdm_en = true;
-	else
-		add_trigger.trigger_cdm_en = false;
-
 	rc = hw_intf->hw_ops.process_cmd(
 		hw_intf->hw_priv,
 		CAM_ISP_HW_CMD_ADD_WAIT_TRIGGER,
@@ -1268,25 +1246,24 @@ int cam_isp_add_wait_trigger(
 
 	if (add_trigger_size) {
 		/* Update the HW entries */
-		hw_entry[num_ent].handle =
+		num_ent = prepare->num_hw_update_entries;
+		prepare->hw_update_entries[num_ent].handle =
 			kmd_buf_info->handle;
-		hw_entry[num_ent].len =
-			add_trigger_size;
-		hw_entry[num_ent].offset =
+		prepare->hw_update_entries[num_ent].len = add_trigger_size;
+		prepare->hw_update_entries[num_ent].offset =
 			kmd_buf_info->offset;
-		hw_entry[num_ent].flags = CAM_ISP_IOCFG_BL;
+		prepare->hw_update_entries[num_ent].flags = CAM_ISP_IOCFG_BL;
 		CAM_DBG(CAM_ISP,
 			"num_ent=%d handle=0x%x, len=%u, offset=%u",
 			num_ent,
-			hw_entry[num_ent].handle,
-			hw_entry[num_ent].len,
-			hw_entry[num_ent].offset);
+			prepare->hw_update_entries[num_ent].handle,
+			prepare->hw_update_entries[num_ent].len,
+			prepare->hw_update_entries[num_ent].offset);
 		num_ent++;
 
 		kmd_buf_info->used_bytes += add_trigger_size;
 		kmd_buf_info->offset     += add_trigger_size;
-		prepare->hw_update_info[base_idx].num_hw_entries
-			= num_ent;
+		prepare->num_hw_update_entries = num_ent;
 		/* add wait trigger is success return status 0 */
 		rc = 0;
 	}

+ 8 - 8
drivers/cam_isp/isp_hw_mgr/hw_utils/include/cam_isp_packet_parser.h

@@ -29,7 +29,7 @@ enum cam_isp_cdm_bl_type {
  * @kmd_buf_info:       Kmd buffer to store the custom cmd data
  */
 struct cam_isp_generic_blob_info {
-	struct cam_isp_hw_update_args         *prepare;
+	struct cam_hw_prepare_update_args     *prepare;
 	struct cam_isp_ctx_base_info          *base_info;
 	struct cam_kmd_buf_info               *kmd_buf_info;
 };
@@ -63,7 +63,7 @@ struct cam_isp_frame_header_info {
  *                         -EINVAL for Fail
  */
 int cam_isp_add_change_base(
-	struct cam_isp_hw_update_args         *prepare,
+	struct cam_hw_prepare_update_args     *prepare,
 	struct list_head                      *res_list_isp_src,
 	uint32_t                               base_idx,
 	struct cam_kmd_buf_info               *kmd_buf_info);
@@ -115,7 +115,7 @@ int cam_isp_add_cmd_buf_update(
  *                         Negative for Failure
  */
 int cam_isp_add_command_buffers(
-	struct cam_isp_hw_update_args      *prepare,
+	struct cam_hw_prepare_update_args  *prepare,
 	struct cam_kmd_buf_info            *kmd_buf_info,
 	struct cam_isp_ctx_base_info       *base_info,
 	cam_packet_generic_blob_handler     blob_handler_cb,
@@ -146,7 +146,7 @@ int cam_isp_add_command_buffers(
 int cam_isp_add_io_buffers(
 	int                                   iommu_hdl,
 	int                                   sec_iommu_hdl,
-	struct cam_isp_hw_update_args        *prepare,
+	struct cam_hw_prepare_update_args    *prepare,
 	uint32_t                              base_idx,
 	struct cam_kmd_buf_info              *kmd_buf_info,
 	struct cam_isp_hw_mgr_res            *res_list_isp_out,
@@ -170,7 +170,7 @@ int cam_isp_add_io_buffers(
  *                         -EINVAL for Fail
  */
 int cam_isp_add_reg_update(
-	struct cam_isp_hw_update_args        *prepare,
+	struct cam_hw_prepare_update_args    *prepare,
 	struct list_head                     *res_list_isp_src,
 	uint32_t                              base_idx,
 	struct cam_kmd_buf_info              *kmd_buf_info);
@@ -191,7 +191,7 @@ int cam_isp_add_reg_update(
  *                         -EINVAL for Fail
  */
 int cam_isp_add_comp_wait(
-	struct cam_isp_hw_update_args        *prepare,
+	struct cam_hw_prepare_update_args    *prepare,
 	struct list_head                     *res_list_isp_src,
 	uint32_t                              base_idx,
 	struct cam_kmd_buf_info              *kmd_buf_info);
@@ -213,7 +213,7 @@ int cam_isp_add_comp_wait(
  *                         -EINVAL for Fail
  */
 int cam_isp_add_wait_trigger(
-	struct cam_isp_hw_update_args        *prepare,
+	struct cam_hw_prepare_update_args    *prepare,
 	struct list_head                     *res_list_isp_src,
 	uint32_t                              base_idx,
 	struct cam_kmd_buf_info              *kmd_buf_info,
@@ -233,7 +233,7 @@ int cam_isp_add_wait_trigger(
  *                         -EINVAL for Fail
  */
 int cam_isp_add_go_cmd(
-	struct cam_isp_hw_update_args        *prepare,
+	struct cam_hw_prepare_update_args    *prepare,
 	struct list_head                     *res_list_isp_rd,
 	uint32_t                              base_idx,
 	struct cam_kmd_buf_info              *kmd_buf_info);

+ 2 - 96
drivers/cam_isp/isp_hw_mgr/include/cam_isp_hw_mgr_intf.h

@@ -23,12 +23,6 @@
 /* Appliacble vote paths for dual ife, based on no. of UAPI definitions */
 #define CAM_ISP_MAX_PER_PATH_VOTES 30
 
-/*
- * Maximum configuration entry size  - This is based on the
- * worst case DUAL IFE use case plus some margin.
- */
- #define CAM_ISP_CTX_CFG_MAX                     25
-
 /**
  *  enum cam_isp_hw_event_type - Collection of the ISP hardware events
  */
@@ -258,94 +252,6 @@ struct cam_isp_hw_cmd_args {
 	} u;
 };
 
-/**
- * struct cam_isp_hw_update_entry_info - hardware config info
- *
- * @hw_update_entries       Entry for hardware config
- * @num_hw_update_entries:  Number of IFE hw
- *
- */
-struct cam_isp_hw_update_entry_info {
-	struct cam_hw_update_entry     *hw_entries;
-	uint32_t                        num_hw_entries;
-};
-
-/**
- * struct cam_isp_hw_update_info - hardware config info
- *
- * @hw_update_entries       Entry for hardware config
- * @num_hw_update_entries:  number of IFE hw
- *
- */
-
-struct cam_isp_hw_update_info {
-	struct cam_hw_update_entry      hw_entries[CAM_ISP_CTX_CFG_MAX];
-	uint32_t                        num_hw_entries;
-};
-
-/**
- * struct cam_isp_hw_update_args - Payload for prepare command
- *
- * @packet:                CSL packet from user mode driver
- * @remain_len             Remaining length of CPU buffer after config offset
- * @ctxt_to_hw_map:        HW context from the acquire
- * @max_hw_update_entries: Maximum hardware update entries supported
- * @hw_update_info:        Actual hardware update configuration (returned)
- * @max_out_map_entries:   Maximum output fence mapping supported
- * @out_map_entries:       Actual output fence mapping list (returned)
- * @num_out_map_entries:   Number of actual output fence mapping (returned)
- * @max_in_map_entries:    Maximum input fence mapping supported
- * @in_map_entries:        Actual input fence mapping list (returned)
- * @num_in_map_entries:    Number of acutal input fence mapping (returned)
- * @priv:                  Private pointer of hw update
- * @pf_data:               Debug data for page fault
- *
- */
-
-struct cam_isp_hw_update_args {
-	struct cam_packet                   *packet;
-	uint32_t                             remain_len;
-	void                                *ctxt_to_hw_map;
-	uint32_t                             max_hw_update_entries;
-	struct cam_isp_hw_update_entry_info  hw_update_info[CAM_IFE_HW_NUM_MAX];
-	uint32_t                             max_out_map_entries;
-	struct cam_hw_fence_map_entry       *out_map_entries;
-	uint32_t                             num_out_map_entries;
-	uint32_t                             max_in_map_entries;
-	struct cam_hw_fence_map_entry       *in_map_entries;
-	uint32_t                             num_in_map_entries;
-	void                                *priv;
-	struct cam_hw_mgr_dump_pf_data      *pf_data;
-	struct cam_cmd_buf_desc              reg_dump_buf_desc[
-						CAM_REG_DUMP_MAX_BUF_ENTRIES];
-	uint32_t                             num_reg_dump_buf;
-};
-
-/**
- * struct cam_isp_hw_config_args - Payload for config command
- *
- * @ctxt_to_hw_map:        HW context from the acquire
- * @hw_update_info:        Hardware update info for every IFE
- * @out_map_entries:       Out map info
- * @num_out_map_entries:   Number of out map entries
- * @priv:                  Private pointer
- * @request_id:            Request ID
- * @init_packet:           check init packet or update packet
- * @reapply:               check if current req is reapplied
- *
- */
-
-struct cam_isp_hw_config_args {
-	void                                *ctxt_to_hw_map;
-	struct cam_isp_hw_update_entry_info  hw_update_info[CAM_IFE_HW_NUM_MAX];
-	struct cam_hw_fence_map_entry       *out_map_entries;
-	uint32_t                             num_out_map_entries;
-	void                                *priv;
-	uint64_t                             request_id;
-	bool                                 init_packet;
-	bool                                 reapply;
-};
-
 /**
  * struct cam_isp_start_args - isp hardware start arguments
  *
@@ -355,8 +261,8 @@ struct cam_isp_hw_config_args {
  *
  */
 struct cam_isp_start_args {
-	struct cam_isp_hw_config_args hw_config;
-	bool                          start_only;
+	struct cam_hw_config_args hw_config;
+	bool                      start_only;
 };
 
 /**

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů