atv_demod: Output big "PO" sound when change source from ATV [1/3]
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>
diff --git a/drivers/amlogic/atv_demod/atv_demod_ops.c b/drivers/amlogic/atv_demod/atv_demod_ops.c
index b620bf4..029d652 100644
--- a/drivers/amlogic/atv_demod/atv_demod_ops.c
+++ b/drivers/amlogic/atv_demod/atv_demod_ops.c
@@ -52,6 +52,11 @@
*/
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 @@
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 @@
}
} 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 @@
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 @@
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 @@
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 @@
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))
diff --git a/drivers/amlogic/atv_demod/atv_demod_ops.h b/drivers/amlogic/atv_demod/atv_demod_ops.h
index d6a091e..775c5ec 100644
--- a/drivers/amlogic/atv_demod/atv_demod_ops.h
+++ b/drivers/amlogic/atv_demod/atv_demod_ops.h
@@ -70,6 +70,7 @@
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,
diff --git a/drivers/amlogic/atv_demod/atvdemod_func.c b/drivers/amlogic/atv_demod/atvdemod_func.c
index d6d1520..286c161 100644
--- a/drivers/amlogic/atv_demod/atvdemod_func.c
+++ b/drivers/amlogic/atv_demod/atvdemod_func.c
@@ -1766,6 +1766,10 @@
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);
}
diff --git a/drivers/amlogic/media/vout/vdac/vdac_dev.c b/drivers/amlogic/media/vout/vdac/vdac_dev.c
index 587cdae..7383b85 100644
--- a/drivers/amlogic/media/vout/vdac/vdac_dev.c
+++ b/drivers/amlogic/media/vout/vdac/vdac_dev.c
@@ -372,6 +372,12 @@
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*/