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

Commit 686dd40f authored by Jeyaprakash Soundrapandian's avatar Jeyaprakash Soundrapandian Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: isp: Check open count and VFE_HW state" into dev/msm-4.9-camx

parents ccfbd11d 72069bdc
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -1037,16 +1037,23 @@ static int cam_ife_csid_enable_hw(struct cam_ife_csid_hw *csid_hw)

static int cam_ife_csid_disable_hw(struct cam_ife_csid_hw *csid_hw)
{
	int rc = 0;
	int rc = -EINVAL;
	struct cam_hw_soc_info             *soc_info;
	struct cam_ife_csid_reg_offset     *csid_reg;

	/* Check for refcount */
	if (!csid_hw->hw_info->open_count) {
		CAM_WARN(CAM_ISP, "Unbalanced disable_hw");
		return rc;
	}

	/*  Decrement ref Count */
	if (csid_hw->hw_info->open_count)
	csid_hw->hw_info->open_count--;
	if (csid_hw->hw_info->open_count)

	if (csid_hw->hw_info->open_count) {
		rc = 0;
		return rc;
	}

	soc_info = &csid_hw->hw_info->soc_info;
	csid_reg = csid_hw->csid_info->csid_reg;
+48 −26
Original line number Diff line number Diff line
@@ -273,7 +273,8 @@ static int cam_vfe_top_clock_update(
	}

	if (hw_info->hw_state != CAM_HW_STATE_POWER_UP) {
		CAM_DBG(CAM_ISP, "VFE:%d Not ready to set clocks yet :%d",
		CAM_ERR_RATE_LIMIT(CAM_ISP,
			"VFE:%d Not ready to set clocks yet :%d",
			res->hw_intf->hw_idx,
			hw_info->hw_state);
	} else
@@ -321,7 +322,8 @@ static int cam_vfe_top_bw_update(
	}

	if (hw_info->hw_state != CAM_HW_STATE_POWER_UP) {
		CAM_DBG(CAM_ISP, "VFE:%d Not ready to set BW yet :%d",
		CAM_ERR_RATE_LIMIT(CAM_ISP,
			"VFE:%d Not ready to set BW yet :%d",
			res->hw_intf->hw_idx,
			hw_info->hw_state);
	} else
@@ -364,7 +366,8 @@ static int cam_vfe_top_bw_control(
	}

	if (hw_info->hw_state != CAM_HW_STATE_POWER_UP) {
		CAM_DBG(CAM_ISP, "VFE:%d Not ready to set BW yet :%d",
		CAM_ERR_RATE_LIMIT(CAM_ISP,
			"VFE:%d Not ready to set BW yet :%d",
			res->hw_intf->hw_idx,
			hw_info->hw_state);
	} else {
@@ -517,6 +520,7 @@ int cam_vfe_top_start(void *device_priv,
{
	struct cam_vfe_top_ver2_priv            *top_priv;
	struct cam_isp_resource_node            *mux_res;
	struct cam_hw_info                      *hw_info = NULL;
	int rc = 0;

	if (!device_priv || !start_args) {
@@ -526,25 +530,34 @@ int cam_vfe_top_start(void *device_priv,

	top_priv = (struct cam_vfe_top_ver2_priv *)device_priv;
	mux_res = (struct cam_isp_resource_node *)start_args;
	hw_info = (struct cam_hw_info  *)mux_res->hw_intf->hw_priv;

	if (hw_info->hw_state == CAM_HW_STATE_POWER_UP) {
		rc = cam_vfe_top_set_hw_clk_rate(top_priv);
		if (rc) {
		CAM_ERR(CAM_ISP, "set_hw_clk_rate failed, rc=%d", rc);
			CAM_ERR(CAM_ISP,
				"set_hw_clk_rate failed, rc=%d", rc);
			return rc;
		}

		rc = cam_vfe_top_set_axi_bw_vote(top_priv, true);
		if (rc) {
		CAM_ERR(CAM_ISP, "set_axi_bw_vote failed, rc=%d", rc);
			CAM_ERR(CAM_ISP,
				"set_axi_bw_vote failed, rc=%d", rc);
			return rc;
		}

		if (mux_res->start) {
			rc = mux_res->start(mux_res);
		} else {
		CAM_ERR(CAM_ISP, "Invalid res id:%d", mux_res->res_id);
			CAM_ERR(CAM_ISP,
				"Invalid res id:%d", mux_res->res_id);
			rc = -EINVAL;
		}
	} else {
		CAM_ERR(CAM_ISP, "VFE HW not powered up");
		rc = -EPERM;
	}

	return rc;
}
@@ -554,6 +567,7 @@ int cam_vfe_top_stop(void *device_priv,
{
	struct cam_vfe_top_ver2_priv            *top_priv;
	struct cam_isp_resource_node            *mux_res;
	struct cam_hw_info                      *hw_info = NULL;
	int i, rc = 0;

	if (!device_priv || !stop_args) {
@@ -563,6 +577,7 @@ int cam_vfe_top_stop(void *device_priv,

	top_priv = (struct cam_vfe_top_ver2_priv   *)device_priv;
	mux_res = (struct cam_isp_resource_node *)stop_args;
	hw_info = (struct cam_hw_info  *)mux_res->hw_intf->hw_priv;

	if (mux_res->res_id == CAM_ISP_HW_VFE_IN_CAMIF ||
		(mux_res->res_id >= CAM_ISP_HW_VFE_IN_RDI0 &&
@@ -585,17 +600,24 @@ int cam_vfe_top_stop(void *device_priv,
			}
		}

		if (hw_info->hw_state == CAM_HW_STATE_POWER_UP) {
			rc = cam_vfe_top_set_hw_clk_rate(top_priv);
			if (rc) {
			CAM_ERR(CAM_ISP, "set_hw_clk_rate failed, rc=%d", rc);
				CAM_ERR(CAM_ISP,
					"set_hw_clk_rate failed, rc=%d", rc);
				return rc;
			}

			rc = cam_vfe_top_set_axi_bw_vote(top_priv, true);
			if (rc) {
			CAM_ERR(CAM_ISP, "set_axi_bw_vote failed, rc=%d", rc);
				CAM_ERR(CAM_ISP,
					"set_axi_bw_vote failed, rc=%d", rc);
				return rc;
			}
		} else {
			CAM_ERR(CAM_ISP, "VFE HW not powered up");
			rc = -EPERM;
		}
	}

	return rc;