rk30fb: move set_lcd_info to board
authoryxj <yxj@rock-chips.com>
Mon, 23 Apr 2012 11:14:21 +0000 (19:14 +0800)
committeryxj <yxj@rock-chips.com>
Mon, 23 Apr 2012 11:42:52 +0000 (19:42 +0800)
add rk_disp_info in struct rk29fb_info  to distinguish
primary display device and extend display device

arch/arm/mach-rk30/board-rk30-phone.c
arch/arm/mach-rk30/board-rk30-sdk.c
arch/arm/mach-rk30/devices.c
arch/arm/plat-rk/include/plat/board.h
drivers/video/rockchip/chips/rk30_lcdc.c
drivers/video/rockchip/hdmi/rk30_hdmi.h
drivers/video/rockchip/rk_fb.c
drivers/video/rockchip/rkfb_sysfs.c
include/linux/rk_fb.h
include/linux/rk_screen.h

index 25257fdff646d3952c8a5cbfadd24a6e393efac0..5188ed38e0a4c66bb8f05ed57cf91900509d7f44 100755 (executable)
 #include <mach/gpio.h>
 #include <mach/iomux.h>
 #include <linux/mpu.h>
+#include <linux/fb.h>
+#if defined(CONFIG_HDMI_RK30)
+       #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
+#endif
 
 #include <linux/regulator/fixed.h>
 #include <linux/mfd/wm8994/pdata.h>
@@ -1169,14 +1173,27 @@ static int rk_fb_io_enable(void)
 }
 
 
-static struct rk29fb_info rk_fb_info = {
+#if defined(CONFIG_LCDC0_RK30)
+struct rk29fb_info lcdc0_screen_info = {
        .fb_id   = FB_ID,
+       .prop      = PRMRY,
        .mcu_fmk_pin = FB_MCU_FMK_PIN,
        .lcd_info = &rk29_lcd_info,
        .io_init   = rk_fb_io_init,
        .io_disable = rk_fb_io_disable,
        .io_enable = rk_fb_io_enable,
+       .set_screen_info = set_lcd_info,
+};
+#endif
+#if defined(CONFIG_LCDC1_RK30)
+struct rk29fb_info lcdc1_screen_info = {
+       #if defined(CONFIG_HDMI_RK30)
+       .prop      = EXTEND,
+       .lcd_info  = NULL,
+       .set_screen_info = hdmi_set_info,
+       #endif
 };
+#endif
 
 static struct resource resource_fb[] = {
        [0] = {
@@ -1204,9 +1221,6 @@ static struct platform_device device_fb = {
        .id             = -1,
        .num_resources  = ARRAY_SIZE(resource_fb),
        .resource       = resource_fb,
-       .dev            = {
-               .platform_data  = &rk_fb_info,
-       }
 };
 #endif
 
index d633e70f96aeee9444b88e4178430ee8cd2560fc..b1986841a47931ca1c27250b52d695a0514dc0d4 100644 (file)
 #include <mach/io.h>
 #include <mach/gpio.h>
 #include <mach/iomux.h>
+#include <linux/fb.h>
+#if defined(CONFIG_HDMI_RK30)
+       #include "../../../drivers/video/rockchip/hdmi/rk_hdmi.h"
+#endif
 
 #if defined(CONFIG_SPIM_RK29)
 #include "../../../drivers/spi/rk29_spim.h"
@@ -796,12 +800,25 @@ static int rk_fb_io_enable(void)
        return 0;
 }
 
-
-static struct rk29fb_info rk_fb_info = {
+#if defined(CONFIG_LCDC0_RK30)
+struct rk29fb_info lcdc0_screen_info = {
+       .prop      = PRMRY,             //primary display device
        .io_init   = rk_fb_io_init,
        .io_disable = rk_fb_io_disable,
        .io_enable = rk_fb_io_enable,
+       .set_screen_info = set_lcd_info,
+};
+#endif
+
+#if defined(CONFIG_LCDC1_RK30)
+struct rk29fb_info lcdc1_screen_info = {
+       #if defined(CONFIG_HDMI_RK30)
+       .prop           = EXTEND,       //extend display device
+       .lcd_info  = NULL,
+       .set_screen_info = hdmi_set_info,
+       #endif
 };
+#endif
 
 static struct resource resource_fb[] = {
        [0] = {
@@ -829,9 +846,6 @@ static struct platform_device device_fb = {
        .id             = -1,
        .num_resources  = ARRAY_SIZE(resource_fb),
        .resource       = resource_fb,
-       .dev            = {
-               .platform_data  = &rk_fb_info,
-       }
 };
 #endif
 
index c0bde30d7651c52f1f894ef59ae134e405f6a2d9..57937c0976d8bfeaf3e38f5ab3eb9886b5e3ec79 100755 (executable)
@@ -748,6 +748,7 @@ static struct platform_device device_nand = {
 #endif
 
 #ifdef CONFIG_LCDC0_RK30
+extern struct rk29fb_info lcdc0_screen_info;
 static struct resource resource_lcdc0[] = {
        [0] = {
                .name  = "lcdc0 reg",
@@ -769,9 +770,13 @@ static struct platform_device device_lcdc0 = {
        .id               = 0,
        .num_resources    = ARRAY_SIZE(resource_lcdc0),
        .resource         = resource_lcdc0,
+       .dev            = {
+               .platform_data = &lcdc0_screen_info,
+       },
 };
 #endif
 #ifdef CONFIG_LCDC1_RK30
+extern struct rk29fb_info lcdc1_screen_info;
 static struct resource resource_lcdc1[] = {
        [0] = {
                .name  = "lcdc1 reg",
@@ -792,6 +797,9 @@ static struct platform_device device_lcdc1 = {
        .id               = 1,
        .num_resources    = ARRAY_SIZE(resource_lcdc1),
        .resource         = resource_lcdc1,
+       .dev            = {
+               .platform_data = &lcdc1_screen_info,
+       },
 };
 #endif
 
index bb34d0ba5a990400d85c1fc168f6a8e1d07c631e..5d69a91e1932f0611f5e3b3077410d953338ba2d 100755 (executable)
@@ -4,6 +4,7 @@
 #include <linux/types.h>
 #include <linux/init.h>
 #include <linux/device.h>
+#include <linux/rk_screen.h>
 
 struct spi_cs_gpio {
        const char *name;
@@ -39,14 +40,7 @@ struct rk29_io_t {
     int (*io_init)(void);
 };
 
-struct rk29lcd_info {
-       u32 lcd_id;
-       u32 txd_pin;
-       u32 clk_pin;
-       u32 cs_pin;
-       int (*io_init)(void);
-       int (*io_deinit)(void);
-};
+
 
 struct rk29_fb_setting_info {
        u8 data_num;
@@ -59,12 +53,14 @@ struct rk29_fb_setting_info {
 
 struct rk29fb_info {
        u32 fb_id;
+       enum rk_disp_prop prop;         //display device property,like PRMRY,EXTEND
        u32 mcu_fmk_pin;
        struct rk29lcd_info *lcd_info;
        int (*io_init)(struct rk29_fb_setting_info *fb_setting);
        int (*io_deinit)(void);
        int (*io_enable)(void);
        int (*io_disable)(void);
+       void (*set_screen_info)(struct rk29fb_screen *screen, struct rk29lcd_info *lcd_info );
 };
 
 struct rk29_sdmmc_platform_data {
index 2ad128f2dd945c91906a1a8652d1df10e8e3e304..f845a761fed023b2f90491426eee6b80b352ba18 100644 (file)
@@ -683,6 +683,7 @@ static int __devinit rk30_lcdc_probe (struct platform_device *pdev)
 {
        struct rk30_lcdc_device *lcdc_dev=NULL;
        rk_screen *screen;
+       struct rk29fb_info *screen_ctr_info;
        struct resource *res = NULL;
        struct resource *mem;
        int ret = 0;
@@ -696,6 +697,7 @@ static int __devinit rk30_lcdc_probe (struct platform_device *pdev)
        }
        platform_set_drvdata(pdev, lcdc_dev);
        lcdc_dev->id = pdev->id;
+       screen_ctr_info = (struct rk29fb_info * )pdev->dev.platform_data;
        screen =  kzalloc(sizeof(rk_screen), GFP_KERNEL);
        if(!screen)
        {
@@ -736,6 +738,7 @@ static int __devinit rk30_lcdc_probe (struct platform_device *pdev)
        printk("lcdc%d:reg_phy_base = 0x%08x,reg_vir_base:0x%p\n",pdev->id,lcdc_dev->reg_phy_base, lcdc_dev->preg);
        lcdc_dev->driver.dev=&pdev->dev;
        lcdc_dev->driver.screen = screen;
+       lcdc_dev->driver.screen_ctr_info = screen_ctr_info;
        spin_lock_init(&lcdc_dev->reg_lock);
        lcdc_dev->irq = platform_get_irq(pdev, 0);
        if(lcdc_dev->irq < 0)
@@ -753,7 +756,7 @@ static int __devinit rk30_lcdc_probe (struct platform_device *pdev)
        ret = rk_fb_register(&(lcdc_dev->driver),&lcdc_driver,lcdc_dev->id);
        if(ret < 0)
        {
-               printk(KERN_ERR "registe fb for lcdc0 failed!\n");
+               printk(KERN_ERR "register fb for lcdc%d failed!\n",lcdc_dev->id);
                goto err4;
        }
        printk("rk30 lcdc%d probe ok!\n",lcdc_dev->id);
@@ -761,7 +764,7 @@ static int __devinit rk30_lcdc_probe (struct platform_device *pdev)
        return 0;
 
 err4:
-       free_irq(lcdc_dev->irq, pdev);
+       free_irq(lcdc_dev->irq,lcdc_dev);
 err3:  
        iounmap(lcdc_dev->reg_vir_base);
 err2:
index 6852d936ab07645739e7562dc1cc6e7570eeead8..c54a63d486441a8fb3f715a388c56d2d5c7def8d 100755 (executable)
@@ -11,7 +11,8 @@
 #include <linux/earlysuspend.h>
 #endif
 
-#include "../../display/screen/screen.h"
+//#include "../../display/screen/screen.h"
+#include<linux/rk_screen.h>
 #include <linux/rk_fb.h>
 #include "rk_hdmi.h"
 
index ccbdcc17745e39079c1316fcfc64fb987a23c94a..9a55b68fbd3a7548c9c0e9b1d150c3ffe50e6234 100644 (file)
@@ -649,13 +649,18 @@ void rk_fb_switch_screen(rk_screen *screen ,int enable ,int lcdc_id)
        {
                info = inf->fb[2] ;
        }
-       pmy_var = &inf->fb[0]->var;
-       pmy_fix = &inf->fb[0]->fix;
+       
        hdmi_var = &info->var;
        hdmi_fix = &info->fix;
-       hdmi_var->xres = pmy_var->xres;
-       hdmi_var->yres = pmy_var->yres;
-       hdmi_var->nonstd = pmy_var->nonstd;
+       #if defined(CONFIG_DUAL_DISP_IN_KERNEL)
+               pmy_var = &inf->fb[0]->var;
+               pmy_fix = &inf->fb[0]->fix;
+               hdmi_var->xres = pmy_var->xres;
+               hdmi_var->yres = pmy_var->yres;
+               hdmi_var->xres_virtual = pmy_var->xres_virtual;
+               hdmi_var->yres_virtual = pmy_var->yres_virtual;
+               hdmi_var->nonstd = pmy_var->nonstd;
+       #endif
        //hdmi_fix->smem_start = pmy_fix->smem_start;
        dev_drv = (struct rk_lcdc_device_driver * )info->par;
        ret = dev_drv->load_screen(dev_drv,1);
@@ -828,15 +833,17 @@ int rk_fb_register(struct rk_lcdc_device_driver *dev_drv,
        }
        lcdc_id = i;
        init_lcdc_device_driver(dev_drv, def_drv,id);
-       if(id == 0)   //default use lcdc0 as primary dispaly controller
+       if(dev_drv->screen_ctr_info->set_screen_info)
        {
-               set_lcd_info(dev_drv->screen, fb_inf->mach_info->lcd_info);
+               dev_drv->screen_ctr_info->set_screen_info(dev_drv->screen,
+                       dev_drv->screen_ctr_info->lcd_info);
+               if(dev_drv->screen_ctr_info->io_init)
+                       dev_drv->screen_ctr_info->io_init(NULL);
        }
-       else if(id == 1)
+       else
        {
-               memcpy(dev_drv->screen,fb_inf->lcdc_dev_drv[0]->screen,sizeof(rk_screen));
-               dev_drv->screen->init = NULL;
-               dev_drv->screen->standby = NULL;
+               printk(KERN_WARNING "no display device on lcdc%d!?\n",dev_drv->id);
+               return -ENODEV;
        }
                
        dev_drv->init_lcdc(dev_drv);
@@ -948,10 +955,11 @@ static void rkfb_early_suspend(struct early_suspend *h)
                                                early_suspend);
        struct rk_fb_inf *inf = info->inf;
        int i;
-       inf->mach_info->io_disable();
        for(i = 0; i < inf->num_lcdc; i++)
        {
                atomic_set(&inf->lcdc_dev_drv[i]->in_suspend,1);
+               if(inf->lcdc_dev_drv[i]->screen_ctr_info->io_disable)
+                       inf->lcdc_dev_drv[i]->screen_ctr_info->io_disable();
                if(inf->lcdc_dev_drv[i]->screen->standby)
                        inf->lcdc_dev_drv[i]->screen->standby(1);
                
@@ -964,9 +972,10 @@ static void rkfb_early_resume(struct early_suspend *h)
                                                early_suspend);
        struct rk_fb_inf *inf = info->inf;
        int i;
-       inf->mach_info->io_enable();
        for(i = 0; i < inf->num_lcdc; i++)
        {
+               if(inf->lcdc_dev_drv[i]->screen_ctr_info->io_enable)
+                       inf->lcdc_dev_drv[i]->screen_ctr_info->io_enable();
                if(inf->lcdc_dev_drv[i]->screen->standby)
                        inf->lcdc_dev_drv[i]->screen->standby(0);
                
@@ -999,10 +1008,6 @@ static int __devinit rk_fb_probe (struct platform_device *pdev)
                ret = -ENOMEM;
        }
        platform_set_drvdata(pdev,fb_inf);
-       mach_info =  pdev->dev.platform_data;
-       fb_inf->mach_info = mach_info;
-       if(mach_info->io_init)
-               mach_info->io_init(NULL);
 #if defined(CONFIG_HDMI_RK30)
                #if defined(CONFIG_DUAL_DISP_IN_KERNEL)         
                        fb_inf->workqueue = create_singlethread_workqueue("hdmi_post");
index 915ab77538f6bc8c55c20d1e0f47f18ecf5d6d3d..ed73d4366da68151f25860b2cbd60c8fd0fda7cf 100644 (file)
@@ -30,7 +30,7 @@
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <asm/div64.h>
-#include "../display/screen/screen.h"
+#include <linux/rk_screen.h>
 #include <linux/rk_fb.h>
 
 
index 72d6c2a261bfa16eece1e209e44ba17afbdc155e..982951707bed65518e987d6fac05f99371f9aef5 100644 (file)
@@ -21,7 +21,6 @@
 #include<linux/spinlock.h>
 #include<asm/atomic.h>
 #include <mach/board.h>
-#include<linux/rk_screen.h>
 
 
 #define RK30_MAX_LCDC_SUPPORT  4
@@ -200,6 +199,7 @@ struct rk_lcdc_device_driver{
 
        atomic_t in_suspend;                    //when enter suspend write or read lcdc register are forbidden
 
+       struct rk29fb_info *screen_ctr_info;
        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);
index 5096d7cda698bf45c553466de0660d782dca0d0c..d6ebe7bcfea26dec03a5edc24a34b04368818502 100644 (file)
@@ -1,6 +1,5 @@
 #ifndef _SCREEN_H
 #define _SCREEN_H
-#include <mach/board.h>
 
 #ifdef CONFIG_HDMI_DUAL_DISP
 /* Scaler PLL CONFIG */
@@ -76,6 +75,19 @@ typedef enum _MCU_STATUS {
 
 } MCU_STATUS;
 
+enum rk_disp_prop{       //display device property
+    PRMRY = 0,                     //primary display device ,like LCD screen
+    EXTEND,                        //extend display device ,like hdmi ,tv out
+};
+
+struct rk29lcd_info {
+       u32 lcd_id;
+       u32 txd_pin;
+       u32 clk_pin;
+       u32 cs_pin;
+       int (*io_init)(void);
+       int (*io_deinit)(void);
+};
 
 
 /* Screen description */