]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/video/omap/lcd_osk.c
FB: Add support for OMAP framebuffer
[linux-2.6-omap-h63xx.git] / drivers / video / omap / lcd_osk.c
1 /*
2  * File: drivers/video/omap/lcd-osk.c
3  *
4  * LCD panel support for the TI OMAP OSK board
5  *
6  * Copyright (C) 2004 Nokia Corporation
7  * Author: Imre Deak <imre.deak@nokia.com>
8  * Adapted for OSK by <dirk.behme@de.bosch.com>
9  *
10  * This program is free software; you can redistribute it and/or modify it
11  * under the terms of the GNU General Public License as published by the
12  * Free Software Foundation; either version 2 of the License, or (at your
13  * option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License along
21  * with this program; if not, write to the Free Software Foundation, Inc.,
22  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 #include <linux/module.h>
26 #include <linux/platform_device.h>
27
28 #include <asm/arch/gpio.h>
29 #include <asm/arch/mux.h>
30 #include <asm/arch/omapfb.h>
31
32 static int osk_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev)
33 {
34         return 0;
35 }
36
37 static void osk_panel_cleanup(struct lcd_panel *panel)
38 {
39 }
40
41 static int osk_panel_enable(struct lcd_panel *panel)
42 {
43         /* configure PWL pin */
44         omap_cfg_reg(PWL);
45
46         /* Enable PWL unit */
47         omap_writeb(0x01, OMAP_PWL_CLK_ENABLE);
48
49         /* Set PWL level */
50         omap_writeb(0xFF, OMAP_PWL_ENABLE);
51
52         /* configure GPIO2 as output */
53         omap_set_gpio_direction(2, 0);
54
55         /* set GPIO2 high */
56         omap_set_gpio_dataout(2, 1);
57
58         return 0;
59 }
60
61 static void osk_panel_disable(struct lcd_panel *panel)
62 {
63         /* Set PWL level to zero */
64         omap_writeb(0x00, OMAP_PWL_ENABLE);
65
66         /* Disable PWL unit */
67         omap_writeb(0x00, OMAP_PWL_CLK_ENABLE);
68
69         /* set GPIO2 low */
70         omap_set_gpio_dataout(2, 0);
71 }
72
73 static unsigned long osk_panel_get_caps(struct lcd_panel *panel)
74 {
75         return 0;
76 }
77
78 struct lcd_panel osk_panel = {
79         .name           = "osk",
80         .config         = OMAP_LCDC_PANEL_TFT,
81
82         .bpp            = 16,
83         .data_lines     = 16,
84         .x_res          = 240,
85         .y_res          = 320,
86         .pixel_clock    = 12500,
87         .hsw            = 40,
88         .hfp            = 40,
89         .hbp            = 72,
90         .vsw            = 1,
91         .vfp            = 1,
92         .vbp            = 0,
93         .pcd            = 12,
94
95         .init           = osk_panel_init,
96         .cleanup        = osk_panel_cleanup,
97         .enable         = osk_panel_enable,
98         .disable        = osk_panel_disable,
99         .get_caps       = osk_panel_get_caps,
100 };
101
102 static int osk_panel_probe(struct platform_device *pdev)
103 {
104         omapfb_register_panel(&osk_panel);
105         return 0;
106 }
107
108 static int osk_panel_remove(struct platform_device *pdev)
109 {
110         return 0;
111 }
112
113 static int osk_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
114 {
115         return 0;
116 }
117
118 static int osk_panel_resume(struct platform_device *pdev)
119 {
120         return 0;
121 }
122
123 struct platform_driver osk_panel_driver = {
124         .probe          = osk_panel_probe,
125         .remove         = osk_panel_remove,
126         .suspend        = osk_panel_suspend,
127         .resume         = osk_panel_resume,
128         .driver         = {
129                 .name   = "lcd_osk",
130                 .owner  = THIS_MODULE,
131         },
132 };
133
134 static int osk_panel_drv_init(void)
135 {
136         return platform_driver_register(&osk_panel_driver);
137 }
138
139 static void osk_panel_drv_cleanup(void)
140 {
141         platform_driver_unregister(&osk_panel_driver);
142 }
143
144 module_init(osk_panel_drv_init);
145 module_exit(osk_panel_drv_cleanup);
146