aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/dss/sdi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/omap2/dss/sdi.c')
-rw-r--r--drivers/video/omap2/dss/sdi.c115
1 files changed, 7 insertions, 108 deletions
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index c24f307d3da1..12eb4042dd82 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -41,7 +41,7 @@ static void sdi_basic_init(void)
41 dispc_lcd_enable_signal_polarity(1); 41 dispc_lcd_enable_signal_polarity(1);
42} 42}
43 43
44static int sdi_display_enable(struct omap_dss_device *dssdev) 44int omapdss_sdi_display_enable(struct omap_dss_device *dssdev)
45{ 45{
46 struct omap_video_timings *t = &dssdev->panel.timings; 46 struct omap_video_timings *t = &dssdev->panel.timings;
47 struct dss_clock_info dss_cinfo; 47 struct dss_clock_info dss_cinfo;
@@ -57,12 +57,6 @@ static int sdi_display_enable(struct omap_dss_device *dssdev)
57 goto err0; 57 goto err0;
58 } 58 }
59 59
60 if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) {
61 DSSERR("dssdev already enabled\n");
62 r = -EINVAL;
63 goto err1;
64 }
65
66 /* In case of skip_init sdi_init has already enabled the clocks */ 60 /* In case of skip_init sdi_init has already enabled the clocks */
67 if (!sdi.skip_init) 61 if (!sdi.skip_init)
68 dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); 62 dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1);
@@ -119,7 +113,7 @@ static int sdi_display_enable(struct omap_dss_device *dssdev)
119 mdelay(2); 113 mdelay(2);
120 } 114 }
121 115
122 dispc_enable_lcd_out(1); 116 dssdev->manager->enable(dssdev->manager);
123 117
124 if (dssdev->driver->enable) { 118 if (dssdev->driver->enable) {
125 r = dssdev->driver->enable(dssdev); 119 r = dssdev->driver->enable(dssdev);
@@ -127,13 +121,11 @@ static int sdi_display_enable(struct omap_dss_device *dssdev)
127 goto err3; 121 goto err3;
128 } 122 }
129 123
130 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
131
132 sdi.skip_init = 0; 124 sdi.skip_init = 0;
133 125
134 return 0; 126 return 0;
135err3: 127err3:
136 dispc_enable_lcd_out(0); 128 dssdev->manager->disable(dssdev->manager);
137err2: 129err2:
138 dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); 130 dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1);
139err1: 131err1:
@@ -141,120 +133,27 @@ err1:
141err0: 133err0:
142 return r; 134 return r;
143} 135}
136EXPORT_SYMBOL(omapdss_sdi_display_enable);
144 137
145static int sdi_display_resume(struct omap_dss_device *dssdev); 138void omapdss_sdi_display_disable(struct omap_dss_device *dssdev)
146
147static void sdi_display_disable(struct omap_dss_device *dssdev)
148{ 139{
149 if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED)
150 return;
151
152 if (dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED)
153 if (sdi_display_resume(dssdev))
154 return;
155
156 if (dssdev->driver->disable) 140 if (dssdev->driver->disable)
157 dssdev->driver->disable(dssdev); 141 dssdev->driver->disable(dssdev);
158 142
159 dispc_enable_lcd_out(0); 143 dssdev->manager->disable(dssdev->manager);
160 144
161 dss_sdi_disable(); 145 dss_sdi_disable();
162 146
163 dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); 147 dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1);
164 148
165 dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
166
167 omap_dss_stop_device(dssdev); 149 omap_dss_stop_device(dssdev);
168} 150}
169 151EXPORT_SYMBOL(omapdss_sdi_display_disable);
170static int sdi_display_suspend(struct omap_dss_device *dssdev)
171{
172 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
173 return -EINVAL;
174
175 if (dssdev->driver->suspend)
176 dssdev->driver->suspend(dssdev);
177
178 dispc_enable_lcd_out(0);
179
180 dss_sdi_disable();
181
182 dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1);
183
184 dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
185
186 return 0;
187}
188
189static int sdi_display_resume(struct omap_dss_device *dssdev)
190{
191 int r;
192
193 if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED)
194 return -EINVAL;
195
196 dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1);
197
198 r = dss_sdi_enable();
199 if (r)
200 goto err;
201 mdelay(2);
202
203 dispc_enable_lcd_out(1);
204
205 if (dssdev->driver->resume)
206 dssdev->driver->resume(dssdev);
207
208 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
209
210 return 0;
211err:
212 dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1);
213 return r;
214}
215
216static int sdi_display_set_update_mode(struct omap_dss_device *dssdev,
217 enum omap_dss_update_mode mode)
218{
219 if (mode == OMAP_DSS_UPDATE_MANUAL)
220 return -EINVAL;
221
222 if (mode == OMAP_DSS_UPDATE_DISABLED) {
223 dispc_enable_lcd_out(0);
224 sdi.update_enabled = 0;
225 } else {
226 dispc_enable_lcd_out(1);
227 sdi.update_enabled = 1;
228 }
229
230 return 0;
231}
232
233static enum omap_dss_update_mode sdi_display_get_update_mode(
234 struct omap_dss_device *dssdev)
235{
236 return sdi.update_enabled ? OMAP_DSS_UPDATE_AUTO :
237 OMAP_DSS_UPDATE_DISABLED;
238}
239
240static void sdi_get_timings(struct omap_dss_device *dssdev,
241 struct omap_video_timings *timings)
242{
243 *timings = dssdev->panel.timings;
244}
245 152
246int sdi_init_display(struct omap_dss_device *dssdev) 153int sdi_init_display(struct omap_dss_device *dssdev)
247{ 154{
248 DSSDBG("SDI init\n"); 155 DSSDBG("SDI init\n");
249 156
250 dssdev->enable = sdi_display_enable;
251 dssdev->disable = sdi_display_disable;
252 dssdev->suspend = sdi_display_suspend;
253 dssdev->resume = sdi_display_resume;
254 dssdev->set_update_mode = sdi_display_set_update_mode;
255 dssdev->get_update_mode = sdi_display_get_update_mode;
256 dssdev->get_timings = sdi_get_timings;
257
258 return 0; 157 return 0;
259} 158}
260 159