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

Commit 2c27369b authored by Harsh Sahu's avatar Harsh Sahu Committed by Gerrit - the friendly Code Review server
Browse files

drm/msm/sde: add power_enable before cleanup of unused planes



Unused pipes are halted at the end of the commit in the cleanup.
During this if the clocks are turned off will lead to NOC error.
This change adds the power enable before unused plane halt to make
sure the clocks are on at the time of halting.

Change-Id: I162b001651516926464ba386c82d94275a0a2bc5
Signed-off-by: default avatarHarsh Sahu <hsahu@codeaurora.org>
parent cc8b4b38
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -3032,6 +3032,29 @@ static int _sde_plane_fetch_halt(struct drm_plane *plane)
	return sde_vbif_halt_plane_xin(sde_kms, xin_id, clk_ctrl);
}


static inline int _sde_plane_power_enable(struct drm_plane *plane, bool enable)
{
	struct msm_drm_private *priv;
	struct sde_kms *sde_kms;

	if (!plane->dev || !plane->dev->dev_private) {
		SDE_ERROR("invalid drm device\n");
		return -EINVAL;
	}

	priv = plane->dev->dev_private;
	if (!priv->kms) {
		SDE_ERROR("invalid kms\n");
		return -EINVAL;
	}

	sde_kms = to_sde_kms(priv->kms);

	return sde_power_resource_enable(&priv->phandle, sde_kms->core_client,
									enable);
}

static void sde_plane_cleanup_fb(struct drm_plane *plane,
		struct drm_plane_state *old_state)
{
@@ -3057,6 +3080,13 @@ static void sde_plane_cleanup_fb(struct drm_plane *plane,
			       psde->pipe - SSPP_VIG0);

		/* halt this plane now */
		ret = _sde_plane_power_enable(plane, true);
		if (ret) {
			SDE_ERROR("power resource enable failed with %d", ret);
			SDE_EVT32(ret);
			return;
		}

		ret = _sde_plane_fetch_halt(plane);
		if (ret) {
			SDE_ERROR_PLANE(psde,
@@ -3065,6 +3095,7 @@ static void sde_plane_cleanup_fb(struct drm_plane *plane,
			SDE_EVT32(DRMID(plane), psde->pipe - SSPP_VIG0,
				       ret, SDE_EVTLOG_ERROR);
		}
		_sde_plane_power_enable(plane, false);
	}

	old_rstate = &old_pstate->rot;