From f284f42e5e3f0b098507a524823960615515d13d Mon Sep 17 00:00:00 2001 From: yxj Date: Fri, 13 Apr 2012 10:02:53 +0800 Subject: [PATCH] rk30 fb: modify for some lcd screen that need to init the init info passed by struct rk29fb_info --- drivers/video/rockchip/chips/rk30_lcdc.c | 20 ++++---------------- drivers/video/rockchip/rk_fb.c | 21 +++++++++++++-------- include/linux/rk_fb.h | 5 +++-- 3 files changed, 20 insertions(+), 26 deletions(-) diff --git a/drivers/video/rockchip/chips/rk30_lcdc.c b/drivers/video/rockchip/chips/rk30_lcdc.c index 6c77d9d91e8d..c44bc5e000e9 100644 --- a/drivers/video/rockchip/chips/rk30_lcdc.c +++ b/drivers/video/rockchip/chips/rk30_lcdc.c @@ -42,9 +42,9 @@ module_param(dbg_thresd, int, S_IRUGO|S_IWUSR); #define DBG(x...) do { if(unlikely(dbg_thresd)) printk(KERN_INFO x); } while (0) -static int init_rk30_lcdc(struct rk30_lcdc_device *lcdc_dev) +static int init_rk30_lcdc(struct rk_lcdc_device_driver *dev_drv) { - + struct rk30_lcdc_device *lcdc_dev = container_of(dev_drv,struct rk30_lcdc_device,driver); if(lcdc_dev->id == 0) //lcdc0 { lcdc_dev->hclk = clk_get(NULL,"hclk_lcdc0"); @@ -599,6 +599,7 @@ static struct rk_lcdc_device_driver lcdc_driver = { .layer_par = lcdc_layer, .num_layer = ARRAY_SIZE(lcdc_layer), .open = rk30_lcdc_open, + .init_lcdc = init_rk30_lcdc, .ioctl = rk30_lcdc_ioctl, .suspend = rk30_lcdc_early_suspend, .resume = rk30_lcdc_early_resume, @@ -697,21 +698,8 @@ static int __devinit rk30_lcdc_probe (struct platform_device *pdev) lcdc_dev->driver.dev=&pdev->dev; /***************** set lcdc screen ********/ - set_lcd_info(screen, NULL); lcdc_dev->driver.screen = screen; - /***************** INIT LCDC ********/ - ret = init_rk30_lcdc(lcdc_dev); - if(ret < 0) - { - printk(KERN_ERR "init rk30 lcdc failed!\n"); - goto err3; - } - ret = rk30_load_screen(&(lcdc_dev->driver),1); - if(ret < 0) - { - printk(KERN_ERR "rk30 load screen for lcdc0 failed!\n"); - goto err3; - } + /***************** lcdc register ********/ lcdc_dev->irq = platform_get_irq(pdev, 0); if(lcdc_dev->irq < 0) diff --git a/drivers/video/rockchip/rk_fb.c b/drivers/video/rockchip/rk_fb.c index 40b6ba5a0bae..1451527bbc24 100644 --- a/drivers/video/rockchip/rk_fb.c +++ b/drivers/video/rockchip/rk_fb.c @@ -338,6 +338,7 @@ static int rk_fb_set_par(struct fb_info *info) u32 xvir = var->xres_virtual; u32 yvir = var->yres_virtual; u8 data_format = var->nonstd&0xff; + var->pixclock = dev_drv->pixclock; CHK_SUSPEND(dev_drv); layer_id = get_fb_layer_id(fix); if(layer_id < 0) @@ -358,6 +359,7 @@ static int rk_fb_set_par(struct fb_info *info) xsize = (var->grayscale>>8) & 0xfff; //visiable size in panel ,for vide0 ysize = (var->grayscale>>20) & 0xfff; } + /* calculate y_offset,c_offset,line_length,cblen and crlen */ #if 1 switch (data_format) @@ -624,7 +626,9 @@ int rk_fb_register(struct rk_lcdc_device_driver *dev_drv) return -ENOENT; } lcdc_id = i; - + set_lcd_info(dev_drv->screen, fb_inf->mach_info->lcd_info); + dev_drv->init_lcdc(dev_drv); + dev_drv->load_screen(dev_drv,1); /************fb set,one layer one fb ***********/ dev_drv->fb_index_base = fb_inf->num_fb; for(i=0;inum_layer;i++) @@ -725,6 +729,7 @@ int init_lcdc_device_driver(struct rk_lcdc_device_driver *def_drv, dev_drv->layer_par = def_drv->layer_par; dev_drv->num_layer = def_drv->num_layer; dev_drv->open = def_drv->open; + dev_drv->init_lcdc = def_drv->init_lcdc; dev_drv->ioctl = def_drv->ioctl; dev_drv->blank = def_drv->blank; dev_drv->set_par = def_drv->set_par; @@ -752,7 +757,7 @@ static void rkfb_early_suspend(struct early_suspend *h) early_suspend); struct rk_fb_inf *inf = info->inf; int i; - inf->lcd_info->io_disable(); + inf->mach_info->io_disable(); for(i = 0; i < inf->num_lcdc; i++) { atomic_set(&inf->lcdc_dev_drv[i]->in_suspend,1); @@ -765,7 +770,7 @@ static void rkfb_early_resume(struct early_suspend *h) early_suspend); struct rk_fb_inf *inf = info->inf; int i; - inf->lcd_info->io_enable(); + inf->mach_info->io_enable(); for(i = 0; i < inf->num_lcdc; i++) { inf->lcdc_dev_drv[i]->resume(inf->lcdc_dev_drv[i]); @@ -786,7 +791,7 @@ static struct suspend_info suspend_info = { static int __devinit rk_fb_probe (struct platform_device *pdev) { struct rk_fb_inf *fb_inf = NULL; - struct rk29fb_info * lcd_info = NULL; + struct rk29fb_info * mach_info = NULL; int ret = 0; g_fb_pdev=pdev; /* Malloc rk_fb_inf and set it to pdev for drvdata */ @@ -797,10 +802,10 @@ static int __devinit rk_fb_probe (struct platform_device *pdev) ret = -ENOMEM; } platform_set_drvdata(pdev,fb_inf); - lcd_info = pdev->dev.platform_data; - fb_inf->lcd_info = lcd_info; - if(lcd_info->io_init) - lcd_info->io_init(NULL); + mach_info = pdev->dev.platform_data; + fb_inf->mach_info = mach_info; + if(mach_info->io_init) + mach_info->io_init(NULL); #ifdef CONFIG_HAS_EARLYSUSPEND suspend_info.inf = fb_inf; register_early_suspend(&suspend_info.early_suspend); diff --git a/include/linux/rk_fb.h b/include/linux/rk_fb.h index feca19fc7a15..919b8c939587 100644 --- a/include/linux/rk_fb.h +++ b/include/linux/rk_fb.h @@ -200,6 +200,7 @@ struct rk_lcdc_device_driver{ atomic_t in_suspend; //when enter suspend write or read lcdc register are forbidden int (*open)(struct rk_lcdc_device_driver *dev_drv,int layer_id,bool open); + int (*init_lcdc)(struct rk_lcdc_device_driver *dev_drv); int (*ioctl)(struct rk_lcdc_device_driver *dev_drv, unsigned int cmd,unsigned long arg,int layer_id); int (*suspend)(struct rk_lcdc_device_driver *dev_drv); int (*resume)(struct rk_lcdc_device_driver *dev_drv); @@ -207,12 +208,12 @@ struct rk_lcdc_device_driver{ int (*set_par)(struct rk_lcdc_device_driver *dev_drv,int layer_id); int (*pan_display)(struct rk_lcdc_device_driver *dev_drv,int layer_id); int (*get_disp_info)(struct rk_lcdc_device_driver *dev_drv,int layer_id); - int (*load_screen)(struct rk_lcdc_device_driver *lcdc_dev, bool initscreen); + int (*load_screen)(struct rk_lcdc_device_driver *dev_drv, bool initscreen); }; struct rk_fb_inf { - struct rk29fb_info * lcd_info; //lcd io control info + struct rk29fb_info * mach_info; //lcd io control info struct fb_info *fb[RK_MAX_FB_SUPPORT]; int num_fb; -- 2.34.1