Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 780ad838 authored by Chandan Kumar Jha's avatar Chandan Kumar Jha Committed by Gerrit - the friendly Code Review server
Browse files

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.

Change-Id: I06b7439461388358a83569c1f3e0aa46a083fe6e
Signed-off-by: default avatarChandan Kumar Jha <cjha@codeaurora.org>
parent 3aa681b6
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -1442,8 +1442,8 @@ 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) {
@@ -1453,6 +1453,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++;
@@ -1558,6 +1559,7 @@ static int cam_ife_csid_disable_csi2(
	const struct cam_ife_csid_reg_offset *csid_reg;
	struct cam_hw_soc_info               *soc_info;
	uint32_t ppi_index = 0;
	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",
@@ -1567,12 +1569,20 @@ 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;

+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -409,6 +409,7 @@ struct cam_ife_csid_tpg_cfg {
 * @dt:          Data type
 * @cnt:         Cid resource reference count.
 * @tpg_set:     Tpg used for this cid resource
 * @init_cnt     cid resource init count
 *
 */
struct cam_ife_csid_cid_data {
@@ -416,6 +417,7 @@ struct cam_ife_csid_cid_data {
	uint32_t                     dt;
	uint32_t                     cnt;
	uint32_t                     tpg_set;
	uint32_t                     init_cnt;
};

/**