1f9915049c90378bd609f044f1c8334011c4e650
[h-e-n] / drivers / video / omap2 / displays / panel-sharp-ls037v7dw01.c
1 /*
2  * LCD panel driver for Sharp LS037V7DW01
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 sharp_ls_panel_init(struct omap_display *display)
26 {
27         return 0;
28 }
29
30 static void sharp_ls_panel_cleanup(struct omap_display *display)
31 {
32 }
33
34 static int sharp_ls_panel_enable(struct omap_display *display)
35 {
36         int r = 0;
37
38         /* wait couple of vsyncs until enabling the LCD */
39         msleep(50);
40
41         if (display->hw_config.panel_enable)
42                 r = display->hw_config.panel_enable(display);
43
44         return r;
45 }
46
47 static void sharp_ls_panel_disable(struct omap_display *display)
48 {
49         if (display->hw_config.panel_disable)
50                 display->hw_config.panel_disable(display);
51
52         /* wait at least 5 vsyncs after disabling the LCD */
53
54         msleep(100);
55 }
56
57 static int sharp_ls_panel_suspend(struct omap_display *display)
58 {
59         sharp_ls_panel_disable(display);
60         return 0;
61 }
62
63 static int sharp_ls_panel_resume(struct omap_display *display)
64 {
65         return sharp_ls_panel_enable(display);
66 }
67
68 static struct omap_panel sharp_ls_panel = {
69         .owner          = THIS_MODULE,
70         .name           = "sharp-ls037v7dw01",
71         .init           = sharp_ls_panel_init,
72         .cleanup        = sharp_ls_panel_cleanup,
73         .enable         = sharp_ls_panel_enable,
74         .disable        = sharp_ls_panel_disable,
75         .suspend        = sharp_ls_panel_suspend,
76         .resume         = sharp_ls_panel_resume,
77
78         .timings = {
79                 .x_res = 480,
80                 .y_res = 640,
81
82                 .pixel_clock    = 19200,
83
84                 .hsw            = 2,
85                 .hfp            = 1,
86                 .hbp            = 28,
87
88                 .vsw            = 1,
89                 .vfp            = 1,
90                 .vbp            = 1,
91         },
92
93         .acb            = 0x28,
94
95         .config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS,
96 };
97
98
99 static int __init sharp_ls_panel_drv_init(void)
100 {
101         omap_dss_register_panel(&sharp_ls_panel);
102         return 0;
103 }
104
105 static void __exit sharp_ls_panel_drv_exit(void)
106 {
107         omap_dss_unregister_panel(&sharp_ls_panel);
108 }
109
110 module_init(sharp_ls_panel_drv_init);
111 module_exit(sharp_ls_panel_drv_exit);
112 MODULE_LICENSE("GPL");