Browse Source

msm: camera: isp: Optimization for CDM BL FIFO

This change aims at reducing the num of update entries
during the prepare stage. This change combines the change
base entry and RUP entry at the end of each request,
squeezes related entries from handling blob and combines RUP
entry when adding go cmd for offline context.

This change also refactors code on adding and combining
entries, removes unused variables and cleans some coding
style issues.

This change turns UNUSED entry to IQ entry for
convience but it's also compatible for further change on
the BL type of those entries.

CRs-Fixed: 3444613
Change-Id: I0301436971a86b72d8e98018caf130de78b44011
Signed-off-by: Haochen Yang <[email protected]>
Haochen Yang 2 years ago
parent
commit
14dbf1fe63

+ 67 - 48
drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c

@@ -490,30 +490,28 @@ static inline void cam_ife_mgr_update_hw_entries_util(
 	enum cam_isp_cdm_bl_type               cdm_bl_type,
 	uint32_t                               total_used_bytes,
 	struct cam_kmd_buf_info               *kmd_buf_info,
-	struct cam_hw_prepare_update_args     *prepare)
+	struct cam_hw_prepare_update_args     *prepare,
+	bool                                   precheck_combine)
 {
+	bool combine;
 	uint32_t num_ent;
+	struct cam_hw_update_entry *prev_hw_update_entry;
 
-	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 =
-		total_used_bytes;
-	prepare->hw_update_entries[num_ent].offset =
-		kmd_buf_info->offset;
-	prepare->hw_update_entries[num_ent].flags = cdm_bl_type;
-
-	num_ent++;
-	kmd_buf_info->used_bytes += total_used_bytes;
-	kmd_buf_info->offset     += total_used_bytes;
-	prepare->num_hw_update_entries = num_ent;
-
-	CAM_DBG(CAM_ISP, "Handle: 0x%x len: %u offset: %u flags: %u num_ent: %u",
-		prepare->hw_update_entries[num_ent - 1].handle,
-		prepare->hw_update_entries[num_ent - 1].len,
-		prepare->hw_update_entries[num_ent - 1].offset,
-		prepare->hw_update_entries[num_ent - 1].flags,
-		num_ent);
+	/*
+	 * Combine with prev entry only when a new entry was created
+	 * by previus handler and this entry has the same bl type
+	 * as the previous entry, if not, a new entry will be generated
+	 * later
+	 */
+	combine = precheck_combine;
+	if (combine) {
+		num_ent = prepare->num_hw_update_entries;
+		prev_hw_update_entry = &(prepare->hw_update_entries[num_ent - 1]);
+		if (prev_hw_update_entry->flags != cdm_bl_type)
+			combine = false;
+	}
+	cam_isp_update_hw_entry(cdm_bl_type, prepare,
+		kmd_buf_info, total_used_bytes, combine);
 }
 
 static inline int cam_ife_mgr_allocate_cdm_cmd(
@@ -7928,9 +7926,12 @@ static int cam_isp_blob_ubwc_update(
 			total_used_bytes += bytes_used;
 		}
 
-		if (total_used_bytes)
-			cam_ife_mgr_update_hw_entries_util(
-				CAM_ISP_UNUSED_BL, total_used_bytes, kmd_buf_info, prepare);
+		if (total_used_bytes) {
+			cam_ife_mgr_update_hw_entries_util(CAM_ISP_IQ_BL,
+				total_used_bytes, kmd_buf_info,
+				prepare, blob_info->entry_added);
+			blob_info->entry_added = true;
+		}
 		break;
 	default:
 		CAM_ERR(CAM_ISP, "Invalid UBWC API Version %d ctx_idx: %u",
@@ -8103,9 +8104,12 @@ static int cam_isp_blob_ubwc_update_v2(
 		total_used_bytes += bytes_used;
 	}
 
-	if (total_used_bytes)
+	if (total_used_bytes) {
 		cam_ife_mgr_update_hw_entries_util(
-			CAM_ISP_UNUSED_BL, total_used_bytes, kmd_buf_info, prepare);
+			CAM_ISP_IQ_BL, total_used_bytes,
+			kmd_buf_info, prepare, blob_info->entry_added);
+		blob_info->entry_added = true;
+	}
 
 end:
 	return rc;
@@ -8631,9 +8635,12 @@ static int cam_isp_blob_sfe_update_fetch_core_cfg(
 		total_used_bytes += used_bytes;
 	}
 
-	if (total_used_bytes)
+	if (total_used_bytes) {
 		cam_ife_mgr_update_hw_entries_util(
-			false, total_used_bytes, kmd_buf_info, prepare);
+			CAM_ISP_IQ_BL, total_used_bytes,
+			kmd_buf_info, prepare, blob_info->entry_added);
+		blob_info->entry_added = true;
+	}
 
 	return 0;
 }
@@ -8737,9 +8744,12 @@ static int cam_isp_blob_hfr_update(
 		total_used_bytes += bytes_used;
 	}
 
-	if (total_used_bytes)
+	if (total_used_bytes) {
 		cam_ife_mgr_update_hw_entries_util(
-			CAM_ISP_IQ_BL, total_used_bytes, kmd_buf_info, prepare);
+			CAM_ISP_IQ_BL, total_used_bytes,
+			kmd_buf_info, prepare, blob_info->entry_added);
+		blob_info->entry_added = true;
+	}
 
 	return rc;
 }
@@ -9445,10 +9455,12 @@ static int cam_isp_blob_vfe_out_update(
 		total_used_bytes += bytes_used;
 	}
 
-	if (total_used_bytes)
+	if (total_used_bytes) {
 		cam_ife_mgr_update_hw_entries_util(
-			CAM_ISP_UNUSED_BL, total_used_bytes, kmd_buf_info, prepare);
-
+			CAM_ISP_IQ_BL, total_used_bytes,
+			kmd_buf_info, prepare, blob_info->entry_added);
+		blob_info->entry_added = true;
+	}
 	return rc;
 }
 
@@ -9457,7 +9469,6 @@ static int cam_isp_blob_sensor_blanking_config(
 	struct cam_isp_generic_blob_info      *blob_info,
 	struct cam_isp_sensor_blanking_config *sensor_blanking_config,
 	struct cam_hw_prepare_update_args     *prepare)
-
 {
 	struct cam_ife_hw_mgr_ctx       *ctx = NULL;
 	struct cam_isp_hw_mgr_res       *hw_mgr_res;
@@ -9612,9 +9623,12 @@ static int cam_isp_blob_bw_limit_update(
 		total_used_bytes += bytes_used;
 	}
 
-	if (total_used_bytes)
+	if (total_used_bytes) {
 		cam_ife_mgr_update_hw_entries_util(
-			CAM_ISP_IQ_BL, total_used_bytes, kmd_buf_info, prepare);
+			CAM_ISP_IQ_BL, total_used_bytes,
+			kmd_buf_info, prepare, blob_info->entry_added);
+		blob_info->entry_added = true;
+	}
 
 	return rc;
 }
@@ -9666,9 +9680,12 @@ static int cam_isp_hw_mgr_add_cmd_buf_util(
 		return -EINVAL;
 	}
 
-	if (total_used_bytes)
+	if (total_used_bytes) {
 		cam_ife_mgr_update_hw_entries_util(
-			CAM_ISP_IQ_BL, total_used_bytes, kmd_buf_info, prepare);
+			CAM_ISP_IQ_BL, total_used_bytes,
+			kmd_buf_info, prepare, blob_info->entry_added);
+		blob_info->entry_added = true;
+	}
 	return rc;
 }
 
@@ -10514,7 +10531,6 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
 		if (rc)
 			CAM_ERR(CAM_ISP, "QCFA Update Failed rc: %d, ctx_idx: %u",
 				rc, ife_mgr_ctx->ctx_index);
-
 	}
 		break;
 	case CAM_ISP_GENERIC_BLOB_TYPE_FE_CONFIG: {
@@ -11496,7 +11512,8 @@ static int cam_isp_sfe_add_scratch_buffer_cfg(
 
 	if (io_cfg_used_bytes)
 		cam_ife_mgr_update_hw_entries_util(
-			CAM_ISP_IOCFG_BL, io_cfg_used_bytes, kmd_buf_info, prepare);
+			CAM_ISP_IOCFG_BL, io_cfg_used_bytes,
+			kmd_buf_info, prepare, false);
 
 	return rc;
 }
@@ -11576,7 +11593,8 @@ static int cam_isp_ife_add_scratch_buffer_cfg(
 
 	if (io_cfg_used_bytes)
 		cam_ife_mgr_update_hw_entries_util(
-			CAM_ISP_IOCFG_BL, io_cfg_used_bytes, kmd_buf_info, prepare);
+			CAM_ISP_IOCFG_BL, io_cfg_used_bytes,
+			kmd_buf_info, prepare, false);
 
 	return rc;
 }
@@ -11650,7 +11668,7 @@ static int cam_ife_mgr_csid_add_reg_update(struct cam_ife_hw_mgr_ctx *ctx,
 		}
 
 		rc = cam_isp_add_csid_reg_update(prepare, kmd_buf,
-			&rup_args[i]);
+			&rup_args[i], true);
 
 		if (rc) {
 			CAM_ERR(CAM_ISP, "Ctx:%u Reg Update failed idx:%u",
@@ -11698,7 +11716,8 @@ static int cam_ife_mgr_isp_add_reg_update(struct cam_ife_hw_mgr_ctx *ctx,
 
 		rc = cam_isp_add_reg_update(prepare,
 			&ctx->res_list_ife_src,
-			ctx->base[i].idx, kmd_buf);
+			ctx->base[i].idx, kmd_buf,
+			!ctx->flags.internal_cdm);
 
 		if (rc) {
 			CAM_ERR(CAM_ISP,
@@ -11757,7 +11776,7 @@ add_cmds:
 			return rc;
 
 		rc = cam_isp_add_csid_offline_cmd(prepare,
-			hw_mgr_res->hw_res[i], kmd_buf_info);
+			hw_mgr_res->hw_res[i], kmd_buf_info, true);
 		if (rc)
 			return rc;
 
@@ -11808,7 +11827,7 @@ add_cmds:
 		if (rc)
 			return rc;
 
-		rc = cam_isp_add_go_cmd(prepare, hw_mgr_res->hw_res[i], kmd_buf_info);
+		rc = cam_isp_add_go_cmd(prepare, hw_mgr_res->hw_res[i], kmd_buf_info, true);
 		if (rc)
 			return rc;
 
@@ -11833,11 +11852,11 @@ static int cam_ife_hw_mgr_update_cmd_buffer(
 		res_list = &ctx->res_list_sfe_src;
 	} else if (ctx->base[base_idx].hw_type == CAM_ISP_HW_TYPE_VFE) {
 		res_list = &ctx->res_list_ife_src;
-	}else if (ctx->base[base_idx].hw_type == CAM_ISP_HW_TYPE_CSID) {
+	} else if (ctx->base[base_idx].hw_type == CAM_ISP_HW_TYPE_CSID) {
 		if (!cmd_buf_count->csid_cnt)
 			return rc;
 		res_list = &ctx->res_list_ife_csid;
-	}else {
+	} else {
 		CAM_ERR(CAM_ISP,
 			"Invalid hw_type=%d, ctx_idx: %u",
 			ctx->base[base_idx].hw_type, ctx->ctx_index);
@@ -11884,7 +11903,7 @@ static int cam_ife_hw_mgr_update_cmd_buffer(
 			max_ife_out_res));
 	else if (ctx->base[base_idx].hw_type == CAM_ISP_HW_TYPE_CSID)
 		rc = cam_isp_add_csid_command_buffers(prepare,
-			kmd_buf, &ctx->base[base_idx]);
+			&ctx->base[base_idx]);
 
 	CAM_DBG(CAM_ISP,
 		"Add cmdbuf, i=%d, split_id=%d, hw_type=%d ctx_idx: %u",

+ 1 - 1
drivers/cam_isp/isp_hw_mgr/cam_tfe_hw_mgr.c

@@ -4549,7 +4549,7 @@ static int cam_tfe_mgr_prepare_hw_update(void *hw_mgr_priv,
 
 		/*Add reg update */
 		rc = cam_isp_add_reg_update(prepare, &ctx->res_list_tfe_in,
-			ctx->base[i].idx, &prepare_hw_data->kmd_cmd_buff_info);
+			ctx->base[i].idx, &prepare_hw_data->kmd_cmd_buff_info, false);
 		if (rc) {
 			CAM_ERR(CAM_ISP,
 				"Add Reg_update cmd Failed i=%d, idx=%d, rc=%d",

+ 141 - 211
drivers/cam_isp/isp_hw_mgr/hw_utils/cam_isp_packet_parser.c

@@ -13,6 +13,71 @@
 #include "cam_debug_util.h"
 #include "cam_isp_hw_mgr_intf.h"
 
+static void cam_isp_add_update_entry(
+	enum cam_isp_cdm_bl_type            cdm_bl_type,
+	struct cam_hw_prepare_update_args  *prepare,
+	struct cam_kmd_buf_info            *kmd_buf_info,
+	uint32_t                            update_size)
+{
+	/* Validation is done from the caller */
+	uint32_t num_ent;
+	struct cam_hw_update_entry *curr_update_entry;
+
+	num_ent = prepare->num_hw_update_entries;
+	curr_update_entry = &(prepare->hw_update_entries[num_ent]);
+	curr_update_entry->handle = kmd_buf_info->handle;
+	curr_update_entry->len = update_size;
+	curr_update_entry->offset = kmd_buf_info->offset;
+	curr_update_entry->flags = cdm_bl_type;
+
+	num_ent++;
+	kmd_buf_info->used_bytes += update_size;
+	kmd_buf_info->offset     += update_size;
+	prepare->num_hw_update_entries = num_ent;
+
+	CAM_DBG(CAM_ISP,
+		"Add new entry: num_ent=%d handle=0x%x, len=%u, offset=%u",
+		num_ent - 1, curr_update_entry->handle,
+		curr_update_entry->len, curr_update_entry->offset);
+}
+
+static void cam_isp_combine_update_entry(
+	struct cam_hw_prepare_update_args  *prepare,
+	struct cam_kmd_buf_info            *kmd_buf_info,
+	uint32_t                            update_size)
+{
+	/* Validation is done from the caller */
+	uint32_t num_ent;
+	struct cam_hw_update_entry *prev_update_entry;
+
+	num_ent = prepare->num_hw_update_entries;
+	prev_update_entry = &(prepare->hw_update_entries[num_ent - 1]);
+	prev_update_entry->len += update_size;
+
+	CAM_DBG(CAM_ISP,
+		"Combined with prev entry: num_ent=%d handle=0x%x, len=%u, offset=%u",
+		num_ent - 1, prev_update_entry->handle,
+		prev_update_entry->len, prev_update_entry->offset);
+
+	kmd_buf_info->used_bytes += update_size;
+	kmd_buf_info->offset += update_size;
+}
+
+void cam_isp_update_hw_entry(
+	enum cam_isp_cdm_bl_type            cdm_bl_type,
+	struct cam_hw_prepare_update_args  *prepare,
+	struct cam_kmd_buf_info            *kmd_buf_info,
+	uint32_t                            update_size,
+	bool                                combine)
+{
+	if (combine)
+		cam_isp_combine_update_entry(prepare,
+			kmd_buf_info, update_size);
+	else
+		cam_isp_add_update_entry(cdm_bl_type, prepare,
+			kmd_buf_info, update_size);
+}
+
 int cam_isp_add_change_base(
 	struct cam_hw_prepare_update_args      *prepare,
 	struct list_head                       *res_list_isp_src,
@@ -63,23 +128,8 @@ int cam_isp_add_change_base(
 			if (rc)
 				return rc;
 
-			hw_entry[num_ent].handle = kmd_buf_info->handle;
-			hw_entry[num_ent].len    = get_base.cmd.used_bytes;
-			hw_entry[num_ent].offset = kmd_buf_info->offset;
-
-			/* Marking change base as COMMON_CFG */
-			hw_entry[num_ent].flags  = CAM_ISP_COMMON_CFG_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);
-
-			kmd_buf_info->used_bytes += get_base.cmd.used_bytes;
-			kmd_buf_info->offset     += get_base.cmd.used_bytes;
-			num_ent++;
-			prepare->num_hw_update_entries = num_ent;
+			cam_isp_add_update_entry(CAM_ISP_COMMON_CFG_BL, prepare,
+				kmd_buf_info, get_base.cmd.used_bytes);
 
 			/* return success */
 			return 0;
@@ -291,8 +341,7 @@ int cam_isp_add_command_buffers(
 		case CAM_ISP_PACKET_META_DMI_LEFT:
 			if (split_id == CAM_ISP_HW_SPLIT_LEFT) {
 				hw_entry[num_ent].len = cmd_desc[i].length;
-				hw_entry[num_ent].handle =
-					cmd_desc[i].mem_handle;
+				hw_entry[num_ent].handle = cmd_desc[i].mem_handle;
 				hw_entry[num_ent].offset = cmd_desc[i].offset;
 				CAM_DBG(CAM_ISP,
 					"Meta_Left num_ent=%d handle=0x%x, len=%u, offset=%u",
@@ -300,9 +349,7 @@ int cam_isp_add_command_buffers(
 					hw_entry[num_ent].handle,
 					hw_entry[num_ent].len,
 					hw_entry[num_ent].offset);
-					hw_entry[num_ent].flags =
-						CAM_ISP_IQ_BL;
-
+				hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
 				num_ent++;
 			}
 			break;
@@ -310,8 +357,7 @@ int cam_isp_add_command_buffers(
 		case CAM_ISP_PACKET_META_DMI_RIGHT:
 			if (split_id == CAM_ISP_HW_SPLIT_RIGHT) {
 				hw_entry[num_ent].len = cmd_desc[i].length;
-				hw_entry[num_ent].handle =
-					cmd_desc[i].mem_handle;
+				hw_entry[num_ent].handle = cmd_desc[i].mem_handle;
 				hw_entry[num_ent].offset = cmd_desc[i].offset;
 				CAM_DBG(CAM_ISP,
 					"Meta_Right num_ent=%d handle=0x%x, len=%u, offset=%u",
@@ -319,16 +365,14 @@ int cam_isp_add_command_buffers(
 					hw_entry[num_ent].handle,
 					hw_entry[num_ent].len,
 					hw_entry[num_ent].offset);
-					hw_entry[num_ent].flags =
-						CAM_ISP_IQ_BL;
+				hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
 				num_ent++;
 			}
 			break;
 		case CAM_ISP_PACKET_META_COMMON:
 		case CAM_ISP_PACKET_META_DMI_COMMON:
 			hw_entry[num_ent].len = cmd_desc[i].length;
-			hw_entry[num_ent].handle =
-				cmd_desc[i].mem_handle;
+			hw_entry[num_ent].handle = cmd_desc[i].mem_handle;
 			hw_entry[num_ent].offset = cmd_desc[i].offset;
 			CAM_DBG(CAM_ISP,
 				"Meta_Common num_ent=%d handle=0x%x, len=%u, offset=%u",
@@ -336,8 +380,7 @@ int cam_isp_add_command_buffers(
 				hw_entry[num_ent].handle,
 				hw_entry[num_ent].len,
 				hw_entry[num_ent].offset);
-				hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
-
+			hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
 			num_ent++;
 			break;
 		case CAM_ISP_PACKET_META_DUAL_CONFIG:
@@ -351,10 +394,10 @@ int cam_isp_add_command_buffers(
 			if (split_id == CAM_ISP_HW_SPLIT_LEFT) {
 				struct cam_isp_generic_blob_info   blob_info;
 
-				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;
+				blob_info.entry_added = false;
 
 				rc = cam_packet_util_process_generic_cmd_buffer(
 					&cmd_desc[i],
@@ -366,7 +409,6 @@ int cam_isp_add_command_buffers(
 						rc);
 					return rc;
 				}
-				hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
 				num_ent = prepare->num_hw_update_entries;
 			}
 			break;
@@ -374,10 +416,10 @@ int cam_isp_add_command_buffers(
 			if (split_id == CAM_ISP_HW_SPLIT_RIGHT) {
 				struct cam_isp_generic_blob_info   blob_info;
 
-				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;
+				blob_info.entry_added = false;
 
 				rc = cam_packet_util_process_generic_cmd_buffer(
 					&cmd_desc[i],
@@ -389,17 +431,16 @@ int cam_isp_add_command_buffers(
 						rc);
 					return rc;
 				}
-				hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
 				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->num_hw_update_entries = num_ent;
 			blob_info.prepare = prepare;
 			blob_info.base_info = base_info;
 			blob_info.kmd_buf_info = kmd_buf_info;
+			blob_info.entry_added = false;
 
 			rc = cam_packet_util_process_generic_cmd_buffer(
 				&cmd_desc[i],
@@ -410,7 +451,6 @@ int cam_isp_add_command_buffers(
 					"Failed in processing blobs %d", rc);
 				return rc;
 			}
-			hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
 			num_ent = prepare->num_hw_update_entries;
 		}
 			break;
@@ -511,8 +551,7 @@ int cam_sfe_add_command_buffers(
 		case CAM_ISP_SFE_PACKET_META_LEFT:
 			if (split_id == CAM_ISP_HW_SPLIT_LEFT) {
 				hw_entry[num_ent].len = cmd_desc[i].length;
-				hw_entry[num_ent].handle =
-					cmd_desc[i].mem_handle;
+				hw_entry[num_ent].handle = cmd_desc[i].mem_handle;
 				hw_entry[num_ent].offset = cmd_desc[i].offset;
 				CAM_DBG(CAM_ISP,
 					"Meta_Left num_ent=%d handle=0x%x, len=%u, offset=%u",
@@ -520,17 +559,14 @@ int cam_sfe_add_command_buffers(
 					hw_entry[num_ent].handle,
 					hw_entry[num_ent].len,
 					hw_entry[num_ent].offset);
-					hw_entry[num_ent].flags =
-						CAM_ISP_IQ_BL;
-
+				hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
 				num_ent++;
 			}
 			break;
 		case CAM_ISP_SFE_PACKET_META_RIGHT:
 			if (split_id == CAM_ISP_HW_SPLIT_RIGHT) {
 				hw_entry[num_ent].len = cmd_desc[i].length;
-				hw_entry[num_ent].handle =
-					cmd_desc[i].mem_handle;
+				hw_entry[num_ent].handle = cmd_desc[i].mem_handle;
 				hw_entry[num_ent].offset = cmd_desc[i].offset;
 				CAM_DBG(CAM_ISP,
 					"Meta_Right num_ent=%d handle=0x%x, len=%u, offset=%u",
@@ -538,15 +574,13 @@ int cam_sfe_add_command_buffers(
 					hw_entry[num_ent].handle,
 					hw_entry[num_ent].len,
 					hw_entry[num_ent].offset);
-					hw_entry[num_ent].flags =
-						CAM_ISP_IQ_BL;
+				hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
 				num_ent++;
 			}
 			break;
 		case CAM_ISP_SFE_PACKET_META_COMMON:
 			hw_entry[num_ent].len = cmd_desc[i].length;
-			hw_entry[num_ent].handle =
-				cmd_desc[i].mem_handle;
+			hw_entry[num_ent].handle = cmd_desc[i].mem_handle;
 			hw_entry[num_ent].offset = cmd_desc[i].offset;
 			CAM_DBG(CAM_ISP,
 				"Meta_Common num_ent=%d handle=0x%x, len=%u, offset=%u",
@@ -554,8 +588,7 @@ int cam_sfe_add_command_buffers(
 				hw_entry[num_ent].handle,
 				hw_entry[num_ent].len,
 				hw_entry[num_ent].offset);
-				hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
-
+			hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
 			num_ent++;
 			break;
 		case CAM_ISP_SFE_PACKET_META_DUAL_CONFIG:
@@ -569,10 +602,10 @@ int cam_sfe_add_command_buffers(
 			if (split_id == CAM_ISP_HW_SPLIT_LEFT) {
 				struct cam_isp_generic_blob_info   blob_info;
 
-				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;
+				blob_info.entry_added = false;
 
 				rc = cam_packet_util_process_generic_cmd_buffer(
 					&cmd_desc[i],
@@ -584,7 +617,6 @@ int cam_sfe_add_command_buffers(
 						rc);
 					return rc;
 				}
-				hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
 				num_ent = prepare->num_hw_update_entries;
 			}
 			break;
@@ -592,10 +624,10 @@ int cam_sfe_add_command_buffers(
 			if (split_id == CAM_ISP_HW_SPLIT_RIGHT) {
 				struct cam_isp_generic_blob_info   blob_info;
 
-				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;
+				blob_info.entry_added = false;
 
 				rc = cam_packet_util_process_generic_cmd_buffer(
 					&cmd_desc[i],
@@ -607,17 +639,16 @@ int cam_sfe_add_command_buffers(
 						rc);
 					return rc;
 				}
-				hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
 				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->num_hw_update_entries = num_ent;
 			blob_info.prepare = prepare;
 			blob_info.base_info = base_info;
 			blob_info.kmd_buf_info = kmd_buf_info;
+			blob_info.entry_added = false;
 
 			rc = cam_packet_util_process_generic_cmd_buffer(
 				&cmd_desc[i],
@@ -628,7 +659,6 @@ int cam_sfe_add_command_buffers(
 					"Failed in processing blobs %d", rc);
 				return rc;
 			}
-			hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
 			num_ent = prepare->num_hw_update_entries;
 		}
 			break;
@@ -691,32 +721,6 @@ static void cam_isp_validate_for_ife_scratch(
 	}
 }
 
-static inline void cam_isp_update_hw_entries_util(
-	enum cam_isp_cdm_bl_type               cdm_bl_type,
-	struct cam_kmd_buf_info               *kmd_buf_info,
-	uint32_t                               used_bytes,
-	uint32_t                               offset,
-	struct cam_hw_prepare_update_args     *prepare)
-{
-	uint32_t num_ent;
-
-	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 = used_bytes;
-	prepare->hw_update_entries[num_ent].offset = offset;
-	prepare->hw_update_entries[num_ent].flags = cdm_bl_type;
-
-	num_ent++;
-	prepare->num_hw_update_entries = num_ent;
-
-	CAM_DBG(CAM_ISP, "Handle: 0x%x len: %u offset: %u flags: %u num_ent: %u",
-		prepare->hw_update_entries[num_ent - 1].handle,
-		prepare->hw_update_entries[num_ent - 1].len,
-		prepare->hw_update_entries[num_ent - 1].offset,
-		prepare->hw_update_entries[num_ent - 1].flags,
-		num_ent - 1);
-}
-
 static int cam_isp_io_buf_get_entries_util(
 	struct cam_isp_io_buf_info              *buf_info,
 	struct cam_buf_io_cfg                   *io_cfg,
@@ -818,7 +822,6 @@ static int cam_isp_io_buf_get_entries_util(
 		}
 		map_entries->resource_handle = io_cfg->resource_type;
 		map_entries->sync_id = io_cfg->fence;
-
 	}
 
 	return 0;
@@ -1070,9 +1073,18 @@ int cam_isp_add_io_buffers(struct cam_isp_io_buf_info   *io_info)
 	CAM_DBG(CAM_ISP, "io_cfg_used_bytes %d, fill_fence %d",
 		bytes_updated, io_info->fill_fence);
 
-	if (bytes_updated)
-		cam_isp_update_hw_entries_util(CAM_ISP_IOCFG_BL, io_info->kmd_buf_info,
-			bytes_updated, curr_offset, io_info->prepare);
+	if (bytes_updated) {
+		/**
+		 * Offset and used_bytes are already updated in the previous
+		 * add_io_buffers_util function and now points to next empty
+		 * block in kmd buffer, reset it here to align with generic
+		 * update hw entry function
+		 */
+		io_info->kmd_buf_info->offset -= bytes_updated;
+		io_info->kmd_buf_info->used_bytes -= bytes_updated;
+		cam_isp_update_hw_entry(CAM_ISP_IOCFG_BL, io_info->prepare,
+			io_info->kmd_buf_info, bytes_updated, false);
+	}
 
 	return rc;
 }
@@ -1081,13 +1093,14 @@ int cam_isp_add_reg_update(
 	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)
+	struct cam_kmd_buf_info              *kmd_buf_info,
+	bool                                  combine)
 {
 	int rc = -EINVAL;
 	struct cam_isp_resource_node         *res;
 	struct cam_isp_hw_mgr_res            *hw_mgr_res;
 	struct cam_isp_hw_get_cmd_update      get_regup;
-	uint32_t kmd_buf_remain_size, num_ent, i, reg_update_size;
+	uint32_t kmd_buf_remain_size, i, reg_update_size;
 
 	/* Max one hw entries required for each base */
 	if (prepare->num_hw_update_entries + 1 >=
@@ -1147,28 +1160,8 @@ int cam_isp_add_reg_update(
 	}
 
 	if (reg_update_size) {
-		/* Update the HW entries */
-		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 COMMON */
-		prepare->hw_update_entries[num_ent].flags = CAM_ISP_COMMON_CFG_BL;
-		CAM_DBG(CAM_ISP,
-			"num_ent=%d handle=0x%x, len=%u, offset=%u",
-			num_ent,
-			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->num_hw_update_entries = num_ent;
-		/* reg update is success return status 0 */
+		cam_isp_update_hw_entry(CAM_ISP_COMMON_CFG_BL, prepare,
+			kmd_buf_info, reg_update_size, combine);
 		rc = 0;
 	}
 
@@ -1178,11 +1171,12 @@ int cam_isp_add_reg_update(
 int cam_isp_add_go_cmd(
 	struct cam_hw_prepare_update_args    *prepare,
 	struct cam_isp_resource_node         *res,
-	struct cam_kmd_buf_info              *kmd_buf_info)
+	struct cam_kmd_buf_info              *kmd_buf_info,
+	bool                                  combine)
 {
-	int rc = -EINVAL;
+	int rc;
 	struct cam_isp_hw_get_cmd_update      get_regup;
-	uint32_t kmd_buf_remain_size, num_ent, reg_update_size;
+	uint32_t kmd_buf_remain_size, reg_update_size;
 
 	/* Max one hw entries required for each base */
 	if (prepare->num_hw_update_entries + 1 >=
@@ -1204,8 +1198,7 @@ int cam_isp_add_go_cmd(
 			kmd_buf_info->size,
 			kmd_buf_info->used_bytes +
 			reg_update_size);
-		rc = -EINVAL;
-		return rc;
+		return -EINVAL;
 	}
 
 	get_regup.cmd.cmd_buf_addr = kmd_buf_info->cpu_addr +
@@ -1225,25 +1218,11 @@ int cam_isp_add_go_cmd(
 		res->res_type, res->hw_intf->hw_idx);
 	reg_update_size += get_regup.cmd.used_bytes;
 
-	/* Update the HW entries */
-	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_COMMON_CFG_BL;
-	CAM_DBG(CAM_ISP,
-		"num_ent=%d handle=0x%x, len=%u, offset=%u",
-		num_ent,
-		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->num_hw_update_entries = num_ent;
-
+	/* Update HW entries */
+	if (reg_update_size)
+		cam_isp_update_hw_entry(CAM_ISP_COMMON_CFG_BL,
+			prepare, kmd_buf_info, reg_update_size,
+			combine);
 	return 0;
 }
 
@@ -1447,7 +1426,6 @@ int cam_isp_add_wait_trigger(
 
 int cam_isp_add_csid_command_buffers(
 	struct cam_hw_prepare_update_args   *prepare,
-	struct cam_kmd_buf_info             *kmd_buf_info,
 	struct cam_isp_ctx_base_info        *base_info)
 {
 	int rc = 0;
@@ -1492,7 +1470,6 @@ int cam_isp_add_csid_command_buffers(
 			cmd_meta_data, split_id);
 
 		switch (cmd_meta_data) {
-
 		case CAM_ISP_PACKET_META_BASE:
 		case CAM_ISP_PACKET_META_LEFT:
 		case CAM_ISP_PACKET_META_DMI_LEFT:
@@ -1515,8 +1492,7 @@ int cam_isp_add_csid_command_buffers(
 		case CAM_ISP_PACKET_META_CSID_LEFT:
 			if (split_id == CAM_ISP_HW_SPLIT_LEFT) {
 				hw_entry[num_ent].len = cmd_desc[i].length;
-				hw_entry[num_ent].handle =
-					cmd_desc[i].mem_handle;
+				hw_entry[num_ent].handle = cmd_desc[i].mem_handle;
 				hw_entry[num_ent].offset = cmd_desc[i].offset;
 				CAM_DBG(CAM_ISP,
 					"Meta_Left num_ent=%d handle=0x%x, len=%u, offset=%u",
@@ -1524,17 +1500,14 @@ int cam_isp_add_csid_command_buffers(
 					hw_entry[num_ent].handle,
 					hw_entry[num_ent].len,
 					hw_entry[num_ent].offset);
-					hw_entry[num_ent].flags =
-						CAM_ISP_IQ_BL;
-
+				hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
 				num_ent++;
 			}
 			break;
 		case CAM_ISP_PACKET_META_CSID_RIGHT:
 			if (split_id == CAM_ISP_HW_SPLIT_RIGHT) {
 				hw_entry[num_ent].len = cmd_desc[i].length;
-				hw_entry[num_ent].handle =
-					cmd_desc[i].mem_handle;
+				hw_entry[num_ent].handle = cmd_desc[i].mem_handle;
 				hw_entry[num_ent].offset = cmd_desc[i].offset;
 				CAM_DBG(CAM_ISP,
 					"Meta_Right num_ent=%d handle=0x%x, len=%u, offset=%u",
@@ -1542,15 +1515,13 @@ int cam_isp_add_csid_command_buffers(
 					hw_entry[num_ent].handle,
 					hw_entry[num_ent].len,
 					hw_entry[num_ent].offset);
-					hw_entry[num_ent].flags =
-						CAM_ISP_IQ_BL;
+				hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
 				num_ent++;
 			}
 			break;
 		case CAM_ISP_PACKET_META_CSID_COMMON:
 			hw_entry[num_ent].len = cmd_desc[i].length;
-			hw_entry[num_ent].handle =
-				cmd_desc[i].mem_handle;
+			hw_entry[num_ent].handle = cmd_desc[i].mem_handle;
 			hw_entry[num_ent].offset = cmd_desc[i].offset;
 			CAM_DBG(CAM_ISP,
 				"Meta_Common num_ent=%d handle=0x%x, len=%u, offset=%u",
@@ -1558,8 +1529,7 @@ int cam_isp_add_csid_command_buffers(
 				hw_entry[num_ent].handle,
 				hw_entry[num_ent].len,
 				hw_entry[num_ent].offset);
-				hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
-
+			hw_entry[num_ent].flags = CAM_ISP_IQ_BL;
 			num_ent++;
 			break;
 		default:
@@ -1576,12 +1546,12 @@ int cam_isp_add_csid_command_buffers(
 int cam_isp_add_csid_reg_update(
 	struct cam_hw_prepare_update_args    *prepare,
 	struct cam_kmd_buf_info              *kmd_buf_info,
-	void                                 *args)
+	void                                 *args,
+	bool                                  combine)
 {
-	int rc = 0;
+	int rc;
 	struct cam_isp_resource_node         *res;
-	uint32_t kmd_buf_remain_size, num_ent;
-	uint32_t reg_update_size = 0;
+	uint32_t kmd_buf_remain_size, reg_update_size = 0;
 	struct cam_isp_csid_reg_update_args *rup_args = NULL;
 
 	if (prepare->num_hw_update_entries + 1 >=
@@ -1608,7 +1578,7 @@ int cam_isp_add_csid_reg_update(
 		return -EINVAL;
 	}
 
-	kmd_buf_remain_size =  kmd_buf_info->size -
+	kmd_buf_remain_size = kmd_buf_info->size -
 		(kmd_buf_info->used_bytes +
 		reg_update_size);
 
@@ -1632,41 +1602,22 @@ int cam_isp_add_csid_reg_update(
 		res->res_id, res->hw_intf->hw_idx);
 	reg_update_size += rup_args->cmd.used_bytes;
 
-	if (reg_update_size) {
-		/* Update the HW entries */
-		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 COMMON */
-		prepare->hw_update_entries[num_ent].flags = CAM_ISP_COMMON_CFG_BL;
-		CAM_DBG(CAM_ISP,
-			"num_ent=%d handle=0x%x, len=%u, offset=%u",
-			num_ent,
-			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->num_hw_update_entries = num_ent;
-		/* reg update is success return status 0 */
-	}
-
-	return rc;
+	/* Update hw entries */
+	if (reg_update_size)
+		cam_isp_update_hw_entry(CAM_ISP_COMMON_CFG_BL,
+			prepare, kmd_buf_info, reg_update_size,
+			combine);
+	return 0;
 }
 
 int cam_isp_add_csid_offline_cmd(
 	struct cam_hw_prepare_update_args    *prepare,
 	struct cam_isp_resource_node         *res,
-	struct cam_kmd_buf_info              *kmd_buf_info)
+	struct cam_kmd_buf_info              *kmd_buf_info,
+	bool                                  combine)
 {
-	int rc = -EINVAL;
-	uint32_t kmd_buf_remain_size, num_ent, go_cmd_size;
+	int rc;
+	uint32_t kmd_buf_remain_size, go_cmd_size;
 	struct cam_ife_csid_offline_cmd_update_args go_args;
 
 	if (prepare->num_hw_update_entries + 1 >=
@@ -1688,8 +1639,7 @@ int cam_isp_add_csid_offline_cmd(
 			kmd_buf_info->size,
 			kmd_buf_info->used_bytes +
 			go_cmd_size);
-		rc = -EINVAL;
-		goto end;
+		return -EINVAL;
 	}
 
 	go_args.cmd.cmd_buf_addr = kmd_buf_info->cpu_addr +
@@ -1703,39 +1653,19 @@ int cam_isp_add_csid_offline_cmd(
 			CAM_IFE_CSID_PROGRAM_OFFLINE_CMD, &go_args,
 			sizeof(go_args));
 	if (rc)
-		goto end;
+		return rc;
 
 	CAM_DBG(CAM_ISP,
 		"offline cmd update added for CSID: %u res: %d",
 		res->hw_intf->hw_idx, res->res_id);
-
 	go_cmd_size += go_args.cmd.used_bytes;
-	/* Update the HW entries */
-	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 = go_cmd_size;
-	prepare->hw_update_entries[num_ent].offset =
-		kmd_buf_info->offset;
-
-	/* Marking go update as COMMON */
-	prepare->hw_update_entries[num_ent].flags = CAM_ISP_COMMON_CFG_BL;
-	CAM_DBG(CAM_ISP,
-		"num_ent=%d handle=0x%x, len=%u, offset=%u",
-		num_ent,
-		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 += go_cmd_size;
-	kmd_buf_info->offset     += go_cmd_size;
-	prepare->num_hw_update_entries = num_ent;
-	/* offline cmd update is success return status 0 */
-	rc = 0;
 
-end:
-	return rc;
+	/* Update HW entries */
+	if (go_cmd_size)
+		cam_isp_update_hw_entry(CAM_ISP_COMMON_CFG_BL,
+			prepare, kmd_buf_info, go_cmd_size,
+			combine);
+	return 0;
 }
 
 int cam_isp_get_cmd_buf_count(

+ 40 - 12
drivers/cam_isp/isp_hw_mgr/hw_utils/include/cam_isp_packet_parser.h

@@ -30,11 +30,14 @@ enum cam_isp_cdm_bl_type {
  * @prepare:            Payload for prepare command
  * @base_info:          Base hardware information for the context
  * @kmd_buf_info:       Kmd buffer to store the custom cmd data
+ * @entry_added:        Indicate whether the entry is previously
+ *                      added when handling the blob before
  */
 struct cam_isp_generic_blob_info {
 	struct cam_hw_prepare_update_args     *prepare;
 	struct cam_isp_ctx_base_info          *base_info;
 	struct cam_kmd_buf_info               *kmd_buf_info;
+	bool                                   entry_added;
 };
 
 /*
@@ -278,10 +281,11 @@ int cam_isp_add_io_buffers(struct cam_isp_io_buf_info   *io_info);
  *                         processe the isp source list get the reg update from
  *                         ISP HW instance
  *
- * @prepare:               Contain the  packet and HW update variables
+ * @prepare:               Contain the packet and HW update variables
  * @res_list_isp_src:      Resource list for IFE/VFE source
  * @base_idx:              Base or dev index of the IFE/VFE HW instance
  * @kmd_buf_info:          Kmd buffer to store the change base command
+ * @combine:               Indicate whether combine with prev update entry
  * @return:                0 for success
  *                         -EINVAL for Fail
  */
@@ -289,7 +293,8 @@ int cam_isp_add_reg_update(
 	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);
+	struct cam_kmd_buf_info              *kmd_buf_info,
+	bool                                  combine);
 
 /*
  * cam_isp_add_comp_wait()
@@ -298,7 +303,7 @@ int cam_isp_add_reg_update(
  *                         processe the isp source list get the reg update from
  *                         ISP HW instance
  *
- * @prepare:               Contain the  packet and HW update variables
+ * @prepare:               Contain the packet and HW update variables
  * @res_list_isp_src:      Resource list for IFE/VFE source
  * @base_idx:              Base or dev index of the IFE/VFE HW instance
  * @kmd_buf_info:          Kmd buffer to store the change base command
@@ -319,7 +324,7 @@ int cam_isp_add_comp_wait(
  *                         processe the isp source list get the reg update from
  *                         ISP HW instance
  *
- * @prepare:               Contain the  packet and HW update variables
+ * @prepare:               Contain the packet and HW update variables
  * @res_list_isp_src:      Resource list for IFE/VFE source
  * @base_idx:              Base or dev index of the IFE/VFE HW instance
  * @kmd_buf_info:          Kmd buffer to store the change base command
@@ -341,16 +346,18 @@ int cam_isp_add_wait_trigger(
  *
  * @brief                  Add go_cmd in the hw entries list for each rd source
  *
- * @prepare:               Contain the  packet and HW update variables
+ * @prepare:               Contain the packet and HW update variables
  * @res:                   go_cmd added for this resource
  * @kmd_buf_info:          Kmd buffer to store the change base command
+ * @combine:               Indicate whether combine with prev update entry
  * @return:                0 for success
  *                         -EINVAL for Fail
  */
 int cam_isp_add_go_cmd(
 	struct cam_hw_prepare_update_args    *prepare,
 	struct cam_isp_resource_node         *res,
-	struct cam_kmd_buf_info              *kmd_buf_info);
+	struct cam_kmd_buf_info              *kmd_buf_info,
+	bool                                  combine);
 
 /* cam_isp_csid_add_reg_update()
  *
@@ -358,32 +365,36 @@ int cam_isp_add_go_cmd(
  *                         processe the isp source list get the reg update from
  *                         ISP HW instance
  *
- * @prepare:               Contain the  packet and HW update variables
+ * @prepare:               Contain the packet and HW update variables
  * @kmd_buf_info:          Kmd buffer to store the change base command
  * @rup_args:              Reg Update args
+ * @combine:               Indicate whether combine with prev update entry
  * @return:                0 for success
  *                         -EINVAL for Fail
  */
 int cam_isp_add_csid_reg_update(
 	struct cam_hw_prepare_update_args    *prepare,
 	struct cam_kmd_buf_info              *kmd_buf_info,
-	void                                 *args);
+	void                                 *args,
+	bool                                  combine);
 
 
 /* cam_isp_add_csid_offline_cmd()
  *
  * @brief                  Add csid go cmd for offline mode
  *
- * @prepare:               Contain the  packet and HW update variables
+ * @prepare:               Contain the packet and HW update variables
  * @res:                   go_cmd added for this resource
  * @kmd_buf_info:          Kmd buffer to store the change base command
+ * @combine:               Indicate whether combine with prev update entry
  * @return:                0 for success
  *                         -EINVAL for Fail
  */
 int cam_isp_add_csid_offline_cmd(
 	struct cam_hw_prepare_update_args    *prepare,
 	struct cam_isp_resource_node         *res,
-	struct cam_kmd_buf_info              *kmd_buf_info);
+	struct cam_kmd_buf_info              *kmd_buf_info,
+	bool                                  combine);
 
 /*
  * cam_isp_add_csid_command_buffers()
@@ -392,7 +403,6 @@ int cam_isp_add_csid_offline_cmd(
  *                         left or right CSID instance.
  *
  * @prepare:               Contain the packet and HW update variables
- * @kmd_buf_info:          KMD buffer to store the custom cmd data
  * @base_info:             base hardware information
  *
  * @return:                0 for success
@@ -400,7 +410,6 @@ int cam_isp_add_csid_offline_cmd(
  */
 int cam_isp_add_csid_command_buffers(
 	struct cam_hw_prepare_update_args   *prepare,
-	struct cam_kmd_buf_info             *kmd_buf_info,
 	struct cam_isp_ctx_base_info        *base_info);
 
 /*
@@ -417,4 +426,23 @@ int cam_isp_add_csid_command_buffers(
 int cam_isp_get_cmd_buf_count(
 	struct cam_hw_prepare_update_args    *prepare,
 	struct cam_isp_cmd_buf_count         *cmd_buf_count);
+
+/*
+ * cam_isp_update_hw_entry()
+ *
+ * @brief                  Add a new update hw entry or combine with
+ *                         prev update hw entry
+ *
+ * @cdm_bl_type:           CDM BL type for the current updated entry
+ * @prepare:               Contain the packet and HW update variables
+ * @kmd_buf_info:          Kmd buffer to store register value pair changes
+ * @update_size:           Update size for cmd data in kmd buffer
+ * @combine:               Indicate whether combine with prev update entry
+ */
+void cam_isp_update_hw_entry(
+	enum cam_isp_cdm_bl_type            cdm_bl_type,
+	struct cam_hw_prepare_update_args  *prepare,
+	struct cam_kmd_buf_info            *kmd_buf_info,
+	uint32_t                            update_size,
+	bool                                combine);
 #endif /*_CAM_ISP_HW_PARSER_H */