drm/rockchip: Fix up bug in psr state machine
authorSean Paul <seanpaul@chromium.org>
Tue, 6 Sep 2016 18:11:53 +0000 (14:11 -0400)
committerSean Paul <seanpaul@chromium.org>
Wed, 21 Sep 2016 13:55:49 +0000 (06:55 -0700)
The ->set() callback would always be called when transitioning
from FLUSH->DISABLE since we assign state to psr->state right
above the skip condition.

Reported-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
drivers/gpu/drm/rockchip/rockchip_drm_psr.c

index 2cdd6eb..a553e18 100644 (file)
@@ -71,11 +71,13 @@ static void psr_set_state_locked(struct psr_drv *psr, enum psr_state state)
        if (state == psr->state || !psr->active)
                return;
 
-       psr->state = state;
-
        /* Already disabled in flush, change the state, but not the hardware */
-       if (state == PSR_DISABLE && psr->state == PSR_FLUSH)
+       if (state == PSR_DISABLE && psr->state == PSR_FLUSH) {
+               psr->state = state;
                return;
+       }
+
+       psr->state = state;
 
        /* Actually commit the state change to hardware */
        switch (psr->state) {