mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 11:50:43 +09:00
tvafe: support nostd config nostd_vs_th in dts [1/1]
PD#TV-6046 Problem: nostd atv display flicker Solution: config nostd_vs_th in dts for special tuner Verify: x301 Change-Id: Ibdb6422b0a9f031dab0a88b1654c566bcaa0c0d0 Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
This commit is contained in:
@@ -604,6 +604,22 @@
|
||||
>;
|
||||
clocks = <&clkc CLKID_DAC_CLK>;
|
||||
clock-names = "vdac_clk_gate";
|
||||
|
||||
cutwindow_val_h = <0 10 18 20 62>; /* level 0~4 */
|
||||
cutwindow_val_v = <4 8 14 16 24>; /* level 0~4 */
|
||||
/* auto_adj_en:
|
||||
* bit0 -- auto cdto
|
||||
* bit1 -- auto hs
|
||||
* bit2 -- auto vs
|
||||
* bit3 -- auto de
|
||||
* bit4 -- auto 3dcomb
|
||||
* bit5 -- auto pga
|
||||
*/
|
||||
auto_adj_en = <0x3e>;
|
||||
/* val: default=0, 0x1, 0xf1, 0xe1, 0x11 for special tuner
|
||||
* force_flag: force setting to std mode, default=0
|
||||
*/
|
||||
nostd_vs_th = <0 0>; /* val, force_flag */
|
||||
};
|
||||
|
||||
vbi {
|
||||
|
||||
@@ -601,6 +601,22 @@
|
||||
>;
|
||||
clocks = <&clkc CLKID_DAC_CLK>;
|
||||
clock-names = "vdac_clk_gate";
|
||||
|
||||
cutwindow_val_h = <0 10 18 20 62>; /* level 0~4 */
|
||||
cutwindow_val_v = <4 8 14 16 24>; /* level 0~4 */
|
||||
/* auto_adj_en:
|
||||
* bit0 -- auto cdto
|
||||
* bit1 -- auto hs
|
||||
* bit2 -- auto vs
|
||||
* bit3 -- auto de
|
||||
* bit4 -- auto 3dcomb
|
||||
* bit5 -- auto pga
|
||||
*/
|
||||
auto_adj_en = <0x3e>;
|
||||
/* val: default=0, 0x1, 0xf1, 0xe1, 0x11 for special tuner
|
||||
* force_flag: force setting to std mode, default=0
|
||||
*/
|
||||
nostd_vs_th = <0 0>; /* val, force_flag */
|
||||
};
|
||||
|
||||
vbi {
|
||||
|
||||
@@ -595,6 +595,22 @@
|
||||
>;
|
||||
clocks = <&clkc CLKID_DAC_CLK>;
|
||||
clock-names = "vdac_clk_gate";
|
||||
|
||||
cutwindow_val_h = <0 10 18 20 62>; /* level 0~4 */
|
||||
cutwindow_val_v = <4 8 14 16 24>; /* level 0~4 */
|
||||
/* auto_adj_en:
|
||||
* bit0 -- auto cdto
|
||||
* bit1 -- auto hs
|
||||
* bit2 -- auto vs
|
||||
* bit3 -- auto de
|
||||
* bit4 -- auto 3dcomb
|
||||
* bit5 -- auto pga
|
||||
*/
|
||||
auto_adj_en = <0x3e>;
|
||||
/* val: default=0, 0x1, 0xf1, 0xe1, 0x11 for special tuner
|
||||
* force_flag: force setting to std mode, default=0
|
||||
*/
|
||||
nostd_vs_th = <0 0>; /* val, force_flag */
|
||||
};
|
||||
|
||||
vbi {
|
||||
|
||||
@@ -109,14 +109,50 @@ unsigned int av1_plugin_state;
|
||||
unsigned int av2_plugin_state;
|
||||
#endif
|
||||
|
||||
/*tvafe_dbg_print:
|
||||
*bit[0]:normal flow debug print
|
||||
*bit[1]:
|
||||
*bit[2]:vsync isr debug print
|
||||
*bit[3]:smr debug print
|
||||
*bit[4]:nonstd debug print
|
||||
*/
|
||||
unsigned int tvafe_dbg_print;
|
||||
|
||||
#ifdef CONFIG_AMLOGIC_ATV_DEMOD
|
||||
static struct tvafe_info_s *g_tvafe_info;
|
||||
#endif
|
||||
|
||||
static struct tvafe_user_param_s tvafe_user_param = {
|
||||
.cutwindow_val_h = {0, 10, 18, 20, 62},
|
||||
/*level4: 48-->62 for ntsc-m*/
|
||||
.cutwindow_val_v = {4, 8, 14, 16, 24},
|
||||
.cutwindow_val_vs_ve = TVAFE_VS_VE_VAL,
|
||||
/* auto_adj_en:
|
||||
* bit[5]: auto pga
|
||||
* bit[4]: auto 3d comb
|
||||
* bit[3]: auto de
|
||||
* bit[2]: auto vs
|
||||
* bit[1]: auto hs
|
||||
* bit[0]: auto cdto
|
||||
*/
|
||||
.auto_adj_en = 0x3e,
|
||||
.nostd_vs_th = 0x0,
|
||||
.force_vs_th_flag = 0,
|
||||
.nostd_stable_cnt = 3,
|
||||
|
||||
/*4 is the test result@20171101 on fluke-54200 and DVD*/
|
||||
.skip_vf_num = 4,
|
||||
};
|
||||
|
||||
struct tvafe_user_param_s *tvafe_get_user_param(void)
|
||||
{
|
||||
return &tvafe_user_param;
|
||||
}
|
||||
|
||||
/*
|
||||
* tvafe check support port
|
||||
*/
|
||||
int tvafe_dec_support(struct tvin_frontend_s *fe, enum tvin_port_e port)
|
||||
static int tvafe_dec_support(struct tvin_frontend_s *fe, enum tvin_port_e port)
|
||||
{
|
||||
struct tvafe_dev_s *devp = container_of(fe,
|
||||
struct tvafe_dev_s, frontend);
|
||||
@@ -130,7 +166,7 @@ int tvafe_dec_support(struct tvin_frontend_s *fe, enum tvin_port_e port)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CMA
|
||||
void tvafe_cma_alloc(struct tvafe_dev_s *devp)
|
||||
static void tvafe_cma_alloc(struct tvafe_dev_s *devp)
|
||||
{
|
||||
unsigned int mem_size = devp->cma_mem_size;
|
||||
int flags = CODEC_MM_FLAGS_CMA_FIRST|CODEC_MM_FLAGS_CMA_CLEAR|
|
||||
@@ -167,7 +203,7 @@ void tvafe_cma_alloc(struct tvafe_dev_s *devp)
|
||||
}
|
||||
}
|
||||
|
||||
void tvafe_cma_release(struct tvafe_dev_s *devp)
|
||||
static void tvafe_cma_release(struct tvafe_dev_s *devp)
|
||||
{
|
||||
if (devp->cma_config_en == 0)
|
||||
return;
|
||||
@@ -216,7 +252,7 @@ static int tvafe_get_v_fmt(void)
|
||||
/*
|
||||
* tvafe open port and init register
|
||||
*/
|
||||
int tvafe_dec_open(struct tvin_frontend_s *fe, enum tvin_port_e port)
|
||||
static int tvafe_dec_open(struct tvin_frontend_s *fe, enum tvin_port_e port)
|
||||
{
|
||||
struct tvafe_dev_s *devp = container_of(fe, struct tvafe_dev_s,
|
||||
frontend);
|
||||
@@ -315,7 +351,7 @@ int tvafe_dec_open(struct tvin_frontend_s *fe, enum tvin_port_e port)
|
||||
/*
|
||||
* tvafe start after signal stable
|
||||
*/
|
||||
void tvafe_dec_start(struct tvin_frontend_s *fe, enum tvin_sig_fmt_e fmt)
|
||||
static void tvafe_dec_start(struct tvin_frontend_s *fe, enum tvin_sig_fmt_e fmt)
|
||||
{
|
||||
struct tvafe_dev_s *devp = container_of(fe, struct tvafe_dev_s,
|
||||
frontend);
|
||||
@@ -377,7 +413,7 @@ void tvafe_dec_start(struct tvin_frontend_s *fe, enum tvin_sig_fmt_e fmt)
|
||||
/*
|
||||
* tvafe stop port
|
||||
*/
|
||||
void tvafe_dec_stop(struct tvin_frontend_s *fe, enum tvin_port_e port)
|
||||
static void tvafe_dec_stop(struct tvin_frontend_s *fe, enum tvin_port_e port)
|
||||
{
|
||||
struct tvafe_dev_s *devp = container_of(fe, struct tvafe_dev_s,
|
||||
frontend);
|
||||
@@ -406,8 +442,7 @@ void tvafe_dec_stop(struct tvin_frontend_s *fe, enum tvin_port_e port)
|
||||
tvafe->parm.port = port;
|
||||
/* need to do ... */
|
||||
/** write 7740 register for cvbs clamp **/
|
||||
if ((port >= TVIN_PORT_CVBS0) && (port <= TVIN_PORT_CVBS3) &&
|
||||
!(devp->flags & TVAFE_POWERDOWN_IN_IDLE)) {
|
||||
if (!(devp->flags & TVAFE_POWERDOWN_IN_IDLE)) {
|
||||
|
||||
tvafe->cvd2.fmt_loop_cnt = 0;
|
||||
/* reset loop cnt after channel switch */
|
||||
@@ -441,7 +476,7 @@ void tvafe_dec_stop(struct tvin_frontend_s *fe, enum tvin_port_e port)
|
||||
/*
|
||||
* tvafe close port
|
||||
*/
|
||||
void tvafe_dec_close(struct tvin_frontend_s *fe)
|
||||
static void tvafe_dec_close(struct tvin_frontend_s *fe)
|
||||
{
|
||||
struct tvafe_dev_s *devp = container_of(fe, struct tvafe_dev_s,
|
||||
frontend);
|
||||
@@ -523,7 +558,7 @@ void tvafe_dec_close(struct tvin_frontend_s *fe)
|
||||
/*
|
||||
* tvafe vsync interrupt function
|
||||
*/
|
||||
int tvafe_dec_isr(struct tvin_frontend_s *fe, unsigned int hcnt64)
|
||||
static int tvafe_dec_isr(struct tvin_frontend_s *fe, unsigned int hcnt64)
|
||||
{
|
||||
struct tvafe_dev_s *devp = container_of(fe, struct tvafe_dev_s,
|
||||
frontend);
|
||||
@@ -551,70 +586,73 @@ int tvafe_dec_isr(struct tvin_frontend_s *fe, unsigned int hcnt64)
|
||||
return TVIN_BUF_SKIP;
|
||||
}
|
||||
|
||||
if ((port < TVIN_PORT_CVBS0) || (port > TVIN_PORT_CVBS3))
|
||||
return TVIN_BUF_SKIP;
|
||||
|
||||
if (tvafe->cvd2.info.isr_cnt++ >= 65536)
|
||||
tvafe->cvd2.info.isr_cnt = 0;
|
||||
|
||||
/* TVAFE CVD2 3D works abnormally => reset cvd2 */
|
||||
if ((port >= TVIN_PORT_CVBS0) && (port <= TVIN_PORT_CVBS3))
|
||||
tvafe_cvd2_check_3d_comb(&tvafe->cvd2);
|
||||
tvafe_cvd2_check_3d_comb(&tvafe->cvd2);
|
||||
|
||||
#ifdef TVAFE_SET_CVBS_PGA_EN
|
||||
if ((port >= TVIN_PORT_CVBS0) && (port <= TVIN_PORT_CVBS3) &&
|
||||
(port != TVIN_PORT_CVBS3))
|
||||
if (port != TVIN_PORT_CVBS3)
|
||||
tvafe_cvd2_adj_pga(&tvafe->cvd2);
|
||||
#endif
|
||||
|
||||
if (tvafe->parm.info.fmt == TVIN_SIG_FMT_CVBS_PAL_I) {
|
||||
#ifdef TVAFE_SET_CVBS_CDTO_EN
|
||||
if (tvafe->parm.info.fmt == TVIN_SIG_FMT_CVBS_PAL_I)
|
||||
tvafe_cvd2_adj_cdto(&tvafe->cvd2, hcnt64);
|
||||
#endif
|
||||
if (tvafe->parm.info.fmt == TVIN_SIG_FMT_CVBS_PAL_I)
|
||||
tvafe_cvd2_adj_hs(&tvafe->cvd2, hcnt64);
|
||||
else if (tvafe->parm.info.fmt == TVIN_SIG_FMT_CVBS_NTSC_M)
|
||||
} else if (tvafe->parm.info.fmt == TVIN_SIG_FMT_CVBS_NTSC_M)
|
||||
tvafe_cvd2_adj_hs_ntsc(&tvafe->cvd2, hcnt64);
|
||||
|
||||
if ((port >= TVIN_PORT_CVBS0) && (port <= TVIN_PORT_CVBS3)) {
|
||||
aspect_ratio = tvafe_cvd2_get_wss();
|
||||
switch (aspect_ratio) {
|
||||
case TVIN_ASPECT_NULL:
|
||||
count[TVIN_ASPECT_NULL]++;
|
||||
break;
|
||||
case TVIN_ASPECT_1x1:
|
||||
count[TVIN_ASPECT_1x1]++;
|
||||
break;
|
||||
case TVIN_ASPECT_4x3_FULL:
|
||||
count[TVIN_ASPECT_4x3_FULL]++;
|
||||
break;
|
||||
case TVIN_ASPECT_14x9_FULL:
|
||||
count[TVIN_ASPECT_14x9_FULL]++;
|
||||
break;
|
||||
case TVIN_ASPECT_14x9_LB_CENTER:
|
||||
count[TVIN_ASPECT_14x9_LB_CENTER]++;
|
||||
break;
|
||||
case TVIN_ASPECT_14x9_LB_TOP:
|
||||
count[TVIN_ASPECT_14x9_LB_TOP]++;
|
||||
break;
|
||||
case TVIN_ASPECT_16x9_FULL:
|
||||
count[TVIN_ASPECT_16x9_FULL]++;
|
||||
break;
|
||||
case TVIN_ASPECT_16x9_LB_CENTER:
|
||||
count[TVIN_ASPECT_16x9_LB_CENTER]++;
|
||||
break;
|
||||
case TVIN_ASPECT_16x9_LB_TOP:
|
||||
count[TVIN_ASPECT_16x9_LB_TOP]++;
|
||||
break;
|
||||
case TVIN_ASPECT_MAX:
|
||||
break;
|
||||
}
|
||||
/*over 30/40 times,ratio is effective*/
|
||||
if (++(tvafe->aspect_ratio_cnt) > TVAFE_RATIO_CNT) {
|
||||
for (i = 0; i < TVIN_ASPECT_MAX; i++) {
|
||||
if (count[i] > 30) {
|
||||
tvafe->aspect_ratio = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < TVIN_ASPECT_MAX; i++)
|
||||
count[i] = 0;
|
||||
tvafe->aspect_ratio_cnt = 0;
|
||||
}
|
||||
aspect_ratio = tvafe_cvd2_get_wss();
|
||||
switch (aspect_ratio) {
|
||||
case TVIN_ASPECT_NULL:
|
||||
count[TVIN_ASPECT_NULL]++;
|
||||
break;
|
||||
case TVIN_ASPECT_1x1:
|
||||
count[TVIN_ASPECT_1x1]++;
|
||||
break;
|
||||
case TVIN_ASPECT_4x3_FULL:
|
||||
count[TVIN_ASPECT_4x3_FULL]++;
|
||||
break;
|
||||
case TVIN_ASPECT_14x9_FULL:
|
||||
count[TVIN_ASPECT_14x9_FULL]++;
|
||||
break;
|
||||
case TVIN_ASPECT_14x9_LB_CENTER:
|
||||
count[TVIN_ASPECT_14x9_LB_CENTER]++;
|
||||
break;
|
||||
case TVIN_ASPECT_14x9_LB_TOP:
|
||||
count[TVIN_ASPECT_14x9_LB_TOP]++;
|
||||
break;
|
||||
case TVIN_ASPECT_16x9_FULL:
|
||||
count[TVIN_ASPECT_16x9_FULL]++;
|
||||
break;
|
||||
case TVIN_ASPECT_16x9_LB_CENTER:
|
||||
count[TVIN_ASPECT_16x9_LB_CENTER]++;
|
||||
break;
|
||||
case TVIN_ASPECT_16x9_LB_TOP:
|
||||
count[TVIN_ASPECT_16x9_LB_TOP]++;
|
||||
break;
|
||||
case TVIN_ASPECT_MAX:
|
||||
break;
|
||||
}
|
||||
/*over 30/40 times,ratio is effective*/
|
||||
if (++(tvafe->aspect_ratio_cnt) > TVAFE_RATIO_CNT) {
|
||||
for (i = 0; i < TVIN_ASPECT_MAX; i++) {
|
||||
if (count[i] > 30) {
|
||||
tvafe->aspect_ratio = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < TVIN_ASPECT_MAX; i++)
|
||||
count[i] = 0;
|
||||
tvafe->aspect_ratio_cnt = 0;
|
||||
}
|
||||
|
||||
return TVIN_BUF_NULL;
|
||||
}
|
||||
|
||||
@@ -648,8 +686,6 @@ bool tvafe_is_nosig(struct tvin_frontend_s *fe)
|
||||
}
|
||||
if (force_stable)
|
||||
return ret;
|
||||
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;
|
||||
@@ -664,21 +700,17 @@ bool tvafe_is_nosig(struct tvin_frontend_s *fe)
|
||||
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) &&
|
||||
(tvafe->cvd2.config_fmt == TVIN_SIG_FMT_CVBS_PAL_I) &&
|
||||
if (ret && (devp->flags & TVAFE_FLAG_DEV_SNOW_FLAG) &&
|
||||
(tvafe->cvd2.info.state != TVAFE_CVD2_STATE_FIND))
|
||||
tvafe_snow_config_acd();
|
||||
else if ((tvafe->cvd2.config_fmt == TVIN_SIG_FMT_CVBS_PAL_I) &&
|
||||
(tvafe->cvd2.info.state == TVAFE_CVD2_STATE_FIND) &&
|
||||
(port == TVIN_PORT_CVBS3))
|
||||
else if (tvafe->cvd2.info.state == TVAFE_CVD2_STATE_FIND)
|
||||
tvafe_snow_config_acd_resume();
|
||||
|
||||
/* normal sigal & adc reg error, reload source mux */
|
||||
if (tvafe->cvd2.info.adc_reload_en && !ret)
|
||||
tvafe_set_source_muxing(port, devp->pinmux);
|
||||
}
|
||||
|
||||
/* normal sigal & adc reg error, reload source mux */
|
||||
if (tvafe->cvd2.info.adc_reload_en && !ret)
|
||||
tvafe_set_source_muxing(port, devp->pinmux);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -729,7 +761,6 @@ enum tvin_sig_fmt_e tvafe_get_fmt(struct tvin_frontend_s *fe)
|
||||
enum tvin_port_e port = tvafe->parm.port;
|
||||
|
||||
if (!(devp->flags & TVAFE_FLAG_DEV_OPENED)) {
|
||||
|
||||
tvafe_pr_err("tvafe havn't opened, get sig fmt error!!!\n");
|
||||
return fmt;
|
||||
}
|
||||
@@ -737,7 +768,7 @@ enum tvin_sig_fmt_e tvafe_get_fmt(struct tvin_frontend_s *fe)
|
||||
fmt = tvafe_cvd2_get_format(&tvafe->cvd2);
|
||||
|
||||
tvafe->parm.info.fmt = fmt;
|
||||
if (tvafe_dbg_enable)
|
||||
if (tvafe_dbg_print & TVAFE_DBG_SMR)
|
||||
tvafe_pr_info("%s fmt:%s.\n", __func__,
|
||||
tvin_sig_fmt_str(fmt));
|
||||
|
||||
@@ -753,9 +784,11 @@ void tvafe_get_sig_property(struct tvin_frontend_s *fe,
|
||||
struct tvafe_dev_s *devp = container_of(fe, struct tvafe_dev_s,
|
||||
frontend);
|
||||
struct tvafe_info_s *tvafe = &devp->tvafe;
|
||||
struct tvafe_user_param_s *user_param = &tvafe_user_param;
|
||||
enum tvin_port_e port = tvafe->parm.port;
|
||||
unsigned int hs_adj_lev = cutwindow_val_h_level1;
|
||||
unsigned int vs_adj_lev = cutwindow_val_v_level1;
|
||||
unsigned int hs_adj_lev = user_param->cutwindow_val_h[1];
|
||||
unsigned int vs_adj_lev = user_param->cutwindow_val_v[1];
|
||||
unsigned int i;
|
||||
|
||||
if (!(devp->flags & TVAFE_FLAG_DEV_OPENED) ||
|
||||
(devp->flags & TVAFE_POWERDOWN_IN_IDLE)) {
|
||||
@@ -770,16 +803,9 @@ void tvafe_get_sig_property(struct tvin_frontend_s *fe,
|
||||
#ifdef TVAFE_CVD2_AUTO_DE_ENABLE
|
||||
if ((port >= TVIN_PORT_CVBS0) && (port <= TVIN_PORT_CVBS3)) {
|
||||
if (tvafe->cvd2.info.vs_adj_en) {
|
||||
if (tvafe->cvd2.info.vs_adj_level == 0)
|
||||
vs_adj_lev = cutwindow_val_v_level0;
|
||||
else if (tvafe->cvd2.info.vs_adj_level == 1)
|
||||
vs_adj_lev = cutwindow_val_v_level1;
|
||||
else if (tvafe->cvd2.info.vs_adj_level == 2)
|
||||
vs_adj_lev = cutwindow_val_v_level2;
|
||||
else if (tvafe->cvd2.info.vs_adj_level == 3)
|
||||
vs_adj_lev = cutwindow_val_v_level3;
|
||||
else if (tvafe->cvd2.info.vs_adj_level == 4)
|
||||
vs_adj_lev = cutwindow_val_v_level4;
|
||||
i = tvafe->cvd2.info.vs_adj_level;
|
||||
if (i < 5)
|
||||
vs_adj_lev = user_param->cutwindow_val_v[i];
|
||||
else
|
||||
vs_adj_lev = 0;
|
||||
prop->vs = vs_adj_lev;
|
||||
@@ -789,17 +815,14 @@ void tvafe_get_sig_property(struct tvin_frontend_s *fe,
|
||||
prop->ve = 0;
|
||||
}
|
||||
if (tvafe->cvd2.info.hs_adj_en) {
|
||||
if (tvafe->cvd2.info.hs_adj_level == 1)
|
||||
hs_adj_lev = cutwindow_val_h_level1;
|
||||
else if (tvafe->cvd2.info.hs_adj_level == 2)
|
||||
hs_adj_lev = cutwindow_val_h_level2;
|
||||
else if (tvafe->cvd2.info.hs_adj_level == 3)
|
||||
hs_adj_lev = cutwindow_val_h_level3;
|
||||
else if (tvafe->cvd2.info.hs_adj_level == 4) {
|
||||
hs_adj_lev = cutwindow_val_h_level4;
|
||||
prop->vs = cutwindow_val_v;
|
||||
prop->ve = cutwindow_val_v;
|
||||
} else
|
||||
i = tvafe->cvd2.info.hs_adj_level;
|
||||
if (i < 4) {
|
||||
hs_adj_lev = user_param->cutwindow_val_h[i];
|
||||
} else if (i == 4) {
|
||||
hs_adj_lev = user_param->cutwindow_val_h[i];
|
||||
prop->vs = user_param->cutwindow_val_vs_ve;
|
||||
prop->ve = user_param->cutwindow_val_vs_ve;
|
||||
} else {
|
||||
hs_adj_lev = 0;
|
||||
if (tvafe->cvd2.info.hs_adj_dir == true) {
|
||||
prop->hs = 0;
|
||||
@@ -818,8 +841,7 @@ void tvafe_get_sig_property(struct tvin_frontend_s *fe,
|
||||
prop->aspect_ratio = tvafe->aspect_ratio;
|
||||
prop->decimation_ratio = 0;
|
||||
prop->dvi_info = 0;
|
||||
/*4 is the test result@20171101 on fluke-54200 and DVD*/
|
||||
prop->skip_vf_num = 4;
|
||||
prop->skip_vf_num = user_param->skip_vf_num;
|
||||
}
|
||||
/*
|
||||
*get cvbs secam source's phase
|
||||
@@ -864,7 +886,7 @@ static bool tvafe_cvbs_check_frame_skip(struct tvin_frontend_s *fe)
|
||||
ret = false;
|
||||
} else if ((cvd2->hw.no_sig || !cvd2->hw.h_lock || !cvd2->hw.v_lock) &&
|
||||
((port >= TVIN_PORT_CVBS1) && (port <= TVIN_PORT_CVBS2))) {
|
||||
if (tvafe_dbg_enable)
|
||||
if (tvafe_dbg_print & TVAFE_DBG_NORMAL)
|
||||
tvafe_pr_err("cvbs signal unstable, skip frame!!!\n");
|
||||
ret = true;
|
||||
}
|
||||
@@ -924,6 +946,7 @@ static long tvafe_ioctl(struct file *file,
|
||||
struct tvafe_dev_s *devp = file->private_data;
|
||||
struct tvafe_info_s *tvafe = &devp->tvafe;
|
||||
enum tvafe_cvbs_video_e cvbs_lock_status = TVAFE_CVBS_VIDEO_HV_UNLOCKED;
|
||||
enum tvin_sig_fmt_e fmt = TVIN_SIG_FMT_NULL;
|
||||
|
||||
if (_IOC_TYPE(cmd) != _TM_T) {
|
||||
tvafe_pr_err("%s invalid command: %u\n", __func__, cmd);
|
||||
@@ -983,46 +1006,44 @@ static long tvafe_ioctl(struct file *file,
|
||||
tvafe_snow_function_flag = true;
|
||||
tvafe_snow_config(1);
|
||||
tvafe_snow_config_clamp(1);
|
||||
if (tvafe_dbg_enable)
|
||||
if (tvafe_dbg_print & TVAFE_DBG_NORMAL)
|
||||
tvafe_pr_info("TVIN_IOC_S_AFE_SONWON\n");
|
||||
break;
|
||||
case TVIN_IOC_S_AFE_SONWOFF:
|
||||
tvafe_snow_config(0);
|
||||
tvafe_snow_config_clamp(0);
|
||||
devp->flags &= (~TVAFE_FLAG_DEV_SNOW_FLAG);
|
||||
if (tvafe_dbg_enable)
|
||||
if (tvafe_dbg_print & TVAFE_DBG_NORMAL)
|
||||
tvafe_pr_info("TVIN_IOC_S_AFE_SONWOFF\n");
|
||||
break;
|
||||
case TVIN_IOC_G_AFE_CVBS_LOCK:
|
||||
{
|
||||
cvbs_lock_status =
|
||||
tvafe_cvd2_get_lock_status(&tvafe->cvd2);
|
||||
if (copy_to_user(argp,
|
||||
&cvbs_lock_status, sizeof(int))) {
|
||||
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
}
|
||||
tvafe_pr_info("%s: get cvd2 lock status :%d.\n",
|
||||
__func__, cvbs_lock_status);
|
||||
cvbs_lock_status = tvafe_cvd2_get_lock_status(&tvafe->cvd2);
|
||||
if (copy_to_user(argp, &cvbs_lock_status, sizeof(int))) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
}
|
||||
tvafe_pr_info("%s: get cvd2 lock status :%d.\n",
|
||||
__func__, cvbs_lock_status);
|
||||
break;
|
||||
case TVIN_IOC_S_AFE_CVBS_STD:
|
||||
{
|
||||
enum tvin_sig_fmt_e fmt = TVIN_SIG_FMT_NULL;
|
||||
|
||||
if (copy_from_user(&fmt, argp,
|
||||
sizeof(enum tvin_sig_fmt_e))) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
}
|
||||
tvafe->cvd2.manual_fmt = fmt;
|
||||
tvafe_pr_info("%s: ioctl set cvd2 manual fmt:%s.\n",
|
||||
__func__, tvin_sig_fmt_str(fmt));
|
||||
if (fmt != TVIN_SIG_FMT_NULL)
|
||||
manual_flag = 1;
|
||||
if (copy_from_user(&fmt, argp, sizeof(enum tvin_sig_fmt_e))) {
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
}
|
||||
tvafe->cvd2.manual_fmt = fmt;
|
||||
tvafe_pr_info("%s: ioctl set cvd2 manual fmt:%s.\n",
|
||||
__func__, tvin_sig_fmt_str(fmt));
|
||||
if (fmt != TVIN_SIG_FMT_NULL)
|
||||
manual_flag = 1;
|
||||
break;
|
||||
case TVIN_IOC_G_AFE_CVBS_STD:
|
||||
if (tvafe->cvd2.info.state == TVAFE_CVD2_STATE_FIND)
|
||||
fmt = tvafe->cvd2.config_fmt;
|
||||
if (copy_to_user(argp, &fmt, sizeof(enum tvin_sig_fmt_e)))
|
||||
ret = -EFAULT;
|
||||
tvafe_pr_info("%s: ioctl get fmt:%s.\n",
|
||||
__func__, tvin_sig_fmt_str(fmt));
|
||||
break;
|
||||
default:
|
||||
ret = -ENOIOCTLCMD;
|
||||
break;
|
||||
@@ -1178,6 +1199,41 @@ static void tvafe_clktree_probe(struct device *dev)
|
||||
tvafe_pr_err("error: %s: clk vdac_clk_gate\n", __func__);
|
||||
}
|
||||
|
||||
static void tvafe_user_parameters_config(struct device_node *of_node)
|
||||
{
|
||||
unsigned int val[5];
|
||||
int ret;
|
||||
|
||||
if (!of_node)
|
||||
return;
|
||||
|
||||
/* cutwindow config */
|
||||
ret = of_property_read_u32_array(of_node, "cutwindow_val_h",
|
||||
tvafe_user_param.cutwindow_val_h, 5);
|
||||
if (ret)
|
||||
tvafe_pr_err("Can't get cutwindow_val_h\n");
|
||||
ret = of_property_read_u32_array(of_node, "cutwindow_val_v",
|
||||
tvafe_user_param.cutwindow_val_v, 5);
|
||||
if (ret)
|
||||
tvafe_pr_err("Can't get cutwindow_val_v\n");
|
||||
|
||||
ret = of_property_read_u32(of_node, "auto_adj_en", &val[0]);
|
||||
if (ret == 0) {
|
||||
tvafe_pr_info("find auto_adj_en: 0x%x\n", val[0]);
|
||||
tvafe_user_param.auto_adj_en = val[0];
|
||||
}
|
||||
|
||||
ret = of_property_read_u32_array(of_node, "nostd_vs_th",
|
||||
val, 2);
|
||||
if (ret == 0) {
|
||||
tvafe_user_param.nostd_vs_th = val[0];
|
||||
tvafe_user_param.force_vs_th_flag = val[1];
|
||||
tvafe_pr_info("find nostd_vs_th: 0x%x %d\n",
|
||||
tvafe_user_param.nostd_vs_th,
|
||||
tvafe_user_param.force_vs_th_flag);
|
||||
}
|
||||
}
|
||||
|
||||
struct meson_tvafe_data meson_gxtvbb_tvafe_data = {
|
||||
.cpu_id = CPU_TYPE_GXTVBB,
|
||||
.name = "meson-gxtvbb-tvafe",
|
||||
@@ -1377,6 +1433,8 @@ static int tvafe_drv_probe(struct platform_device *pdev)
|
||||
tvafe_pr_info("%s: tvafe maped reg_base =%p, size=%x\n",
|
||||
__func__, tvafe_reg_base, size_io_reg);
|
||||
|
||||
tvafe_user_parameters_config(pdev->dev.of_node);
|
||||
|
||||
/* frontend */
|
||||
tvin_frontend_init(&tdevp->frontend, &tvafe_dec_ops,
|
||||
&tvafe_sm_ops, tdevp->index);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
/* ************************************************* */
|
||||
/* *** macro definitions ********************************************* */
|
||||
/* *********************************************************** */
|
||||
#define TVAFE_VER "Ref.2019/03/29"
|
||||
#define TVAFE_VER "Ref.2019/07/02"
|
||||
|
||||
/* used to set the flag of tvafe_dev_s */
|
||||
#define TVAFE_FLAG_DEV_OPENED 0x00000010
|
||||
@@ -61,6 +61,24 @@ struct tvafe_info_s {
|
||||
unsigned int aspect_ratio_cnt;
|
||||
};
|
||||
|
||||
#define TVAFE_AUTO_CDTO (1 << 0)
|
||||
#define TVAFE_AUTO_HS (1 << 1)
|
||||
#define TVAFE_AUTO_VS (1 << 2)
|
||||
#define TVAFE_AUTO_DE (1 << 3)
|
||||
#define TVAFE_AUTO_3DCOMB (1 << 4)
|
||||
#define TVAFE_AUTO_PGA (1 << 5)
|
||||
|
||||
struct tvafe_user_param_s {
|
||||
unsigned int cutwindow_val_h[5];
|
||||
unsigned int cutwindow_val_v[5];
|
||||
unsigned int cutwindow_val_vs_ve;
|
||||
unsigned int auto_adj_en;
|
||||
unsigned int nostd_vs_th;
|
||||
unsigned int force_vs_th_flag;
|
||||
unsigned int nostd_stable_cnt;
|
||||
unsigned int skip_vf_num;
|
||||
};
|
||||
|
||||
/* tvafe device structure */
|
||||
struct tvafe_dev_s {
|
||||
int index;
|
||||
@@ -81,6 +99,7 @@ struct tvafe_dev_s {
|
||||
struct tvafe_cvd2_mem_s mem;
|
||||
|
||||
struct tvafe_info_s tvafe;
|
||||
|
||||
unsigned int cma_config_en;
|
||||
/*cma_config_flag:1:share with codec_mm;0:cma alone*/
|
||||
unsigned int cma_config_flag;
|
||||
@@ -97,6 +116,8 @@ struct tvafe_dev_s {
|
||||
bool tvafe_get_snow_cfg(void);
|
||||
void tvafe_set_snow_cfg(bool cfg);
|
||||
|
||||
struct tvafe_user_param_s *tvafe_get_user_param(void);
|
||||
|
||||
typedef int (*hook_func_t)(void);
|
||||
typedef int (*hook_func1_t)(bool);
|
||||
extern void aml_fe_hook_cvd(hook_func_t atv_mode,
|
||||
@@ -114,5 +135,15 @@ extern void tvafe_remove_device_files(struct device *dev);
|
||||
extern bool disableapi;
|
||||
extern bool force_stable;
|
||||
|
||||
extern unsigned int force_nostd;
|
||||
|
||||
#define TVAFE_DBG_NORMAL (1 << 0)
|
||||
#define TVAFE_DBG_ISR (1 << 4)
|
||||
#define TVAFE_DBG_SMR (1 << 8)
|
||||
#define TVAFE_DBG_SMR2 (1 << 9)
|
||||
#define TVAFE_DBG_NOSTD (1 << 12)
|
||||
#define TVAFE_DBG_NOSTD2 (1 << 13)
|
||||
extern unsigned int tvafe_dbg_print;
|
||||
|
||||
#endif /* _TVAFE_H */
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -117,6 +117,11 @@ struct tvafe_cvd2_lines_s {
|
||||
};
|
||||
#endif
|
||||
|
||||
#define CVD2_AUTO_HS_DEFAULT 28
|
||||
#define CVD2_AUTO_HS_UNSTABLE 29
|
||||
#define CVD2_AUTO_HS_ADJ_DIR 30
|
||||
#define CVD2_AUTO_HS_ADJ_EN 31
|
||||
|
||||
/* cvd2 signal information */
|
||||
struct tvafe_cvd2_info_s {
|
||||
enum tvafe_cvd2_state_e state;
|
||||
@@ -133,7 +138,13 @@ struct tvafe_cvd2_info_s {
|
||||
#endif
|
||||
unsigned int comb_check_cnt;
|
||||
unsigned int fmt_shift_cnt;
|
||||
unsigned short nonstd_cnt;
|
||||
unsigned short nonstd_stable_cnt;
|
||||
unsigned short nonstd_print_cnt;
|
||||
bool nonstd_flag;
|
||||
bool nonstd_flag_adv;
|
||||
bool non_std_enable;
|
||||
bool non_std_enable_tmp;
|
||||
bool non_std_config;
|
||||
bool non_std_worst;
|
||||
bool adc_reload_en;
|
||||
@@ -141,11 +152,15 @@ struct tvafe_cvd2_info_s {
|
||||
bool vs_adj_en;
|
||||
/*0:+;1:-*/
|
||||
bool hs_adj_dir;
|
||||
unsigned int auto_hs_flag;
|
||||
|
||||
#ifdef TVAFE_CVD2_AUTO_DE_ENABLE
|
||||
struct tvafe_cvd2_lines_s vlines;
|
||||
#endif
|
||||
unsigned int ntsc_switch_cnt;
|
||||
|
||||
unsigned int smr_cnt;
|
||||
unsigned int isr_cnt;
|
||||
};
|
||||
|
||||
/* CVD2 status list */
|
||||
@@ -201,10 +216,10 @@ extern void tvafe_snow_config_clamp(unsigned int onoff);
|
||||
extern void tvafe_snow_config_acd(void);
|
||||
extern void tvafe_snow_config_acd_resume(void);
|
||||
extern enum tvin_aspect_ratio_e tvafe_cvd2_get_wss(void);
|
||||
extern void tvafe_cvd2_get_signal_status(struct tvafe_cvd2_s *cvd2);
|
||||
extern void cvd_vbi_mem_set(unsigned int offset, unsigned int size);
|
||||
extern void cvd_vbi_config(void);
|
||||
extern void tvafe_cvd2_rf_ntsc50_en(bool v);
|
||||
extern void tvafe_cvd2_non_std_config(struct tvafe_cvd2_s *cvd2);
|
||||
|
||||
extern bool tvafe_snow_function_flag;
|
||||
|
||||
|
||||
@@ -43,6 +43,9 @@ static void tvafe_state(struct tvafe_dev_s *devp)
|
||||
struct tvafe_cvd2_info_s *cvd2_info = &cvd2->info;
|
||||
struct tvafe_cvd2_lines_s *vlines = &cvd2_info->vlines;
|
||||
struct tvafe_cvd2_hw_data_s *hw = &cvd2->hw;
|
||||
struct tvafe_user_param_s *user_param = tvafe_get_user_param();
|
||||
int i;
|
||||
|
||||
/* top dev info */
|
||||
tvafe_pr_info("\n!!tvafe_dev_s info:\n");
|
||||
tvafe_pr_info("size of tvafe_dev_s:%d\n", devp->sizeof_tvafe_dev_s);
|
||||
@@ -112,6 +115,8 @@ static void tvafe_state(struct tvafe_dev_s *devp)
|
||||
cvd2_info->vs_adj_level);
|
||||
tvafe_pr_info("tvafe_cvd2_info_s->vs_adj_en:%d\n",
|
||||
cvd2_info->vs_adj_en);
|
||||
tvafe_pr_info("tvafe_cvd2_info_s->auto_hs_flag:0x%08x\n",
|
||||
cvd2_info->auto_hs_flag);
|
||||
#ifdef TVAFE_SET_CVBS_CDTO_EN
|
||||
tvafe_pr_info("tvafe_cvd2_info_s->hcnt64[0]:0x%x\n",
|
||||
cvd2_info->hcnt64[0]);
|
||||
@@ -122,6 +127,11 @@ static void tvafe_state(struct tvafe_dev_s *devp)
|
||||
tvafe_pr_info("tvafe_cvd2_info_s->hcnt64[3]:0x%x\n",
|
||||
cvd2_info->hcnt64[3]);
|
||||
#endif
|
||||
tvafe_pr_info("tvafe_cvd2_info_s->smr_cnt:%d\n",
|
||||
cvd2_info->smr_cnt);
|
||||
tvafe_pr_info("tvafe_cvd2_info_s->isr_cnt:%d\n",
|
||||
cvd2_info->isr_cnt);
|
||||
|
||||
/* tvafe_cvd2_info_s->tvafe_cvd2_lines_s struct info */
|
||||
tvafe_pr_info("\n!!tvafe_cvd2_info_s->tvafe_cvd2_lines_s struct info:\n");
|
||||
tvafe_pr_info("tvafe_cvd2_lines_s->check_cnt:0x%x\n",
|
||||
@@ -173,6 +183,22 @@ static void tvafe_state(struct tvafe_dev_s *devp)
|
||||
tvafe_pr_info("tvafe_cvd2_hw_data_s->fsc_358:%d\n", hw->fsc_358);
|
||||
tvafe_pr_info("tvafe_cvd2_hw_data_s->fsc_425:%d\n", hw->fsc_425);
|
||||
tvafe_pr_info("tvafe_cvd2_hw_data_s->fsc_443:%d\n", hw->fsc_443);
|
||||
for (i = 0; i < 5; i++) {
|
||||
tvafe_pr_info("cutwindow_val_h[%d]:%d\n",
|
||||
i, user_param->cutwindow_val_h[i]);
|
||||
}
|
||||
for (i = 0; i < 5; i++) {
|
||||
tvafe_pr_info("cutwindow_val_v[%d]:%d\n",
|
||||
i, user_param->cutwindow_val_v[i]);
|
||||
}
|
||||
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("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("tvafe version : %s\n", TVAFE_VER);
|
||||
}
|
||||
|
||||
static void tvafe_parse_param(char *buf_orig, char **parm)
|
||||
@@ -200,7 +226,7 @@ static ssize_t tvafe_store(struct device *dev,
|
||||
{
|
||||
unsigned char fmt_index = 0;
|
||||
struct tvafe_dev_s *devp;
|
||||
unsigned long tmp = 0;
|
||||
struct tvafe_user_param_s *user_param = tvafe_get_user_param();
|
||||
char *buf_orig, *parm[47] = {NULL};
|
||||
unsigned int val;
|
||||
|
||||
@@ -254,10 +280,10 @@ static ssize_t tvafe_store(struct device *dev,
|
||||
} else if (!strncmp(buff, "afe_ver", strlen("afe_ver"))) {
|
||||
tvafe_pr_info("tvafe version : %s\n", TVAFE_VER);
|
||||
} else if (!strncmp(buff, "snowcfg", strlen("snowcfg"))) {
|
||||
if (kstrtoul(parm[1], 10, &val) < 0) {
|
||||
kfree(buf_orig);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!parm[1])
|
||||
goto tvafe_store_err;
|
||||
if (kstrtouint(parm[1], 10, &val) < 0)
|
||||
goto tvafe_store_err;
|
||||
if (val) {
|
||||
tvafe_set_snow_cfg(true);
|
||||
tvafe_pr_info("[tvafe..]hadware snow cfg en\n");
|
||||
@@ -266,10 +292,10 @@ static ssize_t tvafe_store(struct device *dev,
|
||||
tvafe_pr_info("[tvafe..]hadware snow cfg dis\n");
|
||||
}
|
||||
} else if (!strncmp(buff, "snowon", strlen("snowon"))) {
|
||||
if (kstrtoul(parm[1], 10, &val) < 0) {
|
||||
kfree(buf_orig);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!parm[1])
|
||||
goto tvafe_store_err;
|
||||
if (kstrtouint(parm[1], 10, &val) < 0)
|
||||
goto tvafe_store_err;
|
||||
if (val) {
|
||||
tvafe_snow_config(1);
|
||||
tvafe_snow_config_clamp(1);
|
||||
@@ -283,17 +309,19 @@ static ssize_t tvafe_store(struct device *dev,
|
||||
tvafe_pr_info("%s:tvafe snowoff\n", __func__);
|
||||
}
|
||||
} else if (!strcmp(parm[0], "frame_skip_enable")) {
|
||||
if (kstrtoul(parm[1], 10, &val) < 0) {
|
||||
kfree(buf_orig);
|
||||
return -EINVAL;
|
||||
if (parm[1]) {
|
||||
if (kstrtouint(parm[1], 10, &val) < 0)
|
||||
goto tvafe_store_err;
|
||||
devp->frame_skip_enable = val;
|
||||
}
|
||||
devp->frame_skip_enable = val;
|
||||
tvafe_pr_info("frame_skip_enable:%d\n",
|
||||
devp->frame_skip_enable);
|
||||
} else if (!strncmp(buff, "state", strlen("state"))) {
|
||||
tvafe_state(devp);
|
||||
} else if (!strncmp(buff, "nonstd_detect_dis",
|
||||
strlen("nonstd_detect_dis"))) {
|
||||
if (!parm[1])
|
||||
goto tvafe_store_err;
|
||||
/*patch for Very low probability hanging issue on atv close*/
|
||||
/*only appeared in one project,this for reserved debug*/
|
||||
/*default setting to disable the nonstandard signal detect*/
|
||||
@@ -309,10 +337,10 @@ static ssize_t tvafe_store(struct device *dev,
|
||||
__func__);
|
||||
}
|
||||
} else if (!strncmp(buff, "rf_ntsc50_en", strlen("rf_ntsc50_en"))) {
|
||||
if (kstrtoul(parm[1], 10, &val) < 0) {
|
||||
kfree(buf_orig);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!parm[1])
|
||||
goto tvafe_store_err;
|
||||
if (kstrtouint(parm[1], 10, &val) < 0)
|
||||
goto tvafe_store_err;
|
||||
if (val) {
|
||||
tvafe_cvd2_rf_ntsc50_en(true);
|
||||
pr_info("[tvafe..]%s:tvafe_cvd2_rf_ntsc50_en\n",
|
||||
@@ -322,6 +350,60 @@ static ssize_t tvafe_store(struct device *dev,
|
||||
pr_info("[tvafe..]%s:tvafe_cvd2_rf_ntsc50_dis\n",
|
||||
__func__);
|
||||
}
|
||||
} else if (!strncmp(buff, "force_nostd", strlen("force_nostd"))) {
|
||||
if (parm[1]) {
|
||||
if (kstrtouint(parm[1], 10, &force_nostd) < 0)
|
||||
goto tvafe_store_err;
|
||||
}
|
||||
pr_info("[tvafe..]%s: force_nostd = %d\n",
|
||||
__func__, force_nostd);
|
||||
} else if (!strncmp(buff, "force_vs_th", strlen("force_vs_th"))) {
|
||||
if (parm[1]) {
|
||||
if (kstrtouint(parm[1], 10,
|
||||
&user_param->force_vs_th_flag) < 0)
|
||||
goto tvafe_store_err;
|
||||
}
|
||||
pr_info("[tvafe..]%s: force_vs_th_flag = 0x%x\n",
|
||||
__func__, user_param->force_vs_th_flag);
|
||||
} else if (!strncmp(buff, "nostd_vs_th", strlen("nostd_vs_th"))) {
|
||||
if (parm[1]) {
|
||||
if (kstrtouint(parm[1], 16,
|
||||
&user_param->nostd_vs_th) < 0)
|
||||
goto tvafe_store_err;
|
||||
}
|
||||
pr_info("[tvafe..]%s: nostd_vs_th = 0x%x\n",
|
||||
__func__, user_param->nostd_vs_th);
|
||||
} 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",
|
||||
__func__, user_param->nostd_stable_cnt);
|
||||
} else if (!strncmp(buff, "auto_adj", strlen("auto_adj"))) {
|
||||
if (parm[1]) {
|
||||
if (kstrtouint(parm[1], 16,
|
||||
&user_param->auto_adj_en) < 0)
|
||||
goto tvafe_store_err;
|
||||
}
|
||||
pr_info("[tvafe..]%s: auto_adj_en = 0x%x\n",
|
||||
__func__, user_param->auto_adj_en);
|
||||
} else if (!strncmp(buff, "skip_vf_num", strlen("skip_vf_num"))) {
|
||||
if (parm[1]) {
|
||||
if (kstrtouint(parm[1], 10,
|
||||
&user_param->skip_vf_num) < 0)
|
||||
goto tvafe_store_err;
|
||||
}
|
||||
pr_info("[tvafe..]%s: skip_vf_num = %d\n",
|
||||
__func__, user_param->skip_vf_num);
|
||||
} else if (!strncmp(buff, "dbg_print", strlen("dbg_print"))) {
|
||||
if (parm[1]) {
|
||||
if (kstrtouint(parm[1], 16, &tvafe_dbg_print) < 0)
|
||||
goto tvafe_store_err;
|
||||
}
|
||||
pr_info("[tvafe..]%s: tvafe_dbg_print = 0x%x\n",
|
||||
__func__, tvafe_dbg_print);
|
||||
} else
|
||||
tvafe_pr_info("[%s]:invaild command.\n", __func__);
|
||||
kfree(buf_orig);
|
||||
@@ -332,28 +414,45 @@ tvafe_store_err:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static const char *tvafe_debug_usage_str = {
|
||||
"Usage:\n"
|
||||
" echo cvdfmt ntsc/ntsc443/pali/palm/palcn/pal60/secam/null > /sys/class/tvafe/tvafe0/debug;conifg manual fmt\n"
|
||||
"\n"
|
||||
" echo disableapi val(d) > /sys/class/tvafe/tvafe0/debug;enable/ignore api cmd\n"
|
||||
"\n"
|
||||
" echo force_stable val(d) > /sys/class/tvafe/tvafe0/debug;force stable or not force\n"
|
||||
"\n"
|
||||
" echo tvafe_enable val(d) > /sys/class/tvafe/tvafe0/debug;tvafe enable/disable\n"
|
||||
"\n"
|
||||
" echo afe_ver > /sys/class/tvafe/tvafe0/debug;show tvafe version\n"
|
||||
"\n"
|
||||
" echo snow val(d) > /sys/class/tvafe/tvafe0/debug;snow on/off\n"
|
||||
"\n"
|
||||
" echo frame_skip_enable val(d) > /sys/class/tvafe/tvafe0/debug;frame skip enable/disable\n"
|
||||
"\n"
|
||||
" echo state > /sys/class/tvafe/tvafe0/debug;show tvafe status\n"
|
||||
"\n"
|
||||
" echo force_nostd val(d) > /sys/class/tvafe/tvafe0/debug;set force_nostd policy\n"
|
||||
"\n"
|
||||
" echo nostd_vs_th val(h) > /sys/class/tvafe/tvafe0/debug;set nostd_vs_th\n"
|
||||
"\n"
|
||||
" echo force_vs_th val(h) > /sys/class/tvafe/tvafe0/debug;set force_vs_th flag\n"
|
||||
"\n"
|
||||
" echo nostd_cnt val(d) > /sys/class/tvafe/tvafe0/debug;set nostd_stable_cnt\n"
|
||||
"\n"
|
||||
" echo skip_vf_num val(d) > /sys/class/tvafe/tvafe0/debug;set skip_vf_num for vdin\n"
|
||||
"\n"
|
||||
" echo dbg_print val(h) > /sys/class/tvafe/tvafe0/debug;enable debug print\n"
|
||||
" bit[0]: normal debug info\n"
|
||||
" bit[4]: vsync isr debug info\n"
|
||||
" bit[8]: smr debug info\n"
|
||||
" bit[12]: nostd debug info\n"
|
||||
};
|
||||
|
||||
static ssize_t tvafe_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
ssize_t len = 0;
|
||||
|
||||
len += sprintf(buf+len,
|
||||
"echo cvdfmt ntsc/ntsc443/pali/palm/palcn/pal60/secam/null > /sys/class/tvafe/tvafe0/debug;conifg manual fmt\n");
|
||||
len += sprintf(buf+len,
|
||||
"echo disableapi val(d) > /sys/class/tvafe/tvafe0/debug;enable/ignore api cmd\n");
|
||||
len += sprintf(buf+len,
|
||||
"echo force_stable val(d) > /sys/class/tvafe/tvafe0/debug;force stable or not force\n");
|
||||
len += sprintf(buf+len,
|
||||
"echo tvafe_enable val(d) > /sys/class/tvafe/tvafe0/debug;tvafe enable/disable\n");
|
||||
len += sprintf(buf+len,
|
||||
"echo afe_ver > /sys/class/tvafe/tvafe0/debug;show tvafe version\n");
|
||||
len += sprintf(buf+len,
|
||||
"echo snow val(d) > /sys/class/tvafe/tvafe0/debug;snow on/off\n");
|
||||
len += sprintf(buf+len,
|
||||
"echo frame_skip_enable val(d) > /sys/class/tvafe/tvafe0/debug;frame skip enable/disable\n");
|
||||
len += sprintf(buf+len,
|
||||
"echo state > /sys/class/tvafe/tvafe0/debug;show tvafe status\n");
|
||||
return len;
|
||||
return sprintf(buf, "%s\n", tvafe_debug_usage_str);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(debug, 0644, tvafe_show, tvafe_store);
|
||||
@@ -594,6 +693,89 @@ static ssize_t tvafe_reg_show(struct device *dev,
|
||||
|
||||
static DEVICE_ATTR(reg, 0644, tvafe_reg_show, tvafereg_store);
|
||||
|
||||
static ssize_t tvafe_cutwindow_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
ssize_t len = 0;
|
||||
|
||||
len += sprintf(buf+len,
|
||||
"echo h index(d) val(d) > /sys/class/tvafe/tvafe0/cutwin;conifg cutwindow_h value\n");
|
||||
len += sprintf(buf+len,
|
||||
"echo v index(d) val(d) > /sys/class/tvafe/tvafe0/cutwin;conifg cutwindow_v value\n");
|
||||
len += sprintf(buf+len,
|
||||
"echo r > /sys/class/tvafe/tvafe0/cutwin;read cutwindow value\n");
|
||||
return len;
|
||||
}
|
||||
|
||||
static ssize_t tvafe_cutwindow_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buff, size_t count)
|
||||
{
|
||||
struct tvafe_user_param_s *user_param = tvafe_get_user_param();
|
||||
char *buf_orig, *parm[20] = {NULL};
|
||||
unsigned int index, val;
|
||||
char *pr_buf;
|
||||
unsigned int pr_len;
|
||||
|
||||
if (!buff)
|
||||
return count;
|
||||
buf_orig = kstrdup(buff, GFP_KERNEL);
|
||||
tvafe_parse_param(buf_orig, (char **)&parm);
|
||||
|
||||
if (!strcmp(parm[0], "h")) {
|
||||
if (kstrtouint(parm[1], 10, &index) < 0)
|
||||
goto tvafe_cutwindow_store_err;
|
||||
if (index < 5) {
|
||||
if (kstrtouint(parm[2], 10, &val) < 0)
|
||||
goto tvafe_cutwindow_store_err;
|
||||
user_param->cutwindow_val_h[index] = val;
|
||||
pr_info("set cutwindow_h[%d] = %d\n", index, val);
|
||||
} else {
|
||||
pr_info("error: invalid index %d\n", index);
|
||||
}
|
||||
} else if (!strcmp(parm[0], "v")) {
|
||||
if (kstrtouint(parm[1], 10, &index) < 0)
|
||||
goto tvafe_cutwindow_store_err;
|
||||
if (index < 5) {
|
||||
if (kstrtouint(parm[2], 10, &val) < 0)
|
||||
goto tvafe_cutwindow_store_err;
|
||||
user_param->cutwindow_val_v[index] = val;
|
||||
pr_info("set cutwindow_v[%d] = %d\n", index, val);
|
||||
} else {
|
||||
pr_info("error: invalid index %d\n", index);
|
||||
}
|
||||
} else if (!strcmp(parm[0], "r")) {
|
||||
pr_buf = kzalloc(sizeof(char) * 100, GFP_KERNEL);
|
||||
if (!pr_buf) {
|
||||
pr_info("print buf malloc error\n");
|
||||
goto tvafe_cutwindow_store_err;
|
||||
}
|
||||
pr_len = 0;
|
||||
pr_len += sprintf(pr_buf+pr_len, "cutwindow_h:");
|
||||
for (index = 0; index < 5; index++) {
|
||||
pr_len += sprintf(pr_buf+pr_len,
|
||||
" %d", user_param->cutwindow_val_h[index]);
|
||||
}
|
||||
pr_len += sprintf(pr_buf+pr_len, "\ncutwindow_v:");
|
||||
for (index = 0; index < 5; index++) {
|
||||
pr_len += sprintf(pr_buf+pr_len,
|
||||
" %d", user_param->cutwindow_val_v[index]);
|
||||
}
|
||||
pr_info("%s\n", pr_buf);
|
||||
kfree(pr_buf);
|
||||
} else
|
||||
pr_info("error: invaild command\n");
|
||||
|
||||
kfree(buf_orig);
|
||||
return count;
|
||||
|
||||
tvafe_cutwindow_store_err:
|
||||
kfree(buf_orig);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(cutwin, 0644,
|
||||
tvafe_cutwindow_show, tvafe_cutwindow_store);
|
||||
|
||||
int tvafe_device_create_file(struct device *dev)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <linux/amlogic/media/frame_provider/tvin/tvin.h>
|
||||
#include "../tvin_global.h"
|
||||
#include "../tvin_format_table.h"
|
||||
#include "tvafe.h"
|
||||
#include "tvafe_regs.h"
|
||||
#include "tvafe_cvd.h"
|
||||
#include "tvafe_debug.h"
|
||||
@@ -326,9 +327,8 @@ void tvafe_set_regmap(struct am_regs_s *p)
|
||||
for (i = 0; i < p->length; i++) {
|
||||
switch (p->am_reg[i].type) {
|
||||
case REG_TYPE_PHY:
|
||||
#ifdef PQ_DEBUG_EN
|
||||
tvafe_pr_info("%s: bus type: phy..\n", __func__);
|
||||
#endif
|
||||
if (tvafe_dbg_print & TVAFE_DBG_NORMAL)
|
||||
tvafe_pr_info("%s: bus type: phy..\n", __func__);
|
||||
break;
|
||||
case REG_TYPE_CBUS:
|
||||
if (p->am_reg[i].mask == 0xffffffff)
|
||||
@@ -338,8 +338,8 @@ for (i = 0; i < p->length; i++) {
|
||||
(aml_read_cbus(p->am_reg[i].addr) &
|
||||
(~(p->am_reg[i].mask))) |
|
||||
(p->am_reg[i].val & p->am_reg[i].mask));
|
||||
#ifdef PQ_DEBUG_EN
|
||||
tvafe_pr_info("%s: cbus: Reg0x%x(%u)=0x%x(%u)val=%x(%u)mask=%x(%u)\n",
|
||||
if (tvafe_dbg_print & TVAFE_DBG_NORMAL)
|
||||
tvafe_pr_info("%s: cbus: Reg0x%x(%u)=0x%x(%u)val=%x(%u)mask=%x(%u)\n",
|
||||
__func__, p->am_reg[i].addr, p->am_reg[i].addr,
|
||||
(p->am_reg[i].val & p->am_reg[i].mask),
|
||||
(p->am_reg[i].val & p->am_reg[i].mask),
|
||||
@@ -355,18 +355,17 @@ for (i = 0; i < p->length; i++) {
|
||||
(R_APB_REG(p->am_reg[i].addr<<2) &
|
||||
(~(p->am_reg[i].mask))) |
|
||||
(p->am_reg[i].val & p->am_reg[i].mask));
|
||||
#ifdef PQ_DEBUG_EN
|
||||
tvafe_pr_info("%s: apb: Reg0x%x(%u)=0x%x(%u)val=%x(%u)mask=%x(%u)\n",
|
||||
if (tvafe_dbg_print & TVAFE_DBG_NORMAL)
|
||||
tvafe_pr_info("%s: apb: Reg0x%x(%u)=0x%x(%u)val=%x(%u)mask=%x(%u)\n",
|
||||
__func__, p->am_reg[i].addr, p->am_reg[i].addr,
|
||||
(p->am_reg[i].val & p->am_reg[i].mask),
|
||||
(p->am_reg[i].val & p->am_reg[i].mask),
|
||||
p->am_reg[i].val, p->am_reg[i].val,
|
||||
p->am_reg[i].mask, p->am_reg[i].mask);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
#ifdef PQ_DEBUG_EN
|
||||
tvafe_pr_info("%s: bus type error!!!bustype = 0x%x................\n",
|
||||
if (tvafe_dbg_print & TVAFE_DBG_NORMAL)
|
||||
tvafe_pr_info("%s: bus type error!!!bustype = 0x%x................\n",
|
||||
__func__, p->am_reg[i].type);
|
||||
#endif
|
||||
break;
|
||||
@@ -623,8 +622,8 @@ int adc_set_pll_cntl(bool on, unsigned int module_sel, void *pDtvPara)
|
||||
mutex_lock(&pll_mutex);
|
||||
adc_pll_chg &= ~module_sel;
|
||||
mutex_unlock(&pll_mutex);
|
||||
if (tvafe_dbg_enable)
|
||||
tvafe_pr_info("\n%s: init flag on:%d,module:0x%x,flag:0x%x\n",
|
||||
if (tvafe_dbg_print & TVAFE_DBG_NORMAL)
|
||||
tvafe_pr_info("%s: init flag on:%d,module:0x%x,flag:0x%x\n",
|
||||
__func__, on, module_sel, adc_pll_chg);
|
||||
return ret;
|
||||
}
|
||||
@@ -693,8 +692,8 @@ int adc_set_pll_cntl(bool on, unsigned int module_sel, void *pDtvPara)
|
||||
mutex_unlock(&pll_mutex);
|
||||
if (adc_pll_lock_cnt == 10)
|
||||
tvafe_pr_info("%s: adc pll lock fail!!!\n", __func__);
|
||||
if (tvafe_dbg_enable)
|
||||
tvafe_pr_info("\n%s: on:%d,module:0x%x,flag:0x%x...\n",
|
||||
if (tvafe_dbg_print & TVAFE_DBG_NORMAL)
|
||||
tvafe_pr_info("%s: on:%d,module:0x%x,flag:0x%x...\n",
|
||||
__func__, on, module_sel, adc_pll_chg);
|
||||
break;
|
||||
case ADC_EN_TVAFE: /* tvafe */
|
||||
@@ -783,8 +782,8 @@ int adc_set_pll_cntl(bool on, unsigned int module_sel, void *pDtvPara)
|
||||
mutex_unlock(&pll_mutex);
|
||||
if (adc_pll_lock_cnt == 10)
|
||||
tvafe_pr_info("%s: adc pll lock fail!!!\n", __func__);
|
||||
if (tvafe_dbg_enable)
|
||||
tvafe_pr_info("\n%s: on:%d,module:0x%x,flag:0x%x...\n",
|
||||
if (tvafe_dbg_print & TVAFE_DBG_NORMAL)
|
||||
tvafe_pr_info("%s: on:%d,module:0x%x,flag:0x%x...\n",
|
||||
__func__, on, module_sel, adc_pll_chg);
|
||||
|
||||
break;
|
||||
@@ -859,8 +858,8 @@ int adc_set_pll_cntl(bool on, unsigned int module_sel, void *pDtvPara)
|
||||
mutex_unlock(&pll_mutex);
|
||||
if (adc_pll_lock_cnt >= 10)
|
||||
tvafe_pr_info("%s: adc pll lock fail!!!\n", __func__);
|
||||
if (tvafe_dbg_enable)
|
||||
tvafe_pr_info("\n%s: on:%d,module:0x%x,flag:0x%x...\n",
|
||||
if (tvafe_dbg_print & TVAFE_DBG_NORMAL)
|
||||
tvafe_pr_info("%s: on:%d,module:0x%x,flag:0x%x...\n",
|
||||
__func__, on, module_sel, adc_pll_chg);
|
||||
break;
|
||||
case ADC_EN_DTV_DEMODPLL: /* dtv demod default*/
|
||||
@@ -934,7 +933,7 @@ int adc_set_pll_cntl(bool on, unsigned int module_sel, void *pDtvPara)
|
||||
mutex_unlock(&pll_mutex);
|
||||
if (adc_pll_lock_cnt == 10)
|
||||
tvafe_pr_info("%s: adc pll lock fail!!!\n", __func__);
|
||||
if (tvafe_dbg_enable)
|
||||
if (tvafe_dbg_print & TVAFE_DBG_NORMAL)
|
||||
tvafe_pr_info("\n%s: on:%d,module:0x%x,flag:0x%x...\n",
|
||||
__func__, on, module_sel, adc_pll_chg);
|
||||
break;
|
||||
|
||||
@@ -195,7 +195,6 @@ extern int tvafe_cpu_type(void);
|
||||
extern void tvafe_clk_gate_ctrl(int status);
|
||||
|
||||
extern struct mutex pll_mutex;
|
||||
extern bool tvafe_dbg_enable;
|
||||
|
||||
#endif /* _TVAFE_GENERAL_H */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user