aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap
diff options
context:
space:
mode:
authorHunyue Yau <hyau@mvista.com>2009-09-22 19:46:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:48 -0400
commit3a76a819dda9a6de0ab83d04b48b3735a4d10b89 (patch)
tree11deda986171e85f3c770e5bf3b97c6c5104d22c /drivers/video/omap
parent92e0ed074a4f134084bef47a44e948b6c6429a89 (diff)
omapfb: add support for the 2430SDP LCD
Add glue to control the 2430SDP LCD as a frame buffer device using the existing dispc.c driver under omapfb. Fixed-by: Kevin Hilman <khilman@mvista.com> Fixed-by: Sergio Aguirre <saaguirre@ti.com> Fixed-by: Francisco Alecrim <francisco.alecrim@indt.org.br> Fixed-by: Tony Lindgren <tony@atomide.com> Fixed-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Hunyue Yau <hyau@mvista.com> Signed-off-by: Kevin Hilman <khilman@mvista.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>
Diffstat (limited to 'drivers/video/omap')
-rw-r--r--drivers/video/omap/Makefile1
-rw-r--r--drivers/video/omap/lcd_2430sdp.c198
2 files changed, 199 insertions, 0 deletions
diff --git a/drivers/video/omap/Makefile b/drivers/video/omap/Makefile
index 2bf94ad891f1..7a37b0396e97 100644
--- a/drivers/video/omap/Makefile
+++ b/drivers/video/omap/Makefile
@@ -26,6 +26,7 @@ objs-$(CONFIG_ARCH_OMAP15XX)$(CONFIG_MACH_OMAP_INNOVATOR) += lcd_inn1510.o
26objs-y$(CONFIG_MACH_OMAP_OSK) += lcd_osk.o 26objs-y$(CONFIG_MACH_OMAP_OSK) += lcd_osk.o
27 27
28objs-y$(CONFIG_MACH_OMAP_APOLLON) += lcd_apollon.o 28objs-y$(CONFIG_MACH_OMAP_APOLLON) += lcd_apollon.o
29objs-y$(CONFIG_MACH_OMAP_2430SDP) += lcd_2430sdp.o
29objs-y$(CONFIG_FB_OMAP_LCD_MIPID) += lcd_mipid.o 30objs-y$(CONFIG_FB_OMAP_LCD_MIPID) += lcd_mipid.o
30 31
31omapfb-objs := $(objs-yy) 32omapfb-objs := $(objs-yy)
diff --git a/drivers/video/omap/lcd_2430sdp.c b/drivers/video/omap/lcd_2430sdp.c
new file mode 100644
index 000000000000..284cfcec55d9
--- /dev/null
+++ b/drivers/video/omap/lcd_2430sdp.c
@@ -0,0 +1,198 @@
1/*
2 * LCD panel support for the TI 2430SDP board
3 *
4 * Copyright (C) 2007 MontaVista
5 * Author: Hunyue Yau <hyau@mvista.com>
6 *
7 * Derived from drivers/video/omap/lcd-apollon.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/gpio.h>
28#include <linux/i2c/twl4030.h>
29
30#include <mach/mux.h>
31#include <mach/omapfb.h>
32#include <asm/mach-types.h>
33
34#define SDP2430_LCD_PANEL_BACKLIGHT_GPIO 91
35#define SDP2430_LCD_PANEL_ENABLE_GPIO 154
36#define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 24
37#define SDP3430_LCD_PANEL_ENABLE_GPIO 28
38
39static unsigned backlight_gpio;
40static unsigned enable_gpio;
41
42#define LCD_PANEL_BACKLIGHT_GPIO 91
43#define LCD_PANEL_ENABLE_GPIO 154
44#define LCD_PIXCLOCK_MAX 5400 /* freq 5.4 MHz */
45#define PM_RECEIVER TWL4030_MODULE_PM_RECEIVER
46#define ENABLE_VAUX2_DEDICATED 0x09
47#define ENABLE_VAUX2_DEV_GRP 0x20
48
49
50#define t2_out(c, r, v) twl4030_i2c_write_u8(c, r, v)
51
52
53static int sdp2430_panel_init(struct lcd_panel *panel,
54 struct omapfb_device *fbdev)
55{
56 if (machine_is_omap_3430sdp()) {
57 enable_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO;
58 backlight_gpio = SDP3430_LCD_PANEL_BACKLIGHT_GPIO;
59 } else {
60 enable_gpio = SDP2430_LCD_PANEL_ENABLE_GPIO;
61 backlight_gpio = SDP2430_LCD_PANEL_BACKLIGHT_GPIO;
62 }
63
64 gpio_request(enable_gpio, "LCD enable"); /* LCD panel */
65 gpio_request(backlight_gpio, "LCD bl"); /* LCD backlight */
66 gpio_direction_output(enable_gpio, 0);
67 gpio_direction_output(backlight_gpio, 0);
68
69 return 0;
70}
71
72static void sdp2430_panel_cleanup(struct lcd_panel *panel)
73{
74 gpio_free(backlight_gpio);
75 gpio_free(enable_gpio);
76}
77
78static int sdp2430_panel_enable(struct lcd_panel *panel)
79{
80 u8 ded_val, ded_reg;
81 u8 grp_val, grp_reg;
82
83 if (machine_is_omap_3430sdp()) {
84 ded_reg = TWL4030_VAUX3_DEDICATED;
85 ded_val = ENABLE_VAUX3_DEDICATED;
86 grp_reg = TWL4030_VAUX3_DEV_GRP;
87 grp_val = ENABLE_VAUX3_DEV_GRP;
88
89 if (omap_rev() > OMAP3430_REV_ES1_0) {
90 t2_out(PM_RECEIVER, ENABLE_VPLL2_DEDICATED,
91 TWL4030_VPLL2_DEDICATED);
92 t2_out(PM_RECEIVER, ENABLE_VPLL2_DEV_GRP,
93 TWL4030_VPLL2_DEV_GRP);
94 }
95 } else {
96 ded_reg = TWL4030_VAUX2_DEDICATED;
97 ded_val = ENABLE_VAUX2_DEDICATED;
98 grp_reg = TWL4030_VAUX2_DEV_GRP;
99 grp_val = ENABLE_VAUX2_DEV_GRP;
100 }
101
102 gpio_set_value(enable_gpio, 1);
103 gpio_set_value(backlight_gpio, 1);
104
105 if (0 != t2_out(PM_RECEIVER, ded_val, ded_reg))
106 return -EIO;
107 if (0 != t2_out(PM_RECEIVER, grp_val, grp_reg))
108 return -EIO;
109
110 return 0;
111}
112
113static void sdp2430_panel_disable(struct lcd_panel *panel)
114{
115 gpio_set_value(enable_gpio, 0);
116 gpio_set_value(backlight_gpio, 0);
117 if (omap_rev() > OMAP3430_REV_ES1_0) {
118 t2_out(PM_RECEIVER, 0x0, TWL4030_VPLL2_DEDICATED);
119 t2_out(PM_RECEIVER, 0x0, TWL4030_VPLL2_DEV_GRP);
120 msleep(4);
121 }
122}
123
124static unsigned long sdp2430_panel_get_caps(struct lcd_panel *panel)
125{
126 return 0;
127}
128
129struct lcd_panel sdp2430_panel = {
130 .name = "sdp2430",
131 .config = OMAP_LCDC_PANEL_TFT | OMAP_LCDC_INV_VSYNC |
132 OMAP_LCDC_INV_HSYNC,
133
134 .bpp = 16,
135 .data_lines = 16,
136 .x_res = 240,
137 .y_res = 320,
138 .hsw = 3, /* hsync_len (4) - 1 */
139 .hfp = 3, /* right_margin (4) - 1 */
140 .hbp = 39, /* left_margin (40) - 1 */
141 .vsw = 1, /* vsync_len (2) - 1 */
142 .vfp = 2, /* lower_margin */
143 .vbp = 7, /* upper_margin (8) - 1 */
144
145 .pixel_clock = LCD_PIXCLOCK_MAX,
146
147 .init = sdp2430_panel_init,
148 .cleanup = sdp2430_panel_cleanup,
149 .enable = sdp2430_panel_enable,
150 .disable = sdp2430_panel_disable,
151 .get_caps = sdp2430_panel_get_caps,
152};
153
154static int sdp2430_panel_probe(struct platform_device *pdev)
155{
156 omapfb_register_panel(&sdp2430_panel);
157 return 0;
158}
159
160static int sdp2430_panel_remove(struct platform_device *pdev)
161{
162 return 0;
163}
164
165static int sdp2430_panel_suspend(struct platform_device *pdev,
166 pm_message_t mesg)
167{
168 return 0;
169}
170
171static int sdp2430_panel_resume(struct platform_device *pdev)
172{
173 return 0;
174}
175
176struct platform_driver sdp2430_panel_driver = {
177 .probe = sdp2430_panel_probe,
178 .remove = sdp2430_panel_remove,
179 .suspend = sdp2430_panel_suspend,
180 .resume = sdp2430_panel_resume,
181 .driver = {
182 .name = "sdp2430_lcd",
183 .owner = THIS_MODULE,
184 },
185};
186
187static int __init sdp2430_panel_drv_init(void)
188{
189 return platform_driver_register(&sdp2430_panel_driver);
190}
191
192static void __exit sdp2430_panel_drv_exit(void)
193{
194 platform_driver_unregister(&sdp2430_panel_driver);
195}
196
197module_init(sdp2430_panel_drv_init);
198module_exit(sdp2430_panel_drv_exit);