Merge current mainline tree into linux-omap tree
[pandora-kernel.git] / drivers / video / omap / lcd_omap3beagle.c
1 /*
2  * LCD panel support for the TI OMAP3 Beagle board
3  *
4  * Author: Koen Kooi <koen@openembedded.org>
5  *
6  * Derived from drivers/video/omap/lcd-omap3evm.c
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21  */
22
23 #include <linux/module.h>
24 #include <linux/platform_device.h>
25 #include <linux/i2c/twl4030.h>
26
27 #include <mach/gpio.h>
28 #include <mach/mux.h>
29 #include <mach/omapfb.h>
30 #include <asm/mach-types.h>
31
32 #define LCD_PANEL_ENABLE_GPIO       170
33
34 #define LCD_XRES                1024    
35 #define LCD_YRES                768
36 #define LCD_PIXCLOCK            64000 /* in kHz */
37
38 static int omap3beagle_panel_init(struct lcd_panel *panel,
39                                 struct omapfb_device *fbdev)
40 {
41         omap_request_gpio(LCD_PANEL_ENABLE_GPIO);
42         return 0;
43 }
44
45 static void omap3beagle_panel_cleanup(struct lcd_panel *panel)
46 {
47 }
48
49 static int omap3beagle_panel_enable(struct lcd_panel *panel)
50 {
51         omap_set_gpio_dataout(LCD_PANEL_ENABLE_GPIO, 1);
52         return 0;
53 }
54
55 static void omap3beagle_panel_disable(struct lcd_panel *panel)
56 {
57         omap_set_gpio_dataout(LCD_PANEL_ENABLE_GPIO, 0);
58 }
59
60 static unsigned long omap3beagle_panel_get_caps(struct lcd_panel *panel)
61 {
62         return 0;
63 }
64
65 struct lcd_panel omap3beagle_panel = {
66         .name           = "omap3beagle",
67         .config         = OMAP_LCDC_PANEL_TFT,
68
69         .bpp            = 16,
70         .data_lines     = 24,
71         .x_res          = LCD_XRES,
72         .y_res          = LCD_YRES,
73         .hsw            = 3,            /* hsync_len (4) - 1 */
74         .hfp            = 3,            /* right_margin (4) - 1 */
75         .hbp            = 39,           /* left_margin (40) - 1 */
76         .vsw            = 1,            /* vsync_len (2) - 1 */
77         .vfp            = 2,            /* lower_margin */
78         .vbp            = 7,            /* upper_margin (8) - 1 */
79
80         .pixel_clock    = LCD_PIXCLOCK,
81
82         .init           = omap3beagle_panel_init,
83         .cleanup        = omap3beagle_panel_cleanup,
84         .enable         = omap3beagle_panel_enable,
85         .disable        = omap3beagle_panel_disable,
86         .get_caps       = omap3beagle_panel_get_caps,
87 };
88
89 static int omap3beagle_panel_probe(struct platform_device *pdev)
90 {
91         omapfb_register_panel(&omap3beagle_panel);
92         return 0;
93 }
94
95 static int omap3beagle_panel_remove(struct platform_device *pdev)
96 {
97         return 0;
98 }
99
100 static int omap3beagle_panel_suspend(struct platform_device *pdev,
101                                    pm_message_t mesg)
102 {
103         return 0;
104 }
105
106 static int omap3beagle_panel_resume(struct platform_device *pdev)
107 {
108         return 0;
109 }
110
111 struct platform_driver omap3beagle_panel_driver = {
112         .probe          = omap3beagle_panel_probe,
113         .remove         = omap3beagle_panel_remove,
114         .suspend        = omap3beagle_panel_suspend,
115         .resume         = omap3beagle_panel_resume,
116         .driver         = {
117                 .name   = "omap3beagle_lcd",
118                 .owner  = THIS_MODULE,
119         },
120 };
121
122 static int __init omap3beagle_panel_drv_init(void)
123 {
124         return platform_driver_register(&omap3beagle_panel_driver);
125 }
126
127 static void __exit omap3beagle_panel_drv_exit(void)
128 {
129         platform_driver_unregister(&omap3beagle_panel_driver);
130 }
131
132 module_init(omap3beagle_panel_drv_init);
133 module_exit(omap3beagle_panel_drv_exit);