tvafe: add tvafe_mode to separate avt playing or search [1/1]

PD#TV-8035

Problem:
snowflake display is not stable when no signal

Solution:
separate avt playing or search

Verify:
x301

Change-Id: I4364d4af533704074a74e7d3b9522df461233f48
Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
This commit is contained in:
Evoke Zhang
2019-07-25 15:22:58 +08:00
committed by Luke Go
parent 8d4026515c
commit 3a293ede3e
3 changed files with 35 additions and 18 deletions

View File

@@ -429,16 +429,19 @@ int tuner_rssi = -80;
bool slow_mode;
typedef int (*hook_func_t) (void);
typedef int (*hook_func1_t)(bool);
hook_func_t aml_fe_hook_atv_status;
hook_func_t aml_fe_hook_hv_lock;
hook_func_t aml_fe_hook_get_fmt;
hook_func1_t aml_fe_hook_set_mode;
void aml_fe_hook_cvd(hook_func_t atv_mode, hook_func_t cvd_hv_lock,
hook_func_t get_fmt)
hook_func_t get_fmt, hook_func1_t set_mode)
{
aml_fe_hook_atv_status = atv_mode;
aml_fe_hook_hv_lock = cvd_hv_lock;
aml_fe_hook_get_fmt = get_fmt;
aml_fe_hook_set_mode = set_mode;
pr_info("%s: OK.\n", __func__);
}
@@ -1131,7 +1134,10 @@ static enum v4l2_search atvdemod_fe_search(struct v4l2_frontend *v4l2_fe)
if (p->afc_range == 0) {
pr_err("[%s] afc_range == 0, skip the search\n", __func__);
aml_fe_hook_set_mode(0);
return V4L2_SEARCH_INVALID;
} else {
aml_fe_hook_set_mode(1);
}
tuner_id = priv->atvdemod_param.tuner_id;

View File

@@ -86,20 +86,9 @@ static bool enable_db_reg = true;
module_param(enable_db_reg, bool, 0644);
MODULE_PARM_DESC(enable_db_reg, "enable/disable tvafe load reg");
bool tvafe_dbg_enable;
module_param(tvafe_dbg_enable, bool, 0644);
MODULE_PARM_DESC(tvafe_dbg_enable, "enable/disable tvafe debug enable");
static int cutwindow_val_v = TVAFE_VS_VE_VAL;
static int cutwindow_val_v_level0 = 4;
static int cutwindow_val_v_level1 = 8;
static int cutwindow_val_v_level2 = 14;
static int cutwindow_val_v_level3 = 16;
static int cutwindow_val_v_level4 = 24;
static int cutwindow_val_h_level1 = 10;
static int cutwindow_val_h_level2 = 18;
static int cutwindow_val_h_level3 = 20;
static int cutwindow_val_h_level4 = 62;/*48-->62 for ntsc-m*/
/*0: atv playmode*/
/*1: atv search mode*/
static bool tvafe_mode;
/*tvconfig snow config*/
static bool snow_cfg;
@@ -203,6 +192,14 @@ void tvafe_cma_release(struct tvafe_dev_s *devp)
#endif
#ifdef CONFIG_AMLOGIC_ATV_DEMOD
static int tvafe_work_mode(bool mode)
{
tvafe_pr_info("%s: %d\n", __func__, mode);
tvafe_mode = mode;
return 0;
}
static int tvafe_get_v_fmt(void)
{
int fmt = 0;
@@ -306,7 +303,7 @@ int tvafe_dec_open(struct tvin_frontend_s *fe, enum tvin_port_e port)
g_tvafe_info = tvafe;
/* register aml_fe hook for atv search */
aml_fe_hook_cvd(tvafe_cvd2_get_atv_format, tvafe_cvd2_get_hv_lock,
tvafe_get_v_fmt);
tvafe_get_v_fmt, tvafe_work_mode);
#endif
tvafe_pr_info("%s open port:0x%x ok.\n", __func__, port);
@@ -472,7 +469,7 @@ void tvafe_dec_close(struct tvin_frontend_s *fe)
#ifdef CONFIG_AMLOGIC_ATV_DEMOD
g_tvafe_info = NULL;
/* register aml_fe hook for atv search */
aml_fe_hook_cvd(NULL, NULL, NULL);
aml_fe_hook_cvd(NULL, NULL, NULL, NULL);
#endif
/**set cvd2 reset to high**/
tvafe_cvd2_hold_rst();
@@ -654,6 +651,18 @@ bool tvafe_is_nosig(struct tvin_frontend_s *fe)
if ((port >= TVIN_PORT_CVBS0) && (port <= TVIN_PORT_CVBS3)) {
ret = tvafe_cvd2_no_sig(&tvafe->cvd2, &devp->mem);
if ((port < TVIN_PORT_CVBS0) || (port > TVIN_PORT_CVBS3))
return ret;
if (tvafe->cvd2.info.smr_cnt++ >= 65536)
tvafe->cvd2.info.smr_cnt = 0;
ret = tvafe_cvd2_no_sig(&tvafe->cvd2, &devp->mem);
if ((!tvafe_mode) && (port == TVIN_PORT_CVBS3) &&
(devp->flags & TVAFE_FLAG_DEV_SNOW_FLAG)) /* playing snow */
ret = true;
if ((port == TVIN_PORT_CVBS3) &&
(tvafe->cvd2.config_fmt == TVIN_SIG_FMT_CVBS_PAL_I)) {
/*fix black side when config atv snow*/
if (ret && (port == TVIN_PORT_CVBS3) &&
(devp->flags & TVAFE_FLAG_DEV_SNOW_FLAG) &&

View File

@@ -98,8 +98,10 @@ bool tvafe_get_snow_cfg(void);
void tvafe_set_snow_cfg(bool cfg);
typedef int (*hook_func_t)(void);
typedef int (*hook_func1_t)(bool);
extern void aml_fe_hook_cvd(hook_func_t atv_mode,
hook_func_t cvd_hv_lock, hook_func_t get_fmt);
hook_func_t cvd_hv_lock, hook_func_t get_fmt,
hook_func1_t set_mode);
extern int tvafe_reg_read(unsigned int reg, unsigned int *val);
extern int tvafe_reg_write(unsigned int reg, unsigned int val);
extern int tvafe_vbi_reg_read(unsigned int reg, unsigned int *val);