videosync: fix can not enter standby [1/1]
authorjintao xu <jintao.xu@amlogic.com>
Thu, 24 Oct 2019 11:00:48 +0000 (19:00 +0800)
committerTao Zeng <tao.zeng@amlogic.com>
Fri, 25 Oct 2019 06:01:11 +0000 (23:01 -0700)
PD#SWPL-15663

Problem:
wake_up always active.

Solution:
No call wake_up when no videosync active.

Verify:
U212

Change-Id: I83b76bf878331db249a2d10bdb65b2c086e28a93
Signed-off-by: jintao xu <jintao.xu@amlogic.com>
drivers/amlogic/media/video_processor/videosync/videosync.c

index f73e6db..050143c 100644 (file)
@@ -205,7 +205,21 @@ static void videosync_vf_put(struct vframe_s *vf, void *op_arg)
 
 void vsync_notify_videosync(void)
 {
-       if (videosync_inited) {
+       int i = 0;
+       struct videosync_s *dev_s = NULL;
+       bool has_active = false;
+
+       if (!videosync_inited)
+               return;
+
+       for (i = 0; i < VIDEOSYNC_S_COUNT; i++) {
+               dev_s = &vp_dev->video_prov[i];
+               if (dev_s && dev_s->active_state == VIDEOSYNC_ACTIVE) {
+                       has_active = true;
+                       break;
+               }
+       }
+       if (has_active) {
                vp_dev->wakeup = 1;
                wake_up_interruptible(&vp_dev->videosync_wait);
        }
@@ -1156,7 +1170,8 @@ static void videosync_thread_tick(struct videosync_dev *dev)
        if (!dev)
                return;
 
-       wait_event_interruptible(dev->videosync_wait, dev->wakeup);
+       wait_event_interruptible_timeout(dev->videosync_wait, dev->wakeup,
+                                        msecs_to_jiffies(500));
        dev->wakeup = 0;
 
        for (i = 0; i < VIDEOSYNC_S_COUNT; i++) {