video: disable video in early suspend [1/1]
authorrongrong zhou <rongrong.zhou@amlogic.com>
Mon, 7 Jan 2019 08:14:56 +0000 (16:14 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Wed, 9 Jan 2019 06:05:47 +0000 (22:05 -0800)
PD#SWPL-2736

Problem:
suspend green screen

Solution:
disable video in early suspend

Verify:
Ampere

Change-Id: If5ad13d2964b1541791d95ffb239293ab1e4ffb6
Signed-off-by: rongrong zhou <rongrong.zhou@amlogic.com>
drivers/amlogic/media/video_sink/video.c

index 689d61f..5d067cd 100644 (file)
@@ -88,6 +88,9 @@ MODULE_AMLOG(LOG_LEVEL_ERROR, 0, LOG_DEFAULT_LEVEL_DESC, LOG_MASK_DESC);
 #include "../common/vfm/vfm.h"
 #include <linux/amlogic/media/amdolbyvision/dolby_vision.h>
 
+#ifdef CONFIG_AMLOGIC_LEGACY_EARLY_SUSPEND
+#include <linux/amlogic/pm.h>
+#endif
 static u32 osd_vpp_misc;
 static u32 osd_vpp_misc_mask;
 static bool update_osd_vpp_misc;
@@ -10446,6 +10449,25 @@ static struct mconfig video_configs[] = {
 #endif
 };
 
+#ifdef CONFIG_AMLOGIC_LEGACY_EARLY_SUSPEND
+static void video_early_suspend(struct early_suspend *h)
+{
+       DisableVideoLayer();
+       DisableVideoLayer2();
+       pr_info("video_early_suspend ok\n");
+}
+
+static void video_late_resume(struct early_suspend *h)
+{
+       pr_info("video_late_resume ok\n");
+};
+
+static struct early_suspend video_early_suspend_handler = {
+       .suspend = video_early_suspend,
+       .resume = video_late_resume,
+};
+#endif
+
 static int amvideom_probe(struct platform_device *pdev)
 {
        int ret = 0;
@@ -10465,11 +10487,17 @@ static int amvideom_probe(struct platform_device *pdev)
 
        pr_info("amvideom vsync irq: %d\n", video_vsync);
 
+#ifdef CONFIG_AMLOGIC_LEGACY_EARLY_SUSPEND
+       register_early_suspend(&video_early_suspend_handler);
+#endif
        return ret;
 }
 
 static int amvideom_remove(struct platform_device *pdev)
 {
+#ifdef CONFIG_AMLOGIC_LEGACY_EARLY_SUSPEND
+       unregister_early_suspend(&video_early_suspend_handler);
+#endif
        return 0;
 }