mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
atv_demod: tm2: atv demod basic functin bringup [1/1]
PD#SWPL-6731 Problem: atv demod basic functin bringup. Solution: atv demod basic functin bringup. Verify: Verified by ab301 and ab309. Change-Id: Ie2d92aad9d2ebf2493f26c50ff7ded57cd040b1c Signed-off-by: nengwen.chen <nengwen.chen@amlogic.com>
This commit is contained in:
@@ -38,7 +38,7 @@ 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()) {
|
||||
} else if (is_meson_tl1_cpu() || is_meson_tm2_cpu()) {
|
||||
amlatvdemod_hiu_reg_read(HHI_GCLK_MPEG0, &ret);
|
||||
if (0 == ((1 << 22) & ret)) {
|
||||
pr_err("%s GCLK_MPEG0:0x%x\n", __func__, ret);
|
||||
@@ -66,7 +66,7 @@ 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()) {
|
||||
} else if (is_meson_tl1_cpu() || is_meson_tm2_cpu()) {
|
||||
amlatvdemod_hiu_reg_read(HHI_GCLK_MPEG0, &ret);
|
||||
if (0 == ((1 << 22) & ret)) {
|
||||
pr_err("%s GCLK_MPEG0:0x%x\n", __func__, ret);
|
||||
@@ -94,7 +94,7 @@ 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()) {
|
||||
} else if (is_meson_tl1_cpu() || is_meson_tm2_cpu()) {
|
||||
amlatvdemod_hiu_reg_read(HHI_GCLK_MPEG0, &ret);
|
||||
if (0 == ((1 << 28) & ret)) {
|
||||
pr_err("%s GCLK_MPEG0:0x%x\n", __func__, ret);
|
||||
@@ -119,7 +119,7 @@ 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()) {
|
||||
} else if (is_meson_tl1_cpu() || is_meson_tm2_cpu()) {
|
||||
amlatvdemod_hiu_reg_read(HHI_GCLK_MPEG0, &ret);
|
||||
if (0 == ((1 << 28) & ret)) {
|
||||
pr_err("%s GCLK_MPEG0:0x%x\n", __func__, ret);
|
||||
|
||||
@@ -95,14 +95,14 @@ static ssize_t aml_atvdemod_store(struct class *class,
|
||||
pr_info("atv init error.\n");
|
||||
} else if (!strncmp(parm[0], "audout_mode", 11)) {
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu()
|
||||
|| is_meson_tl1_cpu()) {
|
||||
|| is_meson_tl1_cpu() || is_meson_tm2_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()
|
||||
|| is_meson_tl1_cpu()) {
|
||||
|| is_meson_tl1_cpu() || is_meson_tm2_cpu()) {
|
||||
update_btsc_mode(1, &stereo_flag, &sap_flag);
|
||||
pr_info("get signal_audmode done ....\n");
|
||||
}
|
||||
@@ -110,7 +110,7 @@ static ssize_t aml_atvdemod_store(struct class *class,
|
||||
adc_set_pll_cntl(1, 0x1, NULL);
|
||||
atvdemod_clk_init();
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu()
|
||||
|| is_meson_tl1_cpu())
|
||||
|| is_meson_tl1_cpu() || is_meson_tm2_cpu())
|
||||
aud_demod_clk_gate(1);
|
||||
pr_info("atvdemod_clk_init done ....\n");
|
||||
} else if (!strncmp(parm[0], "tune", 4)) {
|
||||
@@ -725,7 +725,7 @@ static int aml_atvdemod_probe(struct platform_device *pdev)
|
||||
dev->audio_reg_base = ioremap(round_down(0xffd0d340, 0x3), 4);
|
||||
|
||||
pr_info("audio_reg_base = 0x%p.\n", dev->audio_reg_base);
|
||||
} else if (is_meson_tl1_cpu()) {
|
||||
} else if (is_meson_tl1_cpu() || is_meson_tm2_cpu()) {
|
||||
dev->audio_reg_base = ioremap(round_down(0xff60074c, 0x3), 4);
|
||||
|
||||
pr_info("audio_reg_base = 0x%p.\n", dev->audio_reg_base);
|
||||
|
||||
@@ -146,7 +146,8 @@ 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() || is_meson_tl1_cpu()) {
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu() || is_meson_tl1_cpu()
|
||||
|| is_meson_tm2_cpu()) {
|
||||
aud_demod_clk_gate(1);
|
||||
/* atvauddemod_init(); */
|
||||
}
|
||||
@@ -191,7 +192,8 @@ 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() || is_meson_tl1_cpu())
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu() || is_meson_tl1_cpu()
|
||||
|| is_meson_tm2_cpu())
|
||||
aud_demod_clk_gate(0);
|
||||
|
||||
amlatvdemod_devp->std = 0;
|
||||
@@ -685,7 +687,8 @@ static void atvdemod_fe_try_analog_format(struct v4l2_frontend *v4l2_fe,
|
||||
*audio_fmt = audio;
|
||||
|
||||
/* for audio standard detection */
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu() || is_meson_tl1_cpu()) {
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu() || is_meson_tl1_cpu()
|
||||
|| is_meson_tm2_cpu()) {
|
||||
*soundsys = amlfmt_aud_standard(broad_std);
|
||||
*soundsys = (*soundsys << 16) | 0x00FFFF;
|
||||
} else
|
||||
|
||||
@@ -1440,7 +1440,7 @@ void configure_adec(int Audio_mode)
|
||||
/*
|
||||
* set gate clk for btsc and nicam .
|
||||
*/
|
||||
if (is_meson_txhd_cpu() || is_meson_tl1_cpu())
|
||||
if (is_meson_txhd_cpu() || is_meson_tl1_cpu() || is_meson_tm2_cpu())
|
||||
adec_wr_reg(0x28, 0xa);
|
||||
|
||||
set_standard(Audio_mode);
|
||||
@@ -1546,7 +1546,7 @@ void set_output_left_right_exchange(unsigned int ch)
|
||||
|
||||
atvaudio_ctrl_read(&read);
|
||||
|
||||
if (is_meson_tl1_cpu()) { /* bit[19] */
|
||||
if (is_meson_tl1_cpu() || is_meson_tm2_cpu()) { /* bit[19] */
|
||||
if ((read & (1 << 19)) != ((ch & 0x01) << 19))
|
||||
atvaudio_ctrl_write((read & ~(1 << 19)) |
|
||||
((ch & 0x01) << 19));
|
||||
|
||||
@@ -292,7 +292,7 @@ void atv_dmd_misc(void)
|
||||
atv_dmd_wr_long(APB_BLOCK_ADDR_SIF_STG_2,
|
||||
0x1c, 0x0f000);
|
||||
atvaudio_ctrl_read(®);
|
||||
if (is_meson_tl1_cpu())
|
||||
if (is_meson_tl1_cpu() || is_meson_tm2_cpu())
|
||||
atvaudio_ctrl_write(reg & (~0x100000));/* bit20 */
|
||||
else
|
||||
atvaudio_ctrl_write(reg & (~0x3));/* bit[1-0] */
|
||||
@@ -305,7 +305,7 @@ void atv_dmd_misc(void)
|
||||
atv_dmd_wr_long(APB_BLOCK_ADDR_SIF_STG_2,
|
||||
0x1c, 0x1f000);
|
||||
atvaudio_ctrl_read(®);
|
||||
if (is_meson_tl1_cpu())
|
||||
if (is_meson_tl1_cpu() || is_meson_tm2_cpu())
|
||||
atvaudio_ctrl_write(reg | 0x100000);/* bit20 */
|
||||
else
|
||||
atvaudio_ctrl_write(reg | 0x3);/* bit[1-0] */
|
||||
@@ -315,7 +315,7 @@ void atv_dmd_misc(void)
|
||||
|
||||
void atv_dmd_ring_filter(bool on)
|
||||
{
|
||||
if (!is_meson_tl1_cpu())
|
||||
if (!is_meson_tl1_cpu() && !is_meson_tm2_cpu())
|
||||
return;
|
||||
|
||||
if (on) {
|
||||
@@ -1673,7 +1673,7 @@ int atvdemod_clk_init(void)
|
||||
W_HIU_BIT(RESET1_REGISTER, 1, 7, 1);
|
||||
}
|
||||
#endif
|
||||
if (is_meson_tl1_cpu())
|
||||
if (is_meson_tl1_cpu() || is_meson_tm2_cpu())
|
||||
W_HIU_REG(HHI_ATV_DMD_SYS_CLK_CNTL, 0x1800080);
|
||||
else
|
||||
W_HIU_REG(HHI_ATV_DMD_SYS_CLK_CNTL, 0x80);
|
||||
@@ -1915,7 +1915,8 @@ int amlfmt_aud_standard(int broad_std)
|
||||
|
||||
int atvauddemod_init(void)
|
||||
{
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu() || is_meson_tl1_cpu()) {
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu() || is_meson_tl1_cpu()
|
||||
|| is_meson_tm2_cpu()) {
|
||||
if (audio_thd_en)
|
||||
audio_thd_init();
|
||||
|
||||
@@ -1938,7 +1939,8 @@ int atvauddemod_init(void)
|
||||
|
||||
void atvauddemod_set_outputmode(void)
|
||||
{
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu() || is_meson_tl1_cpu()) {
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu() || is_meson_tl1_cpu()
|
||||
|| is_meson_tm2_cpu()) {
|
||||
if (aud_reinit) {
|
||||
/* before maybe need check afc status */
|
||||
atvauddemod_init();
|
||||
@@ -1952,7 +1954,8 @@ int atvdemod_init(bool on)
|
||||
/* 1.set system clock when atv enter*/
|
||||
|
||||
pr_dbg("%s do configure_receiver ...\n", __func__);
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu() || is_meson_tl1_cpu())
|
||||
if (is_meson_txlx_cpu() || is_meson_txhd_cpu() || is_meson_tl1_cpu()
|
||||
|| is_meson_tm2_cpu())
|
||||
sound_format = 1;
|
||||
configure_receiver(broad_std, if_freq, if_inv, gde_curve, sound_format);
|
||||
pr_dbg("%s do atv_dmd_misc ...\n", __func__);
|
||||
@@ -2457,10 +2460,13 @@ void aml_audio_overmodulation(int enable)
|
||||
atv_dmd_wr_long(APB_BLOCK_ADDR_SIF_STG_2,
|
||||
0x1c, 0x0f000);
|
||||
atvaudio_ctrl_read(®);
|
||||
if (is_meson_tl1_cpu()) /* bit20 */
|
||||
if (is_meson_tl1_cpu() || is_meson_tm2_cpu()) {
|
||||
/* bit20 */
|
||||
atvaudio_ctrl_write(reg & (~0x100000));
|
||||
else
|
||||
atvaudio_ctrl_write(reg & (~0x3));/* bit[1-0] */
|
||||
} else {
|
||||
/* bit[1-0] */
|
||||
atvaudio_ctrl_write(reg & (~0x3));
|
||||
}
|
||||
/* audio_atv_ov_flag = 1;*/ /* Enter and hold */
|
||||
pr_info("tmp_v[0x%lx] > 0x10 && audio_atv_ov_flag == 0.\n",
|
||||
tmp_v);
|
||||
@@ -2475,10 +2481,13 @@ void aml_audio_overmodulation(int enable)
|
||||
atv_dmd_wr_long(APB_BLOCK_ADDR_SIF_STG_2,
|
||||
0x1c, 0x1f000);
|
||||
atvaudio_ctrl_read(®);
|
||||
if (is_meson_tl1_cpu()) /* bit20 */
|
||||
if (is_meson_tl1_cpu() || is_meson_tm2_cpu()) {
|
||||
/* bit20 */
|
||||
atvaudio_ctrl_write(reg | 0x100000);
|
||||
else
|
||||
atvaudio_ctrl_write(reg | 0x3);/* bit[1-0] */
|
||||
} else {
|
||||
/* bit[1-0] */
|
||||
atvaudio_ctrl_write(reg | 0x3);
|
||||
}
|
||||
audio_atv_ov_flag = 0;
|
||||
pr_info("tmp_v[0x%lx] <= 0x10 && audio_atv_ov_flag == 1.\n",
|
||||
tmp_v);
|
||||
|
||||
Reference in New Issue
Block a user