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