]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - arch/arm/mach-pxa/palmtreo.c
Merge tag 'boards' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[karo-tx-linux.git] / arch / arm / mach-pxa / palmtreo.c
index c181a60a23f40c558a784e04feebab7f97a25a67..d82a50b4a8037c77cfbb4dd1a146a3240d6d6a89 100644 (file)
@@ -98,9 +98,6 @@ static unsigned long treo_pin_config[] __initdata = {
        GPIO96_KP_MKOUT_6,
        GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,        /* Hotsync button */
 
-       /* LCD */
-       GPIOxx_LCD_TFT_16BPP,
-
        /* Quick Capture Interface */
        GPIO84_CIF_FV,
        GPIO85_CIF_LV,
@@ -140,6 +137,12 @@ static unsigned long treo680_pin_config[] __initdata = {
        /* MATRIX KEYPAD - different wake up source */
        GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
        GPIO99_KP_MKIN_5,
+
+       /* LCD... L_BIAS alt fn not configured on Treo680; is GPIO instead */
+       GPIOxx_LCD_16BPP,
+       GPIO74_LCD_FCLK,
+       GPIO75_LCD_LCLK,
+       GPIO76_LCD_PCLK,
 };
 #endif /* CONFIG_MACH_TREO680 */
 
@@ -155,6 +158,9 @@ static unsigned long centro685_pin_config[] __initdata = {
        /* MATRIX KEYPAD - different wake up source */
        GPIO100_KP_MKIN_0,
        GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH,
+
+       /* LCD */
+       GPIOxx_LCD_TFT_16BPP,
 };
 #endif /* CONFIG_MACH_CENTRO */
 
@@ -328,7 +334,6 @@ static inline void palmtreo_uhc_init(void) {}
 /******************************************************************************
  * Vibra and LEDs
  ******************************************************************************/
-#ifdef CONFIG_MACH_TREO680
 static struct gpio_led treo680_gpio_leds[] = {
        {
                .name                   = "treo680:vibra:vibra",
@@ -379,21 +384,17 @@ static struct gpio_led_platform_data centro_gpio_led_info = {
 static struct platform_device palmtreo_leds = {
        .name   = "leds-gpio",
        .id     = -1,
-       .dev    = {
-               .platform_data  = &treo680_gpio_led_info,
-       }
 };
 
 static void __init palmtreo_leds_init(void)
 {
        if (machine_is_centro())
                palmtreo_leds.dev.platform_data = &centro_gpio_led_info;
+       else if (machine_is_treo680())
+               palmtreo_leds.dev.platform_data = &treo680_gpio_led_info;
 
        platform_device_register(&palmtreo_leds);
 }
-#else
-static inline void palmtreo_leds_init(void) {}
-#endif
 
 /******************************************************************************
  * diskonchip docg4 flash
@@ -454,10 +455,59 @@ static void __init palmphone_common_init(void)
 }
 
 #ifdef CONFIG_MACH_TREO680
+void __init treo680_gpio_init(void)
+{
+       unsigned int gpio;
+
+       /* drive all three lcd gpios high initially */
+       const unsigned long lcd_flags = GPIOF_INIT_HIGH | GPIOF_DIR_OUT;
+
+       /*
+        * LCD GPIO initialization...
+        */
+
+       /*
+        * This is likely the power to the lcd.  Toggling it low/high appears to
+        * turn the lcd off/on.  Can be toggled after lcd is initialized without
+        * any apparent adverse effects to the lcd operation.  Note that this
+        * gpio line is used by the lcd controller as the L_BIAS signal, but
+        * treo680 configures it as gpio.
+        */
+       gpio = GPIO_NR_TREO680_LCD_POWER;
+       if (gpio_request_one(gpio, lcd_flags, "LCD power") < 0)
+               goto fail;
+
+       /*
+        * These two are called "enables", for lack of a better understanding.
+        * If either of these are toggled after the lcd is initialized, the
+        * image becomes degraded.  N.B. The IPL shipped with the treo
+        * configures GPIO_NR_TREO680_LCD_EN_N as output and drives it high.  If
+        * the IPL is ever reprogrammed, this initialization may be need to be
+        * revisited.
+        */
+       gpio = GPIO_NR_TREO680_LCD_EN;
+       if (gpio_request_one(gpio, lcd_flags, "LCD enable") < 0)
+               goto fail;
+       gpio = GPIO_NR_TREO680_LCD_EN_N;
+       if (gpio_request_one(gpio, lcd_flags, "LCD enable_n") < 0)
+               goto fail;
+
+       /* driving this low turns LCD on */
+       gpio_set_value(GPIO_NR_TREO680_LCD_EN_N, 0);
+
+       return;
+ fail:
+       pr_err("gpio %d initialization failed\n", gpio);
+       gpio_free(GPIO_NR_TREO680_LCD_POWER);
+       gpio_free(GPIO_NR_TREO680_LCD_EN);
+       gpio_free(GPIO_NR_TREO680_LCD_EN_N);
+}
+
 static void __init treo680_init(void)
 {
        pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config));
        palmphone_common_init();
+       treo680_gpio_init();
        palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N, GPIO_NR_TREO680_SD_READONLY,
                        GPIO_NR_TREO680_SD_POWER, 0);
        treo680_docg4_flash_init();
@@ -482,7 +532,7 @@ MACHINE_START(TREO680, "Palm Treo 680")
        .nr_irqs        = PXA_NR_IRQS,
        .init_irq       = pxa27x_init_irq,
        .handle_irq       = pxa27x_handle_irq,
-       .timer          = &pxa_timer,
+       .init_time      = pxa_timer_init,
        .init_machine   = treo680_init,
        .restart        = pxa_restart,
 MACHINE_END
@@ -496,7 +546,7 @@ MACHINE_START(CENTRO, "Palm Centro 685")
        .nr_irqs        = PXA_NR_IRQS,
        .init_irq       = pxa27x_init_irq,
        .handle_irq       = pxa27x_handle_irq,
-       .timer          = &pxa_timer,
+       .init_time      = pxa_timer_init,
        .init_machine   = centro_init,
        .restart        = pxa_restart,
 MACHINE_END