mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
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 <mark.yao@rock-chips.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user