spinlock_t reg_lock;
/* lock vop irq reg */
spinlock_t irq_lock;
+ /* mutex vop enable and disable */
+ struct mutex vop_lock;
unsigned int irq;
{
struct vop *vop = to_vop(crtc);
+ mutex_lock(&vop->vop_lock);
drm_crtc_vblank_off(crtc);
/*
clk_disable_unprepare(vop->dclk);
clk_disable_unprepare(vop->aclk);
clk_disable_unprepare(vop->hclk);
+ mutex_unlock(&vop->vop_lock);
}
static void vop_plane_destroy(struct drm_plane *plane)
u16 vact_end = vact_st + vdisplay;
uint32_t val;
+ mutex_lock(&vop->vop_lock);
vop_initial(crtc);
val = BIT(DCLK_INVERT);
enable_irq(vop->irq);
drm_crtc_vblank_on(crtc);
+ mutex_unlock(&vop->vop_lock);
}
static int vop_zpos_cmp(const void *a, const void *b)
{
struct vop *vop = to_vop(crtc);
unsigned long jiffies_left;
+ int ret = 0;
if (!crtc || !vop->is_enabled)
return -ENODEV;
- if (line_num > crtc->mode.vtotal || mstimeout <= 0)
- return -EINVAL;
+ mutex_lock(&vop->vop_lock);
+
+ if (line_num > crtc->mode.vtotal || mstimeout <= 0) {
+ ret = -EINVAL;
+ goto out;
+ }
- if (vop_line_flag_irq_is_enabled(vop))
- return -EBUSY;
+ if (vop_line_flag_irq_is_enabled(vop)) {
+ ret = -EBUSY;
+ goto out;
+ }
reinit_completion(&vop->line_flag_completion);
vop_line_flag_irq_enable(vop, line_num);
if (jiffies_left == 0) {
dev_err(vop->dev, "Timeout waiting for IRQ\n");
- return -ETIMEDOUT;
+ ret = -ETIMEDOUT;
+ goto out;
}
- return 0;
+out:
+ mutex_unlock(&vop->vop_lock);
+
+ return ret;
}
EXPORT_SYMBOL(rockchip_drm_wait_line_flag);
spin_lock_init(&vop->reg_lock);
spin_lock_init(&vop->irq_lock);
+ mutex_init(&vop->vop_lock);
mutex_init(&vop->vsync_mutex);