atv_demod: fix atv audio no output when line frequency offset over default [1/1]

PD#SWPL-16188, PD#TV-11641, PD#TV-10181, PD#TV-9714

Problem:
fix atv audio no output when line frequency offset over 200Hz.

Solution:
1.fix atv audio no output when line frequency offset over 200Hz.
2.atv demod version: [V2.15].

Verify:
verified by tl1.

Change-Id: Ic43c707d3401ea93909856ff83a6842e14f0fc61
Signed-off-by: nengwen.chen <nengwen.chen@amlogic.com>
This commit is contained in:
nengwen.chen
2019-11-01 21:09:23 +08:00
committed by Nengwen Chen
parent be5814a0af
commit 3671939cf8
5 changed files with 52 additions and 2 deletions

View File

@@ -104,6 +104,7 @@
DEBUGFS_CREATE_NODE(atvdemod_isr_en, 0640, dentry, bool)\
DEBUGFS_CREATE_NODE(atv_audio_overmodulated_cnt, 0640, dentry, u32)\
DEBUGFS_CREATE_NODE(support_secam_l, 0640, dentry, bool)\
DEBUGFS_CREATE_NODE(atvdemod_horiz_freq_det_en, 0640, dentry, bool)\
}

View File

@@ -44,8 +44,10 @@
#include "atvdemod_func.h"
#include "atvauddemod_func.h"
#define AMLATVDEMOD_VER "V2.14"
/********************************CODE CHANGE LIST*****************************/
/* Date --- Version --- Note *************************************************/
/* 2019/11/05 --- V2.15 --- Add dynamic monitoring line frequency deviation. */
#define AMLATVDEMOD_VER "V2.15"
struct aml_atvdemod_device *amlatvdemod_devp;

View File

@@ -37,6 +37,7 @@ bool audio_thd_en;
bool atvdemod_det_nonstd_en;
bool atvaudio_det_outputmode_en = true;
bool audio_carrier_offset_det_en;
bool atvdemod_horiz_freq_det_en = true;
unsigned int atvdemod_timer_delay = 100; /* 1s */
unsigned int atvdemod_timer_delay2 = 10; /* 100ms */
@@ -87,6 +88,9 @@ static void atv_demod_monitor_do_work(struct work_struct *work)
if (atvdemod_det_nonstd_en)
atv_dmd_non_std_set(true);
if (atvdemod_horiz_freq_det_en)
atvdemod_horiz_freq_detection();
}
static void atv_demod_monitor_timer_handler(unsigned long arg)

View File

@@ -2545,3 +2545,45 @@ void aml_audio_overmodulation(int enable)
#endif
}
}
void atvdemod_horiz_freq_detection(void)
{
unsigned long data = 0;
int field_lock = 0;
int line_lock = 0;
int line = 0;
int std_line = 0;
unsigned long horiz_freq = 0;
data = atv_dmd_rd_long(APB_BLOCK_ADDR_VDAGC, 0x4c);
field_lock = data & 0x4; /* bit2 */
line_lock = data & 0x10; /* bit4 */
line = (data >> 6) & 0x3ff; /* bit[15-6] */
switch (broad_std) {
case AML_ATV_DEMOD_VIDEO_MODE_PROP_NTSC:
case AML_ATV_DEMOD_VIDEO_MODE_PROP_PAL_M:
std_line = 525;
break;
default:
std_line = 625;
break;
}
if (field_lock == 0 && line_lock == 0) {
/* bit[31-8] */
data = atv_dmd_rd_long(APB_BLOCK_ADDR_VDAGC, 0x10);
/* fh +/- (200 / 0.23841858) */
if ((line - std_line) > 7)
horiz_freq = freq_hz_cvrt + 0x347;
else if ((line - std_line) < -7)
horiz_freq = freq_hz_cvrt - 0x347;
else
horiz_freq = freq_hz_cvrt;
data = (horiz_freq << 8) | (data & 0xff);
atv_dmd_wr_long(APB_BLOCK_ADDR_VDAGC, 0x10, data);
}
}

View File

@@ -215,6 +215,7 @@ extern void set_atvdemod_scan_mode(int val);
extern int atvauddemod_init(void);
extern int amlfmt_aud_standard(int broad_std);
extern void atvauddemod_set_outputmode(void);
void atvdemod_horiz_freq_detection(void);
/*from amldemod/amlfrontend.c*/
extern int vdac_enable_check_dtv(void);