]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/video/omap/lcd_inn1610.c
FB: Add support for OMAP framebuffer
[linux-2.6-omap-h63xx.git] / drivers / video / omap / lcd_inn1610.c
1 /*
2  * File: drivers/video/omap/lcd-inn1610.c
3  *
4  * LCD panel support for the TI OMAP1610 Innovator 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/omapfb.h>
29
30 #define MODULE_NAME     "omapfb-lcd_h3"
31
32 #define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ": " fmt, ## args)
33
34 static int innovator1610_panel_init(struct lcd_panel *panel,
35                                     struct omapfb_device *fbdev)
36 {
37         int r = 0;
38
39         if (omap_request_gpio(14)) {
40                 pr_err("can't request GPIO 14\n");
41                 r = -1;
42                 goto exit;
43         }
44         if (omap_request_gpio(15)) {
45                 pr_err("can't request GPIO 15\n");
46                 omap_free_gpio(14);
47                 r = -1;
48                 goto exit;
49         }
50         /* configure GPIO(14, 15) as outputs */
51         omap_set_gpio_direction(14, 0);
52         omap_set_gpio_direction(15, 0);
53 exit:
54         return r;
55 }
56
57 static void innovator1610_panel_cleanup(struct lcd_panel *panel)
58 {
59         omap_free_gpio(15);
60         omap_free_gpio(14);
61 }
62
63 static int innovator1610_panel_enable(struct lcd_panel *panel)
64 {
65         /* set GPIO14 and GPIO15 high */
66         omap_set_gpio_dataout(14, 1);
67         omap_set_gpio_dataout(15, 1);
68         return 0;
69 }
70
71 static void innovator1610_panel_disable(struct lcd_panel *panel)
72 {
73         /* set GPIO13, GPIO14 and GPIO15 low */
74         omap_set_gpio_dataout(14, 0);
75         omap_set_gpio_dataout(15, 0);
76 }
77
78 static unsigned long innovator1610_panel_get_caps(struct lcd_panel *panel)
79 {
80         return 0;
81 }
82
83 struct lcd_panel innovator1610_panel = {
84         .name           = "inn1610",
85         .config         = OMAP_LCDC_PANEL_TFT,
86
87         .bpp            = 16,
88         .data_lines     = 16,
89         .x_res          = 320,
90         .y_res          = 240,
91         .pixel_clock    = 12500,
92         .hsw            = 40,
93         .hfp            = 40,
94         .hbp            = 72,
95         .vsw            = 1,
96         .vfp            = 1,
97         .vbp            = 0,
98         .pcd            = 12,
99
100         .init           = innovator1610_panel_init,
101         .cleanup        = innovator1610_panel_cleanup,
102         .enable         = innovator1610_panel_enable,
103         .disable        = innovator1610_panel_disable,
104         .get_caps       = innovator1610_panel_get_caps,
105 };
106
107 static int innovator1610_panel_probe(struct platform_device *pdev)
108 {
109         omapfb_register_panel(&innovator1610_panel);
110         return 0;
111 }
112
113 static int innovator1610_panel_remove(struct platform_device *pdev)
114 {
115         return 0;
116 }
117
118 static int innovator1610_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
119 {
120         return 0;
121 }
122
123 static int innovator1610_panel_resume(struct platform_device *pdev)
124 {
125         return 0;
126 }
127
128 struct platform_driver innovator1610_panel_driver = {
129         .probe          = innovator1610_panel_probe,
130         .remove         = innovator1610_panel_remove,
131         .suspend        = innovator1610_panel_suspend,
132         .resume         = innovator1610_panel_resume,
133         .driver         = {
134                 .name   = "lcd_inn1610",
135                 .owner  = THIS_MODULE,
136         },
137 };
138
139 static int innovator1610_panel_drv_init(void)
140 {
141         return platform_driver_register(&innovator1610_panel_driver);
142 }
143
144 static void innovator1610_panel_drv_cleanup(void)
145 {
146         platform_driver_unregister(&innovator1610_panel_driver);
147 }
148
149 module_init(innovator1610_panel_drv_init);
150 module_exit(innovator1610_panel_drv_cleanup);
151