rk30 fb: adjust fb lcdc backlight driver load and remove order
authoryxj <yxj@rock-chips.com>
Thu, 30 Aug 2012 02:49:48 +0000 (10:49 +0800)
committeryxj <yxj@rock-chips.com>
Thu, 30 Aug 2012 04:26:00 +0000 (12:26 +0800)
        load: fb-->lcdc-->backlight
        remove backlight-->lcdc-->fb
attention: product specific board should modifed according
to board-rk30-sdk.c or board-rk30-ds1001b.c

arch/arm/mach-rk30/board-rk30-ds1001b.c
arch/arm/mach-rk30/board-rk30-sdk.c
arch/arm/mach-rk30/devices.c
drivers/video/rockchip/chips/rk30_lcdc.c

index 0b814178d6c516eabd8a99a24868ed369f700f93..0fa8d94dacc26be5389b80be4777adf869e55fe4 100644 (file)
@@ -899,6 +899,62 @@ static struct platform_device device_fb = {
 };
 #endif
 
+#if defined(CONFIG_LCDC0_RK30)
+static struct resource resource_lcdc0[] = {
+       [0] = {
+               .name  = "lcdc0 reg",
+               .start = RK30_LCDC0_PHYS,
+               .end   = RK30_LCDC0_PHYS + RK30_LCDC0_SIZE - 1,
+               .flags = IORESOURCE_MEM,
+       },
+       
+       [1] = {
+               .name  = "lcdc0 irq",
+               .start = IRQ_LCDC0,
+               .end   = IRQ_LCDC0,
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device device_lcdc0 = {
+       .name             = "rk30-lcdc",
+       .id               = 0,
+       .num_resources    = ARRAY_SIZE(resource_lcdc0),
+       .resource         = resource_lcdc0,
+       .dev            = {
+               .platform_data = &lcdc0_screen_info,
+       },
+};
+#endif
+
+#if defined(CONFIG_LCDC1_RK30) 
+extern struct rk29fb_info lcdc1_screen_info;
+static struct resource resource_lcdc1[] = {
+       [0] = {
+               .name  = "lcdc1 reg",
+               .start = RK30_LCDC1_PHYS,
+               .end   = RK30_LCDC1_PHYS + RK30_LCDC1_SIZE - 1,
+               .flags = IORESOURCE_MEM,
+       },
+       [1] = {
+               .name  = "lcdc1 irq",
+               .start = IRQ_LCDC1,
+               .end   = IRQ_LCDC1,
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device device_lcdc1 = {
+       .name             = "rk30-lcdc",
+       .id               = 1,
+       .num_resources    = ARRAY_SIZE(resource_lcdc1),
+       .resource         = resource_lcdc1,
+       .dev            = {
+               .platform_data = &lcdc1_screen_info,
+       },
+};
+#endif
+
 #ifdef CONFIG_ANDROID_TIMED_GPIO
 static struct timed_gpio timed_gpios[] = {
        {
@@ -1210,12 +1266,20 @@ static struct platform_device rk30_device_adc_battery = {
 #endif
 
 static struct platform_device *devices[] __initdata = {
-#ifdef CONFIG_BACKLIGHT_RK29_BL
-       &rk29_device_backlight,
-#endif
 #ifdef CONFIG_FB_ROCKCHIP
        &device_fb,
 #endif
+#if defined(CONFIG_LCDC0_RK30)
+       &device_lcdc0,
+#endif
+#if defined(CONFIG_LCDC1_RK30)
+       &device_lcdc1,
+#endif
+       
+#ifdef CONFIG_BACKLIGHT_RK29_BL
+       &rk29_device_backlight,
+#endif
+
 #ifdef CONFIG_ION
        &device_ion,
 #endif
@@ -1469,10 +1533,12 @@ static void __init rk30_reserve(void)
 #ifdef CONFIG_FB_ROCKCHIP
        resource_fb[0].start = board_mem_reserve_add("fb0", RK30_FB0_MEM_SIZE);
        resource_fb[0].end = resource_fb[0].start + RK30_FB0_MEM_SIZE - 1;
+       #if 0
        resource_fb[1].start = board_mem_reserve_add("ipp buf", RK30_FB0_MEM_SIZE);
        resource_fb[1].end = resource_fb[1].start + RK30_FB0_MEM_SIZE - 1;
        resource_fb[2].start = board_mem_reserve_add("fb2", RK30_FB0_MEM_SIZE);
        resource_fb[2].end = resource_fb[2].start + RK30_FB0_MEM_SIZE - 1;
+       #endif
 #endif
 #ifdef CONFIG_VIDEO_RK29
        rk30_camera_request_reserve_mem();
index af011c661fcc9565795e892f9b6d8b087cb75ca3..ba9dc209f46567605d78b5565612c3a1206f0ea8 100755 (executable)
@@ -646,6 +646,61 @@ static struct platform_device device_fb = {
 };
 #endif
 
+#if defined(CONFIG_LCDC0_RK30)
+static struct resource resource_lcdc0[] = {
+       [0] = {
+               .name  = "lcdc0 reg",
+               .start = RK30_LCDC0_PHYS,
+               .end   = RK30_LCDC0_PHYS + RK30_LCDC0_SIZE - 1,
+               .flags = IORESOURCE_MEM,
+       },
+       
+       [1] = {
+               .name  = "lcdc0 irq",
+               .start = IRQ_LCDC0,
+               .end   = IRQ_LCDC0,
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device device_lcdc0 = {
+       .name             = "rk30-lcdc",
+       .id               = 0,
+       .num_resources    = ARRAY_SIZE(resource_lcdc0),
+       .resource         = resource_lcdc0,
+       .dev            = {
+               .platform_data = &lcdc0_screen_info,
+       },
+};
+#endif
+#if defined(CONFIG_LCDC1_RK30) 
+extern struct rk29fb_info lcdc1_screen_info;
+static struct resource resource_lcdc1[] = {
+       [0] = {
+               .name  = "lcdc1 reg",
+               .start = RK30_LCDC1_PHYS,
+               .end   = RK30_LCDC1_PHYS + RK30_LCDC1_SIZE - 1,
+               .flags = IORESOURCE_MEM,
+       },
+       [1] = {
+               .name  = "lcdc1 irq",
+               .start = IRQ_LCDC1,
+               .end   = IRQ_LCDC1,
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device device_lcdc1 = {
+       .name             = "rk30-lcdc",
+       .id               = 1,
+       .num_resources    = ARRAY_SIZE(resource_lcdc1),
+       .resource         = resource_lcdc1,
+       .dev            = {
+               .platform_data = &lcdc1_screen_info,
+       },
+};
+#endif
+
 #ifdef CONFIG_ANDROID_TIMED_GPIO
 static struct timed_gpio timed_gpios[] = {
        {
@@ -1078,12 +1133,20 @@ static struct platform_device device_rfkill_rk = {
 #endif
 
 static struct platform_device *devices[] __initdata = {
-#ifdef CONFIG_BACKLIGHT_RK29_BL
-       &rk29_device_backlight,
-#endif
 #ifdef CONFIG_FB_ROCKCHIP
        &device_fb,
 #endif
+#if defined(CONFIG_LCDC0_RK30)
+       &device_lcdc0,
+#endif
+#if defined(CONFIG_LCDC1_RK30)
+       &device_lcdc1,
+#endif
+
+#ifdef CONFIG_BACKLIGHT_RK29_BL
+       &rk29_device_backlight,
+#endif
+
 #ifdef CONFIG_ION
        &device_ion,
 #endif
@@ -1454,10 +1517,12 @@ static void __init rk30_reserve(void)
 #ifdef CONFIG_FB_ROCKCHIP
        resource_fb[0].start = board_mem_reserve_add("fb0", RK30_FB0_MEM_SIZE);
        resource_fb[0].end = resource_fb[0].start + RK30_FB0_MEM_SIZE - 1;
+       #if 0
        resource_fb[1].start = board_mem_reserve_add("ipp buf", RK30_FB0_MEM_SIZE);
        resource_fb[1].end = resource_fb[1].start + RK30_FB0_MEM_SIZE - 1;
        resource_fb[2].start = board_mem_reserve_add("fb2", RK30_FB0_MEM_SIZE);
        resource_fb[2].end = resource_fb[2].start + RK30_FB0_MEM_SIZE - 1;
+       #endif
 #endif
 #ifdef CONFIG_VIDEO_RK29
        rk30_camera_request_reserve_mem();
index 8a9f0b4b1b2ace24a47ab615fcae5223f5e64448..8d736fe91a3f31adc1b0715fa24aebba07a0852d 100755 (executable)
@@ -924,62 +924,6 @@ static struct platform_device device_nand = {
 };
 #endif
 
-#if defined(CONFIG_LCDC0_RK30) || defined(CONFIG_LCDC0_RK31)
-extern struct rk29fb_info lcdc0_screen_info;
-static struct resource resource_lcdc0[] = {
-       [0] = {
-               .name  = "lcdc0 reg",
-               .start = RK30_LCDC0_PHYS,
-               .end   = RK30_LCDC0_PHYS + RK30_LCDC0_SIZE - 1,
-               .flags = IORESOURCE_MEM,
-       },
-       
-       [1] = {
-               .name  = "lcdc0 irq",
-               .start = IRQ_LCDC0,
-               .end   = IRQ_LCDC0,
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device device_lcdc0 = {
-       .name             = "rk30-lcdc",
-       .id               = 0,
-       .num_resources    = ARRAY_SIZE(resource_lcdc0),
-       .resource         = resource_lcdc0,
-       .dev            = {
-               .platform_data = &lcdc0_screen_info,
-       },
-};
-#endif
-#if defined(CONFIG_LCDC1_RK30) || defined(CONFIG_LCDC1_RK31)
-extern struct rk29fb_info lcdc1_screen_info;
-static struct resource resource_lcdc1[] = {
-       [0] = {
-               .name  = "lcdc1 reg",
-               .start = RK30_LCDC1_PHYS,
-               .end   = RK30_LCDC1_PHYS + RK30_LCDC1_SIZE - 1,
-               .flags = IORESOURCE_MEM,
-       },
-       [1] = {
-               .name  = "lcdc1 irq",
-               .start = IRQ_LCDC1,
-               .end   = IRQ_LCDC1,
-               .flags = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device device_lcdc1 = {
-       .name             = "rk30-lcdc",
-       .id               = 1,
-       .num_resources    = ARRAY_SIZE(resource_lcdc1),
-       .resource         = resource_lcdc1,
-       .dev            = {
-               .platform_data = &lcdc1_screen_info,
-       },
-};
-#endif
-
 #ifdef CONFIG_HDMI_RK30
 static struct resource resource_hdmi[] = {
        [0] = {
@@ -1387,12 +1331,6 @@ static int __init rk30_init_devices(void)
 #if defined(CONFIG_ARCH_RK3066B)
        platform_device_register(&device_sgx);
 #endif
-#if    defined(CONFIG_LCDC0_RK30) || defined(CONFIG_LCDC0_RK31)
-       platform_device_register(&device_lcdc0);
-#endif
-#if     defined(CONFIG_LCDC1_RK30) || defined(CONFIG_LCDC1_RK31)
-       platform_device_register(&device_lcdc1);
-#endif
 #ifdef CONFIG_HDMI_RK30
        platform_device_register(&device_hdmi);
 #endif
index 32979175894b5da6c4dd1887939db766366981a9..fa001f96a162264522972b127a31b0f1e7b5d3ee 100644 (file)
@@ -1199,6 +1199,12 @@ static int __devexit rk30_lcdc_remove(struct platform_device *pdev)
 static void rk30_lcdc_shutdown(struct platform_device *pdev)
 {
        struct rk30_lcdc_device *lcdc_dev = platform_get_drvdata(pdev);
+       if(lcdc_dev->driver.cur_screen->standby) //standby the screen if necessary
+               lcdc_dev->driver.cur_screen->standby(1);
+       if(lcdc_dev->driver.screen_ctr_info->io_disable) //power off the screen if necessary
+               lcdc_dev->driver.screen_ctr_info->io_disable();
+       if(lcdc_dev->driver.cur_screen->sscreen_set) //turn off  lvds if necessary
+               lcdc_dev->driver.cur_screen->sscreen_set(lcdc_dev->driver.cur_screen , 0);
        rk_fb_unregister(&(lcdc_dev->driver));
        rk30_lcdc_deinit(lcdc_dev);
        /*iounmap(lcdc_dev->reg_vir_base);