From e2cfe093658b66ab0f503c34b4c1c6c09819a91f Mon Sep 17 00:00:00 2001 From: hjc Date: Wed, 19 Mar 2014 17:45:58 +0800 Subject: [PATCH] rk3288 lcdc: according the win state to set par. --- drivers/video/rockchip/lcdc/rk3288_lcdc.c | 43 +++++++++++++++++++++-- drivers/video/rockchip/rk_fb.c | 8 +++-- 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/drivers/video/rockchip/lcdc/rk3288_lcdc.c b/drivers/video/rockchip/lcdc/rk3288_lcdc.c index 361bbc617f1c..44a774e2580c 100755 --- a/drivers/video/rockchip/lcdc/rk3288_lcdc.c +++ b/drivers/video/rockchip/lcdc/rk3288_lcdc.c @@ -761,7 +761,8 @@ static int rk3288_lcdc_reg_update(struct rk_lcdc_driver *dev_drv) } spin_unlock(&lcdc_dev->reg_lock); - if (dev_drv->wait_fs) { + /*if (dev_drv->wait_fs) {*/ + if (0){ spin_lock_irqsave(&dev_drv->cpl_lock, flags); init_completion(&dev_drv->frame_done); spin_unlock_irqrestore(&dev_drv->cpl_lock, flags); @@ -2708,10 +2709,45 @@ static int rk3288_lcdc_config_done(struct rk_lcdc_driver *dev_drv) { struct lcdc_device *lcdc_dev = container_of(dev_drv, struct lcdc_device, driver); - + int i; + unsigned int mask, val; + struct rk_lcdc_win *win = NULL; spin_lock(&lcdc_dev->reg_lock); lcdc_msk_reg(lcdc_dev, SYS_CTRL, m_STANDBY_EN, v_STANDBY_EN(lcdc_dev->standby)); + for (i=0;i<4;i++) { + win = dev_drv->win[i]; + if (win->state == 0) { + switch (win->id) { + case 0: + mask = m_WIN0_EN; + val = v_WIN0_EN(0); + lcdc_msk_reg(lcdc_dev, WIN0_CTRL0, mask,val); + break; + case 1: + mask = m_WIN1_EN; + val = v_WIN1_EN(0); + lcdc_msk_reg(lcdc_dev, WIN1_CTRL0, mask,val); + break; + case 2: + mask = m_WIN2_EN | m_WIN2_MST0_EN | m_WIN2_MST1_EN | + m_WIN2_MST2_EN | m_WIN2_MST3_EN; + val = v_WIN2_EN(0) | v_WIN2_MST0_EN(0) | v_WIN2_MST1_EN(0) | + v_WIN2_MST2_EN(0) | v_WIN2_MST3_EN(0); + lcdc_msk_reg(lcdc_dev, WIN2_CTRL0, mask,val); + break; + case 3: + mask = m_WIN3_EN | m_WIN3_MST0_EN | m_WIN3_MST1_EN | + m_WIN3_MST2_EN | m_WIN3_MST3_EN; + val = v_WIN3_EN(0) | v_WIN3_MST0_EN(0) | v_WIN3_MST1_EN(0) | + v_WIN3_MST2_EN(0) | v_WIN3_MST3_EN(0); + lcdc_msk_reg(lcdc_dev, WIN3_CTRL0, mask,val); + break; + default: + break; + } + } + } lcdc_cfg_done(lcdc_dev); spin_unlock(&lcdc_dev->reg_lock); return 0; @@ -3014,7 +3050,8 @@ static irqreturn_t rk3288_lcdc_isr(int irq, void *dev_id) timestamp = ktime_get(); lcdc_msk_reg(lcdc_dev, INTR_CTRL0, m_FS_INTR_CLR, v_FS_INTR_CLR(1)); - if(lcdc_dev->driver.wait_fs){ + /*if(lcdc_dev->driver.wait_fs){ */ + if (0) { spin_lock(&(lcdc_dev->driver.cpl_lock)); complete(&(lcdc_dev->driver.frame_done)); spin_unlock(&(lcdc_dev->driver.cpl_lock)); diff --git a/drivers/video/rockchip/rk_fb.c b/drivers/video/rockchip/rk_fb.c index 4d6fb0f2d505..b8c13328e534 100755 --- a/drivers/video/rockchip/rk_fb.c +++ b/drivers/video/rockchip/rk_fb.c @@ -1114,7 +1114,6 @@ static void rk_fb_update_reg(struct rk_lcdc_driver * dev_drv,struct rk_fb_reg_da struct rk_lcdc_driver *ext_dev_drv; struct rk_lcdc_win *ext_win; - dev_drv->atv_layer_cnt = regs->win_num; for(i=0;ilcdc_win_num;i++){ //old_reg_win_data[i]= regs->reg_win_data[i]; win = dev_drv->win[i]; @@ -1125,11 +1124,11 @@ static void rk_fb_update_reg(struct rk_lcdc_driver * dev_drv,struct rk_fb_reg_da if(jwin_num){ rk_fb_update_driver(win,®s->reg_win_data[j]); win->state = 1; + dev_drv->ops->set_par(dev_drv,i); + dev_drv->ops->pan_display(dev_drv,i); }else{ win->state = 0; } - dev_drv->ops->set_par(dev_drv,i); - dev_drv->ops->pan_display(dev_drv,i); } dev_drv->ops->ovl_mgr(dev_drv, 0, 1); @@ -1200,12 +1199,15 @@ ext_win_exit: ret = wait_event_interruptible_timeout(dev_drv->vsync_info.wait, !ktime_equal(timestamp, dev_drv->vsync_info.timestamp),msecs_to_jiffies(dev_drv->cur_screen->ft+5)); + #ifdef H_USE_FENCE sw_sync_timeline_inc(dev_drv->timeline, 1); #endif for(i=0;iwin_num;i++){ rk_fb_free_dma_buf(dev_drv->dev,®s->reg_win_data[i]); } + if (dev_drv->wait_fs == 1) + kfree(regs); } static void rk_fb_update_regs_handler(struct kthread_work *work) -- 2.34.1