sync hh.org
[hh.org.git] / arch / arm / mach-pxa / eseries / e740_lcd.c
blob7659d43a6c2025f882785e2a0ef9f3456e1b9ac1
1 /* e740_lcd.c
3 * (c) Ian Molton 2005
5 * This file contains the definitions for the LCD timings and functions
6 * to control the LCD power / frontlighting via the w100fb driver.
8 */
10 #include <linux/module.h>
11 #include <linux/init.h>
12 #include <linux/kernel.h>
13 #include <linux/tty.h>
14 #include <linux/sched.h>
15 #include <linux/delay.h>
16 #include <linux/device.h>
17 #include <linux/pm.h>
18 #include <linux/lcd.h>
19 #include <linux/backlight.h>
20 #include <linux/fb.h>
21 #include <linux/err.h>
24 #include <asm/mach-types.h>
25 #include <asm/hardware.h>
26 #include <asm/setup.h>
28 #include <asm/mach/arch.h>
29 #include <asm/arch/pxa-regs.h>
30 #include <asm/arch/eseries-gpio.h>
31 #include <linux/platform_device.h>
33 #include <video/w100fb.h>
36 This sequence brings up display on the e740
37 mmDISP_DB_BUF_CNTL 0x00000078 0x04d8
38 mmCLK_PIN_CNTL 0x0003f 0x0080
39 mmPLL_REF_FB_DIV 0x50500d04 0x0084
40 mmPLL_CNTL 0x4b000200 0x0088
41 mmSCLK_CNTL 0x00000b11 0x008C
42 mmPCLK_CNTL 0x00000000 0x0090
43 mmCLK_TEST_CNTL 0x00000000 0x0094
44 mmPWRMGT_CNTL 0x00000004 0x0098
45 mmMC_FB_LOCATION 0x15ff1000 0x0188
46 mmLCD_FORMAT 0x00008023 0x0410
47 mmGRAPHIC_CTRL 0x03cf1c06 0x0414
48 mmGRAPHIC_OFFSET 0x00100000 0x0418
49 mmGRAPHIC_PITCH 0x000001e0 0x041C
50 mmCRTC_TOTAL 0x01510120 0x0420
51 mmACTIVE_H_DISP 0x01040014 0x0424
52 mmACTIVE_V_DISP 0x01490009 0x0428
53 mmGRAPHIC_H_DISP 0x01040014 0x042C
54 mmGRAPHIC_V_DISP 0x01490009 0x0430
55 mmCRTC_SS 0x80140013 0x048C
56 mmCRTC_LS 0x81150110 0x0490
57 mmCRTC_REV 0x0040010a 0x0494
58 mmCRTC_DCLK 0xa906000a 0x049C
59 mmCRTC_GS 0x80050005 0x04A0
60 mmCRTC_VPOS_GS 0x000a0009 0x04A4
61 mmCRTC_GCLK 0x80050108 0x04A8
62 mmCRTC_GOE 0x80050108 0x04AC
63 mmCRTC_FRAME 0x00000000 0x04B0
64 mmCRTC_FRAME_VPOS 0x00000000 0x04B4
65 mmGPIO_DATA 0x21bd21bf 0x04B8
66 mmGPIO_CNTL1 0xffffff00 0x04BC
67 mmGPIO_CNTL2 0x03c00643 0x04C0
68 mmLCDD_CNTL1 0x00000000 0x04C4
69 mmLCDD_CNTL2 0x0003ffff 0x04C8
70 mmGENLCD_CNTL1 0x00fff003 0x04CC
71 mmGENLCD_CNTL2 0x00000003 0x04D0
72 mmCRTC_DEFAULT_COUNT 0x00000000 0x04E0
73 mmLCD_BACKGROUND_COLOR 0x0000ff00 0x04E4
74 mmCRTC_PS1_ACTIVE 0x41060010 0x04F0
75 mmGENLCD_CNTL3 0x000143aa 0x0524
76 mmGPIO_DATA2 0xff3fff3f 0x0528
77 mmGPIO_CNTL3 0xffff0000 0x052C
78 mmGPIO_CNTL4 0x000000ff 0x0530
79 mmDISP_DEBUG2 0x00800000 0x0538
80 .long 0x0c011004 == 0x00100000 @ enable accel?
81 mmDISP_DB_BUF_CNTL 0x0000007b
83 devmem2 0x0c0104d8 w 0x00000078
84 devmem2 0x0c010080 w 0x0000003f
85 devmem2 0x0c010084 w 0x50500d04
86 devmem2 0x0c010088 w 0x4b000200
87 devmem2 0x0c01008C w 0x00000b11
88 devmem2 0x0c010090 w 0x00000000
89 devmem2 0x0c010094 w 0x00000000
90 devmem2 0x0c010098 w 0x00000004
91 devmem2 0x0c010188 w 0x15ff1000
92 devmem2 0x0c010410 w 0x00008023
93 devmem2 0x0c010414 w 0x03cf1c06
94 devmem2 0x0c010418 w 0x00100000
95 devmem2 0x0c01041C w 0x000001e0
96 devmem2 0x0c010420 w 0x01510120
97 devmem2 0x0c010424 w 0x01040014
98 devmem2 0x0c010428 w 0x01490009
99 devmem2 0x0c01042C w 0x01040014
100 devmem2 0x0c010430 w 0x01490009
101 devmem2 0x0c01048C w 0x80140013
102 devmem2 0x0c010490 w 0x81150110
103 devmem2 0x0c010494 w 0x0040010a
104 devmem2 0x0c01049C w 0xa906000a
105 devmem2 0x0c0104A0 w 0x80050005
106 devmem2 0x0c0104A4 w 0x000a0009
107 devmem2 0x0c0104A8 w 0x80050108
108 devmem2 0x0c0104AC w 0x80050108
109 devmem2 0x0c0104B0 w 0x00000000
110 devmem2 0x0c0104B4 w 0x00000000
111 devmem2 0x0c0104B8 w 0x21bd21bf
112 devmem2 0x0c0104BC w 0xffffff00
113 devmem2 0x0c0104C0 w 0x03c00643
114 devmem2 0x0c0104C4 w 0x00000000
115 devmem2 0x0c0104C8 w 0x0003ffff
116 devmem2 0x0c0104CC w 0x00fff003
117 devmem2 0x0c0104D0 w 0x00000003
118 devmem2 0x0c0104E0 w 0x00000000
119 devmem2 0x0c0104E4 w 0x0000ff00
120 devmem2 0x0c0104F0 w 0x41060010
121 devmem2 0x0c010524 w 0x000143aa
122 devmem2 0x0c010528 w 0xff3fff3f
123 devmem2 0x0c01052C w 0xffff0000
124 devmem2 0x0c010530 w 0x000000ff
125 devmem2 0x0c010538 w 0x00800000 # 0xc0800000
126 devmem2 0x0c0104d8 w 0x0000007b
128 **potential** shutdown routine
129 devmem2 0x0c010528 w 0xff3fff00
130 devmem2 0x0c010190 w 0x7FFF8000
131 devmem2 0x0c0101b0 w 0x00FF0000
132 devmem2 0x0c01008c w 0x00000000
133 devmem2 0x0c010080 w 0x000000bf
134 devmem2 0x0c010098 w 0x00000015
135 devmem2 0x0c010088 w 0x4b000204
136 devmem2 0x0c010098 w 0x0000001d
140 static struct w100_gen_regs e740_lcd_regs = {
141 .lcd_format = 0x00008023,
142 .lcdd_cntl1 = 0x0f000000,
143 .lcdd_cntl2 = 0x0003ffff,
144 .genlcd_cntl1 = 0x00ffff03,
145 .genlcd_cntl2 = 0x003c0f03,
146 .genlcd_cntl3 = 0x000143aa,
149 static struct w100_mode e740_lcd_mode = {
150 .xres = 240,
151 .yres = 320,
152 // .bpp = 16,
153 .left_margin = 20,
154 .right_margin = 28,
155 .upper_margin = 9,
156 .lower_margin = 8,
157 .crtc_ss = 0x80140013,
158 .crtc_ls = 0x81150110,
159 .crtc_gs = 0x80050005,
160 .crtc_vpos_gs = 0x000a0009,
161 .crtc_rev = 0x0040010a,
162 .crtc_dclk = 0xa906000a,
163 .crtc_gclk = 0x80050108,
164 .crtc_goe = 0x80050108,
165 .pll_freq = 57,
166 .pixclk_divider = 4,
167 .pixclk_divider_rotated = 4,
168 .pixclk_src = CLK_SRC_XTAL,
169 .sysclk_divider = 1,
170 .sysclk_src = CLK_SRC_PLL,
171 .crtc_ps1_active = 0x41060010,
175 static struct w100_gpio_regs e740_w100_gpio_info = {
176 .init_data1 = 0x21002103,
177 .gpio_dir1 = 0xffffdeff,
178 .gpio_oe1 = 0x03c00643,
179 .init_data2 = 0x003f003f,
180 .gpio_dir2 = 0xffffffff,
181 .gpio_oe2 = 0x000000ff,
184 static struct w100fb_mach_info e740_fb_info = {
185 .modelist = &e740_lcd_mode,
186 .num_modes = 1,
187 .regs = &e740_lcd_regs,
188 .gpio = &e740_w100_gpio_info,
189 .xtal_freq = 14318000,
190 .xtal_dbl = 1,
193 static struct resource e740_fb_resources[] = {
194 [0] = {
195 .start = 0x0c000000,
196 .end = 0x0cffffff,
197 .flags = IORESOURCE_MEM,
201 /* ----------------------- device declarations -------------------------- */
204 static struct platform_device e740_fb_device = {
205 .name = "w100fb",
206 .id = -1,
207 .dev = {
208 .platform_data = &e740_fb_info,
210 .num_resources = ARRAY_SIZE(e740_fb_resources),
211 .resource = e740_fb_resources,
215 static struct platform_device e740_lcd_hook_device = {
216 .name = "e740-lcd-hook",
217 .dev = {
218 .parent = &e740_fb_device.dev,
220 .id = -1,
223 static int e740_lcd_init (void) {
224 int ret;
226 if (!machine_is_e740 ())
227 return -ENODEV;
229 if((ret = platform_device_register(&e740_fb_device)))
230 return ret;
232 platform_device_register(&e740_lcd_hook_device);
234 return 0;
237 static void e740_lcd_exit (void)
239 //FIXME - free the platform dev for the w100 (imageon)
242 module_init (e740_lcd_init);
243 module_exit (e740_lcd_exit);
245 MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
246 MODULE_DESCRIPTION("e740 lcd driver");
247 MODULE_LICENSE("GPLv2");