]> Pileus Git - ~andy/linux/blob - drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
OMAPDSS: ls037v7dw01: remove platform backlight calls
[~andy/linux] / 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 #include <linux/device.h>
23 #include <linux/fb.h>
24 #include <linux/err.h>
25 #include <linux/slab.h>
26
27 #include <video/omapdss.h>
28
29 struct sharp_data {
30 };
31
32 static struct omap_video_timings sharp_ls_timings = {
33         .x_res = 480,
34         .y_res = 640,
35
36         .pixel_clock    = 19200,
37
38         .hsw            = 2,
39         .hfp            = 1,
40         .hbp            = 28,
41
42         .vsw            = 1,
43         .vfp            = 1,
44         .vbp            = 1,
45
46         .vsync_level    = OMAPDSS_SIG_ACTIVE_LOW,
47         .hsync_level    = OMAPDSS_SIG_ACTIVE_LOW,
48         .data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE,
49         .de_level       = OMAPDSS_SIG_ACTIVE_HIGH,
50         .sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES,
51 };
52
53
54 static int sharp_ls_panel_probe(struct omap_dss_device *dssdev)
55 {
56         struct sharp_data *sd;
57
58         dssdev->panel.timings = sharp_ls_timings;
59
60         sd = kzalloc(sizeof(*sd), GFP_KERNEL);
61         if (!sd)
62                 return -ENOMEM;
63
64         dev_set_drvdata(&dssdev->dev, sd);
65
66         return 0;
67 }
68
69 static void __exit sharp_ls_panel_remove(struct omap_dss_device *dssdev)
70 {
71         struct sharp_data *sd = dev_get_drvdata(&dssdev->dev);
72
73         kfree(sd);
74 }
75
76 static int sharp_ls_power_on(struct omap_dss_device *dssdev)
77 {
78         int r = 0;
79
80         if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE)
81                 return 0;
82
83         omapdss_dpi_set_timings(dssdev, &dssdev->panel.timings);
84         omapdss_dpi_set_data_lines(dssdev, dssdev->phy.dpi.data_lines);
85
86         r = omapdss_dpi_display_enable(dssdev);
87         if (r)
88                 goto err0;
89
90         /* wait couple of vsyncs until enabling the LCD */
91         msleep(50);
92
93         if (dssdev->platform_enable) {
94                 r = dssdev->platform_enable(dssdev);
95                 if (r)
96                         goto err1;
97         }
98
99         return 0;
100 err1:
101         omapdss_dpi_display_disable(dssdev);
102 err0:
103         return r;
104 }
105
106 static void sharp_ls_power_off(struct omap_dss_device *dssdev)
107 {
108         if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
109                 return;
110
111         if (dssdev->platform_disable)
112                 dssdev->platform_disable(dssdev);
113
114         /* wait at least 5 vsyncs after disabling the LCD */
115
116         msleep(100);
117
118         omapdss_dpi_display_disable(dssdev);
119 }
120
121 static int sharp_ls_panel_enable(struct omap_dss_device *dssdev)
122 {
123         int r;
124         r = sharp_ls_power_on(dssdev);
125         dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
126         return r;
127 }
128
129 static void sharp_ls_panel_disable(struct omap_dss_device *dssdev)
130 {
131         sharp_ls_power_off(dssdev);
132         dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
133 }
134
135 static struct omap_dss_driver sharp_ls_driver = {
136         .probe          = sharp_ls_panel_probe,
137         .remove         = __exit_p(sharp_ls_panel_remove),
138
139         .enable         = sharp_ls_panel_enable,
140         .disable        = sharp_ls_panel_disable,
141
142         .driver         = {
143                 .name   = "sharp_ls_panel",
144                 .owner  = THIS_MODULE,
145         },
146 };
147
148 static int __init sharp_ls_panel_drv_init(void)
149 {
150         return omap_dss_register_driver(&sharp_ls_driver);
151 }
152
153 static void __exit sharp_ls_panel_drv_exit(void)
154 {
155         omap_dss_unregister_driver(&sharp_ls_driver);
156 }
157
158 module_init(sharp_ls_panel_drv_init);
159 module_exit(sharp_ls_panel_drv_exit);
160 MODULE_LICENSE("GPL");