return err_code;
}
- aml_afc_timer_enable(fe);
- aml_demod_timer_enable(fe);
+ /* aml_afc_timer_enable(fe); */
+ /* aml_demod_timer_enable(fe); */
amlatvdemod_devp->std = 0;
amlatvdemod_devp->audmode = 0;
+ amlatvdemod_devp->soundsys = 0xFF;
atv_demod_set_state(ATVDEMOD_STATE_WORK);
amlatvdemod_devp->std = 0;
amlatvdemod_devp->audmode = 0;
+ amlatvdemod_devp->soundsys = 0xFF;
atv_demod_set_state(ATVDEMOD_STATE_IDEL);
pr_info("%s: OK.\n", __func__);
switch (tvp->cmd) {
case V4L2_SOUND_SYS:
- aud_mode = tvp->data & 0xFF;
+ /* aud_mode = tvp->data & 0xFF; */
+ amlatvdemod_devp->soundsys = tvp->data & 0xFF;
+ if (amlatvdemod_devp->soundsys != 0xFF)
+ aud_mode = amlatvdemod_devp->soundsys;
priv->sound_sys.output_mode = tvp->data & 0xFF;
+#if 0
if (atv_demod_get_state() == ATVDEMOD_STATE_WORK) {
if (is_meson_txlx_cpu() || is_meson_txhd_cpu())
atvauddemod_set_outputmode();
}
+#endif
break;
case V4L2_SLOW_SEARCH_MODE:
/* btsc_detect_delay for btsc detect delay */
unsigned int btsc_detect_delay = 10;
unsigned int nicam_detect_delay = 10;
-unsigned int a2_detect_delay = 10;
+unsigned int a2_detect_delay = 300;
/* signal_audmode for btsc signal audio mode */
unsigned int signal_audmode;
unsigned int audio_thd_threshold1 = 0x1000;
uint32_t reg_value;
uint32_t stereo_power, dual_power;
- mdelay(a2_detect_delay);
+ msleep(a2_detect_delay);
if (auto_en) {
reg_value = adec_rd_reg(CARRIER_MAG_REPORT);
*/
reg_value = adec_rd_reg(ADDR_ADEC_CTRL);
+ pr_info("%s regval:0x%x, signal_audmode:%d, outmode:%d\n",
+ __func__, reg_value, signal_audmode, outmode);
+
if (last_stereo_flag == stereo_flag
&& last_sap_flag == sap_flag
&& last_mode == outmode)
}
break;
case 1: /* Stereo */
- if (outmode != AUDIO_OUTMODE_A2_MONO &&
- outmode != AUDIO_OUTMODE_A2_STEREO) {
+ if ((outmode != AUDIO_OUTMODE_A2_MONO &&
+ outmode != AUDIO_OUTMODE_A2_STEREO)
+ || (last_stereo_flag != stereo_flag)) {
outmode = AUDIO_OUTMODE_A2_STEREO;
aud_mode = AUDIO_OUTMODE_A2_STEREO;
}
break;
case 2: /* Dual */
- if (outmode != AUDIO_OUTMODE_A2_MONO &&
- outmode != AUDIO_OUTMODE_A2_DUAL_A &&
+ if ((outmode != AUDIO_OUTMODE_A2_DUAL_A &&
outmode != AUDIO_OUTMODE_A2_DUAL_B &&
- outmode != AUDIO_OUTMODE_A2_DUAL_AB) {
+ outmode != AUDIO_OUTMODE_A2_DUAL_AB)
+ || (last_dual_flag != dual_flag)) {
outmode = AUDIO_OUTMODE_A2_DUAL_A;
aud_mode = AUDIO_OUTMODE_A2_DUAL_A;
}
uint32_t tmp_value = 0;
int nicam_mono_flag = 0, nicam_stereo_flag = 0, nicam_dual_flag = 0;
int nicam_lock = 0;
- static int last_nicam_lock = -1, last_mono_flag = -1;
+ static int last_nicam_lock = -1, last_nicam_mono_flag = -1;
static int last_stereo_flag = -1, last_dual_flag = -1, last_mode = -1;
update_nicam_mode(&nicam_lock, &nicam_mono_flag,
signal_audmode, outmode);
if (last_nicam_lock == nicam_lock
- && last_mono_flag == nicam_mono_flag
+ && last_nicam_mono_flag == nicam_mono_flag
&& last_stereo_flag == nicam_stereo_flag
&& last_dual_flag == nicam_dual_flag
&& last_mode == outmode)
}
break;
case 1: /* Stereo */
- if (outmode != AUDIO_OUTMODE_NICAM_MONO &&
- outmode != AUDIO_OUTMODE_NICAM_STEREO) {
+ if ((outmode != AUDIO_OUTMODE_NICAM_MONO &&
+ outmode != AUDIO_OUTMODE_NICAM_STEREO)
+ || (last_stereo_flag != nicam_stereo_flag)) {
outmode = AUDIO_OUTMODE_NICAM_STEREO;
aud_mode = AUDIO_OUTMODE_NICAM_STEREO;
}
break;
case 2: /* Dual */
- if (outmode != AUDIO_OUTMODE_NICAM_MONO &&
+ if ((outmode != AUDIO_OUTMODE_NICAM_MONO &&
outmode != AUDIO_OUTMODE_NICAM_DUAL_A &&
outmode != AUDIO_OUTMODE_NICAM_DUAL_B &&
- outmode != AUDIO_OUTMODE_NICAM_DUAL_AB) {
+ outmode != AUDIO_OUTMODE_NICAM_DUAL_AB)
+ || (last_dual_flag != nicam_dual_flag)) {
outmode = AUDIO_OUTMODE_NICAM_DUAL_A;
aud_mode = AUDIO_OUTMODE_NICAM_DUAL_A;
}
break;
case 3: /* NICAM MONO */
- if (outmode != AUDIO_OUTMODE_NICAM_MONO &&
- outmode != AUDIO_OUTMODE_NICAM_MONO1) {
+ if ((outmode != AUDIO_OUTMODE_NICAM_MONO &&
+ outmode != AUDIO_OUTMODE_NICAM_MONO1)
+ || (last_nicam_mono_flag != nicam_mono_flag)) {
outmode = AUDIO_OUTMODE_NICAM_MONO1;
aud_mode = AUDIO_OUTMODE_NICAM_MONO1;
}
pr_info("[%s] tmp_value: 0x%x.\n", __func__, reg_value);
last_nicam_lock = nicam_lock;
- last_mono_flag = nicam_mono_flag;
+ last_nicam_mono_flag = nicam_mono_flag;
last_stereo_flag = nicam_stereo_flag;
last_dual_flag = nicam_dual_flag;
last_mode = outmode;
pr_info("\n%s 0x%x\n", __func__, (reg_value>>16)&0xffff);
if (((reg_value>>16)&0xffff) > audio_a2_threshold) {
std = AUDIO_STANDARD_A2_K;
- aud_mode = AUDIO_OUTMODE_A2_STEREO;
+ if (amlatvdemod_devp->soundsys == 0xFF)
+ aud_mode = AUDIO_OUTMODE_A2_STEREO;
+ else
+ aud_mode = amlatvdemod_devp->soundsys;
} else {
std = AUDIO_STANDARD_BTSC;
- aud_mode = AUDIO_OUTMODE_STEREO;
+ if (amlatvdemod_devp->soundsys == 0xFF)
+ aud_mode = AUDIO_OUTMODE_STEREO;
+ else
+ aud_mode = amlatvdemod_devp->soundsys;
configure_adec(std);
adec_soft_reset();
}
std = AUDIO_STANDARD_NICAM_BG;
configure_adec(std);
adec_soft_reset();
- mdelay(audio_nicam_delay);
+ msleep(audio_nicam_delay);
/* need wait */
pr_info("pll lock: 0x%lx.\n",
atv_dmd_rd_byte(0x06, 0x43) & 0x01);
pr_info("\n%s 0x%x\n", __func__, reg_value);
if (nicam_lock) {
std = AUDIO_STANDARD_NICAM_BG;
- aud_mode = AUDIO_OUTMODE_NICAM_STEREO;
+ if (amlatvdemod_devp->soundsys == 0xFF)
+ aud_mode = AUDIO_OUTMODE_NICAM_STEREO;
+ else
+ aud_mode = amlatvdemod_devp->soundsys;
} else {
std = AUDIO_STANDARD_A2_BG;
- aud_mode = AUDIO_OUTMODE_A2_STEREO;
+ if (amlatvdemod_devp->soundsys == 0xFF)
+ aud_mode = AUDIO_OUTMODE_A2_STEREO;
+ else
+ aud_mode = amlatvdemod_devp->soundsys;
configure_adec(std);
adec_soft_reset();
}
pr_info("\n%s 0x%x\n", __func__, reg_value);
if (nicam_lock) {
std = AUDIO_STANDARD_NICAM_DK;
- aud_mode = AUDIO_OUTMODE_NICAM_STEREO;
+ if (amlatvdemod_devp->soundsys == 0xFF)
+ aud_mode = AUDIO_OUTMODE_NICAM_STEREO;
+ else
+ aud_mode = amlatvdemod_devp->soundsys;
} else {
- std = AUDIO_STANDARD_A2_DK2;
- aud_mode = AUDIO_OUTMODE_A2_STEREO;
+ std = AUDIO_STANDARD_A2_DK1;
+ if (amlatvdemod_devp->soundsys == 0xFF)
+ aud_mode = AUDIO_OUTMODE_A2_STEREO;
+ else
+ aud_mode = amlatvdemod_devp->soundsys;
configure_adec(std);
adec_soft_reset();
}
/* configure_adec(aud_std); */
/* adec_soft_reset(); */
set_outputmode(aud_std, aud_mode);
+ } else {
+ /* for non support adec */
+ aud_std = 0;
}
return 0;