diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c index 22f2c0ca37f5..82f9679bd7a0 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c @@ -1855,8 +1855,9 @@ static int cam_ife_csid_enable_csi2( csid_reg = csid_hw->csid_info->csid_reg; soc_info = &csid_hw->hw_info->soc_info; - CAM_DBG(CAM_ISP, "CSID:%d count:%d config csi2 rx", - csid_hw->hw_intf->hw_idx, csid_hw->csi2_cfg_cnt); + CAM_DBG(CAM_ISP, "CSID:%d count:%d config csi2 rx res_id: %d", + csid_hw->hw_intf->hw_idx, csid_hw->csi2_cfg_cnt, + res->res_id); /* overflow check before increment */ if (csid_hw->csi2_cfg_cnt == UINT_MAX) { @@ -1866,7 +1867,7 @@ static int cam_ife_csid_enable_csi2( } cid_data = (struct cam_ife_csid_cid_data *)res->res_priv; - + cid_data->init_cnt++; res->res_state = CAM_ISP_RESOURCE_STATE_STREAMING; csid_hw->csi2_cfg_cnt++; if (csid_hw->csi2_cfg_cnt > 1) @@ -1913,6 +1914,7 @@ static int cam_ife_csid_disable_csi2( { const struct cam_ife_csid_reg_offset *csid_reg; struct cam_hw_soc_info *soc_info; + struct cam_ife_csid_cid_data *cid_data; if (res->res_id >= CAM_IFE_CSID_CID_MAX) { CAM_ERR(CAM_ISP, "CSID:%d Invalid res id :%d", @@ -1922,12 +1924,22 @@ static int cam_ife_csid_disable_csi2( csid_reg = csid_hw->csid_info->csid_reg; soc_info = &csid_hw->hw_info->soc_info; - CAM_DBG(CAM_ISP, "CSID:%d cnt : %d Disable csi2 rx", - csid_hw->hw_intf->hw_idx, csid_hw->csi2_cfg_cnt); + cid_data = (struct cam_ife_csid_cid_data *)res->res_priv; + CAM_DBG(CAM_ISP, "CSID:%d cnt : %d Disable csi2 rx res->res_id: %d", + csid_hw->hw_intf->hw_idx, csid_hw->csi2_cfg_cnt, + res->res_id); + + if (cid_data->init_cnt) + cid_data->init_cnt--; + if (!cid_data->init_cnt) + res->res_state = CAM_ISP_RESOURCE_STATE_RESERVED; if (csid_hw->csi2_cfg_cnt) csid_hw->csi2_cfg_cnt--; + CAM_DBG(CAM_ISP, "res_id %d res_state=%d", + res->res_id, res->res_state); + if (csid_hw->csi2_cfg_cnt) return 0; diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.h b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.h index b2096b454395..f9806a1ce11c 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.h +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.h @@ -487,6 +487,7 @@ struct cam_ife_csid_tpg_cfg { * @cnt: Cid resource reference count. * @tpg_set: Tpg used for this cid resource * @is_valid_vc1_dt1: Valid vc1 and dt1 + * @init_cnt cid resource init count * */ struct cam_ife_csid_cid_data { @@ -497,6 +498,7 @@ struct cam_ife_csid_cid_data { uint32_t cnt; uint32_t tpg_set; uint32_t is_valid_vc1_dt1; + uint32_t init_cnt; };