diff options
Diffstat (limited to 'drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c')
-rw-r--r-- | drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c b/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c new file mode 100644 index 000000000000..10267461991c --- /dev/null +++ b/drivers/video/omap2/displays/panel-sharp-lq043t1dg01.c | |||
@@ -0,0 +1,159 @@ | |||
1 | /* | ||
2 | * LCD panel driver for Sharp LQ043T1DG01 | ||
3 | * | ||
4 | * Copyright (C) 2009 Texas Instruments Inc | ||
5 | * Author: Vaibhav Hiremath <hvaibhav@ti.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_lq_timings = { | ||
28 | .x_res = 480, | ||
29 | .y_res = 272, | ||
30 | |||
31 | .pixel_clock = 9000, | ||
32 | |||
33 | .hsw = 42, | ||
34 | .hfp = 3, | ||
35 | .hbp = 2, | ||
36 | |||
37 | .vsw = 11, | ||
38 | .vfp = 3, | ||
39 | .vbp = 2, | ||
40 | }; | ||
41 | |||
42 | static int sharp_lq_panel_power_on(struct omap_dss_device *dssdev) | ||
43 | { | ||
44 | int r; | ||
45 | |||
46 | r = omapdss_dpi_display_enable(dssdev); | ||
47 | if (r) | ||
48 | goto err0; | ||
49 | |||
50 | /* wait couple of vsyncs until enabling the LCD */ | ||
51 | msleep(50); | ||
52 | |||
53 | if (dssdev->platform_enable) { | ||
54 | r = dssdev->platform_enable(dssdev); | ||
55 | if (r) | ||
56 | goto err1; | ||
57 | } | ||
58 | |||
59 | return 0; | ||
60 | err1: | ||
61 | omapdss_dpi_display_disable(dssdev); | ||
62 | err0: | ||
63 | return r; | ||
64 | } | ||
65 | |||
66 | static void sharp_lq_panel_power_off(struct omap_dss_device *dssdev) | ||
67 | { | ||
68 | if (dssdev->platform_disable) | ||
69 | dssdev->platform_disable(dssdev); | ||
70 | |||
71 | /* wait at least 5 vsyncs after disabling the LCD */ | ||
72 | msleep(100); | ||
73 | |||
74 | omapdss_dpi_display_disable(dssdev); | ||
75 | } | ||
76 | |||
77 | static int sharp_lq_panel_probe(struct omap_dss_device *dssdev) | ||
78 | { | ||
79 | |||
80 | dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | | ||
81 | OMAP_DSS_LCD_IHS | OMAP_DSS_LCD_IEO; | ||
82 | dssdev->panel.acb = 0x0; | ||
83 | dssdev->panel.timings = sharp_lq_timings; | ||
84 | |||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | static void sharp_lq_panel_remove(struct omap_dss_device *dssdev) | ||
89 | { | ||
90 | } | ||
91 | |||
92 | static int sharp_lq_panel_enable(struct omap_dss_device *dssdev) | ||
93 | { | ||
94 | int r = 0; | ||
95 | |||
96 | r = sharp_lq_panel_power_on(dssdev); | ||
97 | if (r) | ||
98 | return r; | ||
99 | |||
100 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
101 | |||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | static void sharp_lq_panel_disable(struct omap_dss_device *dssdev) | ||
106 | { | ||
107 | sharp_lq_panel_power_off(dssdev); | ||
108 | |||
109 | dssdev->state = OMAP_DSS_DISPLAY_DISABLED; | ||
110 | } | ||
111 | |||
112 | static int sharp_lq_panel_suspend(struct omap_dss_device *dssdev) | ||
113 | { | ||
114 | sharp_lq_panel_power_off(dssdev); | ||
115 | dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; | ||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | static int sharp_lq_panel_resume(struct omap_dss_device *dssdev) | ||
120 | { | ||
121 | int r = 0; | ||
122 | |||
123 | r = sharp_lq_panel_power_on(dssdev); | ||
124 | if (r) | ||
125 | return r; | ||
126 | |||
127 | dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; | ||
128 | |||
129 | return 0; | ||
130 | } | ||
131 | |||
132 | static struct omap_dss_driver sharp_lq_driver = { | ||
133 | .probe = sharp_lq_panel_probe, | ||
134 | .remove = sharp_lq_panel_remove, | ||
135 | |||
136 | .enable = sharp_lq_panel_enable, | ||
137 | .disable = sharp_lq_panel_disable, | ||
138 | .suspend = sharp_lq_panel_suspend, | ||
139 | .resume = sharp_lq_panel_resume, | ||
140 | |||
141 | .driver = { | ||
142 | .name = "sharp_lq_panel", | ||
143 | .owner = THIS_MODULE, | ||
144 | }, | ||
145 | }; | ||
146 | |||
147 | static int __init sharp_lq_panel_drv_init(void) | ||
148 | { | ||
149 | return omap_dss_register_driver(&sharp_lq_driver); | ||
150 | } | ||
151 | |||
152 | static void __exit sharp_lq_panel_drv_exit(void) | ||
153 | { | ||
154 | omap_dss_unregister_driver(&sharp_lq_driver); | ||
155 | } | ||
156 | |||
157 | module_init(sharp_lq_panel_drv_init); | ||
158 | module_exit(sharp_lq_panel_drv_exit); | ||
159 | MODULE_LICENSE("GPL"); | ||