tvin: tvafe: fix black side on atv snow
authorNian Jing <nian.jing@amlogic.com>
Tue, 10 Jul 2018 06:52:02 +0000 (14:52 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Fri, 3 Aug 2018 06:17:09 +0000 (23:17 -0700)
PD#168366: tvin: tvafe: fix black side on atv snow

Change-Id: I3e40ff3d6e9dbee5ba4db4f720ae3c2d7aebc690
Signed-off-by: Nian Jing <nian.jing@amlogic.com>
drivers/amlogic/media/vin/tvin/tvafe/tvafe.c
drivers/amlogic/media/vin/tvin/tvafe/tvafe_cvd.c
drivers/amlogic/media/vin/tvin/vdin/vdin_drv.h
drivers/amlogic/media/vin/tvin/vdin/vdin_sm.c

index ee2f9a0c50d29723b009b8a2235d7a5001b0d35c..de1b1c746bd842733240b2136f484c66d77564a8 100644 (file)
@@ -643,22 +643,9 @@ bool tvafe_is_nosig(struct tvin_frontend_s *fe)
        if ((port >= TVIN_PORT_CVBS0) && (port <= TVIN_PORT_CVBS3)) {
                ret = tvafe_cvd2_no_sig(&tvafe->cvd2, &devp->mem);
 
-               /*fix black side when config atv snow*/
-               if (ret && (port == TVIN_PORT_CVBS3) &&
-                       (devp->flags & TVAFE_FLAG_DEV_SNOW_FLAG) &&
-                       (tvafe->cvd2.config_fmt == TVIN_SIG_FMT_CVBS_PAL_I) &&
-                       (tvafe->cvd2.info.state != TVAFE_CVD2_STATE_FIND))
-                       tvafe_snow_config_acd();
-               else if ((tvafe->cvd2.config_fmt == TVIN_SIG_FMT_CVBS_PAL_I) &&
-                       (tvafe->cvd2.info.state == TVAFE_CVD2_STATE_FIND) &&
-                       (port == TVIN_PORT_CVBS3))
-                       tvafe_snow_config_acd_resume();
-
                /* normal sigal & adc reg error, reload source mux */
                if (tvafe->cvd2.info.adc_reload_en && !ret)
-
                        tvafe_set_source_muxing(port, devp->pinmux);
-
        }
 
        return ret;
index aee1a1945c41cc33be9c275d81eee6e5ceecc1e0..c8b38cbce4550d7b4644753bda59a968db77c504 100644 (file)
@@ -640,13 +640,11 @@ static void tvafe_cvd2_non_std_config(struct tvafe_cvd2_s *cvd2)
                if ((cvd2->vd_port == TVIN_PORT_CVBS3) ||
                        (cvd2->vd_port == TVIN_PORT_CVBS0)) {
 
-#if ((defined CONFIG_AM_R840) || (defined CONFIG_AM_MXL661))
+                       /*config 0 for tuner R840/mxl661*/
+                       /*si2151 si2159 r842 may need set 1*/
                        W_APB_BIT(CVD2_VSYNC_SIGNAL_THRESHOLD, 0,
                                VS_SIGNAL_AUTO_TH_BIT, VS_SIGNAL_AUTO_TH_WID);
-#else
-                       W_APB_BIT(CVD2_VSYNC_SIGNAL_THRESHOLD, 1,
-                               VS_SIGNAL_AUTO_TH_BIT, VS_SIGNAL_AUTO_TH_WID);
-#endif
+
                        /* vsync signal is not good */
                        W_APB_REG(CVD2_NOISE_THRESHOLD, 0x00);
 
@@ -2631,6 +2629,7 @@ void tvafe_snow_config_acd(void)
        /*0x8e035e is debug test result*/
        if (acd_h_config)
                W_APB_REG(ACD_REG_2D, acd_h_config);
+       acd_h = acd_h_back;
 }
 /*only for pal-i*/
 void tvafe_snow_config_acd_resume(void)
index 35fe508dfdfd019a91022c93c60b2eb1fb7d303d..1ead28def3c8efdca032661ade137ec0f868a771 100644 (file)
@@ -335,6 +335,8 @@ extern void ldim_get_matrix(int *data, int reg_sel);
 extern void ldim_set_matrix(int *data, int reg_sel);
 extern void tvafe_snow_config(unsigned int onoff);
 extern void tvafe_snow_config_clamp(unsigned int onoff);
+extern void tvafe_snow_config_acd(void);
+extern void tvafe_snow_config_acd_resume(void);
 extern void vdin_vf_reg(struct vdin_dev_s *devp);
 extern void vdin_vf_unreg(struct vdin_dev_s *devp);
 extern void vdin_pause_dec(struct vdin_dev_s *devp);
index 4e5a98c3951312a10e81edbc2017e9549ae9f2c2..252a3ab0d2d2f2235499b69400b4801cf7b26103 100644 (file)
@@ -332,8 +332,11 @@ void tvin_smr(struct vdin_dev_s *devp)
                ++sm_p->state_cnt;
 #ifdef CONFIG_AMLOGIC_MEDIA_TVIN_AFE
                if ((port == TVIN_PORT_CVBS3) &&
-                       (devp->flags & VDIN_FLAG_SNOW_FLAG))
+                       (devp->flags & VDIN_FLAG_SNOW_FLAG)) {
                        tvafe_snow_config_clamp(1);
+                       /*fix black side when config atv snow*/
+                       tvafe_snow_config_acd();
+               }
 #endif
                if (sm_ops->nosig(devp->frontend)) {
                        sm_p->exit_nosig_cnt = 0;
@@ -472,8 +475,11 @@ void tvin_smr(struct vdin_dev_s *devp)
                devp->unstable_flag = true;
 #ifdef CONFIG_AMLOGIC_MEDIA_TVIN_AFE
                if ((port == TVIN_PORT_CVBS3) &&
-                       (devp->flags & VDIN_FLAG_SNOW_FLAG))
+                       (devp->flags & VDIN_FLAG_SNOW_FLAG)) {
                        tvafe_snow_config_clamp(0);
+                       /*fix black side when config atv snow*/
+                       tvafe_snow_config_acd_resume();
+               }
 #endif
                if (sm_ops->nosig(devp->frontend)) {
                        nosig = true;