drm/msm/sde: move power resource handling for vblank to crtcs

Move the power resource request/release from the sde kms layer
into the CRTCs so that proper accounting for suspend/resume
operations may be done. A single power resource request is
made as long while the CRTC's vblank request ref count is not
zero and the driver is not in a suspended state.

CRs-Fixed: 2019307
Change-Id: I2d47567ec3dded72faed8bd5441d8d4653d5ef25
Signed-off-by: Clarence Ip <cip@codeaurora.org>
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index e65af81..e4a073e 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -502,6 +502,14 @@
 		(_cb)->func = _func;                         \
 	} while (0)
 
+static inline bool msm_is_suspend_state(struct drm_device *dev)
+{
+	if (!dev || !dev->dev_private)
+		return false;
+
+	return ((struct msm_drm_private *)dev->dev_private)->suspend_state != 0;
+}
+
 int msm_atomic_commit(struct drm_device *dev,
 		struct drm_atomic_state *state, bool nonblock);