Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / arch / avr32 / boards / atngw100 / evklcd10x.c
blob20388750d56447ee92324ee50cadfc0dacb5c89b
1 /*
2 * Board-specific setup code for the ATEVKLCD10X addon board to the ATNGW100
3 * Network Gateway
5 * Copyright (C) 2008 Atmel Corporation
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
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>
18 #include <video/atmel_lcdc.h>
20 #include <asm/setup.h>
22 #include <mach/at32ap700x.h>
23 #include <mach/portmux.h>
24 #include <mach/board.h>
26 #include <sound/atmel-ac97c.h>
28 static struct ac97c_platform_data __initdata ac97c0_data = {
29 .reset_pin = GPIO_PIN_PB(19),
32 #ifdef CONFIG_BOARD_ATNGW100_EVKLCD10X_VGA
33 static struct fb_videomode __initdata tcg057vglad_modes[] = {
35 .name = "640x480 @ 50",
36 .refresh = 50,
37 .xres = 640, .yres = 480,
38 .pixclock = KHZ2PICOS(25180),
40 .left_margin = 64, .right_margin = 96,
41 .upper_margin = 34, .lower_margin = 11,
42 .hsync_len = 64, .vsync_len = 15,
44 .sync = 0,
45 .vmode = FB_VMODE_NONINTERLACED,
49 static 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,
61 static struct atmel_lcdfb_info __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,
70 #elif CONFIG_BOARD_ATNGW100_EVKLCD10X_QVGA
71 static struct fb_videomode __initdata tcg057qvlad_modes[] = {
73 .name = "320x240 @ 50",
74 .refresh = 50,
75 .xres = 320, .yres = 240,
76 .pixclock = KHZ2PICOS(6300),
78 .left_margin = 34, .right_margin = 46,
79 .upper_margin = 7, .lower_margin = 15,
80 .hsync_len = 64, .vsync_len = 12,
82 .sync = 0,
83 .vmode = FB_VMODE_NONINTERLACED,
87 static 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,
99 static struct atmel_lcdfb_info __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,
108 #elif CONFIG_BOARD_ATNGW100_EVKLCD10X_POW_QVGA
109 static struct fb_videomode __initdata ph320240t_modes[] = {
111 .name = "320x240 @ 60",
112 .refresh = 60,
113 .xres = 320, .yres = 240,
114 .pixclock = KHZ2PICOS(6300),
116 .left_margin = 38, .right_margin = 20,
117 .upper_margin = 15, .lower_margin = 5,
118 .hsync_len = 30, .vsync_len = 3,
120 .sync = 0,
121 .vmode = FB_VMODE_NONINTERLACED,
125 static 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,
137 static struct atmel_lcdfb_info __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,
146 #endif
148 static void atevklcd10x_lcdc_power_control(int on)
150 gpio_set_value(GPIO_PIN_PB(15), on);
153 static int __init atevklcd10x_init(void)
155 /* PB15 is connected to the enable line on the boost regulator
156 * controlling the backlight for the LCD panel.
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);
162 atevklcd10x_lcdc_data.atmel_lcdfb_power_control =
163 atevklcd10x_lcdc_power_control;
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
174 at32_add_device_ac97c(0, &ac97c0_data, AC97C_BOTH);
176 return 0;
178 postcore_initcall(atevklcd10x_init);