From 94760bf2523b4b5d3938e85ea0964ca7cd59a42b Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Sat, 17 Nov 2012 17:57:20 +0400 Subject: ARM: clps711x: Moving backlight controls of framebuffer driver to the board This patch moves the backlight controls for clps711x-framebuffer driver to the board code. To control we use "generic-bl" driver. Signed-off-by: Alexander Shiyan [olof: fixed space/tab whitespace in drivers/video/clps711xfb.c] Signed-off-by: Olof Johansson --- arch/arm/mach-clps711x/edb7211.c | 18 ++++++++++++++++++ arch/arm/mach-clps711x/include/mach/hardware.h | 6 ------ arch/arm/mach-clps711x/p720t.c | 21 ++++++++++++++++++++- 3 files changed, 38 insertions(+), 7 deletions(-) (limited to 'arch/arm/mach-clps711x') diff --git a/arch/arm/mach-clps711x/edb7211.c b/arch/arm/mach-clps711x/edb7211.c index 81cc6835d7a..d5832b3557a 100644 --- a/arch/arm/mach-clps711x/edb7211.c +++ b/arch/arm/mach-clps711x/edb7211.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -30,6 +31,7 @@ #define EDB7211_LCD_DC_DC_EN CLPS711X_GPIO(3, 1) #define EDB7211_LCDEN CLPS711X_GPIO(3, 2) +#define EDB7211_LCDBL CLPS711X_GPIO(3, 3) #define EDB7211_CS8900_BASE (CS2_PHYS_BASE + 0x300) #define EDB7211_CS8900_IRQ (IRQ_EINT3) @@ -56,9 +58,22 @@ static struct plat_lcd_data edb7211_lcd_power_pdata = { .set_power = edb7211_lcd_power_set, }; +static void edb7211_lcd_backlight_set_intensity(int intensity) +{ + gpio_set_value(EDB7211_LCDBL, intensity); +} + +static struct generic_bl_info edb7211_lcd_backlight_pdata = { + .name = "lcd-backlight.0", + .default_intensity = 0x01, + .max_intensity = 0x01, + .set_bl_intensity = edb7211_lcd_backlight_set_intensity, +}; + static struct gpio edb7211_gpios[] __initconst = { { EDB7211_LCD_DC_DC_EN, GPIOF_OUT_INIT_LOW, "LCD DC-DC" }, { EDB7211_LCDEN, GPIOF_OUT_INIT_LOW, "LCD POWER" }, + { EDB7211_LCDBL, GPIOF_OUT_INIT_LOW, "LCD BACKLIGHT" }, }; static struct map_desc edb7211_io_desc[] __initdata = { @@ -117,6 +132,9 @@ static void __init edb7211_init(void) platform_device_register_data(&platform_bus, "platform-lcd", 0, &edb7211_lcd_power_pdata, sizeof(edb7211_lcd_power_pdata)); + platform_device_register_data(&platform_bus, "generic-bl", 0, + &edb7211_lcd_backlight_pdata, + sizeof(edb7211_lcd_backlight_pdata)); platform_device_register_simple("video-clps711x", 0, NULL, 0); platform_device_register_simple("cs89x0", 0, edb7211_cs8900_resource, ARRAY_SIZE(edb7211_cs8900_resource)); diff --git a/arch/arm/mach-clps711x/include/mach/hardware.h b/arch/arm/mach-clps711x/include/mach/hardware.h index 6acf714031e..1ebf7b9e69f 100644 --- a/arch/arm/mach-clps711x/include/mach/hardware.h +++ b/arch/arm/mach-clps711x/include/mach/hardware.h @@ -81,10 +81,4 @@ #endif /* CONFIG_ARCH_EDB7211 */ -/* - * Relevant bits in port D, which controls power to the various parts of - * the LCD on the EDB7211. - */ -#define EDB_PD3_LCDBL (1<<3) - #endif diff --git a/arch/arm/mach-clps711x/p720t.c b/arch/arm/mach-clps711x/p720t.c index e25f10ed560..1518fc83bab 100644 --- a/arch/arm/mach-clps711x/p720t.c +++ b/arch/arm/mach-clps711x/p720t.c @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include #include #include @@ -33,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -103,6 +104,21 @@ static struct plat_lcd_data p720t_lcd_power_pdata = { .set_power = p720t_lcd_power_set, }; +static void p720t_lcd_backlight_set_intensity(int intensity) +{ + if (intensity) + PLD_PWR |= PLD_S3_ON; + else + PLD_PWR = 0; +} + +static struct generic_bl_info p720t_lcd_backlight_pdata = { + .name = "lcd-backlight.0", + .default_intensity = 0x01, + .max_intensity = 0x01, + .set_bl_intensity = p720t_lcd_backlight_set_intensity, +}; + /* * Map the P720T system PLD. It occupies two address spaces: * 0x10000000 and 0x10400000. We map both regions as one. @@ -187,6 +203,9 @@ static void __init p720t_init(void) platform_device_register_data(&platform_bus, "platform-lcd", 0, &p720t_lcd_power_pdata, sizeof(p720t_lcd_power_pdata)); + platform_device_register_data(&platform_bus, "generic-bl", 0, + &p720t_lcd_backlight_pdata, + sizeof(p720t_lcd_backlight_pdata)); platform_device_register_simple("video-clps711x", 0, NULL, 0); } -- cgit v1.2.3