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