From: Mark Yao Date: Tue, 6 Sep 2016 08:44:57 +0000 (+0800) Subject: drm/rockchip: vop: reject vlank control when vop is disabled X-Git-Tag: firefly_0821_release~1548 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f064782cc6750e31d178dc31d34b0ef3c8a5e8d7;p=firefly-linux-kernel-4.4.55.git drm/rockchip: vop: reject vlank control when vop is disabled drm enable/disable_vblank callback maybe call when vop is disabled, it would cause system hang, we need reject it. Change-Id: I3825fc9074203579bba0f71b1135f77075af85bb Signed-off-by: Mark Yao --- diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 4b76d8cecf4e..e5c95bdb38ea 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -158,6 +158,7 @@ struct vop { struct drm_property *plane_feature_prop; bool is_iommu_enabled; bool is_iommu_needed; + bool is_enabled; /* mutex vsync_ work */ struct mutex vsync_mutex; @@ -558,6 +559,7 @@ static void vop_enable(struct drm_crtc *crtc) VOP_WIN_SET(vop, win, gate, 1); } + vop->is_enabled = true; spin_lock(&vop->reg_lock); @@ -620,6 +622,7 @@ static void vop_crtc_disable(struct drm_crtc *crtc) disable_irq(vop->irq); + vop->is_enabled = false; if (vop->is_iommu_enabled) { /* * vop standby complete, so iommu detach is safe. @@ -978,6 +981,9 @@ static int vop_crtc_enable_vblank(struct drm_crtc *crtc) struct vop *vop = to_vop(crtc); unsigned long flags; + if (!vop->is_enabled) + return -EPERM; + spin_lock_irqsave(&vop->irq_lock, flags); VOP_INTR_SET_TYPE(vop, enable, FS_INTR, 1); @@ -992,6 +998,9 @@ static void vop_crtc_disable_vblank(struct drm_crtc *crtc) struct vop *vop = to_vop(crtc); unsigned long flags; + if (!vop->is_enabled) + return; + spin_lock_irqsave(&vop->irq_lock, flags); VOP_INTR_SET_TYPE(vop, enable, FS_INTR, 0);