atv_demod: Output big "PO" sound when change source from ATV [1/3]
authornengwen.chen <nengwen.chen@amlogic.com>
Mon, 12 Nov 2018 07:23:04 +0000 (15:23 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 19 Nov 2018 12:20:34 +0000 (04:20 -0800)
PD#SWPL-318

Problem:
Output big "PO" sound when change source from ATV to others,
or switch between small window and full screen in ATV source.

Solution:
disable atv status early when exit ATV source.

Verify:
verified by p321

Change-Id: I82af7f8eaef181f1f72ef1f9d194e33c1efdcdb5
Signed-off-by: nengwen.chen <nengwen.chen@amlogic.com>
drivers/amlogic/atv_demod/atv_demod_ops.c
drivers/amlogic/atv_demod/atv_demod_ops.h
drivers/amlogic/atv_demod/atvdemod_func.c
drivers/amlogic/media/vout/vdac/vdac_dev.c

index b620bf4..029d652 100644 (file)
@@ -52,6 +52,11 @@ unsigned int btsc_sap_mode = 1;      /*0: off 1:monitor 2:auto */
  */
 void aml_fe_get_atvaudio_state(int *state)
 {
+#if 0 /* delay notification stable */
+       static unsigned int count;
+       static bool mute = true;
+#endif
+       int av_status = 0;
        int power = 0;
        int vpll_lock = 0;
        int line_lock = 0;
@@ -64,14 +69,16 @@ void aml_fe_get_atvaudio_state(int *state)
                return;
        }
 
+       av_status = tvin_get_av_status();
        /* scan mode need mute */
        if (priv->state == ATVDEMOD_STATE_WORK
                        && !priv->scanning
-                       && !priv->standby) {
+                       && !priv->standby
+                       && av_status) {
                retrieve_vpll_carrier_lock(&vpll_lock);
                retrieve_vpll_carrier_line_lock(&line_lock);
                if ((vpll_lock == 0) && (line_lock == 0)) {
-                       retrieve_vpll_carrier_audio_power(&power);
+                       /* retrieve_vpll_carrier_audio_power(&power); */
                        *state = 1;
                } else {
                        *state = 0;
@@ -80,9 +87,9 @@ void aml_fe_get_atvaudio_state(int *state)
                }
        } else {
                *state = 0;
-               pr_audio("%s, ATV in state[%d], scanning[%d], standby[%d].\n",
-                               __func__, priv->state,
-                               priv->scanning, priv->standby);
+               pr_audio("ATV state[%d], scan[%d], standby[%d], av[%d].\n",
+                               priv->state, priv->scanning,
+                               priv->standby, av_status);
        }
 
        /* If the atv signal is locked, it means there is audio data,
@@ -94,7 +101,23 @@ void aml_fe_get_atvaudio_state(int *state)
        else
                *state = 0;
 #endif
-       pr_audio("aml_fe_get_atvaudio_state: %d, power = %d.\n",
+#if 0 /* delay notification stable */
+       if (*state) {
+               if (mute) {
+                       count++;
+                       if (count > 100) {
+                               count = 0;
+                               mute = false;
+                       } else
+                               *state = 0;
+               } else
+                       count = 0;
+       } else {
+               count = 0;
+               mute = true;
+       }
+#endif
+       pr_audio("aml_fe_get_atvaudio_state: %d, power = %d\n",
                        *state, power);
 }
 
@@ -150,6 +173,7 @@ int atv_demod_leave_mode(struct dvb_frontend *fe)
        struct atv_demod_priv *priv = fe->analog_demod_priv;
 
        priv->state = ATVDEMOD_STATE_IDEL;
+       priv->standby = true;
 
        if (priv->afc.disable)
                priv->afc.disable(&priv->afc);
@@ -256,9 +280,10 @@ static void atv_demod_set_params(struct dvb_frontend *fe,
 
                if (priv->monitor.enable)
                        priv->monitor.enable(&priv->monitor);
-       }
 
-       priv->standby = false;
+               /* for searching mute audio */
+               priv->standby = false;
+       }
 }
 
 static int atv_demod_has_signal(struct dvb_frontend *fe, u16 *signal)
@@ -344,6 +369,7 @@ static int atv_demod_set_config(struct dvb_frontend *fe, void *priv_cfg)
        switch (*state) {
        case AML_ATVDEMOD_INIT:
                if (priv->state != ATVDEMOD_STATE_WORK) {
+                       priv->standby = true;
                        if (fe->ops.tuner_ops.set_config)
                                fe->ops.tuner_ops.set_config(fe, NULL);
                        if (!atv_demod_enter_mode(fe))
index d6a091e..775c5ec 100644 (file)
@@ -70,6 +70,7 @@ struct atv_demod_priv {
 
 
 extern int atv_demod_enter_mode(struct dvb_frontend *fe);
+extern int tvin_get_av_status(void);
 
 struct dvb_frontend *aml_atvdemod_attach(struct dvb_frontend *fe,
                struct v4l2_frontend *v4l2_fe,
index d6d1520..286c161 100644 (file)
@@ -1766,6 +1766,10 @@ int atvdemod_init(void)
 
 void atvdemod_uninit(void)
 {
+       /* mute atv audio output */
+       if (is_meson_txl_cpu())
+               atv_dmd_wr_long(APB_BLOCK_ADDR_MONO_PROC, 0x50, 0);
+
        atv_dmd_non_std_set(false);
 }
 
index 587cdae..7383b85 100644 (file)
@@ -372,6 +372,12 @@ void vdac_enable(bool on, unsigned int module_sel)
        mutex_lock(&vdac_mutex);
        switch (module_sel) {
        case VDAC_MODULE_ATV_DEMOD: /* atv demod */
+               if ((on && (pri_flag & VDAC_MODULE_ATV_DEMOD))
+                       || (!on && !(pri_flag & VDAC_MODULE_ATV_DEMOD))) {
+                       pr_info("%s: ATV DEMOD had done!:%d.\n", __func__, on);
+                       break;
+               }
+
                if (on) {
                        ana_ref_cntl0_bit9(1, VDAC_MODULE_ATV_DEMOD);
                        /*after txlx need reset bandgap after bit9 enabled*/