From 7ef827f5a8e5de3b118db135cfca08a4b8a872d8 Mon Sep 17 00:00:00 2001 From: "nengwen.chen" Date: Mon, 29 Oct 2018 11:30:34 +0800 Subject: [PATCH] atv_demod: switch channel with the script, the ATV shows no signal [1/1] 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 --- drivers/amlogic/atv_demod/atv_demod_access.c | 6 ++++++ drivers/amlogic/atv_demod/atv_demod_ops.c | 15 ++++++++------- drivers/amlogic/atv_demod/atvdemod_func.c | 7 ++----- drivers/amlogic/media/vin/tvin/tvafe/tvafe_general.c | 4 +++- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/drivers/amlogic/atv_demod/atv_demod_access.c b/drivers/amlogic/atv_demod/atv_demod_access.c index 0b6243b..390c5d0 100644 --- a/drivers/amlogic/atv_demod/atv_demod_access.c +++ b/drivers/amlogic/atv_demod/atv_demod_access.c @@ -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; } diff --git a/drivers/amlogic/atv_demod/atv_demod_ops.c b/drivers/amlogic/atv_demod/atv_demod_ops.c index 12ead9f..50b556d 100644 --- a/drivers/amlogic/atv_demod/atv_demod_ops.c +++ b/drivers/amlogic/atv_demod/atv_demod_ops.c @@ -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; diff --git a/drivers/amlogic/atv_demod/atvdemod_func.c b/drivers/amlogic/atv_demod/atvdemod_func.c index 854f132..d6d1520 100644 --- a/drivers/amlogic/atv_demod/atvdemod_func.c +++ b/drivers/amlogic/atv_demod/atvdemod_func.c @@ -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; diff --git a/drivers/amlogic/media/vin/tvin/tvafe/tvafe_general.c b/drivers/amlogic/media/vin/tvin/tvafe/tvafe_general.c index a4439a26..363d252 100644 --- a/drivers/amlogic/media/vin/tvin/tvafe/tvafe_general.c +++ b/drivers/amlogic/media/vin/tvin/tvafe/tvafe_general.c @@ -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; -- 2.7.4