Merge branch 'linux-next' of git://git.infradead.org/ubifs-2.6
[pandora-kernel.git] / arch / avr32 / boards / atngw100 / evklcd10x.c
index 8140b22..0033711 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <linux/init.h>
 #include <linux/linkage.h>
+#include <linux/gpio.h>
 #include <linux/fb.h>
 #include <linux/platform_device.h>
 
 #include <asm/setup.h>
 
 #include <mach/at32ap700x.h>
+#include <mach/portmux.h>
 #include <mach/board.h>
 
+#include <sound/atmel-ac97c.h>
+
 static struct ac97c_platform_data __initdata ac97c0_data = {
-       .dma_rx_periph_id       = 3,
-       .dma_tx_periph_id       = 4,
-       .dma_controller_id      = 0,
-       .reset_pin              = GPIO_PIN_PB(19),
+       .reset_pin = GPIO_PIN_PB(19),
 };
 
 #ifdef CONFIG_BOARD_ATNGW100_EVKLCD10X_VGA
 static struct fb_videomode __initdata tcg057vglad_modes[] = {
        {
-               .name           = "640x480 @ 60",
-               .refresh        = 60,
+               .name           = "640x480 @ 50",
+               .refresh        = 50,
                .xres           = 640,          .yres           = 480,
                .pixclock       = KHZ2PICOS(25180),
 
-               .left_margin    = 64,           .right_margin   = 31,
-               .upper_margin   = 34,           .lower_margin   = 2,
-               .hsync_len      = 96,           .vsync_len      = 4,
+               .left_margin    = 64,           .right_margin   = 96,
+               .upper_margin   = 34,           .lower_margin   = 11,
+               .hsync_len      = 64,           .vsync_len      = 15,
 
                .sync           = 0,
                .vmode          = FB_VMODE_NONINTERLACED,
@@ -69,14 +70,14 @@ static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
 #elif CONFIG_BOARD_ATNGW100_EVKLCD10X_QVGA
 static struct fb_videomode __initdata tcg057qvlad_modes[] = {
        {
-               .name           = "320x240 @ 60",
-               .refresh        = 60,
+               .name           = "320x240 @ 50",
+               .refresh        = 50,
                .xres           = 320,          .yres           = 240,
                .pixclock       = KHZ2PICOS(6300),
 
-               .left_margin    = 52,           .right_margin   = 28,
-               .upper_margin   = 7,            .lower_margin   = 2,
-               .hsync_len      = 96,           .vsync_len      = 4,
+               .left_margin    = 34,           .right_margin   = 46,
+               .upper_margin   = 7,            .lower_margin   = 15,
+               .hsync_len      = 64,           .vsync_len      = 12,
 
                .sync           = 0,
                .vmode          = FB_VMODE_NONINTERLACED,
@@ -144,12 +145,29 @@ static struct atmel_lcdfb_info __initdata atevklcd10x_lcdc_data = {
 };
 #endif
 
+static void atevklcd10x_lcdc_power_control(int on)
+{
+       gpio_set_value(GPIO_PIN_PB(15), on);
+}
+
 static int __init atevklcd10x_init(void)
 {
-       at32_add_device_ac97c(0, &ac97c0_data);
+       /* PB15 is connected to the enable line on the boost regulator
+        * controlling the backlight for the LCD panel.
+        */
+       at32_select_gpio(GPIO_PIN_PB(15), AT32_GPIOF_OUTPUT);
+       gpio_request(GPIO_PIN_PB(15), "backlight");
+       gpio_direction_output(GPIO_PIN_PB(15), 0);
+
+       atevklcd10x_lcdc_data.atmel_lcdfb_power_control =
+               atevklcd10x_lcdc_power_control;
 
        at32_add_device_lcdc(0, &atevklcd10x_lcdc_data,
-                       fbmem_start, fbmem_size, 1);
+                       fbmem_start, fbmem_size,
+                       ATMEL_LCDC_ALT_18BIT | ATMEL_LCDC_PE_DVAL);
+
+       at32_add_device_ac97c(0, &ac97c0_data, AC97C_BOTH);
+
        return 0;
 }
 postcore_initcall(atevklcd10x_init);