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

Commit db43e286 authored by Veera Sundaram Sankaran's avatar Veera Sundaram Sankaran
Browse files

drm/msm/sde: avoid reset on pm_resume during LP1/LP2



Crtc state is left to active when pm_suspend is received
during LP1(doze) or LP2(doze suspend) as the display is still
ON. Avoid resetting the crtc/plane/connectors on pm_resume
when the crtc's are in active state to avoid clearing out
all the states.

Change-Id: I1500f7c8aa4658a1b916676bb0abc6da31d82441
Signed-off-by: default avatarVeera Sundaram Sankaran <veeras@codeaurora.org>
parent 037d768f
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <linux/backlight.h>
#include "dsi_drm.h"
#include "dsi_display.h"
#include "sde_crtc.h"

#define BL_NODE_NAME_SIZE 32

@@ -580,6 +581,12 @@ static void sde_connector_atomic_reset(struct drm_connector *connector)

	c_conn = to_sde_connector(connector);

	if (connector->state &&
			!sde_crtc_is_reset_required(connector->state->crtc)) {
		SDE_DEBUG_CONN(c_conn, "avoid reset for connector\n");
		return;
	}

	if (connector->state) {
		sde_connector_atomic_destroy_state(connector, connector->state);
		connector->state = 0;
+8 −1
Original line number Diff line number Diff line
@@ -3001,9 +3001,16 @@ static void sde_crtc_reset(struct drm_crtc *crtc)
	}

	/* revert suspend actions, if necessary */
	if (sde_kms_is_suspend_state(crtc->dev))
	if (sde_kms_is_suspend_state(crtc->dev)) {
		_sde_crtc_set_suspend(crtc, false);

		if (!sde_crtc_is_reset_required(crtc)) {
			SDE_DEBUG("avoiding reset for crtc:%d\n",
					crtc->base.id);
			return;
		}
	}

	/* remove previous state, if present */
	if (crtc->state) {
		sde_crtc_destroy_state(crtc, crtc->state);
+24 −0
Original line number Diff line number Diff line
@@ -530,6 +530,30 @@ static inline u32 sde_crtc_get_inline_prefill(struct drm_crtc *crtc)
		cstate->sbuf_prefill_line : 0;
}

/**
 * sde_crtc_is_reset_required - validate the reset request based on the
 *	pm_suspend and crtc's active status. crtc's are left active
 *	on pm_suspend during LP1/LP2 states, as the display is still
 *	left ON. Avoid reset for the subsequent pm_resume in such cases.
 * @crtc: Pointer to crtc
 * return: false if in suspend state and crtc active, true otherwise
 */
static inline bool sde_crtc_is_reset_required(struct drm_crtc *crtc)
{
	/*
	 * reset is required even when there is no crtc_state as it is required
	 * to create the initial state object
	 */
	if (!crtc || !crtc->state)
		return true;

	/* reset not required if crtc is active during suspend state */
	if (sde_kms_is_suspend_state(crtc->dev) && crtc->state->active)
		return false;

	return true;
}

/**
 * sde_crtc_event_queue - request event callback
 * @crtc: Pointer to drm crtc structure
+5 −0
Original line number Diff line number Diff line
@@ -4379,6 +4379,11 @@ static void sde_plane_reset(struct drm_plane *plane)
	psde = to_sde_plane(plane);
	SDE_DEBUG_PLANE(psde, "\n");

	if (plane->state && !sde_crtc_is_reset_required(plane->state->crtc)) {
		SDE_DEBUG_PLANE(psde, "avoid reset for plane\n");
		return;
	}

	/* remove previous state, if present */
	if (plane->state) {
		sde_plane_destroy_state(plane, plane->state);