From 3b6058f04ad1cf697d248426d2bf2be34396fa46 Mon Sep 17 00:00:00 2001 From: Evoke Zhang Date: Mon, 17 Jun 2019 14:49:44 +0800 Subject: [PATCH] tvafe: fix identify as PAL-DK when the input signal is SCAM DK [1/1] PD#TV-7779 Problem: identify as PAL-DK when the input signal is SECAM DK Solution: increase atv try_fmt max cnt to recognize SECAM Verify: x301 Change-Id: I306f2337b6b2c3d0b4ec2fc85e45f9f5993b754b Signed-off-by: Evoke Zhang --- .../amlogic/media/vin/tvin/tvafe/tvafe_cvd.c | 17 +++++++++++++---- .../amlogic/media/vin/tvin/tvafe/tvafe_cvd.h | 3 +++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/amlogic/media/vin/tvin/tvafe/tvafe_cvd.c b/drivers/amlogic/media/vin/tvin/tvafe/tvafe_cvd.c index 951bd60c5e55..8af1edcedd93 100644 --- a/drivers/amlogic/media/vin/tvin/tvafe/tvafe_cvd.c +++ b/drivers/amlogic/media/vin/tvin/tvafe/tvafe_cvd.c @@ -90,7 +90,6 @@ #define SYNC_SENSITIVITY true #define NOISE_JUDGE false #define PGA_DEFAULT_VAL 0x20 -#define TRY_FORMAT_MAX 5 /*0:NORMAL 1:a little sharper 2:sharper 3:even sharper*/ #define CVD2_FILTER_CONFIG_LEVEL 0 @@ -132,6 +131,9 @@ module_param(config_force_fmt, uint, 0664); MODULE_PARM_DESC(config_force_fmt, "after try TRY_FORMAT_MAX times ,we will force one fmt"); +unsigned int try_fmt_max_atv = 24; /* 5->24 for SECAM identify to PAL */ +unsigned int try_fmt_max_av = 5; + /*0:normal nonstandard configure every loop*/ /*1:force nonstandard configure every loop*/ /*2:nonstandard configure once*/ @@ -1569,6 +1571,13 @@ static void tvafe_cvd2_search_video_mode(struct tvafe_cvd2_s *cvd2, struct tvafe_cvd2_mem_s *mem) { unsigned int shift_cnt = 0; + unsigned int try_format_max; + + if ((cvd2->vd_port == TVIN_PORT_CVBS3) || + (cvd2->vd_port == TVIN_PORT_CVBS0)) + try_format_max = try_fmt_max_atv; + else + try_format_max = try_fmt_max_av; /* execute manual mode */ if ((cvd2->manual_fmt) && (cvd2->config_fmt != cvd2->manual_fmt) && @@ -1625,10 +1634,10 @@ static void tvafe_cvd2_search_video_mode(struct tvafe_cvd2_s *cvd2, cvd2->hw_data[cvd2->hw_data_cur].secam_detected); /* force mode:due to some*/ /*signal is hard to check out */ - if (++try_format_cnt == TRY_FORMAT_MAX) { + if (++try_format_cnt == try_format_max) { cvd_force_config_fmt(cvd2, mem, config_force_fmt); return; - } else if (try_format_cnt > TRY_FORMAT_MAX) { + } else if (try_format_cnt > try_format_max) { cvd2->info.state = TVAFE_CVD2_STATE_FIND; force_fmt_flag = 1; return; @@ -1836,7 +1845,7 @@ static void tvafe_cvd2_search_video_mode(struct tvafe_cvd2_s *cvd2, cvd_force_config_fmt(cvd2, mem, config_force_fmt); try_format_cnt = - TRY_FORMAT_MAX+1; + try_format_max+1; } else tvafe_cvd2_try_format(cvd2, mem, TVIN_SIG_FMT_CVBS_PAL_I); diff --git a/drivers/amlogic/media/vin/tvin/tvafe/tvafe_cvd.h b/drivers/amlogic/media/vin/tvin/tvafe/tvafe_cvd.h index ee0fc33f30df..3daab7d044f0 100644 --- a/drivers/amlogic/media/vin/tvin/tvafe/tvafe_cvd.h +++ b/drivers/amlogic/media/vin/tvin/tvafe/tvafe_cvd.h @@ -224,5 +224,8 @@ extern void tvafe_cvd2_non_std_config(struct tvafe_cvd2_s *cvd2); extern bool tvafe_snow_function_flag; +extern unsigned int try_fmt_max_atv; +extern unsigned int try_fmt_max_av; + #endif /* _TVAFE_CVD_H */