return 0;
}
+static int rk3288_win_area_check_var(int win_id,int area_num,struct rk_lcdc_win_area *area_pre,
+ struct rk_lcdc_win_area *area_now)
+{
+ if((area_pre->ypos >= area_now->ypos) ||
+ (area_pre->ypos+area_pre->ysize >= area_now->ypos)){
+ area_now->state = 0;
+ pr_err("win[%d]:\n"
+ "area_pre[%d]:ypos[%d],ysize[%d]\n"
+ "area_now[%d]:ypos[%d],ysize[%d]\n",
+ win_id,
+ area_num-1,area_pre->ypos,area_pre->ysize,
+ area_num, area_now->ypos,area_now->ysize);
+ return -EINVAL;
+ }
+ return 0;
+}
+
static int rk3288_win_0_1_reg_update(struct rk_lcdc_driver *dev_drv,int win_id)
{
struct lcdc_device *lcdc_dev =
mask = m_WIN0_BIC_COE_SEL |
m_WIN0_VSD_YRGB_GT4 | m_WIN0_VSD_YRGB_GT2 |
- m_WIN0_VSD_CBR_GT4 | m_WIN0_VSD_CBR_GT4 |
+ m_WIN0_VSD_CBR_GT4 | m_WIN0_VSD_CBR_GT2 |
m_WIN0_YRGB_HOR_SCL_MODE | m_WIN0_YRGB_VER_SCL_MODE |
m_WIN0_YRGB_HSD_MODE | m_WIN0_YRGB_VSU_MODE |
m_WIN0_YRGB_VSD_MODE | m_WIN0_CBR_HOR_SCL_MODE |
/*area 0*/
if(win->area[0].state == 1){
mask = m_WIN2_MST0_EN;
- val = v_WIN2_MST0_EN(1);
+ val = v_WIN2_MST0_EN(win->area[0].state);
lcdc_msk_reg(lcdc_dev,WIN2_CTRL0+off,mask,val);
mask = m_WIN2_VIR_STRIDE0;
}
/*area 1*/
if(win->area[1].state == 1){
+ rk3288_win_area_check_var(win_id,1,&win->area[0],&win->area[1]);
+
mask = m_WIN2_MST1_EN;
- val = v_WIN2_MST1_EN(1);
+ val = v_WIN2_MST1_EN(win->area[1].state);
lcdc_msk_reg(lcdc_dev,WIN2_CTRL0+off,mask,val);
mask = m_WIN2_VIR_STRIDE1;
}
/*area 2*/
if(win->area[2].state == 1){
+ rk3288_win_area_check_var(win_id,2,&win->area[1],&win->area[2]);
+
mask = m_WIN2_MST2_EN;
- val = v_WIN2_MST2_EN(1);
+ val = v_WIN2_MST2_EN(win->area[2].state);
lcdc_msk_reg(lcdc_dev,WIN2_CTRL0+off,mask,val);
mask = m_WIN2_VIR_STRIDE2;
}
/*area 3*/
if(win->area[3].state == 1){
+ rk3288_win_area_check_var(win_id,3,&win->area[2],&win->area[3]);
+
mask = m_WIN2_MST3_EN;
- val = v_WIN2_MST3_EN(1);
+ val = v_WIN2_MST3_EN(win->area[3].state);
lcdc_msk_reg(lcdc_dev,WIN2_CTRL0+off,mask,val);
mask = m_WIN2_VIR_STRIDE3;
static int rk3288_lcdc_blank(struct rk_lcdc_driver *dev_drv,
int win_id, int blank_mode)
{
- struct lcdc_device *lcdc_dev =
- container_of(dev_drv, struct lcdc_device, driver);
-
switch (blank_mode) {
case FB_BLANK_UNBLANK:
rk3288_lcdc_early_resume(dev_drv);
v_STANDBY_EN(lcdc_dev->standby));
for (i=0;i<4;i++) {
win = dev_drv->win[i];
- if (win->state == 0) {
+ if ((win->state == 0)&&(win->last_state == 1)) {
switch (win->id) {
case 0:
mask = m_WIN0_EN;
break;
}
}
+ win->last_state = win->state;
}
lcdc_cfg_done(lcdc_dev);
spin_unlock(&lcdc_dev->reg_lock);
{
struct lcdc_device *lcdc_dev =
container_of(dev_drv, struct lcdc_device, driver);
+ int ovl;
spin_lock(&lcdc_dev->reg_lock);
- int ovl = lcdc_read_bit(lcdc_dev, SYS_CTRL, m_DIRECT_PATH_EN);
+ ovl = lcdc_read_bit(lcdc_dev, SYS_CTRL, m_DIRECT_PATH_EN);
spin_unlock(&lcdc_dev->reg_lock);
return ovl;
}
container_of(dev_drv, struct lcdc_device, driver);
struct rk_screen *screen = dev_drv->cur_screen;
int total_pixel,calc_pixel,stage_up,stage_down;
- u32 mask, val;
+ u32 mask=0, val=0;
u32 cabc_mode[5][3]={
/*num ,up, down*/
u32 xoffset = var->xoffset;
u32 yoffset = var->yoffset;
u32 xvir = var->xres_virtual;
- u32 yvir = var->yres_virtual;
+ /*u32 yvir = var->yres_virtual;*/
/*u8 data_format = var->nonstd&0xff;*/
u8 pixel_width;
kfree(data);
}
}
+static int rk_fb_check_config_var(struct rk_fb_area_par *area_par,struct rk_screen *screen)
+{
+ if(area_par->x_offset+area_par->xact > area_par->xvir){
+ pr_err("check config var fail 0:\n"
+ "x_offset=%d,xact=%d,xvir=%d\n",
+ area_par->x_offset,
+ area_par->xact,
+ area_par->xvir);
+ return -EINVAL;
+ }
+
+ if((area_par->xpos+area_par->xsize > screen->mode.xres) ||
+ (area_par->ypos+area_par->ysize > screen->mode.yres)){
+ pr_err("check config var fail 1:\n"
+ "xpos=%d,xsize=%d,xres=%d\n"
+ "ypos=%d,ysize=%d,yres=%d\n",
+ area_par->xpos,
+ area_par->xsize,
+ screen->mode.xres,
+ area_par->ypos,
+ area_par->ysize,
+ screen->mode.yres
+ );
+ return -EINVAL;
+ }
+ return 0;
+}
static int rk_fb_set_win_buffer(struct fb_info *info,
struct rk_fb_win_par *win_par,struct rk_fb_reg_win_data *reg_win_data)
struct rk_lcdc_driver * dev_drv = (struct rk_lcdc_driver * )info->par;
struct rk_screen *screen = dev_drv->cur_screen;
- int i,j,ion_fd,acq_fence_fd;
+ int i,ion_fd,acq_fence_fd;
u32 xvir,yvir;
u32 xoffset,yoffset;
u32 stride,uv_stride;
u32 stride_32bit_1;
u32 stride_32bit_2;
- u32 stride_128bit_1;
- u32 stride_128bit_2;
u16 uv_x_off,uv_y_off,uv_y_act;
u8 is_pic_yuv=0;
u8 ppixel_a=0,global_a=0;
reg_win_data->win_id = -1;
}
for(i=0;i<reg_win_data->area_num;i++){
+ rk_fb_check_config_var(&win_par->area_par[i],screen);
reg_win_data->reg_area_data[i].xpos = win_par->area_par[i].xpos;//visiable pos in panel
reg_win_data->reg_area_data[i].ypos = win_par->area_par[i].ypos;
struct sync_fence *retire_fence;
struct sync_pt *release_sync_pt[RK_MAX_BUF_NUM];
struct sync_pt *retire_sync_pt;
- int fencd_fd;
char fence_name[20];
#endif
int ret,i,j=0;
u32 stride,uv_stride;
u32 stride_32bit_1;
u32 stride_32bit_2;
- u32 stride_128bit_1;
- u32 stride_128bit_2;
u16 uv_x_off,uv_y_off,uv_y_act;
u8 is_pic_yuv=0;