aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStanley.Miao <stanley.miao@windriver.com>2009-09-22 19:46:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:49 -0400
commit8fea8844a72f95ef22b108f5dc5c4237019771dd (patch)
treea283441a2b4da09a9e762192d68d471a748c1038
parentbe481941c6ddfe96e5c17a5d6f077b00e7b7bdf1 (diff)
omapfb: add support for the ZOOM MDK LCD
Add glue to control the OMAP_LDP LCD as a frame buffer device using the existing dispc.c driver under omapfb. Patch updated for mainline kernel. Note that the drivers/video/omap should be updated to pass omap_lcd_config in platform_data. The patch should also be updated to compile if twl4030 is not selected, and eventually to use the regulator framework. Fixed-by: Jarkko Nikula <jarkko.nikula@gmail.com> Fixed-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Stanley.Miao <stanley.miao@windriver.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Imre Deak <imre.deak@nokia.com> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/arm/configs/omap_ldp_defconfig54
-rw-r--r--drivers/video/omap/Kconfig4
-rw-r--r--drivers/video/omap/Makefile1
-rw-r--r--drivers/video/omap/lcd_ldp.c200
4 files changed, 257 insertions, 2 deletions
diff --git a/arch/arm/configs/omap_ldp_defconfig b/arch/arm/configs/omap_ldp_defconfig
index 679a4a3e265e..b9c48919a68c 100644
--- a/arch/arm/configs/omap_ldp_defconfig
+++ b/arch/arm/configs/omap_ldp_defconfig
@@ -690,6 +690,7 @@ CONFIG_GPIOLIB=y
690# CONFIG_GPIO_MAX732X is not set 690# CONFIG_GPIO_MAX732X is not set
691# CONFIG_GPIO_PCA953X is not set 691# CONFIG_GPIO_PCA953X is not set
692# CONFIG_GPIO_PCF857X is not set 692# CONFIG_GPIO_PCF857X is not set
693CONFIG_GPIO_TWL4030=y
693 694
694# 695#
695# PCI GPIO expanders: 696# PCI GPIO expanders:
@@ -742,6 +743,7 @@ CONFIG_SSB_POSSIBLE=y
742# CONFIG_MFD_SM501 is not set 743# CONFIG_MFD_SM501 is not set
743# CONFIG_HTC_EGPIO is not set 744# CONFIG_HTC_EGPIO is not set
744# CONFIG_HTC_PASIC3 is not set 745# CONFIG_HTC_PASIC3 is not set
746CONFIG_TWL4030_CORE=y
745# CONFIG_MFD_TMIO is not set 747# CONFIG_MFD_TMIO is not set
746# CONFIG_MFD_T7L66XB is not set 748# CONFIG_MFD_T7L66XB is not set
747# CONFIG_MFD_TC6387XB is not set 749# CONFIG_MFD_TC6387XB is not set
@@ -767,8 +769,46 @@ CONFIG_DAB=y
767# 769#
768# CONFIG_VGASTATE is not set 770# CONFIG_VGASTATE is not set
769CONFIG_VIDEO_OUTPUT_CONTROL=m 771CONFIG_VIDEO_OUTPUT_CONTROL=m
770# CONFIG_FB is not set 772CONFIG_FB=y
771# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 773CONFIG_FIRMWARE_EDID=y
774# CONFIG_FB_DDC is not set
775# CONFIG_FB_BOOT_VESA_SUPPORT is not set
776CONFIG_FB_CFB_FILLRECT=y
777CONFIG_FB_CFB_COPYAREA=y
778CONFIG_FB_CFB_IMAGEBLIT=y
779# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
780# CONFIG_FB_SYS_FILLRECT is not set
781# CONFIG_FB_SYS_COPYAREA is not set
782# CONFIG_FB_SYS_IMAGEBLIT is not set
783# CONFIG_FB_FOREIGN_ENDIAN is not set
784# CONFIG_FB_SYS_FOPS is not set
785# CONFIG_FB_SVGALIB is not set
786# CONFIG_FB_MACMODES is not set
787# CONFIG_FB_BACKLIGHT is not set
788CONFIG_FB_MODE_HELPERS=y
789CONFIG_FB_TILEBLITTING=y
790
791#
792# Frame buffer hardware drivers
793#
794# CONFIG_FB_S1D13XXX is not set
795# CONFIG_FB_VIRTUAL is not set
796# CONFIG_FB_METRONOME is not set
797CONFIG_FB_OMAP=y
798CONFIG_FB_OMAP_LCD_VGA=y
799# CONFIG_FB_OMAP_LCDC_EXTERNAL is not set
800# CONFIG_FB_OMAP_BOOTLOADER_INIT is not set
801CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE=4
802CONFIG_BACKLIGHT_LCD_SUPPORT=y
803CONFIG_LCD_CLASS_DEVICE=y
804# CONFIG_LCD_LTV350QV is not set
805# CONFIG_LCD_ILI9320 is not set
806# CONFIG_LCD_TDO24M is not set
807# CONFIG_LCD_VGG2432A4 is not set
808CONFIG_LCD_PLATFORM=y
809CONFIG_BACKLIGHT_CLASS_DEVICE=y
810# CONFIG_BACKLIGHT_CORGI is not set
811# CONFIG_BACKLIGHT_GENERIC is not set
772 812
773# 813#
774# Display device support 814# Display device support
@@ -780,6 +820,16 @@ CONFIG_VIDEO_OUTPUT_CONTROL=m
780# 820#
781# CONFIG_VGA_CONSOLE is not set 821# CONFIG_VGA_CONSOLE is not set
782CONFIG_DUMMY_CONSOLE=y 822CONFIG_DUMMY_CONSOLE=y
823CONFIG_FRAMEBUFFER_CONSOLE=y
824# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
825# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
826# CONFIG_FONTS is not set
827CONFIG_FONT_8x8=y
828CONFIG_FONT_8x16=y
829CONFIG_LOGO=y
830CONFIG_LOGO_LINUX_MONO=y
831CONFIG_LOGO_LINUX_VGA16=y
832CONFIG_LOGO_LINUX_CLUT224=y
783CONFIG_SOUND=y 833CONFIG_SOUND=y
784CONFIG_SND=y 834CONFIG_SND=y
785# CONFIG_SND_SEQUENCER is not set 835# CONFIG_SND_SEQUENCER is not set
diff --git a/drivers/video/omap/Kconfig b/drivers/video/omap/Kconfig
index eb05e0999383..2bffc07f317b 100644
--- a/drivers/video/omap/Kconfig
+++ b/drivers/video/omap/Kconfig
@@ -7,6 +7,10 @@ config FB_OMAP
7 help 7 help
8 Frame buffer driver for OMAP based boards. 8 Frame buffer driver for OMAP based boards.
9 9
10config FB_OMAP_LCD_VGA
11 bool "Use LCD in VGA mode"
12 depends on MACH_OMAP_3430SDP || MACH_OMAP_LDP
13
10choice 14choice
11 depends on FB_OMAP && MACH_OVERO 15 depends on FB_OMAP && MACH_OVERO
12 prompt "Screen resolution" 16 prompt "Screen resolution"
diff --git a/drivers/video/omap/Makefile b/drivers/video/omap/Makefile
index 0d2996a41b39..b63b198d1f03 100644
--- a/drivers/video/omap/Makefile
+++ b/drivers/video/omap/Makefile
@@ -29,6 +29,7 @@ objs-y$(CONFIG_MACH_OMAP_OSK) += lcd_osk.o
29objs-y$(CONFIG_MACH_OMAP_APOLLON) += lcd_apollon.o 29objs-y$(CONFIG_MACH_OMAP_APOLLON) += lcd_apollon.o
30objs-y$(CONFIG_MACH_OMAP_2430SDP) += lcd_2430sdp.o 30objs-y$(CONFIG_MACH_OMAP_2430SDP) += lcd_2430sdp.o
31objs-y$(CONFIG_MACH_OMAP_3430SDP) += lcd_2430sdp.o 31objs-y$(CONFIG_MACH_OMAP_3430SDP) += lcd_2430sdp.o
32objs-y$(CONFIG_MACH_OMAP_LDP) += lcd_ldp.o
32objs-y$(CONFIG_MACH_OMAP2EVM) += lcd_omap2evm.o 33objs-y$(CONFIG_MACH_OMAP2EVM) += lcd_omap2evm.o
33objs-y$(CONFIG_MACH_OMAP3EVM) += lcd_omap3evm.o 34objs-y$(CONFIG_MACH_OMAP3EVM) += lcd_omap3evm.o
34objs-y$(CONFIG_MACH_OMAP3_BEAGLE) += lcd_omap3beagle.o 35objs-y$(CONFIG_MACH_OMAP3_BEAGLE) += lcd_omap3beagle.o
diff --git a/drivers/video/omap/lcd_ldp.c b/drivers/video/omap/lcd_ldp.c
new file mode 100644
index 000000000000..dbfe8974fb94
--- /dev/null
+++ b/drivers/video/omap/lcd_ldp.c
@@ -0,0 +1,200 @@
1/*
2 * LCD panel support for the TI LDP board
3 *
4 * Copyright (C) 2007 WindRiver
5 * Author: Stanley Miao <stanley.miao@windriver.com>
6 *
7 * Derived from drivers/video/omap/lcd-2430sdp.c
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24#include <linux/module.h>
25#include <linux/platform_device.h>
26#include <linux/delay.h>
27#include <linux/i2c/twl4030.h>
28
29#include <mach/gpio.h>
30#include <mach/mux.h>
31#include <mach/omapfb.h>
32#include <asm/mach-types.h>
33
34#define LCD_PANEL_BACKLIGHT_GPIO (15 + OMAP_MAX_GPIO_LINES)
35#define LCD_PANEL_ENABLE_GPIO (7 + OMAP_MAX_GPIO_LINES)
36
37#define LCD_PANEL_RESET_GPIO 55
38#define LCD_PANEL_QVGA_GPIO 56
39
40#ifdef CONFIG_FB_OMAP_LCD_VGA
41#define LCD_XRES 480
42#define LCD_YRES 640
43#define LCD_PIXCLOCK_MAX 41700
44#else
45#define LCD_XRES 240
46#define LCD_YRES 320
47#define LCD_PIXCLOCK_MAX 185186
48#endif
49
50#define PM_RECEIVER TWL4030_MODULE_PM_RECEIVER
51#define ENABLE_VAUX2_DEDICATED 0x09
52#define ENABLE_VAUX2_DEV_GRP 0x20
53#define ENABLE_VAUX3_DEDICATED 0x03
54#define ENABLE_VAUX3_DEV_GRP 0x20
55
56#define ENABLE_VPLL2_DEDICATED 0x05
57#define ENABLE_VPLL2_DEV_GRP 0xE0
58#define TWL4030_VPLL2_DEV_GRP 0x33
59#define TWL4030_VPLL2_DEDICATED 0x36
60
61#define t2_out(c, r, v) twl4030_i2c_write_u8(c, r, v)
62
63
64static int ldp_panel_init(struct lcd_panel *panel,
65 struct omapfb_device *fbdev)
66{
67 gpio_request(LCD_PANEL_RESET_GPIO, "lcd reset");
68 gpio_request(LCD_PANEL_QVGA_GPIO, "lcd qvga");
69 gpio_request(LCD_PANEL_ENABLE_GPIO, "lcd panel");
70 gpio_request(LCD_PANEL_BACKLIGHT_GPIO, "lcd backlight");
71
72 gpio_direction_output(LCD_PANEL_QVGA_GPIO, 0);
73 gpio_direction_output(LCD_PANEL_RESET_GPIO, 0);
74 gpio_direction_output(LCD_PANEL_ENABLE_GPIO, 0);
75 gpio_direction_output(LCD_PANEL_BACKLIGHT_GPIO, 0);
76
77#ifdef CONFIG_FB_OMAP_LCD_VGA
78 gpio_set_value(LCD_PANEL_QVGA_GPIO, 0);
79#else
80 gpio_set_value(LCD_PANEL_QVGA_GPIO, 1);
81#endif
82 gpio_set_value(LCD_PANEL_RESET_GPIO, 1);
83
84 return 0;
85}
86
87static void ldp_panel_cleanup(struct lcd_panel *panel)
88{
89 gpio_free(LCD_PANEL_BACKLIGHT_GPIO);
90 gpio_free(LCD_PANEL_ENABLE_GPIO);
91 gpio_free(LCD_PANEL_QVGA_GPIO);
92 gpio_free(LCD_PANEL_RESET_GPIO);
93}
94
95static int ldp_panel_enable(struct lcd_panel *panel)
96{
97 if (0 != t2_out(PM_RECEIVER, ENABLE_VPLL2_DEDICATED,
98 TWL4030_VPLL2_DEDICATED))
99 return -EIO;
100 if (0 != t2_out(PM_RECEIVER, ENABLE_VPLL2_DEV_GRP,
101 TWL4030_VPLL2_DEV_GRP))
102 return -EIO;
103
104 gpio_direction_output(LCD_PANEL_ENABLE_GPIO, 1);
105 gpio_direction_output(LCD_PANEL_BACKLIGHT_GPIO, 1);
106
107 if (0 != t2_out(PM_RECEIVER, ENABLE_VAUX3_DEDICATED,
108 TWL4030_VAUX3_DEDICATED))
109 return -EIO;
110 if (0 != t2_out(PM_RECEIVER, ENABLE_VAUX3_DEV_GRP,
111 TWL4030_VAUX3_DEV_GRP))
112 return -EIO;
113
114 return 0;
115}
116
117static void ldp_panel_disable(struct lcd_panel *panel)
118{
119 gpio_direction_output(LCD_PANEL_ENABLE_GPIO, 0);
120 gpio_direction_output(LCD_PANEL_BACKLIGHT_GPIO, 0);
121
122 t2_out(PM_RECEIVER, 0x0, TWL4030_VPLL2_DEDICATED);
123 t2_out(PM_RECEIVER, 0x0, TWL4030_VPLL2_DEV_GRP);
124 msleep(4);
125}
126
127static unsigned long ldp_panel_get_caps(struct lcd_panel *panel)
128{
129 return 0;
130}
131
132struct lcd_panel ldp_panel = {
133 .name = "ldp",
134 .config = OMAP_LCDC_PANEL_TFT | OMAP_LCDC_INV_VSYNC |
135 OMAP_LCDC_INV_HSYNC,
136
137 .bpp = 16,
138 .data_lines = 18,
139 .x_res = LCD_XRES,
140 .y_res = LCD_YRES,
141 .hsw = 3, /* hsync_len (4) - 1 */
142 .hfp = 3, /* right_margin (4) - 1 */
143 .hbp = 39, /* left_margin (40) - 1 */
144 .vsw = 1, /* vsync_len (2) - 1 */
145 .vfp = 2, /* lower_margin */
146 .vbp = 7, /* upper_margin (8) - 1 */
147
148 .pixel_clock = LCD_PIXCLOCK_MAX,
149
150 .init = ldp_panel_init,
151 .cleanup = ldp_panel_cleanup,
152 .enable = ldp_panel_enable,
153 .disable = ldp_panel_disable,
154 .get_caps = ldp_panel_get_caps,
155};
156
157static int ldp_panel_probe(struct platform_device *pdev)
158{
159 omapfb_register_panel(&ldp_panel);
160 return 0;
161}
162
163static int ldp_panel_remove(struct platform_device *pdev)
164{
165 return 0;
166}
167
168static int ldp_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
169{
170 return 0;
171}
172
173static int ldp_panel_resume(struct platform_device *pdev)
174{
175 return 0;
176}
177
178struct platform_driver ldp_panel_driver = {
179 .probe = ldp_panel_probe,
180 .remove = ldp_panel_remove,
181 .suspend = ldp_panel_suspend,
182 .resume = ldp_panel_resume,
183 .driver = {
184 .name = "ldp_lcd",
185 .owner = THIS_MODULE,
186 },
187};
188
189static int __init ldp_panel_drv_init(void)
190{
191 return platform_driver_register(&ldp_panel_driver);
192}
193
194static void __exit ldp_panel_drv_exit(void)
195{
196 platform_driver_unregister(&ldp_panel_driver);
197}
198
199module_init(ldp_panel_drv_init);
200module_exit(ldp_panel_drv_exit);