Merge git://git.infradead.org/iommu-2.6
[pandora-kernel.git] / arch / arm / mach-omap2 / board-rx51-video.c
1 /*
2  * linux/arch/arm/mach-omap2/board-rx51-video.c
3  *
4  * Copyright (C) 2010 Nokia
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/gpio.h>
15 #include <linux/spi/spi.h>
16 #include <linux/mm.h>
17
18 #include <asm/mach-types.h>
19 #include <plat/display.h>
20 #include <plat/vram.h>
21 #include <plat/mcspi.h>
22
23 #include "mux.h"
24
25 #define RX51_LCD_RESET_GPIO     90
26
27 #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
28
29 static int rx51_lcd_enable(struct omap_dss_device *dssdev)
30 {
31         gpio_set_value(dssdev->reset_gpio, 1);
32         return 0;
33 }
34
35 static void rx51_lcd_disable(struct omap_dss_device *dssdev)
36 {
37         gpio_set_value(dssdev->reset_gpio, 0);
38 }
39
40 static struct omap_dss_device rx51_lcd_device = {
41         .name                   = "lcd",
42         .driver_name            = "panel-acx565akm",
43         .type                   = OMAP_DISPLAY_TYPE_SDI,
44         .phy.sdi.datapairs      = 2,
45         .reset_gpio             = RX51_LCD_RESET_GPIO,
46         .platform_enable        = rx51_lcd_enable,
47         .platform_disable       = rx51_lcd_disable,
48 };
49
50 static struct omap_dss_device *rx51_dss_devices[] = {
51         &rx51_lcd_device,
52 };
53
54 static struct omap_dss_board_info rx51_dss_board_info = {
55         .num_devices    = ARRAY_SIZE(rx51_dss_devices),
56         .devices        = rx51_dss_devices,
57         .default_device = &rx51_lcd_device,
58 };
59
60 struct platform_device rx51_display_device = {
61         .name   = "omapdss",
62         .id     = -1,
63         .dev    = {
64                 .platform_data = &rx51_dss_board_info,
65         },
66 };
67
68 static struct platform_device *rx51_video_devices[] __initdata = {
69         &rx51_display_device,
70 };
71
72 static int __init rx51_video_init(void)
73 {
74         if (!machine_is_nokia_rx51())
75                 return 0;
76
77         if (omap_mux_init_gpio(RX51_LCD_RESET_GPIO, OMAP_PIN_OUTPUT)) {
78                 pr_err("%s cannot configure MUX for LCD RESET\n", __func__);
79                 return 0;
80         }
81
82         if (gpio_request(RX51_LCD_RESET_GPIO, "LCD ACX565AKM reset")) {
83                 pr_err("%s failed to get LCD Reset GPIO\n", __func__);
84                 return 0;
85         }
86
87         gpio_direction_output(RX51_LCD_RESET_GPIO, 1);
88
89         platform_add_devices(rx51_video_devices,
90                                 ARRAY_SIZE(rx51_video_devices));
91         return 0;
92 }
93
94 subsys_initcall(rx51_video_init);
95
96 void __init rx51_video_mem_init(void)
97 {
98         /*
99          * GFX 864x480x32bpp
100          * VID1/2 1280x720x32bpp double buffered
101          */
102         omap_vram_set_sdram_vram(PAGE_ALIGN(864 * 480 * 4) +
103                         2 * PAGE_ALIGN(1280 * 720 * 4 * 2), 0);
104 }
105
106 #else
107 void __init rx51_video_mem_init(void) { }
108 #endif /* defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) */