cvbs: fix display set mode block
authorNian Jing <nian.jing@amlogic.com>
Wed, 24 Jan 2018 06:00:34 +0000 (14:00 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Tue, 30 Jan 2018 04:01:21 +0000 (20:01 -0800)
PD#157658: add delaywork enable dac

Change-Id: I2682c80c7a28d8bfdb88e038141c3e83aea33c46
Signed-off-by: Nian Jing <nian.jing@amlogic.com>
drivers/amlogic/media/vout/cvbs/cvbs_out.c
drivers/amlogic/media/vout/cvbs/cvbs_out.h

index bbcbcac..47fe2f4 100644 (file)
@@ -34,6 +34,8 @@
 /*#include <linux/major.h>*/
 #include <linux/cdev.h>
 #include <linux/delay.h>
+#include <linux/jiffies.h>
+#include <linux/workqueue.h>
 #include <linux/uaccess.h>
 #include <linux/clk.h>
 
@@ -260,6 +262,7 @@ static void cvbs_out_disable_clk(void)
 
 static void cvbs_out_disable_venc(void)
 {
+       info->dwork_flag = 0;
        cvbs_cntl_output(0);
        cvbs_out_reg_write(ENCI_VIDEO_EN, 0);
 
@@ -352,6 +355,13 @@ static void cvbs_out_clk_gate_ctrl(int status)
        }
 }
 
+static void cvbs_dv_dwork(struct work_struct *work)
+{
+       if (!info->dwork_flag)
+               return;
+       cvbs_cntl_output(1);
+}
+
 int cvbs_out_setmode(void)
 {
        int ret;
@@ -381,9 +391,8 @@ int cvbs_out_setmode(void)
 #ifdef CONFIG_CVBS_PERFORMANCE_COMPATIBILITY_SUPPORT
        cvbs_performance_enhancement(local_cvbs_mode);
 #endif
-       msleep(1000);
-       cvbs_cntl_output(1);
-
+       info->dwork_flag = 1;
+       schedule_delayed_work(&info->dv_dwork, msecs_to_jiffies(1000));
        mutex_unlock(&setmode_mutex);
        return 0;
 }
@@ -565,6 +574,7 @@ static int cvbs_vmode_is_supported(enum vmode_e mode)
 }
 static int cvbs_module_disable(enum vmode_e cur_vmod)
 {
+       info->dwork_flag = 0;
        cvbs_cntl_output(0);
 
        cvbs_out_vpu_power_ctrl(0);
@@ -578,6 +588,7 @@ static int cvbs_suspend(void)
 {
        /* TODO */
        /* video_dac_disable(); */
+       info->dwork_flag = 0;
        cvbs_cntl_output(0);
        return 0;
 }
@@ -1261,6 +1272,7 @@ static int cvbsout_probe(struct platform_device *pdev)
                cvbs_log_err("create_cvbs_attr error\n");
                return -1;
        }
+       INIT_DELAYED_WORK(&info->dv_dwork, cvbs_dv_dwork);
        cvbs_log_info("%s OK\n", __func__);
        return 0;
 }
index 7be7113..e980c69 100644 (file)
@@ -18,6 +18,9 @@
 #ifndef _CVBS_OUT_H_
 #define _CVBS_OUT_H_
 
+/* Standard Linux Headers */
+#include <linux/workqueue.h>
+
 /* Amlogic Headers */
 #include <linux/amlogic/media/vout/vout_notify.h>
 #include "cvbs_mode.h"
@@ -95,6 +98,8 @@ struct disp_module_info_s {
        struct device *dev;
        struct meson_cvbsout_data *cvbs_data;
        struct cvbs_config_s cvbs_conf;
+       struct delayed_work dv_dwork;
+       bool dwork_flag;
 
        /* clktree */
        unsigned int clk_gate_state;