]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/video/omap/lcd_h3.c
FB: Add support for OMAP framebuffer
[linux-2.6-omap-h63xx.git] / drivers / video / omap / lcd_h3.c
1 /*
2  * File: drivers/video/omap/lcd-h3.c
3  *
4  * LCD panel support for the TI OMAP H3 board
5  *
6  * Copyright (C) 2004 Nokia Corporation
7  * Author: Imre Deak <imre.deak@nokia.com>
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
27 #include <asm/arch/gpio.h>
28 #include <asm/arch/tps65010.h>
29 #include <asm/arch/omapfb.h>
30
31 #define MODULE_NAME     "omapfb-lcd_h3"
32
33 #define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ": " fmt, ## args)
34
35 static int h3_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev)
36 {
37         return 0;
38 }
39
40 static void h3_panel_cleanup(struct lcd_panel *panel)
41 {
42 }
43
44 static int h3_panel_enable(struct lcd_panel *panel)
45 {
46         int r = 0;
47
48         /* GPIO1 and GPIO2 of TPS65010 send LCD_ENBKL and LCD_ENVDD signals */
49         r = tps65010_set_gpio_out_value(GPIO1, HIGH);
50         if (!r)
51                 r = tps65010_set_gpio_out_value(GPIO2, HIGH);
52         if (r)
53                 pr_err("Unable to turn on LCD panel\n");
54
55         return r;
56 }
57
58 static void h3_panel_disable(struct lcd_panel *panel)
59 {
60         int r = 0;
61
62         /* GPIO1 and GPIO2 of TPS65010 send LCD_ENBKL and LCD_ENVDD signals */
63         r = tps65010_set_gpio_out_value(GPIO1, LOW);
64         if (!r)
65                 tps65010_set_gpio_out_value(GPIO2, LOW);
66         if (r)
67                 pr_err("Unable to turn off LCD panel\n");
68 }
69
70 static unsigned long h3_panel_get_caps(struct lcd_panel *panel)
71 {
72         return 0;
73 }
74
75 struct lcd_panel h3_panel = {
76         .name           = "h3",
77         .config         = OMAP_LCDC_PANEL_TFT,
78
79         .data_lines     = 16,
80         .bpp            = 16,
81         .x_res          = 240,
82         .y_res          = 320,
83         .pixel_clock    = 12000,
84         .hsw            = 12,
85         .hfp            = 14,
86         .hbp            = 72 - 12,
87         .vsw            = 1,
88         .vfp            = 1,
89         .vbp            = 0,
90         .pcd            = 0,
91
92         .init           = h3_panel_init,
93         .cleanup        = h3_panel_cleanup,
94         .enable         = h3_panel_enable,
95         .disable        = h3_panel_disable,
96         .get_caps       = h3_panel_get_caps,
97 };
98
99 static int h3_panel_probe(struct platform_device *pdev)
100 {
101         omapfb_register_panel(&h3_panel);
102         return 0;
103 }
104
105 static int h3_panel_remove(struct platform_device *pdev)
106 {
107         return 0;
108 }
109
110 static int h3_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
111 {
112         return 0;
113 }
114
115 static int h3_panel_resume(struct platform_device *pdev)
116 {
117         return 0;
118 }
119
120 struct platform_driver h3_panel_driver = {
121         .probe          = h3_panel_probe,
122         .remove         = h3_panel_remove,
123         .suspend        = h3_panel_suspend,
124         .resume         = h3_panel_resume,
125         .driver         = {
126                 .name   = "lcd_h3",
127                 .owner  = THIS_MODULE,
128         },
129 };
130
131 static int h3_panel_drv_init(void)
132 {
133         return platform_driver_register(&h3_panel_driver);
134 }
135
136 static void h3_panel_drv_cleanup(void)
137 {
138         platform_driver_unregister(&h3_panel_driver);
139 }
140
141 module_init(h3_panel_drv_init);
142 module_exit(h3_panel_drv_cleanup);
143