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()) {
/* 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()) {
/* pr_dbg("%s atv demod pll not init\n", __func__); */
return 0;
}
+#endif
writel(val, (amlatvdemod_devp->demod_reg_base + reg));
+
return 0;
}
}
}
- 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();
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); */
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;
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;
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;