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)
committerZihuan Ling <zihuan.ling@amlogic.com>
Wed, 30 Oct 2019 05:31:03 +0000 (22:31 -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 f73e6db284bdd6d3630b1d8024252b8036001ae6..050143c6e020e03b1984356e0549433f2c3d399f 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++) {