summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
diff options
context:
space:
mode:
authorJyri Sarha <jsarha@ti.com>2016-06-21 15:00:44 +0200
committerJyri Sarha <jsarha@ti.com>2016-08-08 22:05:15 +0200
commitafaf833dd5d7793e9441f122bbe3e37a09a0c743 (patch)
treec56baf55c9c6dfdbcd820d28047390e4a7384427 /drivers/gpu/drm/tilcdc/tilcdc_crtc.c
parentdrm/tilcdc: tfp410: Add atomic modeset helpers to connector funcs (diff)
downloadlinux-afaf833dd5d7793e9441f122bbe3e37a09a0c743.tar.xz
linux-afaf833dd5d7793e9441f122bbe3e37a09a0c743.zip
drm/tilcdc: Enable and disable interrupts in crtc start() and stop()
Enable and disable interrupts in crtc start() and stop(). None of the interrupts can fire if CRTC is disabled, so it is cleaner - when considering suspend/resume code etc. - to enable the interrupts when CRTC is turned on and to disable them when CRTC is turned off. Signed-off-by: Jyri Sarha <jsarha@ti.com>
Diffstat (limited to 'drivers/gpu/drm/tilcdc/tilcdc_crtc.c')
-rw-r--r--drivers/gpu/drm/tilcdc/tilcdc_crtc.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
index 3d6000cd5048..773bee27a2d0 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c
@@ -89,6 +89,41 @@ static void set_scanout(struct drm_crtc *crtc, struct drm_framebuffer *fb)
tilcdc_crtc->curr_fb = fb;
}
+static void tilcdc_crtc_enable_irqs(struct drm_device *dev)
+{
+ struct tilcdc_drm_private *priv = dev->dev_private;
+
+ tilcdc_clear_irqstatus(dev, 0xffffffff);
+
+ if (priv->rev == 1) {
+ tilcdc_set(dev, LCDC_RASTER_CTRL_REG,
+ LCDC_V1_UNDERFLOW_INT_ENA);
+ } else {
+ tilcdc_write(dev, LCDC_INT_ENABLE_SET_REG,
+ LCDC_V2_UNDERFLOW_INT_ENA |
+ LCDC_V2_END_OF_FRAME0_INT_ENA |
+ LCDC_FRAME_DONE | LCDC_SYNC_LOST);
+ }
+}
+
+static void tilcdc_crtc_disable_irqs(struct drm_device *dev)
+{
+ struct tilcdc_drm_private *priv = dev->dev_private;
+
+ /* disable irqs that we might have enabled: */
+ if (priv->rev == 1) {
+ tilcdc_clear(dev, LCDC_RASTER_CTRL_REG,
+ LCDC_V1_UNDERFLOW_INT_ENA | LCDC_V1_PL_INT_ENA);
+ tilcdc_clear(dev, LCDC_DMA_CTRL_REG,
+ LCDC_V1_END_OF_FRAME_INT_ENA);
+ } else {
+ tilcdc_write(dev, LCDC_INT_ENABLE_CLR_REG,
+ LCDC_V2_UNDERFLOW_INT_ENA | LCDC_V2_PL_INT_ENA |
+ LCDC_V2_END_OF_FRAME0_INT_ENA |
+ LCDC_FRAME_DONE | LCDC_SYNC_LOST);
+ }
+}
+
static void reset(struct drm_crtc *crtc)
{
struct drm_device *dev = crtc->dev;
@@ -108,6 +143,8 @@ static void start(struct drm_crtc *crtc)
reset(crtc);
+ tilcdc_crtc_enable_irqs(dev);
+
tilcdc_clear(dev, LCDC_DMA_CTRL_REG, LCDC_DUAL_FRAME_BUFFER_ENABLE);
tilcdc_set(dev, LCDC_RASTER_CTRL_REG, LCDC_PALETTE_LOAD_MODE(DATA_ONLY));
tilcdc_set(dev, LCDC_RASTER_CTRL_REG, LCDC_RASTER_ENABLE);
@@ -138,6 +175,8 @@ static void stop(struct drm_crtc *crtc)
}
drm_crtc_vblank_off(crtc);
+
+ tilcdc_crtc_disable_irqs(dev);
}
static void tilcdc_crtc_destroy(struct drm_crtc *crtc)