From 28d7a94680b16673af27779b289b4be2abd2e248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20=C4=8Cech?= Date: Thu, 3 Sep 2009 16:55:47 +0200 Subject: [ARM] pxa/treo680: move LCD power GPIO to proper place MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomáš Čech Signed-off-by: Eric Miao --- arch/arm/mach-pxa/treo680.c | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'arch/arm/mach-pxa') diff --git a/arch/arm/mach-pxa/treo680.c b/arch/arm/mach-pxa/treo680.c index 5d3ec080770..9a2df64c659 100644 --- a/arch/arm/mach-pxa/treo680.c +++ b/arch/arm/mach-pxa/treo680.c @@ -254,16 +254,9 @@ static int treo680_backlight_init(struct device *dev) ret = gpio_direction_output(GPIO_NR_TREO680_BL_POWER, 0); if (ret) goto err2; - ret = gpio_request(GPIO_NR_TREO680_LCD_POWER, "LCD POWER"); - if (ret) - goto err2; - ret = gpio_direction_output(GPIO_NR_TREO680_LCD_POWER, 0); - if (ret) - goto err3; return 0; -err3: - gpio_free(GPIO_NR_TREO680_LCD_POWER); + err2: gpio_free(GPIO_NR_TREO680_BL_POWER); err: @@ -279,7 +272,6 @@ static int treo680_backlight_notify(int brightness) static void treo680_backlight_exit(struct device *dev) { gpio_free(GPIO_NR_TREO680_BL_POWER); - gpio_free(GPIO_NR_TREO680_LCD_POWER); } static struct platform_pwm_backlight_data treo680_backlight_data = { @@ -470,6 +462,11 @@ static struct pxafb_mode_info treo680_lcd_modes[] = { }, }; +static void treo680_lcd_power(int on, struct fb_var_screeninfo *info) +{ + gpio_set_value(GPIO_NR_TREO680_BL_POWER, on); +} + static struct pxafb_mach_info treo680_lcd_screen = { .modes = treo680_lcd_modes, .num_modes = ARRAY_SIZE(treo680_lcd_modes), @@ -509,11 +506,32 @@ static void __init treo680_udc_init(void) } } +static void __init treo680_lcd_power_init(void) +{ + int ret; + + ret = gpio_request(GPIO_NR_TREO680_LCD_POWER, "LCD POWER"); + if (ret) { + pr_err("Treo680: LCD power GPIO request failed!\n"); + return; + } + + ret = gpio_direction_output(GPIO_NR_TREO680_LCD_POWER, 0); + if (ret) { + pr_err("Treo680: setting LCD power GPIO direction failed!\n"); + gpio_free(GPIO_NR_TREO680_LCD_POWER); + return; + } + + treo680_lcd_screen.pxafb_lcd_power = treo680_lcd_power; +} + static void __init treo680_init(void) { treo680_pm_init(); pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config)); pxa_set_keypad_info(&treo680_keypad_platform_data); + treo680_lcd_power_init(); set_pxa_fb_info(&treo680_lcd_screen); pxa_set_mci_info(&treo680_mci_platform_data); treo680_udc_init(); -- cgit v1.2.3