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)\
}
#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;
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 */
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)
#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);
+ }
+}
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);