aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/dss/dpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/omap2/dss/dpi.c')
-rw-r--r--drivers/video/omap2/dss/dpi.c144
1 files changed, 33 insertions, 111 deletions
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 2d71031baa25..960e977a8bf0 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -25,7 +25,10 @@
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/clk.h> 26#include <linux/clk.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/err.h>
28#include <linux/errno.h> 29#include <linux/errno.h>
30#include <linux/platform_device.h>
31#include <linux/regulator/consumer.h>
29 32
30#include <plat/display.h> 33#include <plat/display.h>
31#include <plat/cpu.h> 34#include <plat/cpu.h>
@@ -33,7 +36,7 @@
33#include "dss.h" 36#include "dss.h"
34 37
35static struct { 38static struct {
36 int update_enabled; 39 struct regulator *vdds_dsi_reg;
37} dpi; 40} dpi;
38 41
39#ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL 42#ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL
@@ -53,7 +56,7 @@ static int dpi_set_dsi_clk(bool is_tft, unsigned long pck_req,
53 if (r) 56 if (r)
54 return r; 57 return r;
55 58
56 dss_select_clk_source(0, 1); 59 dss_select_dispc_clk_source(DSS_SRC_DSI1_PLL_FCLK);
57 60
58 r = dispc_set_clock_div(&dispc_cinfo); 61 r = dispc_set_clock_div(&dispc_cinfo);
59 if (r) 62 if (r)
@@ -150,7 +153,7 @@ static int dpi_basic_init(struct omap_dss_device *dssdev)
150 return 0; 153 return 0;
151} 154}
152 155
153static int dpi_display_enable(struct omap_dss_device *dssdev) 156int omapdss_dpi_display_enable(struct omap_dss_device *dssdev)
154{ 157{
155 int r; 158 int r;
156 159
@@ -160,10 +163,10 @@ static int dpi_display_enable(struct omap_dss_device *dssdev)
160 goto err0; 163 goto err0;
161 } 164 }
162 165
163 if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { 166 if (cpu_is_omap34xx()) {
164 DSSERR("display already enabled\n"); 167 r = regulator_enable(dpi.vdds_dsi_reg);
165 r = -EINVAL; 168 if (r)
166 goto err1; 169 goto err1;
167 } 170 }
168 171
169 dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); 172 dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1);
@@ -184,18 +187,10 @@ static int dpi_display_enable(struct omap_dss_device *dssdev)
184 187
185 mdelay(2); 188 mdelay(2);
186 189
187 dispc_enable_lcd_out(1); 190 dssdev->manager->enable(dssdev->manager);
188
189 r = dssdev->driver->enable(dssdev);
190 if (r)
191 goto err5;
192
193 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
194 191
195 return 0; 192 return 0;
196 193
197err5:
198 dispc_enable_lcd_out(0);
199err4: 194err4:
200#ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL 195#ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL
201 dsi_pll_uninit(); 196 dsi_pll_uninit();
@@ -204,78 +199,35 @@ err3:
204#endif 199#endif
205err2: 200err2:
206 dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); 201 dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1);
202 if (cpu_is_omap34xx())
203 regulator_disable(dpi.vdds_dsi_reg);
207err1: 204err1:
208 omap_dss_stop_device(dssdev); 205 omap_dss_stop_device(dssdev);
209err0: 206err0:
210 return r; 207 return r;
211} 208}
209EXPORT_SYMBOL(omapdss_dpi_display_enable);
212 210
213static int dpi_display_resume(struct omap_dss_device *dssdev); 211void omapdss_dpi_display_disable(struct omap_dss_device *dssdev)
214
215static void dpi_display_disable(struct omap_dss_device *dssdev)
216{ 212{
217 if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED) 213 dssdev->manager->disable(dssdev->manager);
218 return;
219
220 if (dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED)
221 dpi_display_resume(dssdev);
222
223 dssdev->driver->disable(dssdev);
224
225 dispc_enable_lcd_out(0);
226 214
227#ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL 215#ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL
228 dss_select_clk_source(0, 0); 216 dss_select_dispc_clk_source(DSS_SRC_DSS1_ALWON_FCLK);
229 dsi_pll_uninit(); 217 dsi_pll_uninit();
230 dss_clk_disable(DSS_CLK_FCK2); 218 dss_clk_disable(DSS_CLK_FCK2);
231#endif 219#endif
232 220
233 dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); 221 dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1);
234 222
235 dssdev->state = OMAP_DSS_DISPLAY_DISABLED; 223 if (cpu_is_omap34xx())
224 regulator_disable(dpi.vdds_dsi_reg);
236 225
237 omap_dss_stop_device(dssdev); 226 omap_dss_stop_device(dssdev);
238} 227}
228EXPORT_SYMBOL(omapdss_dpi_display_disable);
239 229
240static int dpi_display_suspend(struct omap_dss_device *dssdev) 230void dpi_set_timings(struct omap_dss_device *dssdev,
241{
242 if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE)
243 return -EINVAL;
244
245 DSSDBG("dpi_display_suspend\n");
246
247 if (dssdev->driver->suspend)
248 dssdev->driver->suspend(dssdev);
249
250 dispc_enable_lcd_out(0);
251
252 dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1);
253
254 dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
255
256 return 0;
257}
258
259static int dpi_display_resume(struct omap_dss_device *dssdev)
260{
261 if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED)
262 return -EINVAL;
263
264 DSSDBG("dpi_display_resume\n");
265
266 dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1);
267
268 dispc_enable_lcd_out(1);
269
270 if (dssdev->driver->resume)
271 dssdev->driver->resume(dssdev);
272
273 dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
274
275 return 0;
276}
277
278static void dpi_set_timings(struct omap_dss_device *dssdev,
279 struct omap_video_timings *timings) 231 struct omap_video_timings *timings)
280{ 232{
281 DSSDBG("dpi_set_timings\n"); 233 DSSDBG("dpi_set_timings\n");
@@ -285,8 +237,9 @@ static void dpi_set_timings(struct omap_dss_device *dssdev,
285 dispc_go(OMAP_DSS_CHANNEL_LCD); 237 dispc_go(OMAP_DSS_CHANNEL_LCD);
286 } 238 }
287} 239}
240EXPORT_SYMBOL(dpi_set_timings);
288 241
289static int dpi_check_timings(struct omap_dss_device *dssdev, 242int dpi_check_timings(struct omap_dss_device *dssdev,
290 struct omap_video_timings *timings) 243 struct omap_video_timings *timings)
291{ 244{
292 bool is_tft; 245 bool is_tft;
@@ -340,56 +293,25 @@ static int dpi_check_timings(struct omap_dss_device *dssdev,
340 293
341 return 0; 294 return 0;
342} 295}
343 296EXPORT_SYMBOL(dpi_check_timings);
344static void dpi_get_timings(struct omap_dss_device *dssdev,
345 struct omap_video_timings *timings)
346{
347 *timings = dssdev->panel.timings;
348}
349
350static int dpi_display_set_update_mode(struct omap_dss_device *dssdev,
351 enum omap_dss_update_mode mode)
352{
353 if (mode == OMAP_DSS_UPDATE_MANUAL)
354 return -EINVAL;
355
356 if (mode == OMAP_DSS_UPDATE_DISABLED) {
357 dispc_enable_lcd_out(0);
358 dpi.update_enabled = 0;
359 } else {
360 dispc_enable_lcd_out(1);
361 dpi.update_enabled = 1;
362 }
363
364 return 0;
365}
366
367static enum omap_dss_update_mode dpi_display_get_update_mode(
368 struct omap_dss_device *dssdev)
369{
370 return dpi.update_enabled ? OMAP_DSS_UPDATE_AUTO :
371 OMAP_DSS_UPDATE_DISABLED;
372}
373 297
374int dpi_init_display(struct omap_dss_device *dssdev) 298int dpi_init_display(struct omap_dss_device *dssdev)
375{ 299{
376 DSSDBG("init_display\n"); 300 DSSDBG("init_display\n");
377 301
378 dssdev->enable = dpi_display_enable;
379 dssdev->disable = dpi_display_disable;
380 dssdev->suspend = dpi_display_suspend;
381 dssdev->resume = dpi_display_resume;
382 dssdev->set_timings = dpi_set_timings;
383 dssdev->check_timings = dpi_check_timings;
384 dssdev->get_timings = dpi_get_timings;
385 dssdev->set_update_mode = dpi_display_set_update_mode;
386 dssdev->get_update_mode = dpi_display_get_update_mode;
387
388 return 0; 302 return 0;
389} 303}
390 304
391int dpi_init(void) 305int dpi_init(struct platform_device *pdev)
392{ 306{
307 if (cpu_is_omap34xx()) {
308 dpi.vdds_dsi_reg = dss_get_vdds_dsi();
309 if (IS_ERR(dpi.vdds_dsi_reg)) {
310 DSSERR("can't get VDDS_DSI regulator\n");
311 return PTR_ERR(dpi.vdds_dsi_reg);
312 }
313 }
314
393 return 0; 315 return 0;
394} 316}
395 317