msm: camera: isp: Change state of all CID resource to RESERVE on deinit

This change is to update state of all acquired CID resources state to
Reserve on disable CSI2. It will allow, proper release of all CID
resources even in case multiple CID for single CSID.

CRs-Fixed: 2883120
Change-Id: I0630c08a269bfebc6867dd039e752693ffe97ba9
Signed-off-by: Tejas Prajapati <tpraja@codeaurora.org>
This commit is contained in:
Tejas Prajapati 2021-02-26 12:33:25 +05:30
commit 2ea3cac9d4
2 changed files with 19 additions and 5 deletions

View file

@ -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;

View file

@ -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;
};