From 1b03cef9649e866a578b235a5972f41e256c96e3 Mon Sep 17 00:00:00 2001 From: yxj Date: Thu, 30 Aug 2012 10:11:47 +0800 Subject: [PATCH] rk2928 fb: adjust fb lcdc backlight driver load and remove order load: fb-->lcdc-->backlight remove backlight-->lcdc-->fb --- arch/arm/mach-rk2928/board-rk2928-a720.c | 38 ++++++++++++++++++++-- arch/arm/mach-rk2928/board-rk2928-sdk.c | 38 ++++++++++++++++++++-- arch/arm/mach-rk2928/devices.c | 34 ------------------- drivers/video/rockchip/chips/rk2928_lcdc.c | 6 ++++ 4 files changed, 76 insertions(+), 40 deletions(-) diff --git a/arch/arm/mach-rk2928/board-rk2928-a720.c b/arch/arm/mach-rk2928/board-rk2928-a720.c index 821866e2f02b..4ab211558542 100755 --- a/arch/arm/mach-rk2928/board-rk2928-a720.c +++ b/arch/arm/mach-rk2928/board-rk2928-a720.c @@ -239,6 +239,35 @@ static struct platform_device device_fb = { }; #endif +//LCDC +#ifdef CONFIG_LCDC_RK2928 +static struct resource resource_lcdc[] = { + [0] = { + .name = "lcdc reg", + .start = RK2928_LCDC_PHYS, + .end = RK2928_LCDC_PHYS + RK2928_LCDC_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + + [1] = { + .name = "lcdc irq", + .start = IRQ_LCDC, + .end = IRQ_LCDC, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device device_lcdc = { + .name = "rk2928-lcdc", + .id = 0, + .num_resources = ARRAY_SIZE(resource_lcdc), + .resource = resource_lcdc, + .dev = { + .platform_data = &lcdc_screen_info, + }, +}; +#endif + #ifdef CONFIG_ION #define ION_RESERVE_SIZE (80 * SZ_1M) static struct ion_platform_data rk30_ion_pdata = { @@ -461,12 +490,15 @@ static struct platform_device device_acodec = { #endif static struct platform_device *devices[] __initdata = { -#ifdef CONFIG_BACKLIGHT_RK29_BL - &rk29_device_backlight, -#endif #ifdef CONFIG_FB_ROCKCHIP &device_fb, #endif +#ifdef CONFIG_LCDC_RK2928 + &device_lcdc, +#endif +#ifdef CONFIG_BACKLIGHT_RK29_BL + &rk29_device_backlight, +#endif #ifdef CONFIG_ION &device_ion, #endif diff --git a/arch/arm/mach-rk2928/board-rk2928-sdk.c b/arch/arm/mach-rk2928/board-rk2928-sdk.c index 0e743011f20f..90dd117d379d 100755 --- a/arch/arm/mach-rk2928/board-rk2928-sdk.c +++ b/arch/arm/mach-rk2928/board-rk2928-sdk.c @@ -356,6 +356,35 @@ static struct platform_device device_fb = { }; #endif +//LCDC +#ifdef CONFIG_LCDC_RK2928 +static struct resource resource_lcdc[] = { + [0] = { + .name = "lcdc reg", + .start = RK2928_LCDC_PHYS, + .end = RK2928_LCDC_PHYS + RK2928_LCDC_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + + [1] = { + .name = "lcdc irq", + .start = IRQ_LCDC, + .end = IRQ_LCDC, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device device_lcdc = { + .name = "rk2928-lcdc", + .id = 0, + .num_resources = ARRAY_SIZE(resource_lcdc), + .resource = resource_lcdc, + .dev = { + .platform_data = &lcdc_screen_info, + }, +}; +#endif + #ifdef CONFIG_ION #define ION_RESERVE_SIZE (80 * SZ_1M) static struct ion_platform_data rk30_ion_pdata = { @@ -659,12 +688,15 @@ static struct platform_device device_acodec = { #endif static struct platform_device *devices[] __initdata = { -#ifdef CONFIG_BACKLIGHT_RK29_BL - &rk29_device_backlight, -#endif #ifdef CONFIG_FB_ROCKCHIP &device_fb, #endif +#ifdef CONFIG_LCDC_RK2928 + &device_lcdc, +#endif +#ifdef CONFIG_BACKLIGHT_RK29_BL + &rk29_device_backlight, +#endif #ifdef CONFIG_ION &device_ion, #endif diff --git a/arch/arm/mach-rk2928/devices.c b/arch/arm/mach-rk2928/devices.c index 225266270eca..f6c2717d37fa 100755 --- a/arch/arm/mach-rk2928/devices.c +++ b/arch/arm/mach-rk2928/devices.c @@ -203,37 +203,6 @@ static void __init rk2928_init_uart(void) #endif } - -//LCDC -#ifdef CONFIG_LCDC_RK2928 -extern struct rk29fb_info lcdc_screen_info; -static struct resource resource_lcdc[] = { - [0] = { - .name = "lcdc reg", - .start = RK2928_LCDC_PHYS, - .end = RK2928_LCDC_PHYS + RK2928_LCDC_SIZE - 1, - .flags = IORESOURCE_MEM, - }, - - [1] = { - .name = "lcdc irq", - .start = IRQ_LCDC, - .end = IRQ_LCDC, - .flags = IORESOURCE_IRQ, - }, -}; - -static struct platform_device device_lcdc = { - .name = "rk2928-lcdc", - .id = 0, - .num_resources = ARRAY_SIZE(resource_lcdc), - .resource = resource_lcdc, - .dev = { - .platform_data = &lcdc_screen_info, - }, -}; -#endif - // i2c #ifdef CONFIG_I2C_RK30 #ifdef CONFIG_I2C0_CONTROLLER_RK29 @@ -893,9 +862,6 @@ static int __init rk2928_init_devices(void) #ifdef CONFIG_RGA_RK30 platform_device_register(&device_rga); #endif -#ifdef CONFIG_LCDC_RK2928 - platform_device_register(&device_lcdc); -#endif #ifdef CONFIG_USB20_OTG platform_device_register(&device_usb20_otg); #endif diff --git a/drivers/video/rockchip/chips/rk2928_lcdc.c b/drivers/video/rockchip/chips/rk2928_lcdc.c index cb1bf46b895c..45c780617987 100755 --- a/drivers/video/rockchip/chips/rk2928_lcdc.c +++ b/drivers/video/rockchip/chips/rk2928_lcdc.c @@ -1065,6 +1065,12 @@ static int __devexit rk2928_lcdc_remove(struct platform_device *pdev) static void rk2928_lcdc_shutdown(struct platform_device *pdev) { struct rk2928_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 + lcdc_dev->driver.cur_screen->sscreen_set(lcdc_dev->driver.cur_screen , 0); rk_fb_unregister(&(lcdc_dev->driver)); rk2928_lcdc_deinit(lcdc_dev); /*iounmap(lcdc_dev->reg_vir_base); -- 2.34.1