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

Commit 41a92fc9 authored by Xu Yang's avatar Xu Yang
Browse files

drm/msm/sde: Move LUT memeory retention handling to IPC cases



Move LUT memory retention enable/disable handling to CRTC power
event. When IPC suspend, LUT memory retention is enabled. And
when IPC resume, LUT memory retention is disabled. Change fixes
the issue of AD flicker in IPC transition after connect and
disconnect DP.

CRs-Fixed: 2309686
Change-Id: I8215c845cf34fbd216161c01d78d669cfe3fd07b
Signed-off-by: default avatarXu Yang <yangxu@codeaurora.org>
parent 0f724066
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -4251,6 +4251,7 @@ static void sde_crtc_handle_power_event(u32 event_type, void *arg)
	struct sde_crtc_irq_info *node = NULL;
	int ret = 0;
	struct drm_event event;
	struct msm_drm_private *priv;

	if (!crtc) {
		SDE_ERROR("invalid crtc\n");
@@ -4258,6 +4259,7 @@ static void sde_crtc_handle_power_event(u32 event_type, void *arg)
	}
	sde_crtc = to_sde_crtc(crtc);
	cstate = to_sde_crtc_state(crtc->state);
	priv = crtc->dev->dev_private;

	mutex_lock(&sde_crtc->crtc_lock);

@@ -4265,6 +4267,12 @@ static void sde_crtc_handle_power_event(u32 event_type, void *arg)

	switch (event_type) {
	case SDE_POWER_EVENT_POST_ENABLE:
		/* disable mdp LUT memory retention */
		ret = sde_power_clk_set_flags(&priv->phandle, "lut_clk",
					CLKFLAG_NORETAIN_MEM);
		if (ret)
			SDE_ERROR("disable LUT memory retention err %d\n", ret);

		/* restore encoder; crtc will be programmed during commit */
		drm_for_each_encoder(encoder, crtc->dev) {
			if (encoder->crtc != crtc)
@@ -4297,6 +4305,12 @@ static void sde_crtc_handle_power_event(u32 event_type, void *arg)
		}
		break;
	case SDE_POWER_EVENT_PRE_DISABLE:
		/* enable mdp LUT memory retention */
		ret = sde_power_clk_set_flags(&priv->phandle, "lut_clk",
					CLKFLAG_RETAIN_MEM);
		if (ret)
			SDE_ERROR("enable LUT memory retention err %d\n", ret);

		drm_for_each_encoder(encoder, crtc->dev) {
			if (encoder->crtc != crtc)
				continue;
@@ -4417,12 +4431,6 @@ static void sde_crtc_disable(struct drm_crtc *crtc)
	msm_mode_object_event_notify(&crtc->base, crtc->dev, &event,
			(u8 *)&power_on);

	/* disable mdp LUT memory retention */
	ret = sde_power_clk_set_flags(&priv->phandle, "lut_clk",
				CLKFLAG_NORETAIN_MEM);
	if (ret)
		SDE_ERROR("failed to disable LUT memory retention %d\n", ret);

	/* destination scaler if enabled should be reconfigured on resume */
	if (cstate->num_ds_enabled)
		sde_crtc->ds_reconfig = true;
@@ -4577,12 +4585,6 @@ static void sde_crtc_enable(struct drm_crtc *crtc,
	msm_mode_object_event_notify(&crtc->base, crtc->dev, &event,
			(u8 *)&power_on);

	/* enable mdp LUT memory retention */
	ret = sde_power_clk_set_flags(&priv->phandle, "lut_clk",
					CLKFLAG_RETAIN_MEM);
	if (ret)
		SDE_ERROR("failed to enable LUT memory retention %d\n", ret);

	mutex_unlock(&sde_crtc->crtc_lock);

	spin_lock_irqsave(&sde_crtc->spin_lock, flags);