Commit 155b8290 authored by Russell King's avatar Russell King

drm/armada: move sync signal polarity to mode_set_nofb() method

For atomic modeset, we need to set the sync signal polarities from the
CRTC state structure rather than the legacy mode structure stored in
CRTC.  In any case, we should update this from our mode_set_nofb()
method, rather than the commit() method.  Move it there, and ensure
that armada_drm_crtc_update() will not overwrite these bits.
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
parent b5bae71a
...@@ -115,25 +115,9 @@ static void armada_drm_crtc_update(struct armada_crtc *dcrtc) ...@@ -115,25 +115,9 @@ static void armada_drm_crtc_update(struct armada_crtc *dcrtc)
dumb_ctrl |= DUMB_BLANK; dumb_ctrl |= DUMB_BLANK;
} }
/* armada_updatel(dumb_ctrl,
* The documentation doesn't indicate what the normal state of ~(CFG_INV_CSYNC | CFG_INV_HSYNC | CFG_INV_VSYNC),
* the sync signals are. Sebastian Hesselbart kindly probed dcrtc->base + LCD_SPU_DUMB_CTRL);
* these signals on his board to determine their state.
*
* The non-inverted state of the sync signals is active high.
* Setting these bits makes the appropriate signal active low.
*/
if (dcrtc->crtc.mode.flags & DRM_MODE_FLAG_NCSYNC)
dumb_ctrl |= CFG_INV_CSYNC;
if (dcrtc->crtc.mode.flags & DRM_MODE_FLAG_NHSYNC)
dumb_ctrl |= CFG_INV_HSYNC;
if (dcrtc->crtc.mode.flags & DRM_MODE_FLAG_NVSYNC)
dumb_ctrl |= CFG_INV_VSYNC;
if (dcrtc->dumb_ctrl != dumb_ctrl) {
dcrtc->dumb_ctrl = dumb_ctrl;
writel_relaxed(dumb_ctrl, dcrtc->base + LCD_SPU_DUMB_CTRL);
}
} }
static void armada_drm_plane_work_call(struct armada_crtc *dcrtc, static void armada_drm_plane_work_call(struct armada_crtc *dcrtc,
...@@ -280,7 +264,6 @@ static void armada_drm_crtc_prepare(struct drm_crtc *crtc) ...@@ -280,7 +264,6 @@ static void armada_drm_crtc_prepare(struct drm_crtc *crtc)
{ {
struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc); struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc);
struct drm_plane *plane; struct drm_plane *plane;
u32 val;
/* /*
* If we have an overlay plane associated with this CRTC, disable * If we have an overlay plane associated with this CRTC, disable
...@@ -300,11 +283,7 @@ static void armada_drm_crtc_prepare(struct drm_crtc *crtc) ...@@ -300,11 +283,7 @@ static void armada_drm_crtc_prepare(struct drm_crtc *crtc)
drm_crtc_vblank_off(crtc); drm_crtc_vblank_off(crtc);
val = dcrtc->dumb_ctrl & ~CFG_DUMB_ENA; armada_updatel(0, CFG_DUMB_ENA, dcrtc->base + LCD_SPU_DUMB_CTRL);
if (val != dcrtc->dumb_ctrl) {
dcrtc->dumb_ctrl = val;
writel_relaxed(val, dcrtc->base + LCD_SPU_DUMB_CTRL);
}
} }
/* The mode_config.mutex will be held for this call */ /* The mode_config.mutex will be held for this call */
...@@ -516,6 +495,24 @@ static void armada_drm_crtc_mode_set_nofb(struct drm_crtc *crtc) ...@@ -516,6 +495,24 @@ static void armada_drm_crtc_mode_set_nofb(struct drm_crtc *crtc)
val = adj->flags & DRM_MODE_FLAG_NVSYNC ? CFG_VSYNC_INV : 0; val = adj->flags & DRM_MODE_FLAG_NVSYNC ? CFG_VSYNC_INV : 0;
armada_reg_queue_mod(regs, i, val, CFG_VSYNC_INV, LCD_SPU_DMA_CTRL1); armada_reg_queue_mod(regs, i, val, CFG_VSYNC_INV, LCD_SPU_DMA_CTRL1);
/*
* The documentation doesn't indicate what the normal state of
* the sync signals are. Sebastian Hesselbart kindly probed
* these signals on his board to determine their state.
*
* The non-inverted state of the sync signals is active high.
* Setting these bits makes the appropriate signal active low.
*/
val = 0;
if (adj->flags & DRM_MODE_FLAG_NCSYNC)
val |= CFG_INV_CSYNC;
if (adj->flags & DRM_MODE_FLAG_NHSYNC)
val |= CFG_INV_HSYNC;
if (adj->flags & DRM_MODE_FLAG_NVSYNC)
val |= CFG_INV_VSYNC;
armada_reg_queue_mod(regs, i, val, CFG_INV_CSYNC | CFG_INV_HSYNC |
CFG_INV_VSYNC, LCD_SPU_DUMB_CTRL);
armada_reg_queue_end(regs, i); armada_reg_queue_end(regs, i);
armada_drm_crtc_update_regs(dcrtc, regs); armada_drm_crtc_update_regs(dcrtc, regs);
......
...@@ -85,7 +85,6 @@ struct armada_crtc { ...@@ -85,7 +85,6 @@ struct armada_crtc {
int dpms; int dpms;
uint32_t cfg_dumb_ctrl; uint32_t cfg_dumb_ctrl;
uint32_t dumb_ctrl;
uint32_t spu_iopad_ctrl; uint32_t spu_iopad_ctrl;
spinlock_t irq_lock; spinlock_t irq_lock;
......
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