From 3dbeddacd84636e5a9a09d08774c50e80b8a4379 Mon Sep 17 00:00:00 2001 From: Anand Ravi Date: Tue, 26 Jan 2021 11:42:53 -0800 Subject: [PATCH] msm: camera: isp: Allow lite IPP to use RDI state machine Since lite IPP doesn't have an epoch irq and it's primary function is to preprocess the raw input, it should use the RDI state machine. This change also adds a warning if the CAN_USE_LITE flag is used incorrectly by the userspace. CRs-Fixed: 2846451 Change-Id: Iff2b9bda677105181bdfcea20090881934528f73 Signed-off-by: Anand Ravi --- drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c | 27 ++++++++++++++++--- drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.h | 3 +++ .../isp_hw/include/cam_ife_csid_hw_intf.h | 1 + 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c b/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c index 764009323d..10b407619c 100644 --- a/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c +++ b/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c @@ -3452,8 +3452,11 @@ static int cam_ife_hw_mgr_preprocess_port( for (i = 0; i < in_port->num_out_res; i++) { out_port = &in_port->data[i]; - if (cam_ife_hw_mgr_is_rdi_res(out_port->res_type) || - cam_ife_hw_mgr_is_sfe_rdi_res(out_port->res_type)) + if (cam_ife_hw_mgr_is_rdi_res(out_port->res_type)) { + in_port->rdi_count++; + in_port->lite_path_count++; + } + else if (cam_ife_hw_mgr_is_sfe_rdi_res(out_port->res_type)) in_port->rdi_count++; else if (out_port->res_type == CAM_ISP_IFE_OUT_RES_2PD) in_port->ppp_count++; @@ -3463,6 +3466,17 @@ static int cam_ife_hw_mgr_preprocess_port( CAM_DBG(CAM_ISP, "out_res_type %d", out_port->res_type); in_port->ipp_count++; + if (in_port->can_use_lite) { + switch(out_port->res_type) { + case CAM_ISP_IFE_LITE_OUT_RES_PREPROCESS_RAW: + case CAM_ISP_IFE_LITE_OUT_RES_STATS_BG: + in_port->lite_path_count++; + break; + default: + CAM_WARN(CAM_ISP, "Output port 0x%x cannot use lite", + out_port->res_type); + } + } } } @@ -4395,6 +4409,7 @@ static int cam_ife_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args) uint32_t total_pix_port = 0; uint32_t total_rdi_port = 0; uint32_t total_pd_port = 0; + uint32_t total_lite_port = 0; struct cam_isp_acquire_hw_info *acquire_hw_info = NULL; uint32_t input_size = 0; @@ -4461,6 +4476,7 @@ static int cam_ife_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args) in_port[i].lcr_count; total_rdi_port += in_port[i].rdi_count; total_pd_port += in_port[i].ppp_count; + total_lite_port += in_port[i].lite_path_count; } /* Check whether context has only RDI resource */ @@ -4469,6 +4485,11 @@ static int cam_ife_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args) CAM_DBG(CAM_ISP, "RDI only context"); } + /* Check if all output ports are of lite */ + if (total_lite_port == total_pix_port + total_rdi_port) { + ife_ctx->is_lite_context = 1; + } + /* acquire HW resources */ for (i = 0; i < acquire_hw_info->num_inputs; i++) { CAM_DBG(CAM_ISP, "in_res_type %x", in_port[i].res_type); @@ -9597,7 +9618,7 @@ static int cam_ife_mgr_cmd(void *hw_mgr_priv, void *cmd_args) else if (ctx->is_fe_enabled && !ctx->is_offline && ctx->ctx_type != CAM_IFE_CTX_TYPE_SFE) isp_hw_cmd_args->u.ctx_type = CAM_ISP_CTX_FS2; - else if (ctx->is_rdi_only_context) + else if (ctx->is_rdi_only_context || ctx->is_lite_context) isp_hw_cmd_args->u.ctx_type = CAM_ISP_CTX_RDI; else isp_hw_cmd_args->u.ctx_type = CAM_ISP_CTX_PIX; diff --git a/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.h b/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.h index 34267c357a..46a950ceb4 100644 --- a/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.h +++ b/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.h @@ -143,6 +143,8 @@ struct cam_sfe_scratch_buf_cfg { * registers * @last_cdm_done_req: Last cdm done request * @is_rdi_only_context flag to specify the context has only rdi resource + * @is_lite_context flag to specify the context has only uses lite + * resources * @config_done_complete indicator for configuration complete * @reg_dump_buf_desc: cmd buffer descriptors for reg dump * @num_reg_dump_buf: Count of descriptors in reg_dump_buf_desc @@ -204,6 +206,7 @@ struct cam_ife_hw_mgr_ctx { atomic_t cdm_done; uint64_t last_cdm_done_req; uint32_t is_rdi_only_context; + uint32_t is_lite_context; struct completion config_done_complete; uint32_t hw_version; struct cam_cmd_buf_desc reg_dump_buf_desc[ diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_ife_csid_hw_intf.h b/drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_ife_csid_hw_intf.h index be0ca83c51..d98992a5ea 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_ife_csid_hw_intf.h +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_ife_csid_hw_intf.h @@ -130,6 +130,7 @@ struct cam_isp_in_port_generic_info { uint32_t udi_count; uint32_t lcr_count; uint32_t ife_rd_count; + uint32_t lite_path_count; uint32_t sfe_in_path_type; uint32_t sfe_ife_enable; uint32_t secure_mode;