aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap
diff options
context:
space:
mode:
authorSteve Sakoman <steve@sakoman.com>2009-09-22 19:46:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:49 -0400
commit2a8729c47a9dfe5c8ba55883b86b719b33e6e099 (patch)
tree47d4e169ed694a791f5224d4d9aa8add4b0e99e3 /drivers/video/omap
parentfb49b78452503f6cdf8b243ccb40cda81aae9998 (diff)
omapfb: add support for the OMAP3 EVM LCD
Add LCD support for OMAP3 EVM Backlight support by Arun C <arunedarath@mistralsolutions.com> Fixed-by: Jarkko Nikula <jarkko.nikula@gmail.com> Fixed-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Steve Sakoman <steve@sakoman.com> Acked-by: Syed Mohammed Khasim <khasim@ti.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_omap3evm.c192
2 files changed, 193 insertions, 0 deletions
diff --git a/drivers/video/omap/Makefile b/drivers/video/omap/Makefile
index 96d2d4349bda..4345157b23ef 100644
--- a/drivers/video/omap/Makefile
+++ b/drivers/video/omap/Makefile
@@ -30,6 +30,7 @@ objs-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_OMAP2EVM) += lcd_omap2evm.o 32objs-y$(CONFIG_MACH_OMAP2EVM) += lcd_omap2evm.o
33objs-y$(CONFIG_MACH_OMAP3EVM) += lcd_omap3evm.o
33objs-y$(CONFIG_FB_OMAP_LCD_MIPID) += lcd_mipid.o 34objs-y$(CONFIG_FB_OMAP_LCD_MIPID) += lcd_mipid.o
34 35
35omapfb-objs := $(objs-yy) 36omapfb-objs := $(objs-yy)
diff --git a/drivers/video/omap/lcd_omap3evm.c b/drivers/video/omap/lcd_omap3evm.c
new file mode 100644
index 000000000000..b6a4c2c57a2f
--- /dev/null
+++ b/drivers/video/omap/lcd_omap3evm.c
@@ -0,0 +1,192 @@
1/*
2 * LCD panel support for the TI OMAP3 EVM board
3 *
4 * Author: Steve Sakoman <steve@sakoman.com>
5 *
6 * Derived from drivers/video/omap/lcd-apollon.c
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 */
22
23#include <linux/module.h>
24#include <linux/platform_device.h>
25#include <linux/gpio.h>
26#include <linux/i2c/twl4030.h>
27
28#include <mach/mux.h>
29#include <mach/omapfb.h>
30#include <asm/mach-types.h>
31
32#define LCD_PANEL_ENABLE_GPIO 153
33#define LCD_PANEL_LR 2
34#define LCD_PANEL_UD 3
35#define LCD_PANEL_INI 152
36#define LCD_PANEL_QVGA 154
37#define LCD_PANEL_RESB 155
38
39#define ENABLE_VDAC_DEDICATED 0x03
40#define ENABLE_VDAC_DEV_GRP 0x20
41#define ENABLE_VPLL2_DEDICATED 0x05
42#define ENABLE_VPLL2_DEV_GRP 0xE0
43
44#define TWL_LED_LEDEN 0x00
45#define TWL_PWMA_PWMAON 0x00
46#define TWL_PWMA_PWMAOFF 0x01
47
48static unsigned int bklight_level;
49
50static int omap3evm_panel_init(struct lcd_panel *panel,
51 struct omapfb_device *fbdev)
52{
53 gpio_request(LCD_PANEL_LR, "LCD lr");
54 gpio_request(LCD_PANEL_UD, "LCD ud");
55 gpio_request(LCD_PANEL_INI, "LCD ini");
56 gpio_request(LCD_PANEL_RESB, "LCD resb");
57 gpio_request(LCD_PANEL_QVGA, "LCD qvga");
58
59 gpio_direction_output(LCD_PANEL_RESB, 1);
60 gpio_direction_output(LCD_PANEL_INI, 1);
61 gpio_direction_output(LCD_PANEL_QVGA, 0);
62 gpio_direction_output(LCD_PANEL_LR, 1);
63 gpio_direction_output(LCD_PANEL_UD, 1);
64
65 twl4030_i2c_write_u8(TWL4030_MODULE_LED, 0x11, TWL_LED_LEDEN);
66 twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, 0x01, TWL_PWMA_PWMAON);
67 twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, 0x02, TWL_PWMA_PWMAOFF);
68 bklight_level = 100;
69
70 return 0;
71}
72
73static void omap3evm_panel_cleanup(struct lcd_panel *panel)
74{
75 gpio_free(LCD_PANEL_QVGA);
76 gpio_free(LCD_PANEL_RESB);
77 gpio_free(LCD_PANEL_INI);
78 gpio_free(LCD_PANEL_UD);
79 gpio_free(LCD_PANEL_LR);
80}
81
82static int omap3evm_panel_enable(struct lcd_panel *panel)
83{
84 gpio_set_value(LCD_PANEL_ENABLE_GPIO, 0);
85 return 0;
86}
87
88static void omap3evm_panel_disable(struct lcd_panel *panel)
89{
90 gpio_set_value(LCD_PANEL_ENABLE_GPIO, 1);
91}
92
93static unsigned long omap3evm_panel_get_caps(struct lcd_panel *panel)
94{
95 return 0;
96}
97
98static int omap3evm_bklight_setlevel(struct lcd_panel *panel,
99 unsigned int level)
100{
101 u8 c;
102 if ((level >= 0) && (level <= 100)) {
103 c = (125 * (100 - level)) / 100 + 2;
104 twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, c, TWL_PWMA_PWMAOFF);
105 bklight_level = level;
106 }
107 return 0;
108}
109
110static unsigned int omap3evm_bklight_getlevel(struct lcd_panel *panel)
111{
112 return bklight_level;
113}
114
115static unsigned int omap3evm_bklight_getmaxlevel(struct lcd_panel *panel)
116{
117 return 100;
118}
119
120struct lcd_panel omap3evm_panel = {
121 .name = "omap3evm",
122 .config = OMAP_LCDC_PANEL_TFT | OMAP_LCDC_INV_VSYNC |
123 OMAP_LCDC_INV_HSYNC,
124
125 .bpp = 16,
126 .data_lines = 18,
127 .x_res = 480,
128 .y_res = 640,
129 .hsw = 3, /* hsync_len (4) - 1 */
130 .hfp = 3, /* right_margin (4) - 1 */
131 .hbp = 39, /* left_margin (40) - 1 */
132 .vsw = 1, /* vsync_len (2) - 1 */
133 .vfp = 2, /* lower_margin */
134 .vbp = 7, /* upper_margin (8) - 1 */
135
136 .pixel_clock = 26000,
137
138 .init = omap3evm_panel_init,
139 .cleanup = omap3evm_panel_cleanup,
140 .enable = omap3evm_panel_enable,
141 .disable = omap3evm_panel_disable,
142 .get_caps = omap3evm_panel_get_caps,
143 .set_bklight_level = omap3evm_bklight_setlevel,
144 .get_bklight_level = omap3evm_bklight_getlevel,
145 .get_bklight_max = omap3evm_bklight_getmaxlevel,
146};
147
148static int omap3evm_panel_probe(struct platform_device *pdev)
149{
150 omapfb_register_panel(&omap3evm_panel);
151 return 0;
152}
153
154static int omap3evm_panel_remove(struct platform_device *pdev)
155{
156 return 0;
157}
158
159static int omap3evm_panel_suspend(struct platform_device *pdev,
160 pm_message_t mesg)
161{
162 return 0;
163}
164
165static int omap3evm_panel_resume(struct platform_device *pdev)
166{
167 return 0;
168}
169
170struct platform_driver omap3evm_panel_driver = {
171 .probe = omap3evm_panel_probe,
172 .remove = omap3evm_panel_remove,
173 .suspend = omap3evm_panel_suspend,
174 .resume = omap3evm_panel_resume,
175 .driver = {
176 .name = "omap3evm_lcd",
177 .owner = THIS_MODULE,
178 },
179};
180
181static int __init omap3evm_panel_drv_init(void)
182{
183 return platform_driver_register(&omap3evm_panel_driver);
184}
185
186static void __exit omap3evm_panel_drv_exit(void)
187{
188 platform_driver_unregister(&omap3evm_panel_driver);
189}
190
191module_init(omap3evm_panel_drv_init);
192module_exit(omap3evm_panel_drv_exit);