aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/tilcdc
diff options
context:
space:
mode:
authorJyri Sarha <jsarha@ti.com>2017-05-26 06:20:17 -0400
committerJyri Sarha <jsarha@ti.com>2017-10-05 04:47:13 -0400
commit46a956ab3c5be9141b75c0a6d8a754bdd4426577 (patch)
tree130be1d8939cec46035c874c040ede6ffd08aa49 /drivers/gpu/drm/tilcdc
parent61dd13b44435166c5136bd1e5b76a265bd9cddaf (diff)
drm/tilcdc: Turn raster off in crtc reset, if it was on in the HW
This forces the HW to be in sync with the empty state. This should help with the problem when LCDC is already enabled (e.g. by the bootloader) at the initialization phase and the enable fails when a new mode is applied. Signed-off-by: Jyri Sarha <jsarha@ti.com>
Diffstat (limited to 'drivers/gpu/drm/tilcdc')
-rw-r--r--drivers/gpu/drm/tilcdc/tilcdc_crtc.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index d2589f310437..0533fbeefafc 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -728,11 +728,39 @@ static void tilcdc_crtc_disable_vblank(struct drm_crtc *crtc)
728{ 728{
729} 729}
730 730
731static void tilcdc_crtc_reset(struct drm_crtc *crtc)
732{
733 struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc);
734 struct drm_device *dev = crtc->dev;
735 int ret;
736
737 drm_atomic_helper_crtc_reset(crtc);
738
739 /* Turn the raster off if it for some reason is on. */
740 pm_runtime_get_sync(dev->dev);
741 if (tilcdc_read(dev, LCDC_RASTER_CTRL_REG) & LCDC_RASTER_ENABLE) {
742 /* Enable DMA Frame Done Interrupt */
743 tilcdc_write(dev, LCDC_INT_ENABLE_SET_REG, LCDC_FRAME_DONE);
744 tilcdc_clear_irqstatus(dev, 0xffffffff);
745
746 tilcdc_crtc->frame_done = false;
747 tilcdc_clear(dev, LCDC_RASTER_CTRL_REG, LCDC_RASTER_ENABLE);
748
749 ret = wait_event_timeout(tilcdc_crtc->frame_done_wq,
750 tilcdc_crtc->frame_done,
751 msecs_to_jiffies(500));
752 if (ret == 0)
753 dev_err(dev->dev, "%s: timeout waiting for framedone\n",
754 __func__);
755 }
756 pm_runtime_put_sync(dev->dev);
757}
758
731static const struct drm_crtc_funcs tilcdc_crtc_funcs = { 759static const struct drm_crtc_funcs tilcdc_crtc_funcs = {
732 .destroy = tilcdc_crtc_destroy, 760 .destroy = tilcdc_crtc_destroy,
733 .set_config = drm_atomic_helper_set_config, 761 .set_config = drm_atomic_helper_set_config,
734 .page_flip = drm_atomic_helper_page_flip, 762 .page_flip = drm_atomic_helper_page_flip,
735 .reset = drm_atomic_helper_crtc_reset, 763 .reset = tilcdc_crtc_reset,
736 .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, 764 .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
737 .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, 765 .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
738 .enable_vblank = tilcdc_crtc_enable_vblank, 766 .enable_vblank = tilcdc_crtc_enable_vblank,