Răsfoiți Sursa

Merge "msm: camera: isp: Add UAPI changes for new VFE hardware" into camera-kernel.lnx.4.0

Camera Software Integration 4 ani în urmă
părinte
comite
e57a660343

+ 54 - 35
drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c

@@ -54,6 +54,8 @@ static uint32_t blob_type_hw_cmd_map[CAM_ISP_GENERIC_BLOB_TYPE_MAX] = {
 
 static struct cam_ife_hw_mgr g_ife_hw_mgr;
 
+static uint32_t max_ife_out_res;
+
 static int cam_ife_hw_mgr_event_handler(
 	void                                *priv,
 	uint32_t                             evt_id,
@@ -507,7 +509,7 @@ static void cam_ife_hw_mgr_deinit_hw(
 	}
 
 	/* Deinit IFE OUT */
-	for (i = 0; i < CAM_IFE_HW_OUT_RES_MAX; i++)
+	for (i = 0; i < max_ife_out_res; i++)
 		cam_ife_hw_mgr_deinit_hw_res(&ctx->res_list_ife_out[i]);
 
 	ctx->init_done = false;
@@ -583,7 +585,7 @@ static int cam_ife_hw_mgr_init_hw(
 	CAM_DBG(CAM_ISP, "INIT IFE OUT RESOURCES in ctx id:%d",
 		ctx->ctx_index);
 
-	for (i = 0; i < CAM_IFE_HW_OUT_RES_MAX; i++) {
+	for (i = 0; i < max_ife_out_res; i++) {
 		rc = cam_ife_hw_mgr_init_hw_res(&ctx->res_list_ife_out[i]);
 		if (rc) {
 			CAM_ERR(CAM_ISP, "Can not INIT IFE OUT (%d)",
@@ -939,7 +941,7 @@ static void cam_ife_hw_mgr_dump_acq_data(
 	}
 
 	/* Iterate over IFE OUT resources */
-	for (i = 0; i < CAM_IFE_HW_OUT_RES_MAX; i++) {
+	for (i = 0; i < max_ife_out_res; i++) {
 		for (j = 0; j < CAM_ISP_HW_SPLIT_MAX; j++) {
 			hw_mgr_res = &hwr_mgr_ctx->res_list_ife_out[i];
 			hw_res = hw_mgr_res->hw_res[j];
@@ -1048,7 +1050,7 @@ static int cam_ife_hw_mgr_release_hw_for_ctx(
 	struct cam_isp_hw_mgr_res        *hw_mgr_res_temp;
 
 	/* ife leaf resource */
-	for (i = 0; i < CAM_IFE_HW_OUT_RES_MAX; i++)
+	for (i = 0; i < max_ife_out_res; i++)
 		cam_ife_hw_mgr_free_hw_res(&ife_ctx->res_list_ife_out[i]);
 
 	/* ife bus rd resource */
@@ -1308,7 +1310,7 @@ static int cam_ife_hw_mgr_acquire_res_ife_out_pixel(
 	for (i = 0; i < in_port->num_out_res; i++) {
 		out_port = &in_port->data[i];
 		k = out_port->res_type & 0xFF;
-		if (k >= CAM_IFE_HW_OUT_RES_MAX) {
+		if (k >= max_ife_out_res) {
 			CAM_ERR(CAM_ISP, "invalid output resource type 0x%x",
 				 out_port->res_type);
 			continue;
@@ -2262,7 +2264,7 @@ static int cam_ife_mgr_check_and_update_fe_v0(
 			return -EINVAL;
 		}
 
-		if ((in_port->num_out_res > CAM_IFE_HW_OUT_RES_MAX) ||
+		if ((in_port->num_out_res > max_ife_out_res) ||
 			(in_port->num_out_res <= 0)) {
 			CAM_ERR(CAM_ISP, "Invalid num output res %u",
 				in_port->num_out_res);
@@ -2325,7 +2327,7 @@ static int cam_ife_mgr_check_and_update_fe_v2(
 			return -EINVAL;
 		}
 
-		if ((in_port->num_out_res > CAM_IFE_HW_OUT_RES_MAX) ||
+		if ((in_port->num_out_res > max_ife_out_res) ||
 			(in_port->num_out_res <= 0)) {
 			CAM_ERR(CAM_ISP, "Invalid num output res %u",
 				in_port->num_out_res);
@@ -3390,7 +3392,7 @@ static int cam_ife_mgr_acquire_dev(void *hw_mgr_priv, void *acquire_hw_args)
 			u64_to_user_ptr(isp_resource[i].res_hdl),
 			isp_resource[i].length);
 		if (!IS_ERR(in_port)) {
-			if (in_port->num_out_res > CAM_IFE_HW_OUT_RES_MAX) {
+			if (in_port->num_out_res > max_ife_out_res) {
 				CAM_ERR(CAM_ISP, "too many output res %d",
 					in_port->num_out_res);
 				rc = -EINVAL;
@@ -4057,7 +4059,7 @@ static int cam_ife_mgr_stop_hw_in_overflow(void *stop_hw_args)
 	}
 
 	/* IFE out resources */
-	for (i = 0; i < CAM_IFE_HW_OUT_RES_MAX; i++)
+	for (i = 0; i < max_ife_out_res; i++)
 		cam_ife_hw_mgr_stop_hw_res(&ctx->res_list_ife_out[i]);
 
 
@@ -4210,7 +4212,7 @@ static int cam_ife_mgr_stop_hw(void *hw_mgr_priv, void *stop_hw_args)
 	CAM_DBG(CAM_ISP, "Going to stop IFE Out");
 
 	/* IFE out resources */
-	for (i = 0; i < CAM_IFE_HW_OUT_RES_MAX; i++)
+	for (i = 0; i < max_ife_out_res; i++)
 		cam_ife_hw_mgr_stop_hw_res(&ctx->res_list_ife_out[i]);
 
 	CAM_DBG(CAM_ISP, "Going to stop IFE Mux");
@@ -4353,7 +4355,7 @@ static int cam_ife_mgr_restart_hw(void *start_hw_args)
 	cam_tasklet_start(ctx->common.tasklet_info);
 
 	/* start the IFE out devices */
-	for (i = 0; i < CAM_IFE_HW_OUT_RES_MAX; i++) {
+	for (i = 0; i < max_ife_out_res; i++) {
 		rc = cam_ife_hw_mgr_start_hw_res(
 			&ctx->res_list_ife_out[i], ctx);
 		if (rc) {
@@ -4421,7 +4423,7 @@ static int cam_ife_mgr_start_hw(void *hw_mgr_priv, void *start_hw_args)
 	uint32_t                          primary_rdi_out_res;
 
 	primary_rdi_src_res = CAM_ISP_HW_VFE_IN_MAX;
-	primary_rdi_out_res = CAM_ISP_IFE_OUT_RES_MAX;
+	primary_rdi_out_res = g_ife_hw_mgr.max_vfe_out_res_type;
 
 	if (!hw_mgr_priv || !start_isp) {
 		CAM_ERR(CAM_ISP, "Invalid arguments");
@@ -4491,7 +4493,7 @@ static int cam_ife_mgr_start_hw(void *hw_mgr_priv, void *start_hw_args)
 
 	if (g_ife_hw_mgr.debug_cfg.disable_ubwc_comp) {
 		disable_ubwc_comp = 1;
-		for (i = 0; i < CAM_IFE_HW_OUT_RES_MAX; i++) {
+		for (i = 0; i < max_ife_out_res; i++) {
 			hw_mgr_res = &ctx->res_list_ife_out[i];
 			for (j = 0; j < CAM_ISP_HW_SPLIT_MAX; j++) {
 				if (!hw_mgr_res->hw_res[i])
@@ -4553,7 +4555,7 @@ start_only:
 	CAM_DBG(CAM_ISP, "START IFE OUT ... in ctx id:%d",
 		ctx->ctx_index);
 	/* start the IFE out devices */
-	for (i = 0; i < CAM_IFE_HW_OUT_RES_MAX; i++) {
+	for (i = 0; i < max_ife_out_res; i++) {
 		hw_mgr_res = &ctx->res_list_ife_out[i];
 		switch (hw_mgr_res->res_id) {
 		case CAM_ISP_IFE_OUT_RES_RDI_0:
@@ -4579,7 +4581,7 @@ start_only:
 		}
 	}
 
-	if (primary_rdi_out_res < CAM_ISP_IFE_OUT_RES_MAX)
+	if (primary_rdi_out_res < g_ife_hw_mgr.max_vfe_out_res_type)
 		primary_rdi_src_res =
 			cam_convert_rdi_out_res_id_to_src(primary_rdi_out_res);
 
@@ -4909,7 +4911,7 @@ static int cam_isp_blob_ubwc_update(
 			CAM_DBG(CAM_ISP, "UBWC config idx %d, port_type=%d", i,
 				ubwc_plane_cfg->port_type);
 
-			if (res_id_out >= CAM_IFE_HW_OUT_RES_MAX) {
+			if (res_id_out >= max_ife_out_res) {
 				CAM_ERR(CAM_ISP, "Invalid port type:%x",
 					ubwc_plane_cfg->port_type);
 				rc = -EINVAL;
@@ -5079,7 +5081,7 @@ static int cam_isp_blob_ubwc_update_v2(
 		CAM_DBG(CAM_ISP, "UBWC config idx %d, port_type=%d", i,
 			ubwc_plane_cfg->port_type);
 
-		if (res_id_out >= CAM_IFE_HW_OUT_RES_MAX) {
+		if (res_id_out >= max_ife_out_res) {
 			CAM_ERR(CAM_ISP, "Invalid port type:%x",
 				ubwc_plane_cfg->port_type);
 			rc = -EINVAL;
@@ -5190,7 +5192,7 @@ static int cam_isp_blob_hfr_update(
 		CAM_DBG(CAM_ISP, "hfr config idx %d, type=%d", i,
 			res_id_out);
 
-		if (res_id_out >= CAM_IFE_HW_OUT_RES_MAX) {
+		if (res_id_out >= max_ife_out_res) {
 			CAM_ERR(CAM_ISP, "invalid out restype:%x",
 				port_hfr_config->resource_type);
 			return -EINVAL;
@@ -5645,7 +5647,7 @@ static int cam_isp_blob_vfe_out_update(
 		CAM_DBG(CAM_ISP, "VFE out config idx: %d port: 0x%x",
 			i, wm_config->port_type);
 
-		if (res_id_out >= CAM_IFE_HW_OUT_RES_MAX) {
+		if (res_id_out >= max_ife_out_res) {
 			CAM_ERR(CAM_ISP, "Invalid out port:0x%x",
 				wm_config->port_type);
 			return -EINVAL;
@@ -5832,7 +5834,7 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
 
 		hfr_config = (struct cam_isp_resource_hfr_config *)blob_data;
 
-		if (hfr_config->num_ports > CAM_ISP_IFE_OUT_RES_MAX ||
+		if (hfr_config->num_ports > g_ife_hw_mgr.max_vfe_out_res_type ||
 			hfr_config->num_ports == 0) {
 			CAM_ERR(CAM_ISP, "Invalid num_ports %u in HFR config",
 				hfr_config->num_ports);
@@ -6221,12 +6223,12 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
 
 		vfe_out_config = (struct cam_isp_vfe_out_config *)blob_data;
 
-		if (vfe_out_config->num_ports > CAM_IFE_HW_OUT_RES_MAX ||
+		if (vfe_out_config->num_ports > max_ife_out_res ||
 			vfe_out_config->num_ports == 0) {
 			CAM_ERR(CAM_ISP,
 				"Invalid num_ports:%u in vfe out config",
 				vfe_out_config->num_ports,
-				CAM_IFE_HW_OUT_RES_MAX);
+				max_ife_out_res);
 			return -EINVAL;
 		}
 
@@ -6497,7 +6499,7 @@ static int cam_ife_mgr_prepare_hw_update(void *hw_mgr_priv,
 			rc = cam_isp_add_command_buffers(prepare, &kmd_buf,
 				&ctx->base[i],
 				cam_isp_packet_generic_blob_handler,
-				ctx->res_list_ife_out, CAM_IFE_HW_OUT_RES_MAX);
+				ctx->res_list_ife_out, max_ife_out_res);
 			if (rc) {
 				CAM_ERR(CAM_ISP,
 					"Failed in add cmdbuf, i=%d, split_id=%d, rc=%d",
@@ -6521,7 +6523,7 @@ static int cam_ife_mgr_prepare_hw_update(void *hw_mgr_priv,
 			prepare, ctx->base[i].idx,
 			&kmd_buf, ctx->res_list_ife_out,
 			&ctx->res_list_ife_in_rd,
-			CAM_IFE_HW_OUT_RES_MAX, fill_fence,
+			max_ife_out_res, fill_fence,
 			&frame_header_info);
 
 		if (rc) {
@@ -6803,7 +6805,7 @@ static void cam_ife_mgr_pf_dump(uint32_t res_id,
 	event_info.res_id = res_id;
 	res_id_out = res_id & 0xFF;
 
-	if (res_id_out >= CAM_IFE_HW_OUT_RES_MAX) {
+	if (res_id_out >= max_ife_out_res) {
 		CAM_ERR(CAM_ISP, "Invalid out resource id :%x",
 			res_id);
 		return;
@@ -6891,7 +6893,7 @@ static void cam_ife_mgr_dump_pf_data(
 	}
 
 mid_check:
-	for (i = 0; i < CAM_IFE_HW_OUT_RES_MAX; i++) {
+	for (i = 0; i < max_ife_out_res; i++) {
 		hw_mgr_res = &ctx->res_list_ife_out[i];
 		if (!hw_mgr_res->hw_res[0])
 			continue;
@@ -6899,7 +6901,7 @@ mid_check:
 		break;
 	}
 
-	if (i >= CAM_IFE_HW_OUT_RES_MAX) {
+	if (i >= max_ife_out_res) {
 		CAM_ERR(CAM_ISP,
 			"NO valid outport resources ctx id:%d req id:%lld",
 			ctx->ctx_index, packet->header.request_id);
@@ -8121,10 +8123,10 @@ int cam_ife_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl)
 {
 	int rc = -EFAULT;
 	int i, j;
-	bool support_consumed_addr = false;
 	struct cam_iommu_handle cdm_handles;
 	struct cam_ife_hw_mgr_ctx *ctx_pool;
 	struct cam_isp_hw_mgr_res *res_list_ife_out;
+	struct cam_isp_hw_bus_cap isp_bus_cap = {0};
 
 	memset(&g_ife_hw_mgr, 0, sizeof(g_ife_hw_mgr));
 
@@ -8147,14 +8149,17 @@ int cam_ife_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl)
 				ife_device->hw_priv;
 			struct cam_hw_soc_info *soc_info = &vfe_hw->soc_info;
 
-			if (j == 0)
+			if (j == 0) {
 				ife_device->hw_ops.process_cmd(
 					vfe_hw,
-					CAM_ISP_HW_CMD_IS_CONSUMED_ADDR_SUPPORT,
-					&support_consumed_addr,
-					sizeof(support_consumed_addr));
-			j++;
+					CAM_ISP_HW_CMD_QUERY_BUS_CAP,
+					&isp_bus_cap,
+					sizeof(struct cam_isp_hw_bus_cap));
+				CAM_DBG(CAM_ISP, "max VFE out resources: 0x%x",
+					isp_bus_cap.max_vfe_out_res_type);
+			}
 
+			j++;
 			g_ife_hw_mgr.cdm_reg_map[i] = &soc_info->reg_map[0];
 			CAM_DBG(CAM_ISP,
 				"reg_map: mem base = %pK cam_base = 0x%llx",
@@ -8173,7 +8178,9 @@ int cam_ife_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl)
 		return -EINVAL;
 	}
 
-	g_ife_hw_mgr.support_consumed_addr = support_consumed_addr;
+	g_ife_hw_mgr.support_consumed_addr = isp_bus_cap.support_consumed_addr;
+	g_ife_hw_mgr.max_vfe_out_res_type = isp_bus_cap.max_vfe_out_res_type;
+	max_ife_out_res = g_ife_hw_mgr.max_vfe_out_res_type & 0xFF;
 
 	/* fill csid hw intf information */
 	for (i = 0, j = 0; i < CAM_IFE_CSID_HW_NUM_MAX; i++) {
@@ -8253,7 +8260,15 @@ int cam_ife_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl)
 		INIT_LIST_HEAD(&g_ife_hw_mgr.ctx_pool[i].res_list_ife_src);
 		INIT_LIST_HEAD(&g_ife_hw_mgr.ctx_pool[i].res_list_ife_in_rd);
 		ctx_pool = &g_ife_hw_mgr.ctx_pool[i];
-		for (j = 0; j < CAM_IFE_HW_OUT_RES_MAX; j++) {
+		ctx_pool->res_list_ife_out = kzalloc((max_ife_out_res *
+			sizeof(struct cam_isp_hw_mgr_res)), GFP_KERNEL);
+		if (!ctx_pool->res_list_ife_out) {
+			rc = -ENOMEM;
+			CAM_ERR(CAM_ISP, "Alloc failed for ife out res list");
+			goto end;
+		}
+
+		for (j = 0; j < max_ife_out_res; j++) {
 			res_list_ife_out = &ctx_pool->res_list_ife_out[j];
 			INIT_LIST_HEAD(&res_list_ife_out->list);
 		}
@@ -8329,6 +8344,8 @@ end:
 				&g_ife_hw_mgr.mgr_common.tasklet_pool[i]);
 			kfree(g_ife_hw_mgr.ctx_pool[i].cdm_cmd);
 			g_ife_hw_mgr.ctx_pool[i].cdm_cmd = NULL;
+			kfree(g_ife_hw_mgr.ctx_pool[i].res_list_ife_out);
+			g_ife_hw_mgr.ctx_pool[i].res_list_ife_out = NULL;
 			g_ife_hw_mgr.ctx_pool[i].common.tasklet_info = NULL;
 		}
 	}
@@ -8354,6 +8371,8 @@ void cam_ife_hw_mgr_deinit(void)
 			&g_ife_hw_mgr.mgr_common.tasklet_pool[i]);
 		kfree(g_ife_hw_mgr.ctx_pool[i].cdm_cmd);
 		g_ife_hw_mgr.ctx_pool[i].cdm_cmd = NULL;
+		kfree(g_ife_hw_mgr.ctx_pool[i].res_list_ife_out);
+		g_ife_hw_mgr.ctx_pool[i].res_list_ife_out = NULL;
 		g_ife_hw_mgr.ctx_pool[i].common.tasklet_info = NULL;
 	}
 

+ 3 - 4
drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.h

@@ -17,7 +17,6 @@
 
 /* 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)
 #define CAM_IFE_HW_RES_POOL_MAX          64
 
 /* IFE_HW_MGR custom config */
@@ -122,9 +121,7 @@ struct cam_ife_hw_mgr_ctx {
 	struct list_head                res_list_ife_csid;
 	struct list_head                res_list_ife_src;
 	struct list_head                res_list_ife_in_rd;
-	struct cam_isp_hw_mgr_res       res_list_ife_out[
-						CAM_IFE_HW_OUT_RES_MAX];
-
+	struct cam_isp_hw_mgr_res      *res_list_ife_out;
 	struct list_head                free_res_list;
 	struct cam_isp_hw_mgr_res       res_pool[CAM_IFE_HW_RES_POOL_MAX];
 
@@ -182,6 +179,7 @@ struct cam_ife_hw_mgr_ctx {
  * @ctx_lock               context lock
  * @support_consumed_addr  indicate whether hw supports last consumed address
  * @hw_pid_support         hw pid support for this target
+ * @max_vfe_out_res_type   max ife out res type value from hw
  */
 struct cam_ife_hw_mgr {
 	struct cam_isp_hw_mgr          mgr_common;
@@ -204,6 +202,7 @@ struct cam_ife_hw_mgr {
 	spinlock_t                     ctx_lock;
 	bool                           support_consumed_addr;
 	bool                           hw_pid_support;
+	uint32_t                       max_vfe_out_res_type;
 };
 
 /**

+ 3 - 2
drivers/cam_isp/isp_hw_mgr/hw_utils/cam_isp_packet_parser.c

@@ -132,7 +132,7 @@ static int cam_isp_update_dual_config(
 	}
 	for (i = 0; i < dual_config->num_ports; i++) {
 
-		if (i >= CAM_ISP_IFE_OUT_RES_MAX) {
+		if (i >= CAM_ISP_IFE_OUT_RES_BASE + size_isp_out) {
 			CAM_ERR(CAM_ISP,
 				"failed update for i:%d > size_isp_out:%d",
 				i, size_isp_out);
@@ -151,7 +151,8 @@ static int cam_isp_update_dual_config(
 			res = hw_mgr_res->hw_res[j];
 
 			if (res->res_id < CAM_ISP_IFE_OUT_RES_BASE ||
-				res->res_id >= CAM_ISP_IFE_OUT_RES_MAX)
+				res->res_id >= (CAM_ISP_IFE_OUT_RES_BASE +
+				size_isp_out))
 				continue;
 
 			outport_id = res->res_id & 0xFF;

+ 15 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_isp_hw.h

@@ -135,6 +135,7 @@ enum cam_isp_hw_cmd_type {
 	CAM_ISP_HW_CMD_CSID_CHANGE_HALT_MODE,
 	CAM_ISP_HW_CMD_DISABLE_UBWC_COMP,
 	CAM_ISP_HW_CMD_SET_SFE_DEBUG_CFG,
+	CAM_ISP_HW_CMD_QUERY_BUS_CAP,
 	CAM_ISP_HW_CMD_MAX,
 };
 
@@ -377,4 +378,18 @@ struct cam_isp_hw_intf_data {
 	uint32_t                num_hw_pid;
 	uint32_t                hw_pid[CAM_ISP_HW_MAX_PID_VAL];
 };
+/**
+ * struct cam_isp_hw_bus_cap:
+ *
+ * @Brief:         ISP hw bus capabilities
+ *
+ * @support_consumed_addr:   Indicate whether HW has last consumed addr reg
+ * @max_vfe_out_res_type:    Maximum value of out resource type supported by hw
+ *
+ */
+struct cam_isp_hw_bus_cap {
+	bool                    support_consumed_addr;
+	uint32_t                max_vfe_out_res_type;
+};
+
 #endif /* _CAM_ISP_HW_H_ */

+ 1 - 1
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/cam_vfe_core.c

@@ -616,9 +616,9 @@ int cam_vfe_process_cmd(void *hw_priv, uint32_t cmd_type,
 	case CAM_ISP_HW_CMD_GET_SECURE_MODE:
 	case CAM_ISP_HW_CMD_UNMASK_BUS_WR_IRQ:
 	case CAM_ISP_HW_CMD_DUMP_BUS_INFO:
-	case CAM_ISP_HW_CMD_IS_CONSUMED_ADDR_SUPPORT:
 	case CAM_ISP_HW_CMD_GET_RES_FOR_MID:
 	case CAM_ISP_HW_CMD_DISABLE_UBWC_COMP:
+	case CAM_ISP_HW_CMD_QUERY_BUS_CAP:
 		rc = core_info->vfe_bus->hw_ops.process_cmd(
 			core_info->vfe_bus->bus_priv, cmd_type, cmd_args,
 			arg_size);

+ 1 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe170.h

@@ -861,6 +861,7 @@ static struct cam_vfe_bus_ver2_hw_info vfe170_bus_hw_info = {
 	},
 	.top_irq_shift = 9,
 	.support_consumed_addr = false,
+	.max_out_res = CAM_ISP_IFE_OUT_RES_BASE + 19,
 };
 
 static struct cam_vfe_hw_info cam_vfe170_hw_info = {

+ 1 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe170_150.h

@@ -829,6 +829,7 @@ static struct cam_vfe_bus_ver2_hw_info vfe170_150_bus_hw_info = {
 		},
 	},
 	.support_consumed_addr = false,
+	.max_out_res = CAM_ISP_IFE_OUT_RES_BASE + 19,
 };
 
 static struct cam_vfe_hw_info cam_vfe170_150_hw_info = {

+ 1 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe175.h

@@ -1022,6 +1022,7 @@ static struct cam_vfe_bus_ver2_hw_info vfe175_bus_hw_info = {
 	},
 	.top_irq_shift = 9,
 	.support_consumed_addr = false,
+	.max_out_res = CAM_ISP_IFE_OUT_RES_BASE + 23,
 };
 
 static struct cam_vfe_hw_info cam_vfe175_hw_info = {

+ 1 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe175_130.h

@@ -1137,6 +1137,7 @@ static struct cam_vfe_bus_ver2_hw_info vfe175_130_bus_hw_info = {
 	},
 	.top_irq_shift = 9,
 	.support_consumed_addr = false,
+	.max_out_res = CAM_ISP_IFE_OUT_RES_BASE + 23,
 };
 
 static struct cam_vfe_hw_info cam_vfe175_130_hw_info = {

+ 1 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe480.h

@@ -1349,6 +1349,7 @@ static struct cam_vfe_bus_ver3_hw_info vfe480_bus_hw_info = {
 	.comp_done_shift = 6,
 	.top_irq_shift   = 7,
 	.support_consumed_addr = true,
+	.max_out_res = CAM_ISP_IFE_OUT_RES_BASE + 25,
 };
 
 static struct cam_irq_register_set vfe480_bus_rd_irq_reg[1] = {

+ 1 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe_lite17x.h

@@ -334,6 +334,7 @@ static struct cam_vfe_bus_ver2_hw_info vfe17x_bus_hw_info = {
 	},
 	.top_irq_shift = 9,
 	.support_consumed_addr = false,
+	.max_out_res = CAM_ISP_IFE_OUT_RES_BASE + 23,
 };
 
 static struct cam_vfe_hw_info cam_vfe_lite17x_hw_info = {

+ 1 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe17x/cam_vfe_lite48x.h

@@ -400,6 +400,7 @@ static struct cam_vfe_bus_ver3_hw_info vfe48x_bus_hw_info = {
 	.comp_done_shift = 4,
 	.top_irq_shift   = 4,
 	.support_consumed_addr = true,
+	.max_out_res = CAM_ISP_IFE_OUT_RES_BASE + 25,
 };
 
 static struct cam_vfe_hw_info cam_vfe_lite48x_hw_info = {

+ 13 - 8
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver2.c

@@ -201,6 +201,7 @@ struct cam_vfe_bus_ver2_priv {
 	int                                 irq_handle;
 	int                                 error_irq_handle;
 	void                               *tasklet_info;
+	uint32_t                            max_out_res;
 };
 
 static int cam_vfe_bus_process_cmd(
@@ -3394,7 +3395,7 @@ static int cam_vfe_bus_update_stripe_cfg(void *priv, void *cmd_args,
 
 	outport_id = stripe_args->res->res_id & 0xFF;
 	if (stripe_args->res->res_id < CAM_ISP_IFE_OUT_RES_BASE ||
-		stripe_args->res->res_id >= CAM_ISP_IFE_OUT_RES_MAX)
+		stripe_args->res->res_id >= bus_priv->max_out_res)
 		return 0;
 
 	ports_plane_idx = (stripe_args->split_id *
@@ -3637,7 +3638,8 @@ static int cam_vfe_bus_process_cmd(
 	int rc = -EINVAL;
 	struct cam_vfe_bus_ver2_priv		 *bus_priv;
 	uint32_t top_mask_0 = 0;
-	bool *support_consumed_addr;
+	struct cam_isp_hw_bus_cap *vfe_bus_cap;
+
 
 	if (!priv || !cmd_args) {
 		CAM_ERR_RATE_LIMIT(CAM_ISP, "Invalid input arguments");
@@ -3684,12 +3686,6 @@ static int cam_vfe_bus_process_cmd(
 		cam_io_w_mb(top_mask_0, bus_priv->common_data.mem_base +
 			bus_priv->common_data.common_reg->top_irq_mask_0);
 		break;
-	case CAM_ISP_HW_CMD_IS_CONSUMED_ADDR_SUPPORT:
-		bus_priv = (struct cam_vfe_bus_ver2_priv *) priv;
-		support_consumed_addr = (bool *)cmd_args;
-		*support_consumed_addr =
-			bus_priv->common_data.support_consumed_addr;
-		break;
 	case CAM_ISP_HW_CMD_GET_RES_FOR_MID:
 		bus_priv = (struct cam_vfe_bus_ver2_priv *) priv;
 		rc = cam_vfe_bus_get_res_for_mid(bus_priv, cmd_args, arg_size);
@@ -3697,6 +3693,14 @@ static int cam_vfe_bus_process_cmd(
 	case CAM_ISP_HW_CMD_DISABLE_UBWC_COMP:
 		bus_priv = (struct cam_vfe_bus_ver2_priv *) priv;
 		bus_priv->common_data.disable_ubwc_comp = true;
+		break;
+	case CAM_ISP_HW_CMD_QUERY_BUS_CAP:
+		bus_priv = (struct cam_vfe_bus_ver2_priv  *) priv;
+		vfe_bus_cap = (struct cam_isp_hw_bus_cap *) cmd_args;
+		vfe_bus_cap->max_vfe_out_res_type = bus_priv->max_out_res;
+		vfe_bus_cap->support_consumed_addr =
+			bus_priv->common_data.support_consumed_addr;
+
 		break;
 	default:
 		CAM_ERR_RATE_LIMIT(CAM_ISP, "Invalid camif process command:%d",
@@ -3749,6 +3753,7 @@ int cam_vfe_bus_ver2_init(
 	bus_priv->num_client                     = ver2_hw_info->num_client;
 	bus_priv->num_out                        = ver2_hw_info->num_out;
 	bus_priv->top_irq_shift                  = ver2_hw_info->top_irq_shift;
+	bus_priv->max_out_res                    = ver2_hw_info->max_out_res;
 	bus_priv->common_data.num_sec_out        = 0;
 	bus_priv->common_data.secure_mode        = CAM_SECURE_MODE_NON_SECURE;
 	bus_priv->common_data.core_index         = soc_info->index;

+ 2 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver2.h

@@ -182,6 +182,7 @@ struct cam_vfe_bus_ver2_vfe_out_hw_info {
  * @vfe_out_hw_info:       VFE output capability
  * @top_irq_shift:         Mask shift for top level BUS WR irq
  * @support_consumed_addr: Indicate if bus support consumed address
+ * @max_out_res:           Max vfe out resource value supported for hw
  */
 struct cam_vfe_bus_ver2_hw_info {
 	struct cam_vfe_bus_ver2_reg_offset_common common_reg;
@@ -195,6 +196,7 @@ struct cam_vfe_bus_ver2_hw_info {
 		vfe_out_hw_info[CAM_VFE_BUS_VER2_VFE_OUT_MAX];
 	uint32_t top_irq_shift;
 	bool support_consumed_addr;
+	uint32_t max_out_res;
 };
 
 /*

+ 12 - 8
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver3.c

@@ -198,6 +198,7 @@ struct cam_vfe_bus_ver3_priv {
 	int                                 rup_irq_handle;
 	int                                 error_irq_handle;
 	void                               *tasklet_info;
+	uint32_t                            max_out_res;
 };
 
 static const struct cam_vfe_bus_error_info vfe_error_list[] = {
@@ -3497,7 +3498,7 @@ static int cam_vfe_bus_ver3_update_stripe_cfg(void *priv, void *cmd_args,
 
 	outport_id = stripe_args->res->res_id & 0xFF;
 	if (stripe_args->res->res_id < CAM_ISP_IFE_OUT_RES_BASE ||
-		stripe_args->res->res_id >= CAM_ISP_IFE_OUT_RES_MAX)
+		stripe_args->res->res_id >= bus_priv->max_out_res)
 		return 0;
 
 	ports_plane_idx = (stripe_args->split_id *
@@ -3778,7 +3779,8 @@ static int cam_vfe_bus_ver3_process_cmd(
 	int rc = -EINVAL;
 	struct cam_vfe_bus_ver3_priv		 *bus_priv;
 	uint32_t top_mask_0 = 0;
-	bool *support_consumed_addr;
+	struct cam_isp_hw_bus_cap *vfe_bus_cap;
+
 
 	if (!priv || !cmd_args) {
 		CAM_ERR_RATE_LIMIT(CAM_ISP, "Invalid input arguments");
@@ -3836,12 +3838,6 @@ static int cam_vfe_bus_ver3_process_cmd(
 		cam_io_w_mb(top_mask_0, bus_priv->common_data.mem_base +
 			bus_priv->common_data.common_reg->top_irq_mask_0);
 		break;
-	case CAM_ISP_HW_CMD_IS_CONSUMED_ADDR_SUPPORT:
-		bus_priv = (struct cam_vfe_bus_ver3_priv *) priv;
-		support_consumed_addr = (bool *)cmd_args;
-		*support_consumed_addr =
-			bus_priv->common_data.support_consumed_addr;
-		break;
 	case CAM_ISP_HW_CMD_GET_RES_FOR_MID:
 		bus_priv = (struct cam_vfe_bus_ver3_priv *) priv;
 		rc = cam_vfe_bus_get_res_for_mid(bus_priv, cmd_args, arg_size);
@@ -3850,6 +3846,13 @@ static int cam_vfe_bus_ver3_process_cmd(
 		bus_priv = (struct cam_vfe_bus_ver3_priv *) priv;
 		bus_priv->common_data.disable_ubwc_comp = true;
 		break;
+	case CAM_ISP_HW_CMD_QUERY_BUS_CAP:
+		bus_priv = (struct cam_vfe_bus_ver3_priv  *) priv;
+		vfe_bus_cap = (struct cam_isp_hw_bus_cap *) cmd_args;
+		vfe_bus_cap->max_vfe_out_res_type = bus_priv->max_out_res;
+		vfe_bus_cap->support_consumed_addr =
+			bus_priv->common_data.support_consumed_addr;
+		break;
 	default:
 		CAM_ERR_RATE_LIMIT(CAM_ISP, "Invalid camif process command:%d",
 			cmd_type);
@@ -3909,6 +3912,7 @@ int cam_vfe_bus_ver3_init(
 	bus_priv->num_client                     = ver3_hw_info->num_client;
 	bus_priv->num_out                        = ver3_hw_info->num_out;
 	bus_priv->top_irq_shift                  = ver3_hw_info->top_irq_shift;
+	bus_priv->max_out_res                    = ver3_hw_info->max_out_res;
 	bus_priv->common_data.num_sec_out        = 0;
 	bus_priv->common_data.secure_mode        = CAM_SECURE_MODE_NON_SECURE;
 	bus_priv->common_data.core_index         = soc_info->index;

+ 2 - 0
drivers/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_bus/cam_vfe_bus_ver3.h

@@ -176,6 +176,7 @@ struct cam_vfe_bus_ver3_vfe_out_hw_info {
  * @comp_done_shift:       Mask shift for comp done mask
  * @top_irq_shift:         Mask shift for top level BUS WR irq
  * @support_consumed_addr: Indicate if bus support consumed address
+ * @max_out_res:           Max vfe out resource value supported for hw
  */
 struct cam_vfe_bus_ver3_hw_info {
 	struct cam_vfe_bus_ver3_reg_offset_common common_reg;
@@ -188,6 +189,7 @@ struct cam_vfe_bus_ver3_hw_info {
 	uint32_t comp_done_shift;
 	uint32_t top_irq_shift;
 	bool support_consumed_addr;
+	uint32_t max_out_res;
 };
 
 /*

+ 8 - 3
include/uapi/camera/media/cam_isp_ife.h

@@ -34,9 +34,14 @@
 #define CAM_ISP_IFE_OUT_RES_2PD                (CAM_ISP_IFE_OUT_RES_BASE + 22)
 #define CAM_ISP_IFE_OUT_RES_RDI_RD             (CAM_ISP_IFE_OUT_RES_BASE + 23)
 #define CAM_ISP_IFE_OUT_RES_LCR                (CAM_ISP_IFE_OUT_RES_BASE + 24)
-
-#define CAM_ISP_IFE_OUT_RES_MAX                (CAM_ISP_IFE_OUT_RES_BASE + 25)
-
+#define CAM_ISP_IFE_OUT_RES_SPARSE_PD          (CAM_ISP_IFE_OUT_RES_BASE + 25)
+#define CAM_ISP_IFE_OUT_RES_2PD_STATS          (CAM_ISP_IFE_OUT_RES_BASE + 26)
+#define CAM_ISP_IFE_OUT_RES_AWB_BFW            (CAM_ISP_IFE_OUT_RES_BASE + 27)
+#define CAM_ISP_IFE_OUT_RES_STATS_AEC_BE       (CAM_ISP_IFE_OUT_RES_BASE + 28)
+#define CAM_ISP_IFE_OUT_RES_LTM_STATS          (CAM_ISP_IFE_OUT_RES_BASE + 29)
+#define CAM_ISP_IFE_OUT_RES_STATS_GTM_BHIST    (CAM_ISP_IFE_OUT_RES_BASE + 30)
+#define CAM_ISP_IFE_LITE_OUT_RES_STATS_BE      (CAM_ISP_IFE_OUT_RES_BASE + 31)
+#define CAM_ISP_IFE_LITE_OUT_RES_GAMMA         (CAM_ISP_IFE_OUT_RES_BASE + 32)
 
 /* IFE input port resource type (global unique) */
 #define CAM_ISP_IFE_IN_RES_BASE                 0x4000