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