summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/linux/linux-omap-2.6.29/omap3evm/omap3evm-dss2.diff
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/linux/linux-omap-2.6.29/omap3evm/omap3evm-dss2.diff')
-rw-r--r--meta/recipes-kernel/linux/linux-omap-2.6.29/omap3evm/omap3evm-dss2.diff443
1 files changed, 443 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-omap-2.6.29/omap3evm/omap3evm-dss2.diff b/meta/recipes-kernel/linux/linux-omap-2.6.29/omap3evm/omap3evm-dss2.diff
new file mode 100644
index 0000000000..60832e72ca
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-omap-2.6.29/omap3evm/omap3evm-dss2.diff
@@ -0,0 +1,443 @@
1From: hvaibhav@ti.com
2To: linux-fbdev-devel@lists.sourceforge.net, linux-omap@vger.kernel.org
3Cc: Vaibhav Hiremath <hvaibhav@ti.com>
4Subject: [REVIEW PATCH] Added OMAP3EVM support on Tomis FBDEV/DSS Patches
5Date: Fri, 14 Nov 2008 12:02:32 +0530
6
7From: Vaibhav Hiremath <hvaibhav@ti.com>
8
9Tested LCD, TV, DVI (480P) out on OMAP3EVM board.
10
11Please make sure that you change the option
12CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE=7 and apply the
13Mans Rullgard clock patches to support set_rate and round_rate API.
14
15Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
16---
17 arch/arm/mach-omap2/board-omap3evm.c | 224 ++++++++++++++++++++++++++++++++--
18 drivers/video/omap2/Kconfig | 5 +
19 drivers/video/omap2/Makefile | 1 +
20 drivers/video/omap2/panel-omap3evm.c | 110 +++++++++++++++++
21 5 files changed, 341 insertions(+), 53 deletions(-)
22 create mode 100644 drivers/video/omap2/panel-omap3evm.c
23
24diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
25index 42ab826..e244fa7 100644
26--- a/arch/arm/mach-omap2/board-omap3evm.c
27+++ b/arch/arm/mach-omap2/board-omap3evm.c
28@@ -37,6 +37,8 @@
29 #include <mach/usb-ehci.h>
30 #include <mach/common.h>
31 #include <mach/mcspi.h>
32+#include <mach/omapfb.h>
33+#include <mach/display.h>
34
35 #include "sdram-micron-mt46h32m32lf-6.h"
36 #include "twl4030-generic-scripts.h"
37@@ -161,14 +163,215 @@ static int __init omap3_evm_i2c_init(void)
38 omap_register_i2c_bus(3, 400, NULL, 0);
39 return 0;
40 }
41+static struct omap_fbmem_config evm_fbmem0_config = {
42+ .size = 480*720*4,
43+ .start = OMAPFB_MEMTYPE_SDRAM,
44+};
45
46-static struct platform_device omap3_evm_lcd_device = {
47- .name = "omap3evm_lcd",
48- .id = -1,
49+static struct omap_fbmem_config evm_fbmem1_config = {
50+ .size = 480*720*4,
51+ .start = OMAPFB_MEMTYPE_SDRAM,
52 };
53
54-static struct omap_lcd_config omap3_evm_lcd_config __initdata = {
55- .ctrl_name = "internal",
56+static struct omap_fbmem_config evm_fbmem2_config = {
57+ .size = 480*720*4,
58+ .start = OMAPFB_MEMTYPE_SDRAM,
59+};
60+#define LCD_PANEL_LR 2
61+#define LCD_PANEL_UD 3
62+#define LCD_PANEL_INI 152
63+#define LCD_PANEL_ENABLE_GPIO 153
64+#define LCD_PANEL_QVGA 154
65+#define LCD_PANEL_RESB 155
66+
67+#define ENABLE_VDAC_DEDICATED 0x03
68+#define ENABLE_VDAC_DEV_GRP 0x20
69+#define ENABLE_VPLL2_DEDICATED 0x05
70+#define ENABLE_VPLL2_DEV_GRP 0xE0
71+
72+#define TWL4030_GPIODATA_IN3 0x03
73+#define TWL4030_GPIODATA_DIR3 0x06
74+#define TWL4030_VPLL2_DEV_GRP 0x33
75+#define TWL4030_VPLL2_DEDICATED 0x36
76+
77+static int lcd_enabled;
78+static int dvi_enabled;
79+
80+static void __init evm_display_init(void)
81+{
82+ int r;
83+ r = gpio_request(LCD_PANEL_LR, "lcd_panel_lr");
84+ if (r) {
85+ printk(KERN_ERR "failed to get LCD_PANEL_LR\n");
86+ return;
87+ }
88+ r = gpio_request(LCD_PANEL_UD, "lcd_panel_ud");
89+ if (r) {
90+ printk(KERN_ERR "failed to get LCD_PANEL_UD\n");
91+ goto err_1;
92+ }
93+
94+ r = gpio_request(LCD_PANEL_INI, "lcd_panel_ini");
95+ if (r) {
96+ printk(KERN_ERR "failed to get LCD_PANEL_INI\n");
97+ goto err_2;
98+ }
99+ r = gpio_request(LCD_PANEL_RESB, "lcd_panel_resb");
100+ if (r) {
101+ printk(KERN_ERR "failed to get LCD_PANEL_RESB\n");
102+ goto err_3;
103+ }
104+ r = gpio_request(LCD_PANEL_QVGA, "lcd_panel_qvga");
105+ if (r) {
106+ printk(KERN_ERR "failed to get LCD_PANEL_QVGA\n");
107+ goto err_4;
108+ }
109+
110+ gpio_direction_output(LCD_PANEL_LR, 0);
111+ gpio_direction_output(LCD_PANEL_UD, 0);
112+ gpio_direction_output(LCD_PANEL_INI, 0);
113+ gpio_direction_output(LCD_PANEL_RESB, 0);
114+ gpio_direction_output(LCD_PANEL_QVGA, 0);
115+
116+#define TWL_LED_LEDEN 0x00
117+#define TWL_PWMA_PWMAON 0x00
118+#define TWL_PWMA_PWMAOFF 0x01
119+
120+ twl4030_i2c_write_u8(TWL4030_MODULE_LED, 0x11, TWL_LED_LEDEN);
121+ twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, 0x01, TWL_PWMA_PWMAON);
122+ twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, 0x02, TWL_PWMA_PWMAOFF);
123+
124+ gpio_direction_output(LCD_PANEL_RESB, 1);
125+ gpio_direction_output(LCD_PANEL_INI, 1);
126+ gpio_direction_output(LCD_PANEL_QVGA, 0);
127+ gpio_direction_output(LCD_PANEL_LR, 1);
128+ gpio_direction_output(LCD_PANEL_UD, 1);
129+
130+ return;
131+
132+err_4:
133+ gpio_free(LCD_PANEL_RESB);
134+err_3:
135+ gpio_free(LCD_PANEL_INI);
136+err_2:
137+ gpio_free(LCD_PANEL_UD);
138+err_1:
139+ gpio_free(LCD_PANEL_LR);
140+
141+}
142+
143+static int panel_enable_lcd(struct omap_display *display)
144+{
145+ if (dvi_enabled) {
146+ printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
147+ return -EINVAL;
148+ }
149+ if (omap_rev() > OMAP3430_REV_ES1_0) {
150+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
151+ ENABLE_VPLL2_DEDICATED, TWL4030_VPLL2_DEDICATED);
152+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
153+ ENABLE_VPLL2_DEV_GRP, TWL4030_VPLL2_DEV_GRP);
154+ }
155+ gpio_direction_output(LCD_PANEL_ENABLE_GPIO, 0);
156+ lcd_enabled = 1;
157+ return 0;
158+}
159+
160+static void panel_disable_lcd(struct omap_display *display)
161+{
162+ if (omap_rev() > OMAP3430_REV_ES1_0) {
163+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x0,
164+ TWL4030_VPLL2_DEDICATED);
165+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x0,
166+ TWL4030_VPLL2_DEV_GRP);
167+ }
168+ gpio_set_value(LCD_PANEL_ENABLE_GPIO, 1);
169+ lcd_enabled = 0;
170+}
171+
172+static struct omap_display_data evm_display_data = {
173+ .type = OMAP_DISPLAY_TYPE_DPI,
174+ .name = "lcd",
175+ .panel_name = "panel-sdp3430",
176+ .u.dpi.data_lines = 16,
177+ .panel_enable = panel_enable_lcd,
178+ .panel_disable = panel_disable_lcd,
179+};
180+
181+static int panel_enable_tv(struct omap_display *display)
182+{
183+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
184+ ENABLE_VDAC_DEDICATED, TWL4030_VDAC_DEDICATED);
185+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
186+ ENABLE_VDAC_DEV_GRP, TWL4030_VDAC_DEV_GRP);
187+ return 0;
188+}
189+
190+static void panel_disable_tv(struct omap_display *display)
191+{
192+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x00,
193+ TWL4030_VDAC_DEDICATED);
194+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x00,
195+ TWL4030_VDAC_DEV_GRP);
196+}
197+
198+static struct omap_display_data evm_display_data_tv = {
199+ .type = OMAP_DISPLAY_TYPE_VENC,
200+ .name = "tv",
201+ .u.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
202+ .panel_enable = panel_enable_tv,
203+ .panel_disable = panel_disable_tv,
204+};
205+
206+
207+static int panel_enable_dvi(struct omap_display *display)
208+{
209+ if (lcd_enabled) {
210+ printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
211+ return -EINVAL;
212+ }
213+ twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, 0x80,
214+ TWL4030_GPIODATA_IN3);
215+ twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, 0x80,
216+ TWL4030_GPIODATA_DIR3);
217+ dvi_enabled = 1;
218+
219+ return 0;
220+}
221+
222+static void panel_disable_dvi(struct omap_display *display)
223+{
224+ twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, 0x00,
225+ TWL4030_GPIODATA_IN3);
226+ twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, 0x00,
227+ TWL4030_GPIODATA_DIR3);
228+ dvi_enabled = 0;
229+}
230+
231+
232+static struct omap_display_data evm_display_data_dvi = {
233+ .type = OMAP_DISPLAY_TYPE_DPI,
234+ .name = "dvi",
235+ .panel_name = "panel-dvi",
236+ .u.dpi.data_lines = 24,
237+ .panel_enable = panel_enable_dvi,
238+ .panel_disable = panel_disable_dvi,
239+};
240+
241+static struct omap_dss_platform_data evm_dss_data = {
242+ .num_displays = 3,
243+ .displays = {
244+ &evm_display_data,
245+ &evm_display_data_dvi,
246+ &evm_display_data_tv,
247+ }
248+};
249+static struct platform_device evm_dss_device = {
250+ .name = "omap-dss",
251+ .id = -1,
252+ .dev = {
253+ .platform_data = &evm_dss_data,
254+ },
255 };
256
257 static void ads7846_dev_init(void)
258@@ -227,11 +430,13 @@ static void __init omap3_evm_init_irq(void)
259
260 static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
261 { OMAP_TAG_UART, &omap3_evm_uart_config },
262- { OMAP_TAG_LCD, &omap3_evm_lcd_config },
263+ { OMAP_TAG_FBMEM, &evm_fbmem0_config },
264+ { OMAP_TAG_FBMEM, &evm_fbmem1_config },
265+ { OMAP_TAG_FBMEM, &evm_fbmem2_config },
266 };
267
268 static struct platform_device *omap3_evm_devices[] __initdata = {
269- &omap3_evm_lcd_device,
270+ &evm_dss_device,
271 &omap3evm_smc911x_device,
272 };
273
274@@ -250,8 +455,6 @@ static void __init omap3_evm_init(void)
275 omap3_evm_i2c_init();
276
277 platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices));
278- omap_board_config = omap3_evm_config;
279- omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
280
281 spi_register_board_info(omap3evm_spi_board_info,
282 ARRAY_SIZE(omap3evm_spi_board_info));
283@@ -262,10 +465,13 @@ static void __init omap3_evm_init(void)
284 usb_ehci_init();
285 omap3evm_flash_init();
286 ads7846_dev_init();
287+ evm_display_init();
288 }
289
290 static void __init omap3_evm_map_io(void)
291 {
292+ omap_board_config = omap3_evm_config;
293+ omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
294 omap2_set_globals_343x();
295 omap2_map_common_io();
296 }
297diff --git a/drivers/video/omap2/Kconfig b/drivers/video/omap2/Kconfig
298index 95691ad..8211ffd 100644
299--- a/drivers/video/omap2/Kconfig
300+++ b/drivers/video/omap2/Kconfig
301@@ -51,4 +51,9 @@ config PANEL_SDP3430
302 help
303 SDP3430 LCD
304
305+config PANEL_OMAP3EVM
306+ tristate "OMAP3EVM Panel"
307+ depends on OMAP2_DSS
308+ help
309+ OMAP3EVM LCD Panel
310 endmenu
311diff --git a/drivers/video/omap2/Makefile b/drivers/video/omap2/Makefile
312index 73ab1c0..668e8c6 100644
313--- a/drivers/video/omap2/Makefile
314+++ b/drivers/video/omap2/Makefile
315@@ -3,3 +3,4 @@ omapfb-y := omapfb-main.o omapfb-sysfs.o omapfb-ioctl.o
316
317 obj-$(CONFIG_PANEL_DVI) += panel-dvi.o
318 obj-$(CONFIG_PANEL_SDP3430) += panel-sdp3430.o
319+obj-$(CONFIG_PANEL_OMAP3EVM) += panel-omap3evm.o
320diff --git a/drivers/video/omap2/panel-omap3evm.c b/drivers/video/omap2/panel-omap3evm.c
321new file mode 100644
322index 0000000..4a00b02
323--- /dev/null
324+++ b/drivers/video/omap2/panel-omap3evm.c
325@@ -0,0 +1,110 @@
326+/*
327+ * LCD panel support for the TI OMAP3EVM board
328+ *
329+ * Copyright (C) 2008 Texas Instruments, Inc.
330+ * Author: Vaibhav Hiremath <hvaibhav@ti.com>
331+ *
332+ * Derived from drivers/video/omap2/panel-sdp3430.c
333+ *
334+ * This program is free software; you can redistribute it and/or modify it
335+ * under the terms of the GNU General Public License version 2 as published by
336+ * the Free Software Foundation.
337+ *
338+ * This program is distributed in the hope that it will be useful, but WITHOUT
339+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
340+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
341+ * more details.
342+ *
343+ * You should have received a copy of the GNU General Public License along with
344+ * this program. If not, see <http://www.gnu.org/licenses/>.
345+ */
346+
347+#include <linux/module.h>
348+#include <linux/delay.h>
349+
350+#include <mach/display.h>
351+
352+static int omap3evm_panel_init(struct omap_display *display)
353+{
354+ return 0;
355+}
356+
357+static void omap3evm_panel_cleanup(struct omap_display *display)
358+{
359+}
360+
361+static int omap3evm_panel_enable(struct omap_display *display)
362+{
363+ int r = 0;
364+
365+ if (display->hw_config.panel_enable)
366+ r = display->hw_config.panel_enable(display);
367+
368+ return r;
369+}
370+
371+static void omap3evm_panel_disable(struct omap_display *display)
372+{
373+ if (display->hw_config.panel_disable)
374+ display->hw_config.panel_disable(display);
375+}
376+
377+static int omap3evm_panel_suspend(struct omap_display *display)
378+{
379+ omap3evm_panel_disable(display);
380+ return 0;
381+}
382+
383+static int omap3evm_panel_resume(struct omap_display *display)
384+{
385+ return omap3evm_panel_enable(display);
386+}
387+
388+static struct omap_panel omap3evm_panel = {
389+ .owner = THIS_MODULE,
390+ .name = "panel-evm",
391+ .init = omap3evm_panel_init,
392+ .cleanup = omap3evm_panel_cleanup,
393+ .enable = omap3evm_panel_enable,
394+ .disable = omap3evm_panel_disable,
395+ .suspend = omap3evm_panel_suspend,
396+ .resume = omap3evm_panel_resume,
397+ /*.set_mode = omap3evm_set_mode, */
398+
399+ .timings = {
400+ .pixel_clock = 26000,
401+
402+ .hsw = 4,
403+ .hfp = 4,
404+ .hbp = 40,
405+
406+ .vsw = 2,
407+ .vfp = 2,
408+ .vbp = 7,
409+ },
410+
411+ .acb = 0x28,
412+
413+ .config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS |
414+ OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IPC,
415+
416+ .x_res = 480,
417+ .y_res = 640,
418+ .bpp = 18,
419+};
420+
421+
422+static int __init omap3evm_panel_drv_init(void)
423+{
424+ omap_dss_register_panel(&omap3evm_panel);
425+ return 0;
426+}
427+
428+static void __exit omap3evm_panel_drv_exit(void)
429+{
430+ omap_dss_unregister_panel(&omap3evm_panel);
431+}
432+
433+module_init(omap3evm_panel_drv_init);
434+module_exit(omap3evm_panel_drv_exit);
435+MODULE_LICENSE("GPL");
436--
4371.5.6
438
439--
440To unsubscribe from this list: send the line "unsubscribe linux-omap" in
441the body of a message to majordomo@vger.kernel.org
442More majordomo info at http://vger.kernel.org/majordomo-info.html
443