[PATCH] drm/rockchip: Fix up bug in psr state machine

Sean Paul seanpaul at chromium.org
Tue Sep 6 19:12:26 UTC 2016


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 at chromium.org>
Signed-off-by: Sean Paul <seanpaul at chromium.org>
---
 drivers/gpu/drm/rockchip/rockchip_drm_psr.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
index c6ac5d0..cb17709 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c
@@ -74,11 +74,13 @@ static void psr_set_state_locked(struct psr_drv *psr, enum psr_state state)
 	if (state == PSR_FLUSH && psr->state == PSR_DISABLE)
 		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) {
-- 
2.8.0.rc3.226.g39d4020



More information about the dri-devel mailing list