video: rockchip: fb: add reference count for vsync
authorHuang Jiachai <hjc@rock-chips.com>
Tue, 6 Sep 2016 10:10:49 +0000 (18:10 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Thu, 8 Sep 2016 07:45:21 +0000 (15:45 +0800)
Change-Id: I76ff8489f3e71f21de3461c0834424b5d1bf1962
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
drivers/video/rockchip/rk_fb.c
include/linux/rk_fb.h

index 2ff4f79af12c42e734561cf1ac1ecfb0a81cc656..fb2e34f690df879f29d92bdbcea4207a8f4cd7a8 100644 (file)
@@ -2913,9 +2913,11 @@ static int rk_fb_ioctl(struct fb_info *info, unsigned int cmd,
        case RK_FBIOSET_VSYNC_ENABLE:
                if (copy_from_user(&enable, argp, sizeof(enable)))
                        return -EFAULT;
-               dev_drv->vsync_info.active = enable;
+               if (enable)
+                       dev_drv->vsync_info.active++;
+               else
+                       dev_drv->vsync_info.active--;
                break;
-
        case RK_FBIOGET_DSP_ADDR:
                dev_drv->ops->get_dsp_addr(dev_drv, dsp_addr);
                if (copy_to_user(argp, &dsp_addr, sizeof(dsp_addr)))
@@ -3467,7 +3469,7 @@ static int rk_fb_wait_for_vsync_thread(void *data)
                ktime_t timestamp = dev_drv->vsync_info.timestamp;
                int ret = wait_event_interruptible(dev_drv->vsync_info.wait,
                                !ktime_equal(timestamp, dev_drv->vsync_info.timestamp) &&
-                               (dev_drv->vsync_info.active || dev_drv->vsync_info.irq_stop));
+                               (dev_drv->vsync_info.active > 0 || dev_drv->vsync_info.irq_stop));
 
                if (!ret)
                        sysfs_notify(&fbi->dev->kobj, NULL, "vsync");
index 2374664e6dfe4f4205308c551506a2a7f8a18c4d..6fbcae14ea9484b7f5197a753bbb296d7f580784 100755 (executable)
@@ -327,7 +327,7 @@ struct rk_fb_frame_time {
 struct rk_fb_vsync {
        wait_queue_head_t wait;
        ktime_t timestamp;
-       bool active;
+       int active;
        bool irq_stop;
        int irq_refcount;
        struct mutex irq_lock;