d48b6e82766d13430f11b000f8381ee58c0b91e3
[openwrt.git] / target / linux / pxa / patches-2.6.21 / 035-pxafb-definition.patch
1 --- a/arch/arm/mach-pxa/gumstix.c
2 +++ b/arch/arm/mach-pxa/gumstix.c
3 @@ -25,6 +25,7 @@
4  #include <asm/arch/udc.h>
5  #include <asm/arch/mmc.h>
6  #include <asm/arch/pxa-regs.h>
7 +#include <asm/arch/pxafb.h>
8  #include <asm/arch/gumstix.h>
9  
10  #include "generic.h"
11 @@ -90,6 +91,89 @@ static struct platform_device gum_audio_
12         .id             = -1,
13  };
14  
15 +
16 +#if defined(CONFIG_FB_PXA_SHARP_LQ043_PSP) || defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
17 +static void gumstix_lcd_backlight(int on_or_off)
18 +{
19 +       if(on_or_off)
20 +       {
21 +               pxa_gpio_mode(17 | GPIO_IN);
22 +       } else {
23 +               GPCR(17) = GPIO_bit(17);
24 +               pxa_gpio_mode(17 | GPIO_OUT);
25 +               GPCR(17) = GPIO_bit(17);
26 +       }
27 +}
28 +#endif
29 +
30 +
31 +#ifdef CONFIG_FB_PXA_ALPS_CDOLLAR
32 +static struct pxafb_mode_info gumstix_fb_mode = {
33 +       .pixclock       = 300000,
34 +       .xres           = 240,
35 +       .yres           = 320,
36 +       .bpp            = 16,
37 +       .hsync_len      = 2,
38 +       .left_margin    = 1,
39 +       .right_margin   = 1,
40 +       .vsync_len      = 3,
41 +       .upper_margin   = 0,
42 +       .lower_margin   = 0,
43 +       .sync           = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
44 +};
45 +
46 +static struct pxafb_mach_info gumstix_fb_info = {
47 +       .modes          = &gumstix_fb_mode,
48 +       .num_modes      = 1,
49 +       .lccr0          = LCCR0_Pas | LCCR0_Sngl | LCCR0_Color,
50 +       .lccr3          = 0,
51 +};
52 +#elif defined(CONFIG_FB_PXA_SHARP_LQ043_PSP)
53 +static struct pxafb_mode_info gumstix_fb_mode = {
54 +       .pixclock       = 110000,
55 +       .xres           = 480,
56 +       .yres           = 272,
57 +       .bpp            = 16,
58 +       .hsync_len      = 41,
59 +       .left_margin    = 2,
60 +       .right_margin   = 2,
61 +       .vsync_len      = 10,
62 +       .upper_margin   = 2,
63 +       .lower_margin   = 2,
64 +       .sync           = 0, // Hsync and Vsync both active low
65 +};
66 +
67 +static struct pxafb_mach_info gumstix_fb_info = {
68 +       .modes                  = &gumstix_fb_mode,
69 +       .num_modes              = 1,
70 +       .lccr0                  = LCCR0_Act | LCCR0_Sngl | LCCR0_Color,
71 +       .lccr3                  = LCCR3_OutEnH | LCCR3_PixFlEdg | (3 << 30),
72 +       .pxafb_backlight_power  = &gumstix_lcd_backlight,
73 +};
74 +#elif defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
75 +static struct pxafb_mode_info gumstix_fb_mode = {
76 +       .pixclock       = 108696, // 9.2MHz typical DOTCLK from datasheet
77 +       .xres           = 480,
78 +       .hsync_len      = 41, // HLW from datasheet: 41 typ
79 +       .left_margin    = 4, // HBP - HLW from datasheet: 45 - 41 = 4
80 +       .right_margin   = 8, // HFP from datasheet: 8 typ
81 +       .yres           = 272,
82 +       .vsync_len      = 10, // VLW from datasheet: 10 typ
83 +       .upper_margin   = 2, // VBP - VLW from datasheet: 12 - 10 = 2
84 +       .lower_margin   = 4, // VFP from datasheet: 4 typ
85 +       .bpp            = 16,
86 +       .sync           = 0, // Hsync and Vsync both active low
87 +};
88 +
89 +static struct pxafb_mach_info gumstix_fb_info = {
90 +       .modes                  = &gumstix_fb_mode,
91 +       .num_modes              = 1,
92 +       .lccr0                  = LCCR0_Act | LCCR0_Sngl | LCCR0_Color,
93 +       .lccr3                  = LCCR3_OutEnH | LCCR3_PixFlEdg | (3 << 30),
94 +       .pxafb_backlight_power  = &gumstix_lcd_backlight,
95 +};
96 +#endif
97 +
98  static struct platform_device *devices[] __initdata = {
99         &gum_audio_device,
100  };
101 @@ -98,6 +182,9 @@ static void __init gumstix_init(void)
102  {
103         pxa_set_mci_info(&gumstix_mci_platform_data);
104         pxa_set_udc_info(&gumstix_udc_info);
105 +#if defined(CONFIG_FB_PXA_ALPS_CDOLLAR) | defined(CONFIG_FB_PXA_SHARP_LQ043_PSP) | defined(CONFIG_FB_PXA_SAMSUNG_LTE430WQ_F0C)
106 +       set_pxa_fb_info(&gumstix_fb_info);
107 +#endif
108         (void) platform_add_devices(devices, ARRAY_SIZE(devices));
109  }
110  
111 --- a/drivers/video/Kconfig
112 +++ b/drivers/video/Kconfig
113 @@ -1495,6 +1495,37 @@ config FB_PXA
114  
115           If unsure, say N.
116  
117 +choice
118 +       depends on FB_PXA
119 +       prompt "LCD Panel"
120 +       default FB_PXA_SAMSUNG_LTE430WQ_F0C
121 +
122 +config FB_PXA_ALPS_CDOLLAR
123 +       boolean "Chris Dollar's ALPS screen"
124 +       ---help---
125 +         Enable definitions (over-ridable on the kernel command line if
126 +         "PXA LCD command line parameters" is also selected) for an ALPS
127 +         screen which Chris Dollar uses
128 +
129 +config FB_PXA_SHARP_LQ043_PSP
130 +       boolean "SHARP LQ043... series"
131 +       ---help---
132 +         Enable definitions (over-ridable on the kernel command line if
133 +         "PXA LCD command line parameters" is also selected) for a SHARP
134 +         LQ043... screen, such as the one used by the PSP.  These screens are
135 +         the ones normally sold by gumstix with its boards.
136 +
137 +config FB_PXA_SAMSUNG_LTE430WQ_F0C
138 +       boolean "Samsung LTE430WQ-F0C (standard gumstix LCD)"
139 +       ---help---
140 +         Enable definitions for a Samsung LTE430WQ-F0C LCD panel, such as the ones resold
141 +         by gumstix for use with their "LCD-Ready" boards.
142 +
143 +config FB_PXA_NONEOFTHEABOVE
144 +       boolean "None of the above"
145 +
146 +endchoice
147 +
148  config FB_PXA_PARAMETERS
149         bool "PXA LCD command line parameters"
150         default n
151 --- a/drivers/video/pxafb.c
152 +++ b/drivers/video/pxafb.c
153 @@ -22,6 +22,7 @@
154   *
155   */
156  
157 +#include <linux/autoconf.h>
158  #include <linux/module.h>
159  #include <linux/moduleparam.h>
160  #include <linux/kernel.h>
161 @@ -789,7 +790,13 @@ static void pxafb_setup_gpio(struct pxaf
162         pxa_gpio_mode(GPIO74_LCD_FCLK_MD);
163         pxa_gpio_mode(GPIO75_LCD_LCLK_MD);
164         pxa_gpio_mode(GPIO76_LCD_PCLK_MD);
165 +#ifdef CONFIG_FB_PXA_SHARP_LQ043_PSP
166 +       /* DISP must be always high while screen is on */
167 +       pxa_gpio_mode(GPIO77_LCD_ACBIAS | GPIO_OUT);
168 +       GPSR(GPIO77_LCD_ACBIAS) = GPIO_bit(GPIO77_LCD_ACBIAS);
169 +#else
170         pxa_gpio_mode(GPIO77_LCD_ACBIAS_MD);
171 +#endif
172  }
173  
174  static void pxafb_enable_controller(struct pxafb_info *fbi)