Skip to content

Commit

Permalink
drm/rockchip: A couple small fixes to psr
Browse files Browse the repository at this point in the history
A few things that need tidying up, no functional changes.

Reviewed-by: Yakir Yang <[email protected]>
Signed-off-by: Sean Paul <[email protected]>
  • Loading branch information
atseanpaul committed Aug 23, 2016
1 parent eec8534 commit 46bdc64
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions drivers/gpu/drm/rockchip/rockchip_drm_psr.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,25 @@ static void psr_set_state_locked(struct psr_drv *psr, enum psr_state state)
* Allowed finite state machine:
*
* PSR_ENABLE < = = = = = > PSR_FLUSH
* | ^ |
* | | |
* v | |
* | ^ |
* | | |
* v | |
* PSR_DISABLE < - - - - - - - - -
*/

/* Forbid no state change */
if (state == psr->state)
return;

/* Forbid DISABLE change to FLUSH */
/* Requesting a flush when disabled is a noop */
if (state == PSR_FLUSH && psr->state == PSR_DISABLE)
return;

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)
return;

/* Refact to hardware state change */
/* Actually commit the state change to hardware */
switch (psr->state) {
case PSR_ENABLE:
psr->set(psr->encoder, true);
Expand All @@ -109,10 +107,7 @@ static void psr_flush_handler(unsigned long data)
struct psr_drv *psr = (struct psr_drv *)data;
unsigned long flags;

if (!psr)
return;

/* State changed between flush time, then keep it */
/* If the state has changed since we initiated the flush, do nothing */
spin_lock_irqsave(&psr->lock, flags);
if (psr->state == PSR_FLUSH)
psr_set_state_locked(psr, PSR_ENABLE);
Expand Down

0 comments on commit 46bdc64

Please sign in to comment.