0x00015a60, /* TVIN_SIG_FMT_CVBS_SECAM, */
};
-static int cnt_dbg_en;
static int force_fmt_flag;
-static unsigned int scene_colorful = 1;
-static int scene_colorful_old;
-static int auto_de_en = 1;
+static bool scene_colorful_old;
static int lock_cnt;
static unsigned int cvd_reg8a = 0xa;
static bool ntsc50_en;
-module_param(auto_de_en, int, 0664);
-MODULE_PARM_DESC(auto_de_en, "auto_de_en\n");
-
-module_param(cnt_dbg_en, int, 0664);
-MODULE_PARM_DESC(cnt_dbg_en, "cnt_dbg_en\n");
-
static int cdto_adj_th = TVAFE_CVD2_CDTO_ADJ_TH;
module_param(cdto_adj_th, int, 0664);
MODULE_PARM_DESC(cdto_adj_th, "cvd2_adj_diff_threshold");
/*3:force don't nonstandard configure*/
unsigned int force_nostd = 2;
-/*0x001:enable cdto adj 0x010:enable 3d adj 0x100:enable pga;*/
-/*0x1000:enable hs adj,which can instead cdto*/
-static unsigned int cvd_isr_en = 0x1110;
-module_param(cvd_isr_en, uint, 0644);
-MODULE_PARM_DESC(cvd_isr_en, "cvd_isr_en\n");
-
static int ignore_pal_nt;
module_param(ignore_pal_nt, int, 0644);
MODULE_PARM_DESC(ignore_pal_nt, "ignore_pal_nt\n");
(cvd2->vd_port == TVIN_PORT_CVBS0)) { /* atv */
if (cvd2->config_fmt == TVIN_SIG_FMT_CVBS_PAL_I) {
if (user_param->force_vs_th_flag)
- W_APB_BIT(CVD2_VSYNC_SIGNAL_THRESHOLD,
- user_param->nostd_vs_th, 0, 8);
+ W_APB_REG(CVD2_VSYNC_SIGNAL_THRESHOLD,
+ (user_param->nostd_vs_th & 0xff));
}
}
W_APB_BIT(CVD2_VSYNC_SIGNAL_THRESHOLD, 1,
VS_SIGNAL_AUTO_TH_BIT, VS_SIGNAL_AUTO_TH_WID);
W_APB_REG(CVD2_NOISE_THRESHOLD, 0x04);
- if (scene_colorful)
+ if (cvd2->info.scene_colorful)
W_APB_REG(CVD2_VSYNC_CNTL, 0x02);
if (noise_strenth > 48 && NOISE_JUDGE)
W_APB_BIT(CVD2_H_LOOP_MAXSTATE, 4,
else
W_APB_BIT(CVD2_H_LOOP_MAXSTATE, 5,
HSTATE_MAX_BIT, HSTATE_MAX_WID);
- if (scene_colorful)
+ if (cvd2->info.scene_colorful)
W_APB_REG(CVD2_VSYNC_CNTL, 0x02);
W_APB_REG(CVD2_VSYNC_SIGNAL_THRESHOLD, 0x10);
W_APB_REG(CVD2_NOISE_THRESHOLD, 0x08);
/*config 0 for tuner R840/mxl661*/
/*si2151 si2159 r842 may need set 1*/
- W_APB_BIT(CVD2_VSYNC_SIGNAL_THRESHOLD,
- user_param->nostd_vs_th, 0, 8);
+ W_APB_REG(CVD2_VSYNC_SIGNAL_THRESHOLD,
+ (user_param->nostd_vs_th & 0xff));
+ W_APB_BIT(CVD2_VSYNC_NO_SIGNAL_THRESHOLD,
+ (user_param->nostd_no_vs_th & 0xff),
+ VS_NO_SIGNAL_TH_BIT, VS_NO_SIGNAL_TH_WID);
+ W_APB_BIT(CVD2_VSYNC_CNTL,
+ (user_param->nostd_vs_cntl & 0x3),
+ VS_CNTL_BIT, VS_CNTL_WID);
+ W_APB_BIT(CVD2_VSYNC_TIME_CONSTANT,
+ (user_param->nostd_vloop_tc & 0x3),
+ VLOOP_TC_BIT, VLOOP_TC_WID);
+
+ W_APB_BIT(TVFE_ATV_DMD_CLP_CTRL,
+ (user_param->nostd_dmd_clp_step & 0xfffff),
+ ATV_DMD_IN_CLAMP_STEP_BIT,
+ ATV_DMD_IN_CLAMP_STEP_WID);
/* vsync signal is not good */
W_APB_REG(CVD2_NOISE_THRESHOLD, 0x00);
} else {
- if (scene_colorful)
+ if (cvd2->info.scene_colorful)
W_APB_REG(CVD2_VSYNC_CNTL, 0x02);
W_APB_BIT(CVD2_VSYNC_SIGNAL_THRESHOLD, 1,
VS_SIGNAL_AUTO_TH_BIT, VS_SIGNAL_AUTO_TH_WID);
W_APB_REG(CVD2_VSYNC_SIGNAL_THRESHOLD, 0xf0);
W_APB_REG(CVD2_VSYNC_CNTL, 0x2);
- if (tvafe_dbg_print & TVAFE_DBG_NOSTD)
+ if (tvafe_dbg_print & TVAFE_DBG_NOSTD) {
tvafe_pr_info("%s: out of non-std signal.rssi=%d\n",
__func__, cvd_get_rf_strength());
+ }
}
#else
SYNC_SENSITIVITY) {
W_APB_REG(CVD2_VSYNC_SIGNAL_THRESHOLD, 0xf0);
W_APB_REG(CVD2_VSYNC_CNTL, 0x2);
- if (tvafe_dbg_print & TVAFE_DBG_NOSTD)
+ if (tvafe_dbg_print & TVAFE_DBG_NOSTD) {
tvafe_pr_info("%s: use the cvd register to judge the rssi.rssi=%u\n",
- __func__, R_APB_REG(CVD2_SYNC_NOISE_STATUS));
+ __func__,
+ R_APB_REG(CVD2_SYNC_NOISE_STATUS));
+ }
}
#endif
else{
W_APB_REG(CVD2_VSYNC_CNTL, 0x01);
- W_APB_BIT(CVD2_VSYNC_SIGNAL_THRESHOLD, 0,
- VS_SIGNAL_AUTO_TH_BIT, VS_SIGNAL_AUTO_TH_WID);
+ if (user_param->force_vs_th_flag) {
+ W_APB_REG(CVD2_VSYNC_SIGNAL_THRESHOLD,
+ (user_param->nostd_vs_th & 0xff));
+ } else {
+ W_APB_REG(CVD2_VSYNC_SIGNAL_THRESHOLD,
+ 0);
+ }
}
W_APB_REG(CVD2_NOISE_THRESHOLD, 0x32);
W_APB_BIT(CVD2_ACTIVE_VIDEO_VSTART, 0x2a,
}
#endif
+static void tvafe_cvd2_info_init(struct tvafe_cvd2_s *cvd2)
+{
+ /* init variable */
+ memset(&cvd2->info, 0, sizeof(struct tvafe_cvd2_info_s));
+
+ /* set default value if needed */
+ cvd2->info.scene_colorful = 1;
+}
+
/*
* tvafe cvd2 write Reg table by different format
*/
__func__, tvin_sig_fmt_str(fmt));
cvd2->config_fmt = fmt;
tvafe_cvd2_write_mode_reg(cvd2, mem);
- /* init variable */
- memset(&cvd2->info, 0, sizeof(struct tvafe_cvd2_info_s));
+ tvafe_cvd2_info_init(cvd2);
}
}
chroma_sum_filt = chroma_sum_filt_tmp;
if (chroma_sum_filt >= SCENE_COLORFUL_TH)
- scene_colorful = 1;
+ cvd2->info.scene_colorful = 1;
else
- scene_colorful = 0;
+ cvd2->info.scene_colorful = 0;
- if ((cvd2->hw.h_nonstd | (cvd2->hw.v_nonstd && scene_colorful)) &&
+ if ((cvd2->hw.h_nonstd ||
+ (cvd2->hw.v_nonstd && cvd2->info.scene_colorful)) &&
(cvd2->info.nonstd_cnt < CVD2_NONSTD_CNT_INC_LIMIT)) {
cvd2->info.nonstd_cnt += CVD2_NONSTD_CNT_INC_STEP;
cvd2->info.nonstd_stable_cnt = 0;
if (tvafe_dbg_print & TVAFE_DBG_NOSTD) {
tvafe_pr_info("%s: scene_colorful = %d, chroma_sum_filt = %ld, hw_h_nonstd=%d, hw_v_nonstd=%d\n",
- __func__, scene_colorful, chroma_sum_filt,
+ __func__, cvd2->info.scene_colorful,
+ chroma_sum_filt,
cvd2->hw.h_nonstd, cvd2->hw.v_nonstd);
- tvafe_pr_info("%s: smr_cnt=%d, nonstd_cnt=%d, nonstd_flag=%d, dgain=0x%x, non_std_enable=%d\n",
+ tvafe_pr_info("%s: smr_cnt=%d, nonstd_cnt=%d, stabl_cnt=%d, nonstd_flag=%d, dgain=0x%x, non_std_enable=%d\n",
__func__, cvd2->info.smr_cnt,
cvd2->info.nonstd_cnt,
+ cvd2->info.nonstd_stable_cnt,
cvd2->info.nonstd_flag, dgain,
cvd2->info.non_std_enable);
}
cvd2->info.nonstd_stable_cnt++;
if (tvafe_dbg_print & TVAFE_DBG_NOSTD) {
tvafe_pr_info("%s: scene_colorful = %d, chroma_sum_filt = %ld, hw_h_nonstd=%d, hw_v_nonstd=%d\n",
- __func__, scene_colorful,
+ __func__, cvd2->info.scene_colorful,
chroma_sum_filt,
cvd2->hw.h_nonstd,
cvd2->hw.v_nonstd);
- tvafe_pr_info("%s: smr_cnt=%d, nonstd_cnt=%d, nonstd_flag=%d, dgain=0x%x, non_std_enable=%d\n",
+ tvafe_pr_info("%s: smr_cnt=%d, nonstd_cnt=%d, stabl_cnt=%d, nonstd_flag=%d, dgain=0x%x, non_std_enable=%d\n",
__func__, cvd2->info.smr_cnt,
cvd2->info.nonstd_cnt,
+ cvd2->info.nonstd_stable_cnt,
cvd2->info.nonstd_flag, dgain,
cvd2->info.non_std_enable);
}
l_min = lines->val[i];
l_ave += lines->val[i];
}
- if (lines->check_cnt++ == TVAFE_CVD2_AUTO_DE_CHECK_CNT) {
+ if (lines->check_cnt++ == user_param->vline_chk_cnt) {
lines->check_cnt = 0;
- /* if (tvafe_dbg_print & TVAFE_DBG_SMR) */
- /* tvafe_pr_info("%s: check lines every 100*10ms\n", __func__); */
+ if (tvafe_dbg_print & TVAFE_DBG_SMR) {
+ tvafe_pr_info("%s: check lines every %d*10ms\n",
+ __func__, user_param->vline_chk_cnt);
+ }
l_ave = (l_ave - l_max - l_min + 1) >> 1;
/* get the average value */
if (l_ave > TVAFE_CVD2_AUTO_DE_TH) {
l_min = lines->val[i];
l_ave += lines->val[i];
}
- if (lines->check_cnt++ == TVAFE_CVD2_AUTO_DE_CHECK_CNT)
- lines->check_cnt = TVAFE_CVD2_AUTO_DE_CHECK_CNT;
- if (lines->check_cnt == TVAFE_CVD2_AUTO_DE_CHECK_CNT) {
+ if (lines->check_cnt++ == user_param->vline_chk_cnt)
+ lines->check_cnt = user_param->vline_chk_cnt;
+ if (lines->check_cnt == user_param->vline_chk_cnt) {
l_ave = (l_ave - l_max - l_min + 1) >> 1;
if (l_ave > TVAFE_CVD2_AUTO_VS_TH) {
cvd2->info.vs_adj_en = 1;
if (tvafe_dbg_print & TVAFE_DBG_SMR)
pr_info("[tvafe..] %s: reset auto de.\n", __func__);
}
- /* init variable */
- memset(&cvd2->info, 0, sizeof(struct tvafe_cvd2_info_s));
+ tvafe_cvd2_info_init(cvd2);
cvd2->cvd2_init_en = true;
if (tvafe_dbg_print & TVAFE_DBG_SMR)
ret = false;
cvd2->cvd2_init_en = false;
#ifdef TVAFE_CVD2_AUTO_DE_ENABLE
- if ((!scene_colorful) &&
+ if ((!cvd2->info.scene_colorful) &&
((user_param->auto_adj_en & TVAFE_AUTO_DE) ||
(user_param->auto_adj_en & TVAFE_AUTO_VS))) {
tvafe_cvd2_auto_de(cvd2);
tvafe_pr_info("tvafe_cvd2_info_s->state:0x%x\n", cvd2_info->state);
tvafe_pr_info("tvafe_cvd2_info_s->state_cnt:%d\n",
cvd2_info->state_cnt);
+ tvafe_pr_info("tvafe_cvd2_info_s->scene_colorful:%d\n",
+ cvd2_info->scene_colorful);
tvafe_pr_info("tvafe_cvd2_info_s->non_std_enable:%d\n",
cvd2_info->non_std_enable);
tvafe_pr_info("tvafe_cvd2_info_s->non_std_config:%d\n",
}
tvafe_pr_info("cutwindow_val_vs_ve:%d\n",
user_param->cutwindow_val_vs_ve);
- tvafe_pr_info("auto_adj_en:%d\n", user_param->auto_adj_en);
+ tvafe_pr_info("auto_adj_en:0x%x\n", user_param->auto_adj_en);
+ tvafe_pr_info("vline_chk_cnt:%d\n", user_param->vline_chk_cnt);
tvafe_pr_info("nostd_vs_th:0x%x\n", user_param->nostd_vs_th);
- 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("nostd_no_vs_th:0x%x\n", user_param->nostd_no_vs_th);
+ tvafe_pr_info("nostd_vs_cntl:0x%x\n", user_param->nostd_vs_cntl);
+ tvafe_pr_info("nostd_vloop_tc:0x%x\n", user_param->nostd_vloop_tc);
+ tvafe_pr_info("force_vs_th_flag:%d\n", user_param->force_vs_th_flag);
+ tvafe_pr_info("nostd_stable_cnt:%d\n", user_param->nostd_stable_cnt);
+ tvafe_pr_info("nostd_dmd_clp_step:0x%x\n",
+ user_param->nostd_dmd_clp_step);
+ tvafe_pr_info("skip_vf_num:%d\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);
&user_param->force_vs_th_flag) < 0)
goto tvafe_store_err;
}
- pr_info("[tvafe..]%s: force_vs_th_flag = 0x%x\n",
+ pr_info("[tvafe..]%s: force_vs_th_flag = %d\n",
__func__, user_param->force_vs_th_flag);
} else if (!strncmp(buff, "nostd_vs_th", strlen("nostd_vs_th"))) {
if (parm[1]) {
}
pr_info("[tvafe..]%s: nostd_vs_th = 0x%x\n",
__func__, user_param->nostd_vs_th);
+ } else if (!strncmp(buff, "nostd_no_vs_th", strlen("nostd_no_vs_th"))) {
+ if (parm[1]) {
+ if (kstrtouint(parm[1], 16,
+ &user_param->nostd_no_vs_th) < 0)
+ goto tvafe_store_err;
+ }
+ pr_info("[tvafe..]%s: nostd_no_vs_th = 0x%x\n",
+ __func__, user_param->nostd_no_vs_th);
+ } else if (!strncmp(buff, "nostd_vs_cntl", strlen("nostd_vs_cntl"))) {
+ if (parm[1]) {
+ if (kstrtouint(parm[1], 16,
+ &user_param->nostd_vs_cntl) < 0)
+ goto tvafe_store_err;
+ }
+ pr_info("[tvafe..]%s: nostd_vs_cntl = 0x%x\n",
+ __func__, user_param->nostd_vs_cntl);
+ } else if (!strncmp(buff, "nostd_vloop_tc", strlen("nostd_vloop_tc"))) {
+ if (parm[1]) {
+ if (kstrtouint(parm[1], 16,
+ &user_param->nostd_vloop_tc) < 0)
+ goto tvafe_store_err;
+ }
+ pr_info("[tvafe..]%s: nostd_vloop_tc = 0x%x\n",
+ __func__, user_param->nostd_vloop_tc);
} else if (!strncmp(buff, "nostd_cnt", strlen("nostd_cnt"))) {
if (parm[1]) {
if (kstrtouint(parm[1], 10,
&user_param->nostd_stable_cnt) < 0)
goto tvafe_store_err;
}
- pr_info("[tvafe..]%s: nostd_stable_cnt = 0x%x\n",
+ pr_info("[tvafe..]%s: nostd_stable_cnt = %d\n",
__func__, user_param->nostd_stable_cnt);
} else if (!strncmp(buff, "auto_adj", strlen("auto_adj"))) {
if (parm[1]) {
}
pr_info("[tvafe..]%s: auto_adj_en = 0x%x\n",
__func__, user_param->auto_adj_en);
+ } else if (!strncmp(buff, "vline_chk_cnt",
+ strlen("vline_chk_cnt"))) {
+ if (parm[1]) {
+ if (kstrtouint(parm[1], 10,
+ &user_param->vline_chk_cnt) < 0)
+ goto tvafe_store_err;
+ }
+ pr_info("[tvafe..]%s: vline_chk_cnt = 0x%x\n",
+ __func__, user_param->vline_chk_cnt);
+ } else if (!strncmp(buff, "nostd_dmd_clp_step",
+ strlen("nostd_dmd_clp_step"))) {
+ if (parm[1]) {
+ if (kstrtouint(parm[1], 16,
+ &user_param->nostd_dmd_clp_step) < 0)
+ goto tvafe_store_err;
+ }
+ pr_info("[tvafe..]%s: nostd_dmd_clp_step = 0x%x\n",
+ __func__, user_param->nostd_dmd_clp_step);
} else if (!strncmp(buff, "skip_vf_num", strlen("skip_vf_num"))) {
if (parm[1]) {
if (kstrtouint(parm[1], 10,