3 * This file contains the definitions for the LCD timings and functions
4 * to control the LCD power / frontlighting via the w100fb driver.
6 * (c) 2005 Ian Molton <spyro@f2s.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
14 #include <linux/module.h>
15 #include <linux/device.h>
17 #include <linux/err.h>
18 #include <linux/platform_device.h>
20 #include <asm/mach-types.h>
22 #include <video/w100fb.h>
24 static struct w100_gen_regs e800_lcd_regs = {
25 .lcd_format = 0x00008003,
26 .lcdd_cntl1 = 0x02a00000,
27 .lcdd_cntl2 = 0x0003ffff,
28 .genlcd_cntl1 = 0x000ff2a3,
29 .genlcd_cntl2 = 0x000002a3,
30 .genlcd_cntl3 = 0x000102aa,
33 static struct w100_mode e800_lcd_mode[2] = {
41 .crtc_ss = 0x80350034,
42 .crtc_ls = 0x802b0026,
43 .crtc_gs = 0x80160016,
44 .crtc_vpos_gs = 0x00020003,
45 .crtc_rev = 0x0040001d,
46 .crtc_dclk = 0xe0000000,
47 .crtc_gclk = 0x82a50049,
48 .crtc_goe = 0x80ee001c,
49 .crtc_ps1_active = 0x00000000,
52 .pixclk_divider_rotated = 6,
53 .pixclk_src = CLK_SRC_PLL,
55 .sysclk_src = CLK_SRC_PLL,
64 .crtc_ss = 0xd010000f,
65 .crtc_ls = 0x80070003,
66 .crtc_gs = 0x80000000,
67 .crtc_vpos_gs = 0x01460147,
68 .crtc_rev = 0x00400003,
69 .crtc_dclk = 0xa1700030,
70 .crtc_gclk = 0x814b0008,
71 .crtc_goe = 0x80cc0015,
72 .crtc_ps1_active = 0x00000000,
74 .pixclk_divider = 6, /* Wince uses 14 which gives a 7MHz pclk. */
75 .pixclk_divider_rotated = 6, /* we want a 14MHz one (much nicer to look at) */
76 .pixclk_src = CLK_SRC_PLL,
78 .sysclk_src = CLK_SRC_PLL,
83 static struct w100_gpio_regs e800_w100_gpio_info = {
84 .init_data1 = 0xc13fc019,
85 .gpio_dir1 = 0x3e40df7f,
86 .gpio_oe1 = 0x003c3000,
87 .init_data2 = 0x00000000,
88 .gpio_dir2 = 0x00000000,
89 .gpio_oe2 = 0x00000000,
92 static struct w100_mem_info e800_w100_mem_info = {
93 .ext_cntl = 0x09640011,
94 .sdram_mode_reg = 0x00600021,
95 .ext_timing_cntl = 0x10001545,
96 .io_cntl = 0x7ddd7333,
100 static void e800_tg_change(struct w100fb_par *par)
104 tmp = w100fb_gpio_read(W100_GPIO_PORT_A);
105 if (par->mode->xres == 480)
109 w100fb_gpio_write(W100_GPIO_PORT_A, tmp);
112 static struct w100_tg_info e800_tg_info = {
113 .change = e800_tg_change,
116 static struct w100fb_mach_info e800_fb_info = {
117 .modelist = e800_lcd_mode,
119 .regs = &e800_lcd_regs,
120 .gpio = &e800_w100_gpio_info,
121 .mem = &e800_w100_mem_info,
123 .xtal_freq = 16000000,
126 static struct resource e800_fb_resources[] = {
130 .flags = IORESOURCE_MEM,
134 /* ----------------------- device declarations -------------------------- */
137 static struct platform_device e800_fb_device = {
141 .platform_data = &e800_fb_info,
143 .num_resources = ARRAY_SIZE(e800_fb_resources),
144 .resource = e800_fb_resources,
147 static int e800_lcd_init(void)
149 if (!machine_is_e800())
152 return platform_device_register(&e800_fb_device);
155 module_init(e800_lcd_init);
157 MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
158 MODULE_DESCRIPTION("e800 lcd driver");
159 MODULE_LICENSE("GPLv2");