Commit ea908ba8 authored by Russell King's avatar Russell King

drm/armada: fix clock counts

The DPMS handling wrt clock enables/disables was incorrect: we could end
up decrementing the clock count multiple times if we transition via
several low-power DPMS states, resulting in a kernel warning.  Fix this
by only testing to see whether we are entering or exiting the DPMS off
state.
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
parent c8d2bc9b
...@@ -332,17 +332,19 @@ static void armada_drm_crtc_dpms(struct drm_crtc *crtc, int dpms) ...@@ -332,17 +332,19 @@ static void armada_drm_crtc_dpms(struct drm_crtc *crtc, int dpms)
{ {
struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc); struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
if (dcrtc->dpms != dpms) { if (dpms_blanked(dcrtc->dpms) != dpms_blanked(dpms)) {
dcrtc->dpms = dpms;
if (!IS_ERR(dcrtc->clk) && !dpms_blanked(dpms))
WARN_ON(clk_prepare_enable(dcrtc->clk));
armada_drm_crtc_update(dcrtc);
if (!IS_ERR(dcrtc->clk) && dpms_blanked(dpms))
clk_disable_unprepare(dcrtc->clk);
if (dpms_blanked(dpms)) if (dpms_blanked(dpms))
armada_drm_vblank_off(dcrtc); armada_drm_vblank_off(dcrtc);
else else if (!IS_ERR(dcrtc->clk))
WARN_ON(clk_prepare_enable(dcrtc->clk));
dcrtc->dpms = dpms;
armada_drm_crtc_update(dcrtc);
if (!dpms_blanked(dpms))
drm_crtc_vblank_on(&dcrtc->crtc); drm_crtc_vblank_on(&dcrtc->crtc);
else if (!IS_ERR(dcrtc->clk))
clk_disable_unprepare(dcrtc->clk);
} else if (dcrtc->dpms != dpms) {
dcrtc->dpms = dpms;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment