Commit 46bdc649 authored by Sean Paul's avatar Sean Paul

drm/rockchip: A couple small fixes to psr

A few things that need tidying up, no functional changes.
Reviewed-by: default avatarYakir Yang <ykk@rock-chips.com>
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
parent eec85347
...@@ -62,27 +62,25 @@ static void psr_set_state_locked(struct psr_drv *psr, enum psr_state state) ...@@ -62,27 +62,25 @@ static void psr_set_state_locked(struct psr_drv *psr, enum psr_state state)
* Allowed finite state machine: * Allowed finite state machine:
* *
* PSR_ENABLE < = = = = = > PSR_FLUSH * PSR_ENABLE < = = = = = > PSR_FLUSH
* | ^ | * | ^ |
* | | | * | | |
* v | | * v | |
* PSR_DISABLE < - - - - - - - - - * PSR_DISABLE < - - - - - - - - -
*/ */
/* Forbid no state change */
if (state == psr->state) if (state == psr->state)
return; return;
/* Forbid DISABLE change to FLUSH */ /* Requesting a flush when disabled is a noop */
if (state == PSR_FLUSH && psr->state == PSR_DISABLE) if (state == PSR_FLUSH && psr->state == PSR_DISABLE)
return; return;
psr->state = state; psr->state = state;
/* Allow but no need hardware change, just need assign the 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)
return; return;
/* Refact to hardware state change */ /* Actually commit the state change to hardware */
switch (psr->state) { switch (psr->state) {
case PSR_ENABLE: case PSR_ENABLE:
psr->set(psr->encoder, true); psr->set(psr->encoder, true);
...@@ -109,10 +107,7 @@ static void psr_flush_handler(unsigned long data) ...@@ -109,10 +107,7 @@ static void psr_flush_handler(unsigned long data)
struct psr_drv *psr = (struct psr_drv *)data; struct psr_drv *psr = (struct psr_drv *)data;
unsigned long flags; unsigned long flags;
if (!psr) /* If the state has changed since we initiated the flush, do nothing */
return;
/* State changed between flush time, then keep it */
spin_lock_irqsave(&psr->lock, flags); spin_lock_irqsave(&psr->lock, flags);
if (psr->state == PSR_FLUSH) if (psr->state == PSR_FLUSH)
psr_set_state_locked(psr, PSR_ENABLE); psr_set_state_locked(psr, PSR_ENABLE);
......
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