Commit b9f59376 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Stefan Agner

drm: mxsfb: Enable vblank handling

Enable vblank handling when the CRTC is turned on and disable it when it
is turned off. This requires moving vblank init after the KMS pipeline
initialisation, otherwise drm_vblank_init() gets called with 0 CRTCs.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarEmil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: default avatarStefan Agner <stefan@agner.ch>
Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200727020654.8231-15-laurent.pinchart@ideasonboard.com
parent 07b7fd77
...@@ -161,12 +161,6 @@ static int mxsfb_load(struct drm_device *drm) ...@@ -161,12 +161,6 @@ static int mxsfb_load(struct drm_device *drm)
pm_runtime_enable(drm->dev); pm_runtime_enable(drm->dev);
ret = drm_vblank_init(drm, drm->mode_config.num_crtc);
if (ret < 0) {
dev_err(drm->dev, "Failed to initialise vblank\n");
goto err_vblank;
}
/* Modeset init */ /* Modeset init */
drm_mode_config_init(drm); drm_mode_config_init(drm);
...@@ -176,6 +170,15 @@ static int mxsfb_load(struct drm_device *drm) ...@@ -176,6 +170,15 @@ static int mxsfb_load(struct drm_device *drm)
goto err_vblank; goto err_vblank;
} }
ret = drm_vblank_init(drm, drm->mode_config.num_crtc);
if (ret < 0) {
dev_err(drm->dev, "Failed to initialise vblank\n");
goto err_vblank;
}
/* Start with vertical blanking interrupt reporting disabled. */
drm_crtc_vblank_off(&mxsfb->crtc);
ret = mxsfb_attach_bridge(mxsfb); ret = mxsfb_attach_bridge(mxsfb);
if (ret) { if (ret) {
dev_err(drm->dev, "Cannot connect bridge: %d\n", ret); dev_err(drm->dev, "Cannot connect bridge: %d\n", ret);
......
...@@ -322,8 +322,10 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc, ...@@ -322,8 +322,10 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc,
dma_addr_t paddr; dma_addr_t paddr;
pm_runtime_get_sync(drm->dev); pm_runtime_get_sync(drm->dev);
mxsfb_enable_axi_clk(mxsfb); mxsfb_enable_axi_clk(mxsfb);
drm_crtc_vblank_on(crtc);
mxsfb_crtc_mode_set_nofb(mxsfb); mxsfb_crtc_mode_set_nofb(mxsfb);
/* Write cur_buf as well to avoid an initial corrupt frame */ /* Write cur_buf as well to avoid an initial corrupt frame */
...@@ -353,6 +355,8 @@ static void mxsfb_crtc_atomic_disable(struct drm_crtc *crtc, ...@@ -353,6 +355,8 @@ static void mxsfb_crtc_atomic_disable(struct drm_crtc *crtc,
} }
spin_unlock_irq(&drm->event_lock); spin_unlock_irq(&drm->event_lock);
drm_crtc_vblank_off(crtc);
mxsfb_disable_axi_clk(mxsfb); mxsfb_disable_axi_clk(mxsfb);
pm_runtime_put_sync(drm->dev); pm_runtime_put_sync(drm->dev);
} }
......
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