atv_demod: switch channel with the script, the ATV shows no signal [1/1]
authornengwen.chen <nengwen.chen@amlogic.com>
Mon, 29 Oct 2018 03:30:34 +0000 (11:30 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Tue, 30 Oct 2018 11:39:20 +0000 (04:39 -0700)
PD#SWPL-791

Problem:
Switch channel with the script lasts 14 hours, the ATV shows no signal.

Solution:
To avoid conflict, don't need to check the CLK
and PLL states in atv demod write and read function.

Verify:
verified by p321

Change-Id: I033c54f14541ed540dfce1b9c4e21d2b5a8b9487
Signed-off-by: nengwen.chen <nengwen.chen@amlogic.com>
drivers/amlogic/atv_demod/atv_demod_access.c
drivers/amlogic/atv_demod/atv_demod_ops.c
drivers/amlogic/atv_demod/atvdemod_func.c
drivers/amlogic/media/vin/tvin/tvafe/tvafe_general.c

index 0b6243b..390c5d0 100644 (file)
@@ -29,6 +29,7 @@
 
 int amlatvdemod_reg_read(unsigned int reg, unsigned int *val)
 {
+#if 0 /* Don't need to check the CLK and PLL states, it's done in init */
        int ret = 0;
 
        if (is_meson_txlx_cpu() || is_meson_txhd_cpu()) {
@@ -41,13 +42,16 @@ int amlatvdemod_reg_read(unsigned int reg, unsigned int *val)
                /* pr_dbg("%s atv demod pll not init\n", __func__); */
                return 0;
        }
+#endif
 
        *val = readl(amlatvdemod_devp->demod_reg_base + reg);
+
        return 0;
 }
 
 int amlatvdemod_reg_write(unsigned int reg, unsigned int val)
 {
+#if 0 /* Don't need to check the CLK and PLL states, it's done in init */
        int ret = 0;
 
        if (is_meson_txlx_cpu() || is_meson_txhd_cpu()) {
@@ -60,8 +64,10 @@ int amlatvdemod_reg_write(unsigned int reg, unsigned int val)
                /* pr_dbg("%s atv demod pll not init\n", __func__); */
                return 0;
        }
+#endif
 
        writel(val, (amlatvdemod_devp->demod_reg_base + reg));
+
        return 0;
 }
 
index 12ead9f..50b556d 100644 (file)
@@ -114,7 +114,7 @@ int atv_demod_enter_mode(struct dvb_frontend *fe)
                }
        }
 
-       adc_set_pll_cntl(1, ADC_EN_ATV_DEMOD, NULL);
+       err_code = adc_set_pll_cntl(1, ADC_EN_ATV_DEMOD, NULL);
        vdac_enable(1, 1);
        usleep_range(2000, 2100);
        atvdemod_clk_init();
@@ -124,9 +124,10 @@ int atv_demod_enter_mode(struct dvb_frontend *fe)
                aud_demod_clk_gate(1);
                /* atvauddemod_init(); */
        }
+
        if (err_code) {
-               pr_dbg("[amlatvdemod..]%s init atvdemod error.\n", __func__);
-               return err_code;
+               pr_dbg("%s: init atvdemod error %d.\n", __func__, err_code);
+               return -1;
        }
 
        /* aml_afc_timer_enable(fe); */
@@ -339,8 +340,8 @@ static int atv_demod_set_config(struct dvb_frontend *fe, void *priv_cfg)
                if (priv->state != ATVDEMOD_STATE_WORK) {
                        if (fe->ops.tuner_ops.set_config)
                                fe->ops.tuner_ops.set_config(fe, NULL);
-                       atv_demod_enter_mode(fe);
-                       priv->state = ATVDEMOD_STATE_WORK;
+                       if (!atv_demod_enter_mode(fe))
+                               priv->state = ATVDEMOD_STATE_WORK;
                }
                break;
 
@@ -354,8 +355,8 @@ static int atv_demod_set_config(struct dvb_frontend *fe, void *priv_cfg)
 
        case AML_ATVDEMOD_RESUME:
                if (priv->state == ATVDEMOD_STATE_SLEEP) {
-                       atv_demod_enter_mode(fe);
-                       priv->state = ATVDEMOD_STATE_WORK;
+                       if (!atv_demod_enter_mode(fe))
+                               priv->state = ATVDEMOD_STATE_WORK;
                }
                break;
 
index 854f132..d6d1520 100644 (file)
@@ -1746,12 +1746,9 @@ int atvdemod_init(void)
        pr_err("%s do atv_dmd_soft_reset ...\n", __func__);
        /*4.software reset*/
        atv_dmd_soft_reset();
-       atv_dmd_soft_reset();
-       atv_dmd_soft_reset();
-       atv_dmd_soft_reset();
 
-       /* ?????
-        *      while (!all_lock) {
+       /* check the PLL, line lock status, don't need to check. */
+       /*      while (!all_lock) {
         *      data32 = atv_dmd_rd_long(APB_BLOCK_ADDR_VDAGC,0x13<<2);
         *      if ((data32 & 0x1c) == 0x0) {
         *              all_lock = 1;
index a4439a2..363d252 100644 (file)
@@ -810,8 +810,10 @@ int tvafe_adc_get_pll_flag(void)
 {
        unsigned int ret = 0;
 
-       if (!mutex_trylock(&pll_mutex))
+       if (!mutex_trylock(&pll_mutex)) {
+               tvafe_pr_info("%s trylock pll_mutex fail.\n", __func__);
                return 0;
+       }
        ret = adc_pll_chg;
        mutex_unlock(&pll_mutex);
        return ret;