From 8fc2f93b48b8d8863ace3925f9865e216fc37a3f Mon Sep 17 00:00:00 2001 From: yxj Date: Wed, 16 Jan 2013 17:37:43 +0800 Subject: [PATCH] rk fb:move screen related power control from fb driver to lcdc driver --- drivers/video/rockchip/lcdc/rk2928_lcdc.c | 30 ++++++++++++++++++++ drivers/video/rockchip/lcdc/rk3066b_lcdc.c | 30 ++++++++++++++++++++ drivers/video/rockchip/lcdc/rk30_lcdc.c | 32 +++++++++++++++++++++ drivers/video/rockchip/lcdc/rk3188_lcdc.c | 31 ++++++++++++++++++++ drivers/video/rockchip/rk_fb.c | 33 ++-------------------- 5 files changed, 125 insertions(+), 31 deletions(-) diff --git a/drivers/video/rockchip/lcdc/rk2928_lcdc.c b/drivers/video/rockchip/lcdc/rk2928_lcdc.c index d3ed19c1b26e..c920611325b5 100644 --- a/drivers/video/rockchip/lcdc/rk2928_lcdc.c +++ b/drivers/video/rockchip/lcdc/rk2928_lcdc.c @@ -1028,6 +1028,11 @@ static int rk2928_lcdc_hdmi_process(struct rk_lcdc_device_driver *dev_drv,int mo int rk2928_lcdc_early_suspend(struct rk_lcdc_device_driver *dev_drv) { struct rk2928_lcdc_device *lcdc_dev = container_of(dev_drv,struct rk2928_lcdc_device,driver); + + if(dev_drv->screen0->standby) + dev_drv->screen0->standby(1); + if(dev_drv->screen_ctr_info->io_disable) + dev_drv->screen_ctr_info->io_disable(); if(dev_drv->cur_screen->sscreen_set) dev_drv->cur_screen->sscreen_set(dev_drv->cur_screen , 0); @@ -1065,6 +1070,9 @@ int rk2928_lcdc_early_suspend(struct rk_lcdc_device_driver *dev_drv) int rk2928_lcdc_early_resume(struct rk_lcdc_device_driver *dev_drv) { struct rk2928_lcdc_device *lcdc_dev = container_of(dev_drv,struct rk2928_lcdc_device,driver); + + if(dev_drv->screen_ctr_info->io_enable) //power on + dev_drv->screen_ctr_info->io_enable(); if(!lcdc_dev->clk_on) { @@ -1090,6 +1098,9 @@ int rk2928_lcdc_early_resume(struct rk_lcdc_device_driver *dev_drv) if(dev_drv->cur_screen->sscreen_set) dev_drv->cur_screen->sscreen_set(dev_drv->cur_screen , 1); + + if(dev_drv->screen0->standby) + dev_drv->screen0->standby(0); //screen wake up return 0; @@ -1246,6 +1257,25 @@ static int __devinit rk2928_lcdc_probe (struct platform_device *pdev) ret = -EBUSY; goto err3; } + + if(screen_ctr_info->set_screen_info) + { + screen_ctr_info->set_screen_info(screen0,screen_ctr_info->lcd_info); + if(SCREEN_NULL==screen0->type) + { + printk(KERN_WARNING "no display device on lcdc%d!?\n",lcdc_dev->id); + ret = -ENODEV; + } + if(screen_ctr_info->io_init) + screen_ctr_info->io_init(NULL); + } + else + { + printk(KERN_WARNING "no display device on lcdc%d!?\n",lcdc_dev->id); + ret = -ENODEV; + goto err4; + } + ret = rk_fb_register(&(lcdc_dev->driver),&lcdc_driver,lcdc_dev->id); if(ret < 0) { diff --git a/drivers/video/rockchip/lcdc/rk3066b_lcdc.c b/drivers/video/rockchip/lcdc/rk3066b_lcdc.c index 8a413e951e47..fd456dfbe8fa 100755 --- a/drivers/video/rockchip/lcdc/rk3066b_lcdc.c +++ b/drivers/video/rockchip/lcdc/rk3066b_lcdc.c @@ -923,6 +923,11 @@ static void rk3066b_lcdc_reg_dump(struct rk3066b_lcdc_device *lcdc_dev) int rk3066b_lcdc_early_suspend(struct rk_lcdc_device_driver *dev_drv) { struct rk3066b_lcdc_device *lcdc_dev = container_of(dev_drv,struct rk3066b_lcdc_device,driver); + + if(dev_drv->screen0->standby) + dev_drv->screen0->standby(1); + if(dev_drv->screen_ctr_info->io_disable) + dev_drv->screen_ctr_info->io_disable(); spin_lock(&lcdc_dev->reg_lock); if(likely(lcdc_dev->clk_on)) @@ -953,6 +958,9 @@ int rk3066b_lcdc_early_suspend(struct rk_lcdc_device_driver *dev_drv) int rk3066b_lcdc_early_resume(struct rk_lcdc_device_driver *dev_drv) { struct rk3066b_lcdc_device *lcdc_dev = container_of(dev_drv,struct rk3066b_lcdc_device,driver); + + if(dev_drv->screen_ctr_info->io_enable) //power on + dev_drv->screen_ctr_info->io_enable(); if(!lcdc_dev->clk_on) { @@ -977,6 +985,9 @@ int rk3066b_lcdc_early_resume(struct rk_lcdc_device_driver *dev_drv) } lcdc_dev->clk_on = 1; spin_unlock(&lcdc_dev->reg_lock); + + if(dev_drv->screen0->standby) + dev_drv->screen0->standby(0); //screen wake up return 0; } @@ -1141,6 +1152,25 @@ static int __devinit rk3066b_lcdc_probe (struct platform_device *pdev) ret = -EBUSY; goto err3; } + + if(screen_ctr_info->set_screen_info) + { + screen_ctr_info->set_screen_info(screen,screen_ctr_info->lcd_info); + if(SCREEN_NULL==screen->type) + { + printk(KERN_WARNING "no display device on lcdc%d!?\n",lcdc_dev->id); + ret = -ENODEV; + } + if(screen_ctr_info->io_init) + screen_ctr_info->io_init(NULL); + } + else + { + printk(KERN_WARNING "no display device on lcdc%d!?\n",lcdc_dev->id); + ret = -ENODEV; + goto err4; + } + ret = rk_fb_register(&(lcdc_dev->driver),&lcdc_driver,lcdc_dev->id); if(ret < 0) { diff --git a/drivers/video/rockchip/lcdc/rk30_lcdc.c b/drivers/video/rockchip/lcdc/rk30_lcdc.c index 842f48ad23a7..6443b50c6d6a 100644 --- a/drivers/video/rockchip/lcdc/rk30_lcdc.c +++ b/drivers/video/rockchip/lcdc/rk30_lcdc.c @@ -1254,6 +1254,12 @@ static int rk30_set_dsp_lut(struct rk_lcdc_device_driver *dev_drv,int *lut) int rk30_lcdc_early_suspend(struct rk_lcdc_device_driver *dev_drv) { struct rk30_lcdc_device *lcdc_dev = container_of(dev_drv,struct rk30_lcdc_device,driver); + + + if(dev_drv->screen0->standby) + dev_drv->screen0->standby(1); + if(dev_drv->screen_ctr_info->io_disable) + dev_drv->screen_ctr_info->io_disable(); spin_lock(&lcdc_dev->reg_lock); if(likely(lcdc_dev->clk_on)) @@ -1282,6 +1288,10 @@ int rk30_lcdc_early_resume(struct rk_lcdc_device_driver *dev_drv) int i=0; int __iomem *c; int v; + + if(dev_drv->screen_ctr_info->io_enable) //power on + dev_drv->screen_ctr_info->io_enable(); + if(!lcdc_dev->clk_on) { rk30_lcdc_clk_enable(lcdc_dev); @@ -1313,6 +1323,9 @@ int rk30_lcdc_early_resume(struct rk_lcdc_device_driver *dev_drv) if(!lcdc_dev->atv_layer_cnt) rk30_lcdc_clk_disable(lcdc_dev); + if(dev_drv->screen0->standby) + dev_drv->screen0->standby(0); //screen wake up + return 0; } static irqreturn_t rk30_lcdc_isr(int irq, void *dev_id) @@ -1467,6 +1480,25 @@ static int __devinit rk30_lcdc_probe (struct platform_device *pdev) ret = -EBUSY; goto err3; } + + if(screen_ctr_info->set_screen_info) + { + screen_ctr_info->set_screen_info(screen,screen_ctr_info->lcd_info); + if(SCREEN_NULL==screen->type) + { + printk(KERN_WARNING "no display device on lcdc%d!?\n",lcdc_dev->id); + ret = -ENODEV; + } + if(screen_ctr_info->io_init) + screen_ctr_info->io_init(NULL); + } + else + { + printk(KERN_WARNING "no display device on lcdc%d!?\n",lcdc_dev->id); + ret = -ENODEV; + goto err4; + } + ret = rk_fb_register(&(lcdc_dev->driver),&lcdc_driver,lcdc_dev->id); if(ret < 0) { diff --git a/drivers/video/rockchip/lcdc/rk3188_lcdc.c b/drivers/video/rockchip/lcdc/rk3188_lcdc.c index ec05afa08b95..256cd98c290e 100644 --- a/drivers/video/rockchip/lcdc/rk3188_lcdc.c +++ b/drivers/video/rockchip/lcdc/rk3188_lcdc.c @@ -649,6 +649,11 @@ static int rk3188_lcdc_early_suspend(struct rk_lcdc_device_driver *dev_drv) struct rk3188_lcdc_device *lcdc_dev = container_of(dev_drv,struct rk3188_lcdc_device,driver); + if(dev_drv->screen0->standby) + dev_drv->screen0->standby(1); + if(dev_drv->screen_ctr_info->io_disable) + dev_drv->screen_ctr_info->io_disable(); + spin_lock(&lcdc_dev->reg_lock); if(likely(lcdc_dev->clk_on)) { @@ -674,6 +679,10 @@ static int rk3188_lcdc_early_resume(struct rk_lcdc_device_driver *dev_drv) int i=0; int __iomem *c; int v; + + if(dev_drv->screen_ctr_info->io_enable) //power on + dev_drv->screen_ctr_info->io_enable(); + if(!lcdc_dev->clk_on) { rk3188_lcdc_clk_enable(lcdc_dev); @@ -704,6 +713,9 @@ static int rk3188_lcdc_early_resume(struct rk_lcdc_device_driver *dev_drv) if(!lcdc_dev->atv_layer_cnt) rk3188_lcdc_clk_disable(lcdc_dev); + + if(dev_drv->screen0->standby) + dev_drv->screen0->standby(0); //screen wake up return 0; } @@ -1098,6 +1110,25 @@ static int __devinit rk3188_lcdc_probe(struct platform_device *pdev) ret = -EBUSY; goto err3; } + + if(screen_ctr_info->set_screen_info) + { + screen_ctr_info->set_screen_info(screen,screen_ctr_info->lcd_info); + if(SCREEN_NULL==screen->type) + { + printk(KERN_WARNING "no display device on lcdc%d!?\n",lcdc_dev->id); + ret = -ENODEV; + } + if(screen_ctr_info->io_init) + screen_ctr_info->io_init(NULL); + } + else + { + printk(KERN_WARNING "no display device on lcdc%d!?\n",lcdc_dev->id); + ret = -ENODEV; + goto err4; + } + ret = rk_fb_register(&(lcdc_dev->driver),&lcdc_driver,lcdc_dev->id); if(ret < 0) { diff --git a/drivers/video/rockchip/rk_fb.c b/drivers/video/rockchip/rk_fb.c index 90932633d41a..dbd4fe350265 100644 --- a/drivers/video/rockchip/rk_fb.c +++ b/drivers/video/rockchip/rk_fb.c @@ -1099,26 +1099,7 @@ int rk_fb_register(struct rk_lcdc_device_driver *dev_drv, } lcdc_id = i; init_lcdc_device_driver(dev_drv, def_drv,id); - if(dev_drv->screen_ctr_info->set_screen_info) - { - dev_drv->screen_ctr_info->set_screen_info(dev_drv->cur_screen, - dev_drv->screen_ctr_info->lcd_info); - if(SCREEN_NULL==dev_drv->cur_screen->type) - { - printk(KERN_WARNING "no display device on lcdc%d!?\n",dev_drv->id); - fb_inf->num_lcdc--; - return -ENODEV; - } - if(dev_drv->screen_ctr_info->io_init) - dev_drv->screen_ctr_info->io_init(NULL); - } - else - { - printk(KERN_WARNING "no display device on lcdc%d!?\n",dev_drv->id); - fb_inf->num_lcdc--; - return -ENODEV; - } - + dev_drv->init_lcdc(dev_drv); /************fb set,one layer one fb ***********/ dev_drv->fb_index_base = fb_inf->num_fb; @@ -1254,10 +1235,7 @@ static void rkfb_early_suspend(struct early_suspend *h) { if (!inf->lcdc_dev_drv[i]) continue; - if(inf->lcdc_dev_drv[i]->screen0->standby) - inf->lcdc_dev_drv[i]->screen0->standby(1); - if(inf->lcdc_dev_drv[i]->screen_ctr_info->io_disable) - inf->lcdc_dev_drv[i]->screen_ctr_info->io_disable(); + inf->lcdc_dev_drv[i]->suspend(inf->lcdc_dev_drv[i]); } } @@ -1271,15 +1249,8 @@ static void rkfb_early_resume(struct early_suspend *h) { if (!inf->lcdc_dev_drv[i]) continue; - if(inf->lcdc_dev_drv[i]->screen_ctr_info->io_enable) //power on - inf->lcdc_dev_drv[i]->screen_ctr_info->io_enable(); inf->lcdc_dev_drv[i]->resume(inf->lcdc_dev_drv[i]); // data out - - if(inf->lcdc_dev_drv[i]->screen0->standby) - inf->lcdc_dev_drv[i]->screen0->standby(0); //screen wake up - - } } -- 2.34.1