if ((vf->ratio_control & DISP_RATIO_ADAPTED_PICMODE)
&& !disable_adapted) {
wide_mode = vf->pic_mode.screen_mode;
- video_source_crop_top = vf->pic_mode.vs;
- video_source_crop_left = vf->pic_mode.hs;
- video_source_crop_bottom = vf->pic_mode.ve;
- video_source_crop_right = vf->pic_mode.he;
+ if (vf->pic_mode.provider == PIC_MODE_PROVIDER_WSS) {
+ /* from wss, need add global setting */
+ video_source_crop_top += vf->pic_mode.vs;
+ video_source_crop_left += vf->pic_mode.hs;
+ video_source_crop_bottom += vf->pic_mode.ve;
+ video_source_crop_right += vf->pic_mode.he;
+ } else {
+ /* from PQ database, final setting */
+ video_source_crop_top = vf->pic_mode.vs;
+ video_source_crop_left = vf->pic_mode.hs;
+ video_source_crop_bottom = vf->pic_mode.ve;
+ video_source_crop_right = vf->pic_mode.he;
+ }
if (vf->pic_mode.AFD_enable
&& (vf->ratio_control & DISP_RATIO_INFOFRAME_AVAIL))
wide_mode = VIDEO_WIDEOPTION_AFD;
struct mutex pll_mutex;
#define TVAFE_TIMER_INTERVAL (HZ/100) /* 10ms, #define HZ 100 */
-#define TVAFE_RATIO_CNT 50
+#define TVAFE_RATIO_CNT 40
static struct am_regs_s tvaferegs;
static struct tvafe_pin_mux_s tvafe_pinmux;
struct tvafe_info_s *tvafe = &devp->tvafe;
enum tvin_port_e port = tvafe->parm.port;
enum tvin_aspect_ratio_e aspect_ratio = TVIN_ASPECT_NULL;
+ static int count[10] = {0};
+ int i;
if (!(devp->flags & TVAFE_FLAG_DEV_OPENED) ||
(devp->flags & TVAFE_POWERDOWN_IN_IDLE)) {
if ((port >= TVIN_PORT_CVBS0) && (port <= TVIN_PORT_CVBS3)) {
aspect_ratio = tvafe_cvd2_get_wss();
- if (aspect_ratio != tvafe->aspect_ratio_last) {
- tvafe->aspect_ratio_last = aspect_ratio;
+ 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;
- } else if (++(tvafe->aspect_ratio_cnt) > TVAFE_RATIO_CNT) {
- tvafe->aspect_ratio = aspect_ratio;
- /* avoid overflow */
- tvafe->aspect_ratio_cnt = TVAFE_RATIO_CNT;
}
}
-
return TVIN_BUF_NULL;
}
struct tvafe_cvd2_s cvd2;
/*WSS INFO for av/atv*/
enum tvin_aspect_ratio_e aspect_ratio;
- enum tvin_aspect_ratio_e aspect_ratio_last;
unsigned int aspect_ratio_cnt;
};
unsigned int full_format = 0;
enum tvin_aspect_ratio_e aspect_ratio = TVIN_ASPECT_NULL;
- full_format = R_APB_BIT(CVD2_VBI_WSS_DATA1, 0, 4);
+ full_format = R_APB_REG(CVD2_VBI_WSS_DATA1);
if (full_format == TVIN_AR_14x9_LB_CENTER_VAL)
aspect_ratio = TVIN_ASPECT_14x9_LB_CENTER;
#endif
tvafe_pr_info("tvafe_info_s->aspect_ratio:%d\n",
devp->tvafe.aspect_ratio);
- tvafe_pr_info("tvafe_info_s->aspect_ratio_last:%d\n",
- devp->tvafe.aspect_ratio_last);
tvafe_pr_info("tvafe_info_s->aspect_ratio_cnt:%d\n",
devp->tvafe.aspect_ratio_cnt);
/* tvafe_dev_s->tvin_parm_s struct info */
};
enum tvin_ar_b3_b0_val_e {
- TVIN_AR_14x9_LB_CENTER_VAL = 1,
- TVIN_AR_14x9_LB_TOP_VAL = 2,
- TVIN_AR_16x9_LB_TOP_VAL = 4,
- TVIN_AR_16x9_FULL_VAL = 7,
- TVIN_AR_4x3_FULL_VAL = 8,
- TVIN_AR_16x9_LB_CENTER_VAL = 11,
- TVIN_AR_16x9_LB_CENTER1_VAL = 13,
- TVIN_AR_14x9_FULL_VAL = 14,
+ TVIN_AR_14x9_LB_CENTER_VAL = 0x11,
+ TVIN_AR_14x9_LB_TOP_VAL = 0x12,
+ TVIN_AR_16x9_LB_TOP_VAL = 0x14,
+ TVIN_AR_16x9_FULL_VAL = 0x17,
+ TVIN_AR_4x3_FULL_VAL = 0x18,
+ TVIN_AR_16x9_LB_CENTER_VAL = 0x1b,
+ TVIN_AR_16x9_LB_CENTER1_VAL = 0x1d,
+ TVIN_AR_14x9_FULL_VAL = 0x1e,
};
enum tvin_aspect_ratio_e {
switch (aspect_ratio) {
case TVIN_ASPECT_4x3_FULL:
vf->pic_mode.screen_mode = VIDEO_WIDEOPTION_CUSTOM;
+ vf->pic_mode.provider = PIC_MODE_PROVIDER_WSS;
vf->pic_mode.hs = 0;
vf->pic_mode.he = 0;
- vf->pic_mode.vs = 1;
+ vf->pic_mode.vs = 0;
vf->pic_mode.ve = 0;
/* 3*256/4=0xc0 */
vf->pic_mode.custom_ar = 0xc0;
break;
case TVIN_ASPECT_14x9_FULL:
vf->pic_mode.screen_mode = VIDEO_WIDEOPTION_CUSTOM;
+ vf->pic_mode.provider = PIC_MODE_PROVIDER_WSS;
vf->pic_mode.hs = 0;
vf->pic_mode.he = 0;
- vf->pic_mode.vs = 1;
+ vf->pic_mode.vs = 0;
vf->pic_mode.ve = 0;
/* 9*256/14=0xc0 */
vf->pic_mode.custom_ar = 0xa4;
break;
case TVIN_ASPECT_16x9_FULL:
vf->pic_mode.screen_mode = VIDEO_WIDEOPTION_CUSTOM;
+ vf->pic_mode.provider = PIC_MODE_PROVIDER_WSS;
vf->pic_mode.hs = 0;
vf->pic_mode.he = 0;
- vf->pic_mode.vs = 1;
+ vf->pic_mode.vs = 0;
vf->pic_mode.ve = 0;
/* 9*256/16=0xc0 */
vf->pic_mode.custom_ar = 0x90;
break;
case TVIN_ASPECT_14x9_LB_CENTER:
/**720/462=14/9;(576-462)/2=57;57/2=28**/
+ /**need cut more**/
vf->pic_mode.screen_mode = VIDEO_WIDEOPTION_CUSTOM;
+ vf->pic_mode.provider = PIC_MODE_PROVIDER_WSS;
vf->pic_mode.hs = 0;
vf->pic_mode.he = 0;
- vf->pic_mode.vs = 28;
- vf->pic_mode.ve = 28;
+ vf->pic_mode.vs = 36;
+ vf->pic_mode.ve = 36;
vf->pic_mode.custom_ar = 0xa4;
vf->ratio_control |= DISP_RATIO_ADAPTED_PICMODE;
break;
case TVIN_ASPECT_14x9_LB_TOP:
/**720/462=14/9;(576-462)/2=57**/
vf->pic_mode.screen_mode = VIDEO_WIDEOPTION_CUSTOM;
+ vf->pic_mode.provider = PIC_MODE_PROVIDER_WSS;
vf->pic_mode.hs = 0;
vf->pic_mode.he = 0;
vf->pic_mode.vs = 0;
/**720/405=16/9;(576-405)/2=85;85/2=42**/
/**need cut more**/
vf->pic_mode.screen_mode = VIDEO_WIDEOPTION_CUSTOM;
+ vf->pic_mode.provider = PIC_MODE_PROVIDER_WSS;
vf->pic_mode.hs = 0;
vf->pic_mode.he = 0;
vf->pic_mode.vs = 70;
case TVIN_ASPECT_16x9_LB_TOP:
/**720/405=16/9;(576-405)/2=85**/
vf->pic_mode.screen_mode = VIDEO_WIDEOPTION_CUSTOM;
+ vf->pic_mode.provider = PIC_MODE_PROVIDER_WSS;
vf->pic_mode.hs = 0;
vf->pic_mode.he = 0;
vf->pic_mode.vs = 0;
VFRAME_DISP_MODE_OK,
};
+enum pic_mode_provider_e {
+ PIC_MODE_PROVIDER_DB = 0,
+ PIC_MODE_PROVIDER_WSS,
+ PIC_MODE_UNKNOWN,
+};
+
struct vframe_pic_mode_s {
int hs;
int he;
u32 screen_mode;
u32 custom_ar;
u32 AFD_enable;
+ enum pic_mode_provider_e provider;
};
#define BITDEPTH_Y_SHIFT 8