blob: 9fff86f67bde401ff475e2ba977db90897c613b0 [file] [log] [blame]
Imre Deakd64ca862007-07-17 04:06:06 -07001/*
2 * LCD panel support for the TI OMAP1610 Innovator board
3 *
4 * Copyright (C) 2004 Nokia Corporation
5 * Author: Imre Deak <imre.deak@nokia.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21
22#include <linux/module.h>
23#include <linux/platform_device.h>
24
Russell Kinga09e64f2008-08-05 16:14:15 +010025#include <mach/gpio.h>
Tomi Valkeinen91773a02009-08-03 15:06:36 +030026#include "omapfb.h"
Imre Deakd64ca862007-07-17 04:06:06 -070027
28#define MODULE_NAME "omapfb-lcd_h3"
29
Imre Deakd64ca862007-07-17 04:06:06 -070030static int innovator1610_panel_init(struct lcd_panel *panel,
31 struct omapfb_device *fbdev)
32{
33 int r = 0;
34
David Brownell93a22f82008-10-15 22:03:15 -070035 if (gpio_request(14, "lcd_en0")) {
Emil Medve1f7c8232007-10-16 23:29:48 -070036 pr_err(MODULE_NAME ": can't request GPIO 14\n");
Imre Deakd64ca862007-07-17 04:06:06 -070037 r = -1;
38 goto exit;
39 }
David Brownell93a22f82008-10-15 22:03:15 -070040 if (gpio_request(15, "lcd_en1")) {
Emil Medve1f7c8232007-10-16 23:29:48 -070041 pr_err(MODULE_NAME ": can't request GPIO 15\n");
David Brownell93a22f82008-10-15 22:03:15 -070042 gpio_free(14);
Imre Deakd64ca862007-07-17 04:06:06 -070043 r = -1;
44 goto exit;
45 }
46 /* configure GPIO(14, 15) as outputs */
David Brownell93a22f82008-10-15 22:03:15 -070047 gpio_direction_output(14, 0);
48 gpio_direction_output(15, 0);
Imre Deakd64ca862007-07-17 04:06:06 -070049exit:
50 return r;
51}
52
53static void innovator1610_panel_cleanup(struct lcd_panel *panel)
54{
David Brownell93a22f82008-10-15 22:03:15 -070055 gpio_free(15);
56 gpio_free(14);
Imre Deakd64ca862007-07-17 04:06:06 -070057}
58
59static int innovator1610_panel_enable(struct lcd_panel *panel)
60{
61 /* set GPIO14 and GPIO15 high */
David Brownell93a22f82008-10-15 22:03:15 -070062 gpio_set_value(14, 1);
63 gpio_set_value(15, 1);
Imre Deakd64ca862007-07-17 04:06:06 -070064 return 0;
65}
66
67static void innovator1610_panel_disable(struct lcd_panel *panel)
68{
69 /* set GPIO13, GPIO14 and GPIO15 low */
David Brownell93a22f82008-10-15 22:03:15 -070070 gpio_set_value(14, 0);
71 gpio_set_value(15, 0);
Imre Deakd64ca862007-07-17 04:06:06 -070072}
73
74static unsigned long innovator1610_panel_get_caps(struct lcd_panel *panel)
75{
76 return 0;
77}
78
79struct lcd_panel innovator1610_panel = {
80 .name = "inn1610",
81 .config = OMAP_LCDC_PANEL_TFT,
82
83 .bpp = 16,
84 .data_lines = 16,
85 .x_res = 320,
86 .y_res = 240,
87 .pixel_clock = 12500,
88 .hsw = 40,
89 .hfp = 40,
90 .hbp = 72,
91 .vsw = 1,
92 .vfp = 1,
93 .vbp = 0,
94 .pcd = 12,
95
96 .init = innovator1610_panel_init,
97 .cleanup = innovator1610_panel_cleanup,
98 .enable = innovator1610_panel_enable,
99 .disable = innovator1610_panel_disable,
100 .get_caps = innovator1610_panel_get_caps,
101};
102
103static int innovator1610_panel_probe(struct platform_device *pdev)
104{
105 omapfb_register_panel(&innovator1610_panel);
106 return 0;
107}
108
109static int innovator1610_panel_remove(struct platform_device *pdev)
110{
111 return 0;
112}
113
114static int innovator1610_panel_suspend(struct platform_device *pdev,
115 pm_message_t mesg)
116{
117 return 0;
118}
119
120static int innovator1610_panel_resume(struct platform_device *pdev)
121{
122 return 0;
123}
124
125struct platform_driver innovator1610_panel_driver = {
126 .probe = innovator1610_panel_probe,
127 .remove = innovator1610_panel_remove,
128 .suspend = innovator1610_panel_suspend,
129 .resume = innovator1610_panel_resume,
130 .driver = {
131 .name = "lcd_inn1610",
132 .owner = THIS_MODULE,
133 },
134};
135
Peter Huewe3f6db502009-07-03 14:39:40 +0200136static int __init innovator1610_panel_drv_init(void)
Imre Deakd64ca862007-07-17 04:06:06 -0700137{
138 return platform_driver_register(&innovator1610_panel_driver);
139}
140
Peter Huewe3f6db502009-07-03 14:39:40 +0200141static void __exit innovator1610_panel_drv_cleanup(void)
Imre Deakd64ca862007-07-17 04:06:06 -0700142{
143 platform_driver_unregister(&innovator1610_panel_driver);
144}
145
146module_init(innovator1610_panel_drv_init);
147module_exit(innovator1610_panel_drv_cleanup);
148