mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
atv_demod: add atv demod support for tl1 [1/1]
PD#172587 Problem: 1.add atv demod driver and dts config for tl1. 2.merge from bringup/amlogic-4.9/tl1-20181111. Solution: add atv demod driver and dts config for tl1 Verify: verified by t962x2_x301 Change-Id: Ibbc00f9d478a9f5e52c6333b9a819aac381894ec Signed-off-by: nengwen.chen <nengwen.chen@amlogic.com>
This commit is contained in:
@@ -885,6 +885,21 @@
|
||||
tuner_xtal_cap = <25>; /* when tuner_xtal_mode = 3, set 25 */
|
||||
};
|
||||
|
||||
atv-demod {
|
||||
compatible = "amlogic, atv-demod";
|
||||
status = "okay";
|
||||
tuner = <&tuner>;
|
||||
btsc_sap_mode = <1>;
|
||||
/* pinctrl-names="atvdemod_agc_pins"; */
|
||||
/* pinctrl-0=<&atvdemod_agc_pins>; */
|
||||
reg = <0xff656000 0x2000 /* demod reg */
|
||||
0xff63c000 0x2000 /* hiu reg */
|
||||
0xff634000 0x2000 /* periphs reg */
|
||||
0xff64a000 0x2000>; /* audio reg */
|
||||
reg_23cf = <0x88188832>;
|
||||
/*default:0x88188832;r840 on haier:0x48188832*/
|
||||
};
|
||||
|
||||
bt-dev{
|
||||
compatible = "amlogic, bt-dev";
|
||||
status = "okay";
|
||||
|
||||
@@ -889,6 +889,21 @@
|
||||
tuner_xtal_cap = <25>; /* when tuner_xtal_mode = 3, set 25 */
|
||||
};
|
||||
|
||||
atv-demod {
|
||||
compatible = "amlogic, atv-demod";
|
||||
status = "okay";
|
||||
tuner = <&tuner>;
|
||||
btsc_sap_mode = <1>;
|
||||
/* pinctrl-names="atvdemod_agc_pins"; */
|
||||
/* pinctrl-0=<&atvdemod_agc_pins>; */
|
||||
reg = <0xff656000 0x2000 /* demod reg */
|
||||
0xff63c000 0x2000 /* hiu reg */
|
||||
0xff634000 0x2000 /* periphs reg */
|
||||
0xff64a000 0x2000>; /* audio reg */
|
||||
reg_23cf = <0x88188832>;
|
||||
/*default:0x88188832;r840 on haier:0x48188832*/
|
||||
};
|
||||
|
||||
bt-dev{
|
||||
compatible = "amlogic, bt-dev";
|
||||
status = "okay";
|
||||
|
||||
@@ -38,6 +38,12 @@ int amlatvdemod_reg_read(unsigned int reg, unsigned int *val)
|
||||
pr_err("%s GCLK_MPEG0:0x%x\n", __func__, ret);
|
||||
return 0;
|
||||
}
|
||||
} else if (is_meson_tl1_cpu()) {
|
||||
amlatvdemod_hiu_reg_read(HHI_GCLK_MPEG0, &ret);
|
||||
if (0 == ((1 << 22) & ret)) {
|
||||
pr_err("%s GCLK_MPEG0:0x%x\n", __func__, ret);
|
||||
return 0;
|
||||
}
|
||||
} else if (0 == (ADC_EN_ATV_DEMOD & tvafe_adc_get_pll_flag())) {
|
||||
/* pr_dbg("%s atv demod pll not init\n", __func__); */
|
||||
return 0;
|
||||
@@ -60,6 +66,12 @@ int amlatvdemod_reg_write(unsigned int reg, unsigned int val)
|
||||
pr_err("%s GCLK_MPEG0:0x%x\n", __func__, ret);
|
||||
return 0;
|
||||
}
|
||||
} else if (is_meson_tl1_cpu()) {
|
||||
amlatvdemod_hiu_reg_read(HHI_GCLK_MPEG0, &ret);
|
||||
if (0 == ((1 << 22) & ret)) {
|
||||
pr_err("%s GCLK_MPEG0:0x%x\n", __func__, ret);
|
||||
return 0;
|
||||
}
|
||||
} else if (0 == (ADC_EN_ATV_DEMOD & tvafe_adc_get_pll_flag())) {
|
||||
/* pr_dbg("%s atv demod pll not init\n", __func__); */
|
||||
return 0;
|
||||
@@ -73,6 +85,7 @@ int amlatvdemod_reg_write(unsigned int reg, unsigned int val)
|
||||
|
||||
int atvaudiodem_reg_read(unsigned int reg, unsigned int *val)
|
||||
{
|
||||
#if 0
|
||||
int ret = 0;
|
||||
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu()) {
|
||||
@@ -81,8 +94,14 @@ int atvaudiodem_reg_read(unsigned int reg, unsigned int *val)
|
||||
pr_err("%s GCLK_MPEG0:0x%x\n", __func__, ret);
|
||||
return 0;
|
||||
}
|
||||
} else if (is_meson_tl1_cpu()) {
|
||||
amlatvdemod_hiu_reg_read(HHI_GCLK_MPEG0, &ret);
|
||||
if (0 == ((1 << 28) & ret)) {
|
||||
pr_err("%s GCLK_MPEG0:0x%x\n", __func__, ret);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
if (amlatvdemod_devp->audio_reg_base)
|
||||
*val = readl(amlatvdemod_devp->audio_reg_base + reg);
|
||||
|
||||
@@ -91,6 +110,7 @@ int atvaudiodem_reg_read(unsigned int reg, unsigned int *val)
|
||||
|
||||
int atvaudiodem_reg_write(unsigned int reg, unsigned int val)
|
||||
{
|
||||
#if 0
|
||||
int ret = 0;
|
||||
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu()) {
|
||||
@@ -99,7 +119,14 @@ int atvaudiodem_reg_write(unsigned int reg, unsigned int val)
|
||||
pr_err("%s GCLK_MPEG0:0x%x\n", __func__, ret);
|
||||
return 0;
|
||||
}
|
||||
} else if (is_meson_tl1_cpu()) {
|
||||
amlatvdemod_hiu_reg_read(HHI_GCLK_MPEG0, &ret);
|
||||
if (0 == ((1 << 28) & ret)) {
|
||||
pr_err("%s GCLK_MPEG0:0x%x\n", __func__, ret);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (amlatvdemod_devp->audio_reg_base)
|
||||
writel(val, (amlatvdemod_devp->audio_reg_base + reg));
|
||||
|
||||
@@ -93,20 +93,23 @@ static ssize_t aml_atvdemod_store(struct class *class,
|
||||
if (ret)
|
||||
pr_info("atv init error.\n");
|
||||
} else if (!strncmp(parm[0], "audout_mode", 11)) {
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu()) {
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu()
|
||||
|| is_meson_tl1_cpu()) {
|
||||
atvauddemod_set_outputmode();
|
||||
pr_info("atvauddemod_set_outputmode done ....\n");
|
||||
}
|
||||
} else if (!strncmp(parm[0], "signal_audmode", 14)) {
|
||||
int stereo_flag, sap_flag;
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu()) {
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu()
|
||||
|| is_meson_tl1_cpu()) {
|
||||
update_btsc_mode(1, &stereo_flag, &sap_flag);
|
||||
pr_info("get signal_audmode done ....\n");
|
||||
}
|
||||
} else if (!strncmp(parm[0], "clk", 3)) {
|
||||
adc_set_pll_cntl(1, 0x1, NULL);
|
||||
atvdemod_clk_init();
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu())
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu()
|
||||
|| is_meson_tl1_cpu())
|
||||
aud_demod_clk_gate(1);
|
||||
pr_info("atvdemod_clk_init done ....\n");
|
||||
} else if (!strncmp(parm[0], "tune", 4)) {
|
||||
@@ -623,6 +626,12 @@ static int aml_atvdemod_probe(struct platform_device *pdev)
|
||||
dev->audio_demod_reg_base = ioremap(
|
||||
round_down(0xffd0d340, 0x3), 4);
|
||||
|
||||
pr_info("audio_demod_reg_base = 0x%p.\n",
|
||||
dev->audio_demod_reg_base);
|
||||
} else if (is_meson_tl1_cpu()) {
|
||||
dev->audio_demod_reg_base = ioremap(
|
||||
round_down(0xff600340, 0x3), 4);
|
||||
|
||||
pr_info("audio_demod_reg_base = 0x%p.\n",
|
||||
dev->audio_demod_reg_base);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,9 @@ static void atv_demod_monitor_do_work(struct work_struct *work)
|
||||
audio_thd_det();
|
||||
|
||||
if (atvaudio_det_outputmode_en &&
|
||||
(is_meson_txlx_cpu() || is_meson_txhd_cpu()))
|
||||
(is_meson_txlx_cpu()
|
||||
|| is_meson_txhd_cpu()
|
||||
|| is_meson_tl1_cpu()))
|
||||
atvauddemod_set_outputmode();
|
||||
|
||||
if (atvdemod_det_nonstd_en)
|
||||
|
||||
@@ -146,7 +146,7 @@ int atv_demod_enter_mode(struct dvb_frontend *fe)
|
||||
atvdemod_clk_init();
|
||||
/* err_code = atvdemod_init(); */
|
||||
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu()) {
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu() || is_meson_tl1_cpu()) {
|
||||
aud_demod_clk_gate(1);
|
||||
/* atvauddemod_init(); */
|
||||
}
|
||||
@@ -189,7 +189,7 @@ int atv_demod_leave_mode(struct dvb_frontend *fe)
|
||||
|
||||
vdac_enable(0, 1);
|
||||
adc_set_pll_cntl(0, ADC_EN_ATV_DEMOD, NULL);
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu())
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu() || is_meson_tl1_cpu())
|
||||
aud_demod_clk_gate(0);
|
||||
|
||||
amlatvdemod_devp->std = 0;
|
||||
@@ -405,11 +405,16 @@ static int atv_demod_set_config(struct dvb_frontend *fe, void *priv_cfg)
|
||||
|
||||
case AML_ATVDEMOD_UNSCAN_MODE:
|
||||
priv->scanning = false;
|
||||
/* No need to enable when exiting the scan,
|
||||
* but enable when actually played.
|
||||
*/
|
||||
#if 0
|
||||
if (priv->afc.enable)
|
||||
priv->afc.enable(&priv->afc);
|
||||
|
||||
if (priv->monitor.enable)
|
||||
priv->monitor.enable(&priv->monitor);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1292,7 +1292,7 @@ void configure_adec(int Audio_mode)
|
||||
/*
|
||||
* set gate clk for btsc and nicam .
|
||||
*/
|
||||
if (is_meson_txhd_cpu())
|
||||
if (is_meson_txhd_cpu() || is_meson_tl1_cpu())
|
||||
adec_wr_reg(0x28, 0xa);
|
||||
|
||||
set_standard(Audio_mode);
|
||||
|
||||
@@ -1579,7 +1579,10 @@ int atvdemod_clk_init(void)
|
||||
W_HIU_BIT(RESET1_REGISTER, 1, 7, 1);
|
||||
}
|
||||
#endif
|
||||
W_HIU_REG(HHI_ATV_DMD_SYS_CLK_CNTL, 0x80);
|
||||
if (is_meson_tl1_cpu())
|
||||
W_HIU_REG(HHI_ATV_DMD_SYS_CLK_CNTL, 0x1800080);
|
||||
else
|
||||
W_HIU_REG(HHI_ATV_DMD_SYS_CLK_CNTL, 0x80);
|
||||
|
||||
/* read_version_register(); */
|
||||
|
||||
@@ -1709,14 +1712,16 @@ int amlfmt_aud_standard(int broad_std)
|
||||
|
||||
int atvauddemod_init(void)
|
||||
{
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu()) {
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu() || is_meson_tl1_cpu()) {
|
||||
if (audio_thd_en)
|
||||
audio_thd_init();
|
||||
|
||||
if (aud_auto)
|
||||
aud_std = amlfmt_aud_standard(broad_std);
|
||||
/* configure_adec(aud_std); */
|
||||
/* adec_soft_reset(); */
|
||||
else {
|
||||
configure_adec(aud_std);
|
||||
adec_soft_reset();
|
||||
}
|
||||
set_outputmode(aud_std, aud_mode);
|
||||
} else {
|
||||
/* for non support adec */
|
||||
@@ -1737,7 +1742,7 @@ int atvdemod_init(void)
|
||||
/* 1.set system clock when atv enter*/
|
||||
|
||||
pr_err("%s do configure_receiver ...\n", __func__);
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu())
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu() || is_meson_tl1_cpu())
|
||||
sound_format = 1;
|
||||
configure_receiver(broad_std, if_freq, if_inv, gde_curve, sound_format);
|
||||
pr_err("%s do atv_dmd_misc ...\n", __func__);
|
||||
|
||||
Reference in New Issue
Block a user