summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorLeonard Crestez <leonard.crestez@nxp.com>2018-09-17 16:42:15 +0300
committerRobert Chiras <robert.chiras@nxp.com>2018-11-08 15:07:06 +0200
commit57aca8a76b84182e786cfeaf4f4aac0749d27781 (patch)
treec68b9b42bb405ae012d99fc8c93f0ae08fc20f7c /drivers/gpu
parent5f5c92ee0a6f49b0dddf36addd60cf45cc18964b (diff)
MLK-20181-7: drm/mxsfb: Switch to drm_atomic_helper_commit_tail_rpm
The lcdif block is only powered on when display is active so plane updates when not enabled are not valid. Writing to an unpowered IP block is mostly ignored but can trigger bus errors on some chips. Prevent this situation by switching to drm_atomic_helper_commit_tail_rpm and having the drm core ensure atomic_plane_update is only called while the crtc is active. This avoids having to keep track of "enabled" bits inside the mxsfb driver. This also requires handling the vblank event for disable from mxsfb_pipe_disable. Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Suggested-by: Stefan Agner <stefan@agner.ch> Reviewed-by: Stefan Agner <stefan@agner.ch> Reviewed-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Stefan Agner <stefan@agner.ch> Link: https://patchwork.freedesktop.org/patch/msgid/c19c0c00ed42e8e8f7965aa4821ac295abc5cd05.1537191359.git.leonard.crestez@nxp.com
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/mxsfb/mxsfb_drv.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index 46ad4c1ba6cc..eadc16e0287b 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -167,6 +167,10 @@ static const struct drm_mode_config_funcs mxsfb_mode_config_funcs = {
.atomic_commit = drm_atomic_helper_commit,
};
+static const struct drm_mode_config_helper_funcs mxsfb_mode_config_helpers = {
+ .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm,
+};
+
static void mxsfb_pipe_enable(struct drm_simple_display_pipe *pipe,
struct drm_crtc_state *crtc_state)
{
@@ -200,21 +204,23 @@ static void mxsfb_pipe_enable(struct drm_simple_display_pipe *pipe,
static void mxsfb_pipe_disable(struct drm_simple_display_pipe *pipe)
{
struct mxsfb_drm_private *mxsfb = drm_pipe_to_mxsfb_drm_private(pipe);
- struct drm_crtc *crtc = &pipe->crtc;
struct drm_device *drm = pipe->plane.dev;
-
- spin_lock_irq(&crtc->dev->event_lock);
- if (crtc->state->event) {
- drm_crtc_send_vblank_event(crtc, crtc->state->event);
- crtc->state->event = NULL;
- }
- spin_unlock_irq(&crtc->dev->event_lock);
+ struct drm_crtc *crtc = &pipe->crtc;
+ struct drm_pending_vblank_event *event;
drm_panel_disable(mxsfb->panel);
mxsfb_crtc_disable(mxsfb);
drm_panel_unprepare(mxsfb->panel);
pm_runtime_put_sync(drm->dev);
+ spin_lock_irq(&drm->event_lock);
+ event = crtc->state->event;
+ if (event) {
+ crtc->state->event = NULL;
+ drm_crtc_send_vblank_event(crtc, event);
+ }
+ spin_unlock_irq(&drm->event_lock);
+
if (mxsfb->connector != &mxsfb->panel_connector)
mxsfb->connector = NULL;
}
@@ -343,6 +349,7 @@ static int mxsfb_load(struct drm_device *drm, unsigned long flags)
drm->mode_config.max_width = max_res[0];
drm->mode_config.max_height = max_res[1];
drm->mode_config.funcs = &mxsfb_mode_config_funcs;
+ drm->mode_config.helper_private = &mxsfb_mode_config_helpers;
drm_mode_config_reset(drm);