enum tvin_aspect_ratio_e aspect_ratio = TVIN_ASPECT_NULL;
full_format = R_APB_BIT(CVD2_VBI_WSS_DATA1, 0, 4);
- if (full_format == 0x8)
- aspect_ratio = TVIN_ASPECT_4x3;
- else if (full_format == 0x7)
- aspect_ratio = TVIN_ASPECT_16x9;
+
+ if (full_format == TVIN_AR_14x9_LB_CENTER_VAL)
+ aspect_ratio = TVIN_ASPECT_14x9_LB_CENTER;
+ else if (full_format == TVIN_AR_14x9_LB_TOP_VAL)
+ aspect_ratio = TVIN_ASPECT_14x9_LB_TOP;
+ else if (full_format == TVIN_AR_16x9_LB_TOP_VAL)
+ aspect_ratio = TVIN_ASPECT_16x9_LB_TOP;
+ else if (full_format == TVIN_AR_16x9_FULL_VAL)
+ aspect_ratio = TVIN_ASPECT_16x9_FULL;
+ else if (full_format == TVIN_AR_4x3_FULL_VAL)
+ aspect_ratio = TVIN_ASPECT_4x3_FULL;
+ else if (full_format == TVIN_AR_16x9_LB_CENTER_VAL)
+ aspect_ratio = TVIN_ASPECT_16x9_LB_CENTER;
+ else if (full_format == TVIN_AR_16x9_LB_CENTER1_VAL)
+ aspect_ratio = TVIN_ASPECT_16x9_LB_CENTER;
+ else if (full_format == TVIN_AR_14x9_FULL_VAL)
+ aspect_ratio = TVIN_ASPECT_14x9_FULL;
else
aspect_ratio = TVIN_ASPECT_NULL;
+
return aspect_ratio;
}
+
/*only for develop debug*/
#ifdef TVAFE_CVD_DEBUG
module_param(hs_adj_th_level0, uint, 0664);
switch (aspect_ratio) {
case TVIN_ASPECT_1x1:
return "TVIN_ASPECT_1x1";
- case TVIN_ASPECT_4x3:
- return "TVIN_ASPECT_4x3";
- case TVIN_ASPECT_16x9:
- return "TVIN_ASPECT_16x9";
+ case TVIN_ASPECT_4x3_FULL:
+ return "TVIN_ASPECT_4x3_FULL";
+ case TVIN_ASPECT_14x9_FULL:
+ return "TVIN_ASPECT_14x9_FULL";
+ case TVIN_ASPECT_14x9_LB_CENTER:
+ return "TVIN_ASPECT_14x9_LETTERBOX_CENTER";
+ case TVIN_ASPECT_14x9_LB_TOP:
+ return "TVIN_ASPECT_14x9_LETTERBOX_TOP";
+ case TVIN_ASPECT_16x9_FULL:
+ return "TVIN_ASPECT_16x9_FULL";
+ case TVIN_ASPECT_16x9_LB_CENTER:
+ return "TVIN_ASPECT_16x9_LETTERBOX_CENTER";
+ case TVIN_ASPECT_16x9_LB_TOP:
+ return "TVIN_ASPECT_16x9_LETTERBOX_TOP";
default:
return "TVIN_ASPECT_NULL";
}
unsigned int duration;
};
+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,
+};
+
enum tvin_aspect_ratio_e {
TVIN_ASPECT_NULL = 0,
TVIN_ASPECT_1x1,
- TVIN_ASPECT_4x3,
- TVIN_ASPECT_16x9,
+ TVIN_ASPECT_4x3_FULL,
+ TVIN_ASPECT_14x9_FULL,
+ TVIN_ASPECT_14x9_LB_CENTER,
+ TVIN_ASPECT_14x9_LB_TOP,
+ TVIN_ASPECT_16x9_FULL,
+ TVIN_ASPECT_16x9_LB_CENTER,
+ TVIN_ASPECT_16x9_LB_TOP,
TVIN_ASPECT_MAX,
};
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/dma-contiguous.h>
+#include <linux/amlogic/media/video_sink/video.h>
#include "../tvin_global.h"
#include "../tvin_format_table.h"
#include "vdin_ctl.h"
else
vf->ratio_control = 0x0 << DISP_RATIO_ASPECT_RATIO_BIT;
- if (aspect_ratio == TVIN_ASPECT_4x3)
- vf->ratio_control = 0xc0 << DISP_RATIO_ASPECT_RATIO_BIT;
- else if (aspect_ratio == TVIN_ASPECT_16x9)
- vf->ratio_control = 0x90 << DISP_RATIO_ASPECT_RATIO_BIT;
+ switch (aspect_ratio) {
+ case TVIN_ASPECT_4x3_FULL:
+ vf->pic_mode.screen_mode = VIDEO_WIDEOPTION_CUSTOM;
+ vf->pic_mode.hs = 0;
+ vf->pic_mode.he = 0;
+ vf->pic_mode.vs = 1;
+ vf->pic_mode.ve = 0;
+ /* 3*256/4=0xc0 */
+ vf->pic_mode.custom_ar = 0xc0;
+ vf->ratio_control |= DISP_RATIO_ADAPTED_PICMODE;
+ break;
+ case TVIN_ASPECT_14x9_FULL:
+ vf->pic_mode.screen_mode = VIDEO_WIDEOPTION_CUSTOM;
+ vf->pic_mode.hs = 0;
+ vf->pic_mode.he = 0;
+ vf->pic_mode.vs = 1;
+ vf->pic_mode.ve = 0;
+ /* 9*256/14=0xc0 */
+ vf->pic_mode.custom_ar = 0xa4;
+ vf->ratio_control |= DISP_RATIO_ADAPTED_PICMODE;
+ break;
+ case TVIN_ASPECT_16x9_FULL:
+ vf->pic_mode.screen_mode = VIDEO_WIDEOPTION_CUSTOM;
+ vf->pic_mode.hs = 0;
+ vf->pic_mode.he = 0;
+ vf->pic_mode.vs = 1;
+ vf->pic_mode.ve = 0;
+ /* 9*256/16=0xc0 */
+ vf->pic_mode.custom_ar = 0x90;
+ vf->ratio_control |= DISP_RATIO_ADAPTED_PICMODE;
+ break;
+ case TVIN_ASPECT_14x9_LB_CENTER:
+ /**720/462=14/9;(576-462)/2=57;57/2=28**/
+ vf->pic_mode.screen_mode = VIDEO_WIDEOPTION_CUSTOM;
+ vf->pic_mode.hs = 0;
+ vf->pic_mode.he = 0;
+ vf->pic_mode.vs = 28;
+ vf->pic_mode.ve = 28;
+ 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.hs = 0;
+ vf->pic_mode.he = 0;
+ vf->pic_mode.vs = 0;
+ vf->pic_mode.ve = 57;
+ vf->pic_mode.custom_ar = 0xa4;
+ vf->ratio_control |= DISP_RATIO_ADAPTED_PICMODE;
+ break;
+ case TVIN_ASPECT_16x9_LB_CENTER:
+ /**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.hs = 0;
+ vf->pic_mode.he = 0;
+ vf->pic_mode.vs = 70;
+ vf->pic_mode.ve = 70;
+ vf->pic_mode.custom_ar = 0x90;
+ vf->ratio_control |= DISP_RATIO_ADAPTED_PICMODE;
+ break;
+ 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.hs = 0;
+ vf->pic_mode.he = 0;
+ vf->pic_mode.vs = 0;
+ vf->pic_mode.ve = 85;
+ vf->pic_mode.custom_ar = 0x90;
+ vf->ratio_control |= DISP_RATIO_ADAPTED_PICMODE;
+ break;
+ default:
+ break;
+ }
}
/*function:set source bitdepth
}
pr_info("force color range-%d\n\n", color_range_force);
break;
+ case TVIN_IOC_SET_AUTO_RATIO_EN:
+ if (devp->index != 0)
+ break;
+ if (copy_from_user(&(devp->auto_ratio_en),
+ argp, sizeof(unsigned int))) {
+ ret = -EFAULT;
+ break;
+ }
+ if (vdin_dbg_en) {
+ pr_info("TVIN_IOC_SET_AUTO_RATIO_EN(%d) done\n\n",
+ devp->auto_ratio_en);
+ }
+ break;
default:
ret = -ENOIOCTLCMD;
/* pr_info("%s %d is not supported command\n", __func__, cmd); */
}
return ret;
}
+
#ifdef CONFIG_COMPAT
static long vdin_compat_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
/*enable auto cutwindow for atv*/
if (vdevp->index == 0) {
vdevp->auto_cutwindow_en = 1;
- vdevp->auto_ratio_en = 1;
+ vdevp->auto_ratio_en = 0;
#ifdef CONFIG_CMA
vdevp->cma_mem_mode = 1;
#endif
spin_lock_irqsave(&p->wr_lock, flags);
vf_pool_put(master, &p->wr_list);
p->wr_list_size++;
+ memset(&(master->vf.pic_mode), 0, sizeof(master->vf.pic_mode));
+ master->vf.ratio_control = 0;
spin_unlock_irqrestore(&p->wr_lock, flags);
spin_lock_irqsave(&p->log_lock, flags);
vf_log(p, VF_OPERATION_BPUT, true);
spin_lock_irqsave(&p->wr_lock, flags);
vf_pool_put(master, &p->wr_list);
p->wr_list_size++;
+ memset(&(master->vf.pic_mode), 0,
+ sizeof(master->vf.pic_mode));
+ master->vf.ratio_control = 0;
spin_unlock_irqrestore(&p->wr_lock, flags);
slave->status = VF_STATUS_SL;
spin_lock_irqsave(&p->log_lock, flags);
#define TVIN_IOC_SET_COLOR_RANGE _IOW(_TM_T, 0X4a,\
enum tvin_force_color_range_e)
#define TVIN_IOC_GAME_MODE _IOW(_TM_T, 0x4b, unsigned int)
+#define TVIN_IOC_SET_AUTO_RATIO_EN _IOW(_TM_T, 0x4c, unsigned int)
+
/* TVAFE */
#define TVIN_IOC_S_AFE_VGA_PARM _IOW(_TM_T, 0x16, struct tvafe_vga_parm_s)
#define TVIN_IOC_G_AFE_VGA_PARM _IOR(_TM_T, 0x17, struct tvafe_vga_parm_s)