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

Commit ba76a5fa authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: isp: correct the CX iPeak voting logic"

parents f3392ded 8628870c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -590,9 +590,9 @@ int vfe_hw_probe(struct platform_device *pdev)
			(struct msm_vfe_hardware_info *) match_dev->data;
		/* Cx ipeak support */
		if (of_find_property(pdev->dev.of_node,
			"qcom,vfe_cx_ipeak", NULL)) {
			"qcom,vfe-cx-ipeak", NULL)) {
			vfe_dev->vfe_cx_ipeak = cx_ipeak_register(
				pdev->dev.of_node, "qcom,vfe_cx_ipeak");
				pdev->dev.of_node, "qcom,vfe-cx-ipeak");
		}
	} else {
		vfe_dev->hw_info = (struct msm_vfe_hardware_info *)
+0 −1
Original line number Diff line number Diff line
@@ -768,7 +768,6 @@ struct vfe_device {
	size_t num_hvx_clk;
	size_t num_norm_clk;
	enum cam_ahb_clk_vote ahb_vote;
	bool turbo_vote;
	struct cx_ipeak_client *vfe_cx_ipeak;

	/* Sync variables*/
+42 −21
Original line number Diff line number Diff line
@@ -331,7 +331,6 @@ int msm_vfe47_init_hardware(struct vfe_device *vfe_dev)
		goto ahb_vote_fail;
	}
	vfe_dev->ahb_vote = CAM_AHB_SVS_VOTE;
	vfe_dev->turbo_vote = 0;

	vfe_dev->common_data->dual_vfe_res->vfe_base[vfe_dev->pdev->id] =
		vfe_dev->vfe_base;
@@ -2563,31 +2562,53 @@ int msm_vfe47_set_clk_rate(struct vfe_device *vfe_dev, long *rate)
	int rc = 0;
	int clk_idx = vfe_dev->hw_info->vfe_clk_idx;
	int ret;
	long clk_rate, prev_clk_rate;

	clk_rate = clk_round_rate(vfe_dev->vfe_clk[clk_idx], *rate);
	if (vfe_dev->msm_isp_vfe_clk_rate == clk_rate)
		return rc;

	prev_clk_rate = vfe_dev->msm_isp_vfe_clk_rate;
	vfe_dev->msm_isp_vfe_clk_rate = clk_rate;
	/*
	 * if cx_ipeak is supported vote first so that dsp throttling is
	 * reduced before we go to turbo
	 */
	if ((vfe_dev->vfe_cx_ipeak) &&
		(vfe_dev->msm_isp_vfe_clk_rate >=
		vfe_dev->vfe_clk_rates[MSM_VFE_CLK_RATE_TURBO]
		[vfe_dev->hw_info->vfe_clk_idx]) &&
		prev_clk_rate <
		vfe_dev->vfe_clk_rates[MSM_VFE_CLK_RATE_TURBO]
		[vfe_dev->hw_info->vfe_clk_idx]) {
		ret = cx_ipeak_update(vfe_dev->vfe_cx_ipeak, true);
		if (ret) {
			pr_err("%s: cx_ipeak_update failed %d\n",
				__func__, ret);
			return ret;
		}
	}
	/*set vfe clock*/
	rc = msm_camera_clk_set_rate(&vfe_dev->pdev->dev,
				vfe_dev->vfe_clk[clk_idx], *rate);
	if (rc < 0)
		return rc;
	*rate = clk_round_rate(vfe_dev->vfe_clk[clk_idx], *rate);
	vfe_dev->msm_isp_vfe_clk_rate = *rate;
	if (vfe_dev->vfe_cx_ipeak) {
		if (vfe_dev->msm_isp_vfe_clk_rate >=
	/*
	 * if cx_ipeak is supported remove the vote for non-turbo clock and
	 * if voting done earlier
	 */
	if ((vfe_dev->vfe_cx_ipeak) &&
		(vfe_dev->msm_isp_vfe_clk_rate <
		vfe_dev->vfe_clk_rates[MSM_VFE_CLK_RATE_TURBO]
			[vfe_dev->hw_info->vfe_clk_idx] &&
			vfe_dev->turbo_vote == 0) {
			ret = cx_ipeak_update(vfe_dev->vfe_cx_ipeak, true);
			if (ret)
				pr_debug("%s: cx_ipeak_update failed %d\n",
					__func__, ret);
			else
				vfe_dev->turbo_vote = 1;
		} else if (vfe_dev->turbo_vote == 1) {
		[vfe_dev->hw_info->vfe_clk_idx]) &&
		prev_clk_rate >=
		vfe_dev->vfe_clk_rates[MSM_VFE_CLK_RATE_TURBO]
		[vfe_dev->hw_info->vfe_clk_idx]) {
		ret = cx_ipeak_update(vfe_dev->vfe_cx_ipeak, false);
			if (ret)
				pr_debug("%s: cx_ipeak_update failed %d\n",
		if (ret) {
			pr_err("%s: cx_ipeak_update failed %d\n",
				__func__, ret);
			else
				vfe_dev->turbo_vote = 0;
			return ret;
		}
	}
	if (vfe_dev->hw_info->vfe_ops.core_ops.ahb_clk_cfg)