aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Dunn <mikedunn@newsguy.com>2012-12-27 13:02:17 -0500
committerHaojian Zhuang <haojian.zhuang@linaro.org>2013-01-23 03:56:32 -0500
commit2c33727a62ac07eed3ae423c209f549394c5c4e9 (patch)
tree051f8fe490a06feac9681f9295469a4f41e7e44f
parent7d1f9aeff1ee4a20b1aeb377dd0f579fe9647619 (diff)
ARM: palmtreo: fix lcd initilialization on treo680
This patch gets the LCD working on my Palm Treo680 by adding some code that manages the three gpios interfaced to the lcd on the Treo 680. The precise role of each gpio in the hardware architecture is not entirely clear to me; this patch is the result of trial-and-error and observing how the PalmOS code initializes the lcd. The need for this patch is not evident when Linux is loaded from PalmOS, because at that point the lcd-related gpios have already been configured. But when booting the kernel by other means, this patch is required unless the bootloader has performed the necessary initialializations. Signed-off-by: Mike Dunn <mikedunn@newsguy.com> Acked-by: Tomas Cech <sleep_walker@suse.cz> Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
-rw-r--r--arch/arm/mach-pxa/include/mach/palmtreo.h3
-rw-r--r--arch/arm/mach-pxa/palmtreo.c61
2 files changed, 61 insertions, 3 deletions
diff --git a/arch/arm/mach-pxa/include/mach/palmtreo.h b/arch/arm/mach-pxa/include/mach/palmtreo.h
index 2d3f14e3be29..32661945d4c3 100644
--- a/arch/arm/mach-pxa/include/mach/palmtreo.h
+++ b/arch/arm/mach-pxa/include/mach/palmtreo.h
@@ -44,6 +44,9 @@
44#define GPIO_NR_TREO680_VIBRATE_EN 44 44#define GPIO_NR_TREO680_VIBRATE_EN 44
45#define GPIO_NR_TREO680_KEYB_BL 24 45#define GPIO_NR_TREO680_KEYB_BL 24
46#define GPIO_NR_TREO680_BT_EN 43 46#define GPIO_NR_TREO680_BT_EN 43
47#define GPIO_NR_TREO680_LCD_POWER 77
48#define GPIO_NR_TREO680_LCD_EN 86
49#define GPIO_NR_TREO680_LCD_EN_N 25
47#endif /* CONFIG_MACH_TREO680 */ 50#endif /* CONFIG_MACH_TREO680 */
48 51
49/* Centro685 specific GPIOs */ 52/* Centro685 specific GPIOs */
diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c
index 3f3c48f2f7ce..44412162fd27 100644
--- a/arch/arm/mach-pxa/palmtreo.c
+++ b/arch/arm/mach-pxa/palmtreo.c
@@ -98,9 +98,6 @@ static unsigned long treo_pin_config[] __initdata = {
98 GPIO96_KP_MKOUT_6, 98 GPIO96_KP_MKOUT_6,
99 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH, /* Hotsync button */ 99 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH, /* Hotsync button */
100 100
101 /* LCD */
102 GPIOxx_LCD_TFT_16BPP,
103
104 /* Quick Capture Interface */ 101 /* Quick Capture Interface */
105 GPIO84_CIF_FV, 102 GPIO84_CIF_FV,
106 GPIO85_CIF_LV, 103 GPIO85_CIF_LV,
@@ -140,6 +137,12 @@ static unsigned long treo680_pin_config[] __initdata = {
140 /* MATRIX KEYPAD - different wake up source */ 137 /* MATRIX KEYPAD - different wake up source */
141 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, 138 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
142 GPIO99_KP_MKIN_5, 139 GPIO99_KP_MKIN_5,
140
141 /* LCD... L_BIAS alt fn not configured on Treo680; is GPIO instead */
142 GPIOxx_LCD_16BPP,
143 GPIO74_LCD_FCLK,
144 GPIO75_LCD_LCLK,
145 GPIO76_LCD_PCLK,
143}; 146};
144#endif /* CONFIG_MACH_TREO680 */ 147#endif /* CONFIG_MACH_TREO680 */
145 148
@@ -155,6 +158,9 @@ static unsigned long centro685_pin_config[] __initdata = {
155 /* MATRIX KEYPAD - different wake up source */ 158 /* MATRIX KEYPAD - different wake up source */
156 GPIO100_KP_MKIN_0, 159 GPIO100_KP_MKIN_0,
157 GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH, 160 GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH,
161
162 /* LCD */
163 GPIOxx_LCD_TFT_16BPP,
158}; 164};
159#endif /* CONFIG_MACH_CENTRO */ 165#endif /* CONFIG_MACH_CENTRO */
160 166
@@ -424,10 +430,59 @@ static void __init palmphone_common_init(void)
424} 430}
425 431
426#ifdef CONFIG_MACH_TREO680 432#ifdef CONFIG_MACH_TREO680
433void __init treo680_gpio_init(void)
434{
435 unsigned int gpio;
436
437 /* drive all three lcd gpios high initially */
438 const unsigned long lcd_flags = GPIOF_INIT_HIGH | GPIOF_DIR_OUT;
439
440 /*
441 * LCD GPIO initialization...
442 */
443
444 /*
445 * This is likely the power to the lcd. Toggling it low/high appears to
446 * turn the lcd off/on. Can be toggled after lcd is initialized without
447 * any apparent adverse effects to the lcd operation. Note that this
448 * gpio line is used by the lcd controller as the L_BIAS signal, but
449 * treo680 configures it as gpio.
450 */
451 gpio = GPIO_NR_TREO680_LCD_POWER;
452 if (gpio_request_one(gpio, lcd_flags, "LCD power") < 0)
453 goto fail;
454
455 /*
456 * These two are called "enables", for lack of a better understanding.
457 * If either of these are toggled after the lcd is initialized, the
458 * image becomes degraded. N.B. The IPL shipped with the treo
459 * configures GPIO_NR_TREO680_LCD_EN_N as output and drives it high. If
460 * the IPL is ever reprogrammed, this initialization may be need to be
461 * revisited.
462 */
463 gpio = GPIO_NR_TREO680_LCD_EN;
464 if (gpio_request_one(gpio, lcd_flags, "LCD enable") < 0)
465 goto fail;
466 gpio = GPIO_NR_TREO680_LCD_EN_N;
467 if (gpio_request_one(gpio, lcd_flags, "LCD enable_n") < 0)
468 goto fail;
469
470 /* driving this low turns LCD on */
471 gpio_set_value(GPIO_NR_TREO680_LCD_EN_N, 0);
472
473 return;
474 fail:
475 pr_err("gpio %d initialization failed\n", gpio);
476 gpio_free(GPIO_NR_TREO680_LCD_POWER);
477 gpio_free(GPIO_NR_TREO680_LCD_EN);
478 gpio_free(GPIO_NR_TREO680_LCD_EN_N);
479}
480
427static void __init treo680_init(void) 481static void __init treo680_init(void)
428{ 482{
429 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config)); 483 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config));
430 palmphone_common_init(); 484 palmphone_common_init();
485 treo680_gpio_init();
431 palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N, GPIO_NR_TREO680_SD_READONLY, 486 palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N, GPIO_NR_TREO680_SD_READONLY,
432 GPIO_NR_TREO680_SD_POWER, 0); 487 GPIO_NR_TREO680_SD_POWER, 0);
433} 488}