diff options
Diffstat (limited to 'drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c')
-rw-r--r-- | drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c new file mode 100644 index 000000000000..8d51a5e6341c --- /dev/null +++ b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c | |||
@@ -0,0 +1,148 @@ | |||
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/err.h> | ||
24 | |||
25 | #include <plat/display.h> | ||
26 | |||
27 | static struct omap_video_timings sharp_ls_timings = { | ||
28 | .x_res = 480, | ||
29 | .y_res = 640, | ||
30 | |||
31 | .pixel_clock = 19200, | ||
32 | |||
33 | .hsw = 2, | ||
34 | .hfp = 1, | ||
35 | .hbp = 28, | ||
36 | |||
37 | .vsw = 1, | ||
38 | .vfp = 1, | ||
39 | .vbp = 1, | ||
40 | }; | ||
41 | |||
42 | static int sharp_ls_panel_probe(struct omap_dss_device *dssdev) | ||
43 | { | ||
44 | dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | | ||
45 | OMAP_DSS_LCD_IHS; | ||
46 | dssdev->panel.acb = 0x28; | ||
47 | dssdev->panel.timings = sharp_ls_timings; | ||
48 | |||
49 | return 0; | ||
50 | } | ||
51 | |||
52 | static void sharp_ls_panel_remove(struct omap_dss_device *dssdev) | ||
53 | { | ||
54 | } | ||
55 | |||
56 | static int sharp_ls_power_on(struct omap_dss_device *dssdev) | ||
57 | { | ||
58 | int r = 0; | ||
59 | |||
60 | r = omapdss_dpi_display_enable(dssdev); | ||
61 | if (r) | ||
62 | goto err0; | ||
63 | |||
64 | /* wait couple of vsyncs until enabling the LCD */ | ||
65 | msleep(50); | ||
66 | |||
67 | if (dssdev->platform_enable) { | ||
68 | r = dssdev->platform_enable(dssdev); | ||
69 | if (r) | ||
70 | goto err1; | ||
71 | } | ||
72 | |||
73 | return 0; | ||
74 | err1: | ||
75 | omapdss_dpi_display_disable(dssdev); | ||
76 | err0: | ||
77 | return r; | ||
78 | } | ||
79 | |||
80 | static void sharp_ls_power_off(struct omap_dss_device *dssdev) | ||
81 | { | ||
82 | if (dssdev->platform_disable) | ||
83 | dssdev->platform_disable(dssdev); | ||
84 | |||
85 | /* wait at least 5 vsyncs after disabling the LCD */ | ||
86 | |||
87 | msleep(100); | ||
88 | |||
89 | omapdss_dpi_display_disable(dssdev); | ||
90 | } | ||
91 | |||
92 | static int sharp_ls_panel_enable(struct omap_dss_device *dssdev) | ||
93 | { | ||
94 | int r; | ||
95 | r = sharp_ls_power_on(dssdev); | ||
96 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
97 | return r; | ||
98 | } | ||
99 | |||
100 | static void sharp_ls_panel_disable(struct omap_dss_device *dssdev) | ||
101 | { | ||
102 | sharp_ls_power_off(dssdev); | ||
103 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
104 | } | ||
105 | |||
106 | static int sharp_ls_panel_suspend(struct omap_dss_device *dssdev) | ||
107 | { | ||
108 | sharp_ls_power_off(dssdev); | ||
109 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
110 | return 0; | ||
111 | } | ||
112 | |||
113 | static int sharp_ls_panel_resume(struct omap_dss_device *dssdev) | ||
114 | { | ||
115 | int r; | ||
116 | r = sharp_ls_power_on(dssdev); | ||
117 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
118 | return r; | ||
119 | } | ||
120 | |||
121 | static struct omap_dss_driver sharp_ls_driver = { | ||
122 | .probe = sharp_ls_panel_probe, | ||
123 | .remove = sharp_ls_panel_remove, | ||
124 | |||
125 | .enable = sharp_ls_panel_enable, | ||
126 | .disable = sharp_ls_panel_disable, | ||
127 | .suspend = sharp_ls_panel_suspend, | ||
128 | .resume = sharp_ls_panel_resume, | ||
129 | |||
130 | .driver = { | ||
131 | .name = "sharp_ls_panel", | ||
132 | .owner = THIS_MODULE, | ||
133 | }, | ||
134 | }; | ||
135 | |||
136 | static int __init sharp_ls_panel_drv_init(void) | ||
137 | { | ||
138 | return omap_dss_register_driver(&sharp_ls_driver); | ||
139 | } | ||
140 | |||
141 | static void __exit sharp_ls_panel_drv_exit(void) | ||
142 | { | ||
143 | omap_dss_unregister_driver(&sharp_ls_driver); | ||
144 | } | ||
145 | |||
146 | module_init(sharp_ls_panel_drv_init); | ||
147 | module_exit(sharp_ls_panel_drv_exit); | ||
148 | MODULE_LICENSE("GPL"); | ||