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

Commit 7420223c authored by Junzhe Zou's avatar Junzhe Zou
Browse files

msm: isp: Fix unbalanced hvx clk disable



Add guard in KMD to prevent hvx clk from being disabled when it
is not enabled.

CRs-Fixed: 2015469
Change-Id: I713a0f9a43e554753cc323451733f74afcafb034
Signed-off-by: default avatarJunzhe Zou <jnzhezou@codeaurora.org>
parent ad64f315
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -767,6 +767,7 @@ struct vfe_device {
	struct msm_cam_clk_info *hvx_clk_info;
	size_t num_hvx_clk;
	size_t num_norm_clk;
	bool hvx_clk_state;
	enum cam_ahb_clk_vote ahb_vote;
	struct cx_ipeak_client *vfe_cx_ipeak;

+27 −11
Original line number Diff line number Diff line
@@ -386,6 +386,7 @@ void msm_vfe47_release_hardware(struct vfe_device *vfe_dev)

	vfe_dev->hw_info->vfe_ops.platform_ops.enable_clks(
							vfe_dev, 0);
	msm_vfe47_configure_hvx(vfe_dev, 0);
	vfe_dev->hw_info->vfe_ops.platform_ops.enable_regulators(vfe_dev, 0);
}

@@ -1508,16 +1509,19 @@ void msm_vfe47_configure_hvx(struct vfe_device *vfe_dev,
		pr_err("%s: no stream_clk\n", __func__);
		return;
	}
	rc = msm_camera_clk_enable(&vfe_dev->pdev->dev, vfe_dev->hvx_clk_info,
			vfe_dev->hvx_clk, vfe_dev->num_hvx_clk, is_stream_on);
	if (is_stream_on) {
		/* Enable HVX */
		if (!vfe_dev->hvx_clk_state) {
			rc = msm_camera_clk_enable(&vfe_dev->pdev->dev,
				vfe_dev->hvx_clk_info, vfe_dev->hvx_clk,
				vfe_dev->num_hvx_clk, is_stream_on);
			if (rc) {
		pr_err("%s: stream_clk enable failed, enable: %u\n",
			__func__,
			is_stream_on);
				pr_err("%s: stream_clk enable failed\n",
						__func__);
				return;
			}
	if (is_stream_on == 1) {
		/* Enable HVX */
			vfe_dev->hvx_clk_state = true;
		}
		val = msm_camera_io_r(vfe_dev->vfe_base + 0x50);
		val |= (1 << 3);
		msm_camera_io_w_mb(val, vfe_dev->vfe_base + 0x50);
@@ -1527,6 +1531,17 @@ void msm_vfe47_configure_hvx(struct vfe_device *vfe_dev,
		msm_camera_io_w_mb(val, vfe_dev->vfe_base + 0x50);
	} else {
		/* Disable HVX */
		if (!vfe_dev->hvx_clk_state)
			return;
		rc = msm_camera_clk_enable(&vfe_dev->pdev->dev,
			vfe_dev->hvx_clk_info, vfe_dev->hvx_clk,
			vfe_dev->num_hvx_clk, is_stream_on);
		if (rc) {
			pr_err("%s: stream_clk disable failed\n",
					__func__);
			return;
		}
		vfe_dev->hvx_clk_state = false;
		val = msm_camera_io_r(vfe_dev->vfe_base + 0x50);
		val &= 0xFFFFFFF7;
		msm_camera_io_w_mb(val, vfe_dev->vfe_base + 0x50);
@@ -2528,6 +2543,7 @@ int msm_vfe47_get_clks(struct vfe_device *vfe_dev)
		vfe_dev->hvx_clk_info =
			&vfe_dev->vfe_clk_info[vfe_dev->num_clk-1];
		vfe_dev->hvx_clk = &vfe_dev->vfe_clk[vfe_dev->num_clk-1];
		vfe_dev->hvx_clk_state = false;
	}

	for (i = 0; i < vfe_dev->num_clk; i++) {
+1 −0
Original line number Diff line number Diff line
@@ -237,6 +237,7 @@ static int msm_vfe48_get_clks(struct vfe_device *vfe_dev)
		vfe_dev->hvx_clk_info =
			&vfe_dev->vfe_clk_info[vfe_dev->num_clk-1];
		vfe_dev->hvx_clk = &vfe_dev->vfe_clk[vfe_dev->num_clk-1];
		vfe_dev->hvx_clk_state = false;
	}

	for (i = 0; i < vfe_dev->num_clk; i++) {