1
2
3
4
5
6
7
8
9
10
11
12#include <linux/init.h>
13#include <linux/linkage.h>
14#include <linux/gpio.h>
15#include <linux/fb.h>
16#include <linux/platform_device.h>
17
18#include <video/atmel_lcdc.h>
19
20#include <asm/setup.h>
21
22#include <mach/at32ap700x.h>
23#include <mach/portmux.h>
24#include <mach/board.h>
25
26#include <sound/atmel-ac97c.h>
27
28static struct ac97c_platform_data __initdata ac97c0_data = {
29 .reset_pin = GPIO_PIN_PB(19),
30};
31
32#ifdef CONFIG_BOARD_ATNGW100_EVKLCD10X_VGA
33static struct fb_videomode __initdata tcg057vglad_modes[] = {
34 {
35 .name = "640x480 @ 50",
36 .refresh = 50,
37 .xres = 640, .yres = 480,
38 .pixclock = KHZ2PICOS(25180),
39
40 .left_margin = 64, .right_margin = 96,
41 .upper_margin = 34, .lower_margin = 11,
42 .hsync_len = 64, .vsync_len = 15,
43
44 .sync = 0,
45 .vmode = FB_VMODE_NONINTERLACED,
46 },
47};
48
49static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
50 .manufacturer = "KYO",
51 .monitor = "TCG057VGLAD",
52 .modedb = tcg057vglad_modes,
53 .modedb_len = ARRAY_SIZE(tcg057vglad_modes),
54 .hfmin = 19948,
55 .hfmax = 31478,
56 .vfmin = 50,
57 .vfmax = 67,
58 .dclkmax = 28330000,
59};
60
61static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
62 .default_bpp = 16,
63 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
64 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
65 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE
66 | ATMEL_LCDC_MEMOR_BIG),
67 .default_monspecs = &atevklcd10x_default_monspecs,
68 .guard_time = 2,
69};
70#elif CONFIG_BOARD_ATNGW100_EVKLCD10X_QVGA
71static struct fb_videomode __initdata tcg057qvlad_modes[] = {
72 {
73 .name = "320x240 @ 50",
74 .refresh = 50,
75 .xres = 320, .yres = 240,
76 .pixclock = KHZ2PICOS(6300),
77
78 .left_margin = 34, .right_margin = 46,
79 .upper_margin = 7, .lower_margin = 15,
80 .hsync_len = 64, .vsync_len = 12,
81
82 .sync = 0,
83 .vmode = FB_VMODE_NONINTERLACED,
84 },
85};
86
87static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
88 .manufacturer = "KYO",
89 .monitor = "TCG057QVLAD",
90 .modedb = tcg057qvlad_modes,
91 .modedb_len = ARRAY_SIZE(tcg057qvlad_modes),
92 .hfmin = 19948,
93 .hfmax = 31478,
94 .vfmin = 50,
95 .vfmax = 67,
96 .dclkmax = 7000000,
97};
98
99static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
100 .default_bpp = 16,
101 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
102 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
103 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE
104 | ATMEL_LCDC_MEMOR_BIG),
105 .default_monspecs = &atevklcd10x_default_monspecs,
106 .guard_time = 2,
107};
108#elif CONFIG_BOARD_ATNGW100_EVKLCD10X_POW_QVGA
109static struct fb_videomode __initdata ph320240t_modes[] = {
110 {
111 .name = "320x240 @ 60",
112 .refresh = 60,
113 .xres = 320, .yres = 240,
114 .pixclock = KHZ2PICOS(6300),
115
116 .left_margin = 38, .right_margin = 20,
117 .upper_margin = 15, .lower_margin = 5,
118 .hsync_len = 30, .vsync_len = 3,
119
120 .sync = 0,
121 .vmode = FB_VMODE_NONINTERLACED,
122 },
123};
124
125static struct fb_monspecs __initdata atevklcd10x_default_monspecs = {
126 .manufacturer = "POW",
127 .monitor = "PH320240T",
128 .modedb = ph320240t_modes,
129 .modedb_len = ARRAY_SIZE(ph320240t_modes),
130 .hfmin = 14400,
131 .hfmax = 21600,
132 .vfmin = 50,
133 .vfmax = 90,
134 .dclkmax = 6400000,
135};
136
137static struct atmel_lcdfb_pdata __initdata atevklcd10x_lcdc_data = {
138 .default_bpp = 16,
139 .default_dmacon = ATMEL_LCDC_DMAEN | ATMEL_LCDC_DMA2DEN,
140 .default_lcdcon2 = (ATMEL_LCDC_DISTYPE_TFT
141 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE
142 | ATMEL_LCDC_MEMOR_BIG),
143 .default_monspecs = &atevklcd10x_default_monspecs,
144 .guard_time = 2,
145};
146#endif
147
148static void atevklcd10x_lcdc_power_control(struct atmel_lcdfb_pdata *pdata, int on)
149{
150 gpio_set_value(GPIO_PIN_PB(15), on);
151}
152
153static int __init atevklcd10x_init(void)
154{
155
156
157
158 at32_select_gpio(GPIO_PIN_PB(15), AT32_GPIOF_OUTPUT);
159 gpio_request(GPIO_PIN_PB(15), "backlight");
160 gpio_direction_output(GPIO_PIN_PB(15), 0);
161
162 atevklcd10x_lcdc_data.atmel_lcdfb_power_control =
163 atevklcd10x_lcdc_power_control;
164
165 at32_add_device_lcdc(0, &atevklcd10x_lcdc_data,
166 fbmem_start, fbmem_size,
167#ifdef CONFIG_BOARD_ATNGW100_MKII
168 ATMEL_LCDC_PRI_18BIT | ATMEL_LCDC_PC_DVAL
169#else
170 ATMEL_LCDC_ALT_18BIT | ATMEL_LCDC_PE_DVAL
171#endif
172 );
173
174 at32_add_device_ac97c(0, &ac97c0_data, AC97C_BOTH);
175
176 return 0;
177}
178postcore_initcall(atevklcd10x_init);
179