e58c90adea10216e9778488c8ab80296bc6bb949
[openembedded.git] /
1 diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
2 index 0c0cbfc..c992cc7 100644
3 --- a/arch/arm/mach-omap2/board-omap3beagle.c
4 +++ b/arch/arm/mach-omap2/board-omap3beagle.c
5 @@ -63,12 +63,23 @@ static struct platform_device omap3_beagle_twl4030rtc_device = {
6         .id             = -1,
7  };
8  
9 +static struct platform_device omap3_beagle_lcd_device = {
10 +       .name           = "omap3beagle_lcd",
11 +       .id             = -1,
12 +};
13 +
14 +static struct omap_lcd_config omap3_beagle_lcd_config __initdata = {
15 +       .ctrl_name      = "internal",
16 +};
17 +
18  static struct omap_board_config_kernel omap3_beagle_config[] __initdata = {
19         { OMAP_TAG_UART,        &omap3_beagle_uart_config },
20         { OMAP_TAG_MMC,         &omap3beagle_mmc_config },
21 +       { OMAP_TAG_LCD,         &omap3_beagle_lcd_config },
22  };
23  
24  static struct platform_device *omap3_beagle_devices[] __initdata = {
25 +       &omap3_beagle_lcd_device,
26  #ifdef CONFIG_RTC_DRV_TWL4030
27         &omap3_beagle_twl4030rtc_device,
28  #endif
29 diff --git a/drivers/video/omap/Makefile b/drivers/video/omap/Makefile
30 index cad6a68..fe7ee5d 100644
31 --- a/drivers/video/omap/Makefile
32 +++ b/drivers/video/omap/Makefile
33 @@ -32,6 +32,7 @@ objs-y$(CONFIG_MACH_OMAP_APOLLON) += lcd_apollon.o
34  objs-y$(CONFIG_MACH_OMAP_2430SDP) += lcd_2430sdp.o
35  objs-y$(CONFIG_MACH_OMAP_3430SDP) += lcd_2430sdp.o
36  objs-y$(CONFIG_MACH_OMAP3EVM) += lcd_omap3evm.o
37 +objs-y$(CONFIG_MACH_OMAP3_BEAGLE) += lcd_omap3beagle.o
38  objs-y$(CONFIG_FB_OMAP_LCD_MIPID) += lcd_mipid.o
39  
40  omapfb-objs := $(objs-yy)
41 diff --git a/drivers/video/omap/lcd_omap3beagle.c b/drivers/video/omap/lcd_omap3beagle.c
42 new file mode 100644
43 index 0000000..d49101a
44 --- /dev/null
45 +++ b/drivers/video/omap/lcd_omap3beagle.c
46 @@ -0,0 +1,140 @@
47 +/*
48 + * LCD panel support for the TI OMAP3 Beagle board
49 + *
50 + * Author: Koen Kooi <koen@openembedded.org>
51 + *
52 + * Derived from drivers/video/omap/lcd-omap3evm.c
53 + *
54 + * This program is free software; you can redistribute it and/or modify it
55 + * under the terms of the GNU General Public License as published by the
56 + * Free Software Foundation; either version 2 of the License, or (at your
57 + * option) any later version.
58 + *
59 + * This program is distributed in the hope that it will be useful, but
60 + * WITHOUT ANY WARRANTY; without even the implied warranty of
61 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
62 + * General Public License for more details.
63 + *
64 + * You should have received a copy of the GNU General Public License along
65 + * with this program; if not, write to the Free Software Foundation, Inc.,
66 + * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
67 + */
68 +
69 +#include <linux/module.h>
70 +#include <linux/platform_device.h>
71 +#include <linux/i2c/twl4030.h>
72 +
73 +#include <asm/arch/gpio.h>
74 +#include <asm/arch/mux.h>
75 +#include <asm/arch/omapfb.h>
76 +#include <asm/mach-types.h>
77 +
78 +#define LCD_PANEL_ENABLE_GPIO       170
79 +
80 +#define LCD_XRES               1024    
81 +#define LCD_YRES               768
82 +#define LCD_PIXCLOCK_MAX        64000 /* in pico seconds  */
83 +#define LCD_PIXCLOCK_MIN        64000 /* in pico seconds */
84 +
85 +#define ENABLE_VDAC_DEDICATED  0x03
86 +#define ENABLE_VDAC_DEV_GRP    0x20
87 +#define ENABLE_VPLL2_DEDICATED 0x05
88 +#define ENABLE_VPLL2_DEV_GRP   0xE0
89 +
90 +static int omap3beagle_panel_init(struct lcd_panel *panel,
91 +                               struct omapfb_device *fbdev)
92 +{
93 +       omap_request_gpio(LCD_PANEL_ENABLE_GPIO);
94 +        
95 +       return 0;
96 +}
97 +
98 +static void omap3beagle_panel_cleanup(struct lcd_panel *panel)
99 +{
100 +}
101 +
102 +static int omap3beagle_panel_enable(struct lcd_panel *panel)
103 +{
104 +       omap_set_gpio_dataout(LCD_PANEL_ENABLE_GPIO, 1);
105 +       return 0;
106 +}
107 +
108 +static void omap3beagle_panel_disable(struct lcd_panel *panel)
109 +{
110 +       omap_set_gpio_dataout(LCD_PANEL_ENABLE_GPIO, 0);
111 +}
112 +
113 +static unsigned long omap3beagle_panel_get_caps(struct lcd_panel *panel)
114 +{
115 +       return 0;
116 +}
117 +
118 +struct lcd_panel omap3beagle_panel = {
119 +       .name           = "omap3beagle",
120 +       .config         = OMAP_LCDC_PANEL_TFT,
121 +
122 +       .bpp            = 24,
123 +       .data_lines     = 24,
124 +       .x_res          = LCD_XRES,
125 +       .y_res          = LCD_YRES,
126 +       .hsw            = 3,            /* hsync_len (4) - 1 */
127 +       .hfp            = 3,            /* right_margin (4) - 1 */
128 +       .hbp            = 39,           /* left_margin (40) - 1 */
129 +       .vsw            = 1,            /* vsync_len (2) - 1 */
130 +       .vfp            = 2,            /* lower_margin */
131 +       .vbp            = 7,            /* upper_margin (8) - 1 */
132 +
133 +       .pixel_clock    = LCD_PIXCLOCK_MAX,
134 +
135 +       .init           = omap3beagle_panel_init,
136 +       .cleanup        = omap3beagle_panel_cleanup,
137 +       .enable         = omap3beagle_panel_enable,
138 +       .disable        = omap3beagle_panel_disable,
139 +       .get_caps       = omap3beagle_panel_get_caps,
140 +};
141 +
142 +static int omap3beagle_panel_probe(struct platform_device *pdev)
143 +{
144 +       omapfb_register_panel(&omap3beagle_panel);
145 +       return 0;
146 +}
147 +
148 +static int omap3beagle_panel_remove(struct platform_device *pdev)
149 +{
150 +       return 0;
151 +}
152 +
153 +static int omap3beagle_panel_suspend(struct platform_device *pdev,
154 +                                  pm_message_t mesg)
155 +{
156 +       return 0;
157 +}
158 +
159 +static int omap3beagle_panel_resume(struct platform_device *pdev)
160 +{
161 +       return 0;
162 +}
163 +
164 +struct platform_driver omap3beagle_panel_driver = {
165 +       .probe          = omap3beagle_panel_probe,
166 +       .remove         = omap3beagle_panel_remove,
167 +       .suspend        = omap3beagle_panel_suspend,
168 +       .resume         = omap3beagle_panel_resume,
169 +       .driver         = {
170 +               .name   = "omap3beagle_lcd",
171 +               .owner  = THIS_MODULE,
172 +       },
173 +};
174 +
175 +static int __init omap3beagle_panel_drv_init(void)
176 +{
177 +       return platform_driver_register(&omap3beagle_panel_driver);
178 +}
179 +
180 +static void __exit omap3beagle_panel_drv_exit(void)
181 +{
182 +       platform_driver_unregister(&omap3beagle_panel_driver);
183 +}
184 +
185 +module_init(omap3beagle_panel_drv_init);
186 +module_exit(omap3beagle_panel_drv_exit);