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

Commit 84875dd9 authored by Lloyd Atkinson's avatar Lloyd Atkinson
Browse files

drm/msm: skip commit when handling pm suspend if no crtcs active



Avoid submitting a commit that mentions no CRTCs in the case
where all the CRTCs are already inactive or not in DPMS_ON
state when handling PM suspend.

Change-Id: I4574cce433cc05a39f225e56f49ce4b8d01d59ba
Signed-off-by: default avatarLloyd Atkinson <latkinso@codeaurora.org>
parent 1d370db5
Loading
Loading
Loading
Loading
+19 −5
Original line number Diff line number Diff line
@@ -1708,7 +1708,7 @@ static int sde_kms_pm_suspend(struct device *dev)
	struct drm_connector *conn;
	struct drm_atomic_state *state;
	struct sde_kms *sde_kms;
	int ret = 0;
	int ret = 0, num_crtcs = 0;

	if (!dev)
		return -EINVAL;
@@ -1768,7 +1768,9 @@ static int sde_kms_pm_suspend(struct device *dev)
				drm_atomic_state_free(state);
				goto unlock;
			}
		} else if (lp != SDE_MODE_DPMS_LP2) {
		}

		if (lp != SDE_MODE_DPMS_LP2) {
			/* force CRTC to be inactive */
			crtc_state = drm_atomic_get_crtc_state(state,
					conn->state->crtc);
@@ -1778,8 +1780,18 @@ static int sde_kms_pm_suspend(struct device *dev)
				drm_atomic_state_free(state);
				goto unlock;
			}

			if (lp != SDE_MODE_DPMS_LP1)
				crtc_state->active = false;
			++num_crtcs;
		}
	}

	/* check for nothing to do */
	if (num_crtcs == 0) {
		DRM_DEBUG("all crtcs are already in the off state\n");
		drm_atomic_state_free(state);
		goto suspended;
	}

	/* commit the "disable all" state */
@@ -1787,10 +1799,12 @@ static int sde_kms_pm_suspend(struct device *dev)
	if (ret < 0) {
		DRM_ERROR("failed to disable crtcs, %d\n", ret);
		drm_atomic_state_free(state);
	} else {
		sde_kms->suspend_block = true;
		goto unlock;
	}

suspended:
	sde_kms->suspend_block = true;

unlock:
	if (ret == -EDEADLK) {
		drm_modeset_backoff(&ctx);