DSS2: Add panel drivers
[pandora-kernel.git] / drivers / video / omap2 / displays / panel-generic.c
1 /*
2  * Generic panel support
3  *
4  * Copyright (C) 2008 Nokia Corporation
5  * Author: Tomi Valkeinen <tomi.valkeinen@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 version 2 as published by
9  * the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #include <linux/module.h>
21 #include <linux/delay.h>
22
23 #include <mach/display.h>
24
25 static int generic_panel_init(struct omap_display *display)
26 {
27         return 0;
28 }
29
30 static int generic_panel_enable(struct omap_display *display)
31 {
32         int r = 0;
33
34         if (display->hw_config.panel_enable)
35                 r = display->hw_config.panel_enable(display);
36
37         return r;
38 }
39
40 static void generic_panel_disable(struct omap_display *display)
41 {
42         if (display->hw_config.panel_disable)
43                 display->hw_config.panel_disable(display);
44 }
45
46 static int generic_panel_suspend(struct omap_display *display)
47 {
48         generic_panel_disable(display);
49         return 0;
50 }
51
52 static int generic_panel_resume(struct omap_display *display)
53 {
54         return generic_panel_enable(display);
55 }
56
57 static struct omap_panel generic_panel = {
58         .owner          = THIS_MODULE,
59         .name           = "panel-generic",
60         .init           = generic_panel_init,
61         .enable         = generic_panel_enable,
62         .disable        = generic_panel_disable,
63         .suspend        = generic_panel_suspend,
64         .resume         = generic_panel_resume,
65
66         .timings = {
67                 /* 640 x 480 @ 60 Hz  Reduced blanking VESA CVT 0.31M3-R */
68                 .x_res          = 640,
69                 .y_res          = 480,
70                 .pixel_clock    = 23500,
71                 .hfp            = 48,
72                 .hsw            = 32,
73                 .hbp            = 80,
74                 .vfp            = 3,
75                 .vsw            = 4,
76                 .vbp            = 7,
77         },
78
79         .config         = OMAP_DSS_LCD_TFT,
80 };
81
82
83 static int __init generic_panel_drv_init(void)
84 {
85         omap_dss_register_panel(&generic_panel);
86         return 0;
87 }
88
89 static void __exit generic_panel_drv_exit(void)
90 {
91         omap_dss_unregister_panel(&generic_panel);
92 }
93
94 module_init(generic_panel_drv_init);
95 module_exit(generic_panel_drv_exit);
96 MODULE_LICENSE("GPL");