From 07e33ba84b4cd3eb0e9c29913481c3c3d89debb8 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 --- drivers/amlogic/media/vin/tvin/tvafe/tvafe.h | 2 +- .../amlogic/media/vin/tvin/tvafe/tvafe_cvd.c | 17 +++++++++++++---- .../amlogic/media/vin/tvin/tvafe/tvafe_cvd.h | 3 +++ .../amlogic/media/vin/tvin/tvafe/tvafe_debug.c | 14 ++++++++++++++ 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/drivers/amlogic/media/vin/tvin/tvafe/tvafe.h b/drivers/amlogic/media/vin/tvin/tvafe/tvafe.h index 32218e0b8d02..48541ef23c3d 100644 --- a/drivers/amlogic/media/vin/tvin/tvafe/tvafe.h +++ b/drivers/amlogic/media/vin/tvin/tvafe/tvafe.h @@ -32,7 +32,7 @@ /* ************************************************* */ /* *** macro definitions ********************************************* */ /* *********************************************************** */ -#define TVAFE_VER "Ref.2019/07/02" +#define TVAFE_VER "Ref.2019/07/15" /* used to set the flag of tvafe_dev_s */ #define TVAFE_FLAG_DEV_OPENED 0x00000010 diff --git a/drivers/amlogic/media/vin/tvin/tvafe/tvafe_cvd.c b/drivers/amlogic/media/vin/tvin/tvafe/tvafe_cvd.c index ab63d6c267e9..14aed9c4af23 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 @@ -141,6 +140,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*/ @@ -1555,6 +1557,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) && @@ -1611,10 +1620,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; @@ -1822,7 +1831,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 346a853fea22..281e8ff6ff30 100644 --- a/drivers/amlogic/media/vin/tvin/tvafe/tvafe_cvd.h +++ b/drivers/amlogic/media/vin/tvin/tvafe/tvafe_cvd.h @@ -223,5 +223,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 */ diff --git a/drivers/amlogic/media/vin/tvin/tvafe/tvafe_debug.c b/drivers/amlogic/media/vin/tvin/tvafe/tvafe_debug.c index 94f920eb1089..9f7c098f5a3b 100644 --- a/drivers/amlogic/media/vin/tvin/tvafe/tvafe_debug.c +++ b/drivers/amlogic/media/vin/tvin/tvafe/tvafe_debug.c @@ -199,6 +199,8 @@ static void tvafe_state(struct tvafe_dev_s *devp) tvafe_pr_info("force_vs_th_flag:0x%x\n", user_param->force_vs_th_flag); tvafe_pr_info("nostd_stable_cnt:0x%x\n", user_param->nostd_stable_cnt); tvafe_pr_info("skip_vf_num:0x%x\n", user_param->skip_vf_num); + tvafe_pr_info("try_fmt_max_atv:%d\n", try_fmt_max_atv); + tvafe_pr_info("try_fmt_max_av:%d\n", try_fmt_max_av); tvafe_pr_info("tvafe version : %s\n", TVAFE_VER); } @@ -398,6 +400,18 @@ static ssize_t tvafe_store(struct device *dev, } pr_info("[tvafe..]%s: skip_vf_num = %d\n", __func__, user_param->skip_vf_num); + } else if (!strncmp(buff, "try_fmt_max_atv", + strlen("try_fmt_max_atv"))) { + if (kstrtouint(parm[1], 10, &try_fmt_max_atv) < 0) + goto tvafe_store_err; + pr_info("[tvafe..]%s: set try_fmt_max_atv = %d\n", + __func__, try_fmt_max_atv); + } else if (!strncmp(buff, "try_fmt_max_av", + strlen("try_fmt_max_av"))) { + if (kstrtouint(parm[1], 10, &try_fmt_max_av) < 0) + goto tvafe_store_err; + pr_info("[tvafe..]%s: set try_fmt_max_av = %d\n", + __func__, try_fmt_max_av); } else if (!strncmp(buff, "dbg_print", strlen("dbg_print"))) { if (parm[1]) { if (kstrtouint(parm[1], 16, &tvafe_dbg_print) < 0)