rk fb:move screen related power control from fb driver to lcdc driver
authoryxj <yxj@rock-chips.com>
Wed, 16 Jan 2013 09:37:43 +0000 (17:37 +0800)
committeryxj <yxj@rock-chips.com>
Wed, 16 Jan 2013 09:43:17 +0000 (17:43 +0800)
drivers/video/rockchip/lcdc/rk2928_lcdc.c
drivers/video/rockchip/lcdc/rk3066b_lcdc.c
drivers/video/rockchip/lcdc/rk30_lcdc.c
drivers/video/rockchip/lcdc/rk3188_lcdc.c
drivers/video/rockchip/rk_fb.c

index d3ed19c1b26e9c4e3b80474acc12bae085309a35..c920611325b55c6d72fefef46358e3247e2a86c1 100644 (file)
@@ -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)
        {
index 8a413e951e47fa8dfb7069be7b532ac8302f9953..fd456dfbe8fa13581828b4faec63f0bd5aadbe14 100755 (executable)
@@ -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)
        {
index 842f48ad23a75dbc53218f6da50e59f9f6c64034..6443b50c6d6aa115522f130a6cde9396d4b3fb75 100644 (file)
@@ -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)
        {
index ec05afa08b95b7a4ee151d35acead20803271386..256cd98c290ee10135eb91b78084cb424267d6fb 100644 (file)
@@ -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)
        {
index 90932633d41ad4c5bdcd03f6d3bac2a6ffe95b14..dbd4fe350265183b1fe72c6a5456eb1f35f5e964 100644 (file)
@@ -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
-               
-               
        }
 
 }