From 9d1980a8e2cfa3f0ae8641093d0f4818f552e2f3 Mon Sep 17 00:00:00 2001 From: Chandan Kumar Jha Date: Thu, 31 Dec 2020 18:40:26 +0530 Subject: [PATCH] msm: camera: isp: Fixing KW errors Fixes KW errors for ISP. CRs-Fixed: 2830502 Change-Id: I60f01a0da2d47bb8d0c249a73962a571ba9bee0a Signed-off-by: Chandan Kumar Jha --- drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c | 26 +++++++++++-------- .../isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c | 8 +++++- 2 files changed, 22 insertions(+), 12 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 aed82237fb..67bfb45431 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 @@ -1987,7 +1987,7 @@ static int cam_ife_hw_mgr_acquire_res_sfe_src( struct cam_sfe_acquire_args sfe_acquire; struct cam_isp_hw_mgr_res *csid_res; struct cam_isp_hw_mgr_res *sfe_src_res; - struct cam_hw_intf *hw_intf; + struct cam_hw_intf *hw_intf = NULL; struct cam_ife_hw_mgr *ife_hw_mgr; ife_hw_mgr = ife_ctx->hw_mgr; @@ -2082,7 +2082,8 @@ static int cam_ife_hw_mgr_acquire_res_sfe_src( break; } - if (rc || !sfe_acquire.sfe_in.rsrc_node) { + if (i == CAM_SFE_HW_NUM_MAX || rc || + !sfe_acquire.sfe_in.rsrc_node) { CAM_ERR(CAM_ISP, "Failed to acquire SFE for res_id: 0x%x", sfe_acquire.sfe_in.res_id); @@ -2091,6 +2092,7 @@ static int cam_ife_hw_mgr_acquire_res_sfe_src( sfe_src_res->hw_res[CAM_ISP_HW_SPLIT_LEFT] = sfe_acquire.sfe_in.rsrc_node; + CAM_DBG(CAM_ISP, "acquire success LEFT SFE: %u res_type: %u res_id: %u", hw_intf->hw_idx, @@ -2404,7 +2406,7 @@ static int cam_ife_hw_mgr_acquire_ife_src_for_sfe( int rc = -1, i; struct cam_vfe_acquire_args vfe_acquire; struct cam_isp_hw_mgr_res *ife_src_res; - struct cam_hw_intf *hw_intf; + struct cam_hw_intf *hw_intf = NULL; struct cam_ife_hw_mgr *ife_hw_mgr; ife_hw_mgr = ife_ctx->hw_mgr; @@ -2502,7 +2504,8 @@ static int cam_ife_hw_mgr_acquire_ife_src_for_sfe( break; } - if (rc || !vfe_acquire.vfe_in.rsrc_node) { + if (i == CAM_IFE_HW_NUM_MAX || rc || + !vfe_acquire.vfe_in.rsrc_node) { CAM_ERR(CAM_ISP, "Unable to acquire right IFE res: %u", vfe_acquire.vfe_in.res_id); rc = -EAGAIN; @@ -3345,7 +3348,7 @@ static int cam_ife_hw_mgr_acquire_offline_res_ife_camif( int rc = -1; int i; struct cam_vfe_acquire_args vfe_acquire; - struct cam_hw_intf *hw_intf; + struct cam_hw_intf *hw_intf = NULL; struct cam_isp_hw_mgr_res *ife_src_res; struct cam_isp_hw_mgr_res *isp_bus_rd_res; struct cam_ife_hw_mgr *ife_hw_mgr; @@ -3400,7 +3403,8 @@ static int cam_ife_hw_mgr_acquire_offline_res_ife_camif( break; } - if (rc || !vfe_acquire.vfe_in.rsrc_node) { + if (i == CAM_IFE_HW_NUM_MAX || rc || + !vfe_acquire.vfe_in.rsrc_node) { CAM_ERR(CAM_ISP, "Failed to acquire IFE LEFT rc: %d", rc); goto put_res; @@ -3456,7 +3460,7 @@ static int cam_ife_hw_mgr_acquire_offline_res_ife_camif( ife_src_res->hw_res[1]->res_id); CAM_DBG(CAM_ISP, "Acquired VFE:%d CAMIF for RIGHT", - ife_src_res->hw_res[i]->hw_intf->hw_idx); + ife_src_res->hw_res[1]->hw_intf->hw_idx); } return rc; @@ -5670,6 +5674,7 @@ static int cam_ife_mgr_start_hw(void *hw_mgr_priv, void *start_hw_args) primary_rdi_src_res = CAM_ISP_HW_VFE_IN_MAX; primary_rdi_out_res = g_ife_hw_mgr.max_vfe_out_res_type; + primary_rdi_csid_res = CAM_IFE_PIX_PATH_RES_MAX; if (!hw_mgr_priv || !start_isp) { CAM_ERR(CAM_ISP, "Invalid arguments"); @@ -6618,7 +6623,7 @@ static int cam_isp_blob_hfr_update( rc = cam_isp_add_cmd_buf_update( hw_mgr_res, blob_type, - blob_type_hw_cmd_map[blob_type], + CAM_ISP_HW_CMD_GET_HFR_UPDATE, blob_info->base_info->idx, (void *)cmd_buf_addr, kmd_buf_remain_size, @@ -8347,7 +8352,7 @@ static int cam_isp_sfe_add_scratch_buffer_cfg( struct list_head *res_list_in_rd, struct cam_ife_hw_mgr_ctx *ctx) { - int i, j, res_id, rc; + int i, j, res_id, rc = 0; uint32_t used_bytes = 0, remain_size = 0; uint32_t io_cfg_used_bytes, num_ent; uint32_t *cpu_addr = NULL; @@ -10302,8 +10307,7 @@ static int cam_ife_hw_mgr_event_handler( return -EINVAL; if (!priv) - if (evt_id != CAM_ISP_HW_EVENT_ERROR) - return -EINVAL; + return -EINVAL; ctx = (struct cam_ife_hw_mgr_ctx *)priv; CAM_DBG(CAM_ISP, "Event ID 0x%x", evt_id); diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c index 6877c63f53..bf1e2e2fd0 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c @@ -1894,7 +1894,13 @@ static int cam_ife_csid_ver2_init_config_pxl_path( path_reg = csid_reg->ipp_reg; else if (res->res_id == CAM_IFE_PIX_PATH_RES_PPP) path_reg = csid_reg->ppp_reg; - + else { + CAM_ERR(CAM_ISP, + "CSID:%d path res type:%d res_id:%d res state %d", + csid_hw->hw_intf->hw_idx, + res->res_type, res->res_id, res->res_state); + return -EINVAL; + } cmn_reg = csid_reg->cmn_reg; path_cfg = (struct cam_ife_csid_ver2_path_cfg *)res->res_priv;