blob: 379c96d36da5833377e5d5df97085662ed6b52f5 [file] [log] [blame]
Dirk Behme107cc642007-07-17 04:06:07 -07001/*
2 * LCD panel support for the TI OMAP OSK board
3 *
4 * Copyright (C) 2004 Nokia Corporation
5 * Author: Imre Deak <imre.deak@nokia.com>
6 * Adapted for OSK by <dirk.behme@de.bosch.com>
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
Russell Kinga09e64f2008-08-05 16:14:15 +010026#include <mach/gpio.h>
27#include <mach/mux.h>
28#include <mach/omapfb.h>
Dirk Behme107cc642007-07-17 04:06:07 -070029
30static int osk_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev)
31{
David Brownell93a22f82008-10-15 22:03:15 -070032 /* gpio2 was allocated in board init */
Dirk Behme107cc642007-07-17 04:06:07 -070033 return 0;
34}
35
36static void osk_panel_cleanup(struct lcd_panel *panel)
37{
38}
39
40static int osk_panel_enable(struct lcd_panel *panel)
41{
42 /* configure PWL pin */
43 omap_cfg_reg(PWL);
44
45 /* Enable PWL unit */
46 omap_writeb(0x01, OMAP_PWL_CLK_ENABLE);
47
48 /* Set PWL level */
49 omap_writeb(0xFF, OMAP_PWL_ENABLE);
50
David Brownell93a22f82008-10-15 22:03:15 -070051 /* set GPIO2 high (lcd power enabled) */
52 gpio_set_value(2, 1);
Dirk Behme107cc642007-07-17 04:06:07 -070053
54 return 0;
55}
56
57static void osk_panel_disable(struct lcd_panel *panel)
58{
59 /* Set PWL level to zero */
60 omap_writeb(0x00, OMAP_PWL_ENABLE);
61
62 /* Disable PWL unit */
63 omap_writeb(0x00, OMAP_PWL_CLK_ENABLE);
64
65 /* set GPIO2 low */
David Brownell93a22f82008-10-15 22:03:15 -070066 gpio_set_value(2, 0);
Dirk Behme107cc642007-07-17 04:06:07 -070067}
68
69static unsigned long osk_panel_get_caps(struct lcd_panel *panel)
70{
71 return 0;
72}
73
74struct lcd_panel osk_panel = {
75 .name = "osk",
76 .config = OMAP_LCDC_PANEL_TFT,
77
78 .bpp = 16,
79 .data_lines = 16,
80 .x_res = 240,
81 .y_res = 320,
82 .pixel_clock = 12500,
83 .hsw = 40,
84 .hfp = 40,
85 .hbp = 72,
86 .vsw = 1,
87 .vfp = 1,
88 .vbp = 0,
89 .pcd = 12,
90
91 .init = osk_panel_init,
92 .cleanup = osk_panel_cleanup,
93 .enable = osk_panel_enable,
94 .disable = osk_panel_disable,
95 .get_caps = osk_panel_get_caps,
96};
97
98static int osk_panel_probe(struct platform_device *pdev)
99{
100 omapfb_register_panel(&osk_panel);
101 return 0;
102}
103
104static int osk_panel_remove(struct platform_device *pdev)
105{
106 return 0;
107}
108
109static int osk_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
110{
111 return 0;
112}
113
114static int osk_panel_resume(struct platform_device *pdev)
115{
116 return 0;
117}
118
119struct platform_driver osk_panel_driver = {
120 .probe = osk_panel_probe,
121 .remove = osk_panel_remove,
122 .suspend = osk_panel_suspend,
123 .resume = osk_panel_resume,
124 .driver = {
125 .name = "lcd_osk",
126 .owner = THIS_MODULE,
127 },
128};
129
130static int osk_panel_drv_init(void)
131{
132 return platform_driver_register(&osk_panel_driver);
133}
134
135static void osk_panel_drv_cleanup(void)
136{
137 platform_driver_unregister(&osk_panel_driver);
138}
139
140module_init(osk_panel_drv_init);
141module_exit(osk_panel_drv_cleanup);
142