#include "../vdin/vdin_ctl.h"
/***************************Local defines**********************************/
-#define TVAFE_CVD2_SHIFT_CNT 6
-/* cnt*10ms,delay for fmt shift counter */
-
#define TVAFE_CVD2_NONSTD_DGAIN_MAX 0x500
/* CVD max digital gain for non-std signal */
#define TVAFE_CVD2_NONSTD_CNT_MAX 0x0A
module_param(cdto_adj_step, int, 0664);
MODULE_PARM_DESC(cdto_adj_step, "cvd2_adj_step");
-static int cvd2_shift_cnt = TVAFE_CVD2_SHIFT_CNT;
-module_param(cvd2_shift_cnt, int, 0664);
-MODULE_PARM_DESC(cvd2_shift_cnt, "cvd2_shift_cnt");
+/* cnt*10ms,delay for fmt shift counter */
+static unsigned int cvd2_shift_cnt_atv = 6;
+static unsigned int cvd2_shift_cnt_av = 2;
/*force the fmt for chrome off,for example ntsc pal_i 12*/
static unsigned int config_force_fmt;
unsigned int vbi_mem_start;
+void cvd_set_shift_cnt(enum tvafe_cvd2_shift_cnt_e src, unsigned int val)
+{
+ if (src == TVAFE_CVD2_SHIFT_CNT_ATV)
+ cvd2_shift_cnt_atv = val;
+ else if (src == TVAFE_CVD2_SHIFT_CNT_AV)
+ cvd2_shift_cnt_av = val;
+ else
+ pr_err("[%s]wrong src para.\n", __func__);
+}
+
+unsigned int cvd_get_shift_cnt(enum tvafe_cvd2_shift_cnt_e src)
+{
+ unsigned int shift_cnt = 0;
+
+ if (src == TVAFE_CVD2_SHIFT_CNT_ATV)
+ shift_cnt = cvd2_shift_cnt_atv;
+ else if (src == TVAFE_CVD2_SHIFT_CNT_AV)
+ shift_cnt = cvd2_shift_cnt_av;
+ else
+ pr_err("[%s]wrong src para.\n", __func__);
+
+ return shift_cnt;
+}
void cvd_vbi_mem_set(unsigned int offset, unsigned int size)
{
unsigned int try_format_max;
if ((cvd2->vd_port == TVIN_PORT_CVBS3) ||
- (cvd2->vd_port == TVIN_PORT_CVBS0))
+ (cvd2->vd_port == TVIN_PORT_CVBS0)) {
try_format_max = try_fmt_max_atv;
- else
+ shift_cnt = cvd2_shift_cnt_atv;
+ } else {
try_format_max = try_fmt_max_av;
+ shift_cnt = cvd2_shift_cnt_av;
+ }
/* execute manual mode */
if ((cvd2->manual_fmt) && (cvd2->config_fmt != cvd2->manual_fmt) &&
try_format_cnt = 0;
if (tvafe_cvd2_condition_shift(cvd2)) {
if (cvd2->info.non_std_enable)
- shift_cnt = cvd2_shift_cnt*10;
- else
- shift_cnt = cvd2_shift_cnt;
+ shift_cnt *= 10;
+
/* if no color burst,*/
/*pal flag can not be trusted */
if (cvd2->info.fmt_shift_cnt++ > shift_cnt) {
}
pr_info("[tvafe..]%s: tvafe_dbg_print = 0x%x\n",
__func__, tvafe_dbg_print);
+ } else if (!strcmp(parm[0], "shift_cnt_av")) {
+ if (parm[1]) {
+ if (kstrtouint(parm[1], 10, &val) < 0) {
+ pr_info("str->uint error.\n");
+ goto tvafe_store_err;
+ } else {
+ cvd_set_shift_cnt(TVAFE_CVD2_SHIFT_CNT_AV,
+ val);
+ pr_info("[tvafe]%s: av shift cnt = %d\n",
+ __func__, val);
+ }
+ } else
+ pr_info("[shift_cnt_av]miss parameter,ori val = %d\n",
+ cvd_get_shift_cnt(TVAFE_CVD2_SHIFT_CNT_AV));
+ } else if (!strcmp(parm[0], "shift_cnt_atv")) {
+ if (parm[1]) {
+ if (kstrtouint(parm[1], 10, &val) < 0) {
+ pr_info("str->uint error.\n");
+ goto tvafe_store_err;
+ } else {
+ cvd_set_shift_cnt(TVAFE_CVD2_SHIFT_CNT_ATV,
+ val);
+ pr_info("[tvafe]%s: atv shift cnt = %d\n",
+ __func__, val);
+ }
+ } else
+ pr_info("[shift_cnt_atv]miss parameter,ori val = %d\n",
+ cvd_get_shift_cnt(TVAFE_CVD2_SHIFT_CNT_ATV));
} else
tvafe_pr_info("[%s]:invaild command.\n", __func__);
kfree(buf_orig);