diff options
Diffstat (limited to 'drivers/video/omap2/dss')
-rw-r--r-- | drivers/video/omap2/dss/dispc.c | 12 | ||||
-rw-r--r-- | drivers/video/omap2/dss/display.c | 14 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dpi.c | 102 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dsi.c | 136 | ||||
-rw-r--r-- | drivers/video/omap2/dss/rfbi.c | 22 | ||||
-rw-r--r-- | drivers/video/omap2/dss/sdi.c | 75 | ||||
-rw-r--r-- | drivers/video/omap2/dss/venc.c | 251 |
7 files changed, 146 insertions, 466 deletions
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 5a5c31c163c7..e777e352dbcd 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c @@ -2872,12 +2872,13 @@ static void dispc_error_worker(struct work_struct *work) manager = mgr; enable = mgr->device->state == OMAP_DSS_DISPLAY_ACTIVE; - mgr->device->disable(mgr->device); + mgr->device->driver->disable(mgr->device); break; } } if (manager) { + struct omap_dss_device *dssdev = manager->device; for (i = 0; i < omap_dss_get_num_overlays(); ++i) { struct omap_overlay *ovl; ovl = omap_dss_get_overlay(i); @@ -2892,7 +2893,7 @@ static void dispc_error_worker(struct work_struct *work) dispc_go(manager->id); mdelay(50); if (enable) - manager->device->enable(manager->device); + dssdev->driver->enable(dssdev); } } @@ -2910,12 +2911,13 @@ static void dispc_error_worker(struct work_struct *work) manager = mgr; enable = mgr->device->state == OMAP_DSS_DISPLAY_ACTIVE; - mgr->device->disable(mgr->device); + mgr->device->driver->disable(mgr->device); break; } } if (manager) { + struct omap_dss_device *dssdev = manager->device; for (i = 0; i < omap_dss_get_num_overlays(); ++i) { struct omap_overlay *ovl; ovl = omap_dss_get_overlay(i); @@ -2930,7 +2932,7 @@ static void dispc_error_worker(struct work_struct *work) dispc_go(manager->id); mdelay(50); if (enable) - manager->device->enable(manager->device); + dssdev->driver->enable(dssdev); } } @@ -2941,7 +2943,7 @@ static void dispc_error_worker(struct work_struct *work) mgr = omap_dss_get_overlay_manager(i); if (mgr->caps & OMAP_DSS_OVL_CAP_DISPC) - mgr->device->disable(mgr->device); + mgr->device->driver->disable(mgr->device); } } diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c index 86996d8d65be..29ec5a4a46bc 100644 --- a/drivers/video/omap2/dss/display.c +++ b/drivers/video/omap2/dss/display.c @@ -53,11 +53,11 @@ static ssize_t display_enabled_store(struct device *dev, if (enabled != (dssdev->state != OMAP_DSS_DISPLAY_DISABLED)) { if (enabled) { - r = dssdev->enable(dssdev); + r = dssdev->driver->enable(dssdev); if (r) return r; } else { - dssdev->disable(dssdev); + dssdev->driver->disable(dssdev); } } @@ -485,13 +485,13 @@ static int dss_suspend_device(struct device *dev, void *data) return 0; } - if (!dssdev->suspend) { + if (!dssdev->driver->suspend) { DSSERR("display '%s' doesn't implement suspend\n", dssdev->name); return -ENOSYS; } - r = dssdev->suspend(dssdev); + r = dssdev->driver->suspend(dssdev); if (r) return r; @@ -520,8 +520,8 @@ static int dss_resume_device(struct device *dev, void *data) int r; struct omap_dss_device *dssdev = to_dss_device(dev); - if (dssdev->activate_after_resume && dssdev->resume) { - r = dssdev->resume(dssdev); + if (dssdev->activate_after_resume && dssdev->driver->resume) { + r = dssdev->driver->resume(dssdev); if (r) return r; } @@ -541,7 +541,7 @@ int dss_resume_all_devices(void) static int dss_disable_device(struct device *dev, void *data) { struct omap_dss_device *dssdev = to_dss_device(dev); - dssdev->disable(dssdev); + dssdev->driver->disable(dssdev); return 0; } diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index 48ff7ea470aa..1eef8b72dbb9 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c @@ -153,7 +153,7 @@ static int dpi_basic_init(struct omap_dss_device *dssdev) return 0; } -static int dpi_display_enable(struct omap_dss_device *dssdev) +int omapdss_dpi_display_enable(struct omap_dss_device *dssdev) { int r; @@ -163,57 +163,42 @@ static int dpi_display_enable(struct omap_dss_device *dssdev) goto err0; } - if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { - DSSERR("display already enabled\n"); - r = -EINVAL; - goto err1; - } - if (cpu_is_omap34xx()) { r = regulator_enable(dpi.vdds_dsi_reg); if (r) - goto err2; + goto err1; } dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); r = dpi_basic_init(dssdev); if (r) - goto err3; + goto err2; #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL dss_clk_enable(DSS_CLK_FCK2); r = dsi_pll_init(dssdev, 0, 1); if (r) - goto err4; + goto err3; #endif r = dpi_set_mode(dssdev); if (r) - goto err5; + goto err4; mdelay(2); dssdev->manager->enable(dssdev->manager); - r = dssdev->driver->enable(dssdev); - if (r) - goto err6; - - dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; - return 0; -err6: - dssdev->manager->disable(dssdev->manager); -err5: +err4: #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL dsi_pll_uninit(); -err4: +err3: dss_clk_disable(DSS_CLK_FCK2); #endif -err3: - dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); err2: + dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); if (cpu_is_omap34xx()) regulator_disable(dpi.vdds_dsi_reg); err1: @@ -221,19 +206,10 @@ err1: err0: return r; } +EXPORT_SYMBOL(omapdss_dpi_display_enable); -static int dpi_display_resume(struct omap_dss_device *dssdev); - -static void dpi_display_disable(struct omap_dss_device *dssdev) +void omapdss_dpi_display_disable(struct omap_dss_device *dssdev) { - if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED) - return; - - if (dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) - dpi_display_resume(dssdev); - - dssdev->driver->disable(dssdev); - dssdev->manager->disable(dssdev->manager); #ifdef CONFIG_OMAP2_DSS_USE_DSI_PLL @@ -247,61 +223,9 @@ static void dpi_display_disable(struct omap_dss_device *dssdev) if (cpu_is_omap34xx()) regulator_disable(dpi.vdds_dsi_reg); - dssdev->state = OMAP_DSS_DISPLAY_DISABLED; - omap_dss_stop_device(dssdev); } - -static int dpi_display_suspend(struct omap_dss_device *dssdev) -{ - if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) - return -EINVAL; - - DSSDBG("dpi_display_suspend\n"); - - if (dssdev->driver->suspend) - dssdev->driver->suspend(dssdev); - - dssdev->manager->disable(dssdev->manager); - - dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); - - if (cpu_is_omap34xx()) - regulator_disable(dpi.vdds_dsi_reg); - - dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; - - return 0; -} - -static int dpi_display_resume(struct omap_dss_device *dssdev) -{ - int r; - - if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) - return -EINVAL; - - DSSDBG("dpi_display_resume\n"); - - if (cpu_is_omap34xx()) { - r = regulator_enable(dpi.vdds_dsi_reg); - if (r) - goto err0; - } - - dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); - - dssdev->manager->enable(dssdev->manager); - - if (dssdev->driver->resume) - dssdev->driver->resume(dssdev); - - dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; - - return 0; -err0: - return r; -} +EXPORT_SYMBOL(omapdss_dpi_display_disable); static void dpi_set_timings(struct omap_dss_device *dssdev, struct omap_video_timings *timings) @@ -379,10 +303,6 @@ int dpi_init_display(struct omap_dss_device *dssdev) { DSSDBG("init_display\n"); - dssdev->enable = dpi_display_enable; - dssdev->disable = dpi_display_disable; - dssdev->suspend = dpi_display_suspend; - dssdev->resume = dpi_display_resume; dssdev->set_timings = dpi_set_timings; dssdev->check_timings = dpi_check_timings; dssdev->get_timings = dpi_get_timings; diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index 203b18bbddae..41cdefbaf7f3 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c @@ -3106,18 +3106,7 @@ static int dsi_display_init_dsi(struct omap_dss_device *dssdev) dsi_if_enable(1); dsi_force_tx_stop_mode_io(); - if (dssdev->driver->enable) { - r = dssdev->driver->enable(dssdev); - if (r) - goto err4; - } - - /* enable high-speed after initial config */ - omapdss_dsi_vc_enable_hs(0, 1); - return 0; -err4: - dsi_if_enable(0); err3: dsi_complexio_uninit(); err2: @@ -3131,9 +3120,6 @@ err0: static void dsi_display_uninit_dsi(struct omap_dss_device *dssdev) { - if (dssdev->driver->disable) - dssdev->driver->disable(dssdev); - dss_select_dispc_clk_source(DSS_SRC_DSS1_ALWON_FCLK); dss_select_dsi_clk_source(DSS_SRC_DSS1_ALWON_FCLK); dsi_complexio_uninit(); @@ -3156,14 +3142,15 @@ static int dsi_core_init(void) return 0; } -static int dsi_display_enable(struct omap_dss_device *dssdev) +int omapdss_dsi_display_enable(struct omap_dss_device *dssdev) { int r = 0; DSSDBG("dsi_display_enable\n"); + WARN_ON(!dsi_bus_is_locked()); + mutex_lock(&dsi.lock); - dsi_bus_lock(); r = omap_dss_start_device(dssdev); if (r) { @@ -3171,90 +3158,49 @@ static int dsi_display_enable(struct omap_dss_device *dssdev) goto err0; } - if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { - DSSERR("dssdev already enabled\n"); - r = -EINVAL; - goto err1; - } - enable_clocks(1); dsi_enable_pll_clock(1); r = _dsi_reset(); if (r) - goto err2; + goto err1; dsi_core_init(); r = dsi_display_init_dispc(dssdev); if (r) - goto err2; + goto err1; r = dsi_display_init_dsi(dssdev); if (r) - goto err3; - - dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; + goto err2; dsi.use_ext_te = dssdev->phy.dsi.ext_te; - dsi_bus_unlock(); mutex_unlock(&dsi.lock); return 0; -err3: - dsi_display_uninit_dispc(dssdev); err2: + dsi_display_uninit_dispc(dssdev); +err1: enable_clocks(0); dsi_enable_pll_clock(0); -err1: omap_dss_stop_device(dssdev); err0: - dsi_bus_unlock(); mutex_unlock(&dsi.lock); DSSDBG("dsi_display_enable FAILED\n"); return r; } +EXPORT_SYMBOL(omapdss_dsi_display_enable); -static void dsi_display_disable(struct omap_dss_device *dssdev) +void omapdss_dsi_display_disable(struct omap_dss_device *dssdev) { DSSDBG("dsi_display_disable\n"); - mutex_lock(&dsi.lock); - dsi_bus_lock(); - - if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED || - dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) - goto end; - - dssdev->state = OMAP_DSS_DISPLAY_DISABLED; - - dsi_display_uninit_dispc(dssdev); - - dsi_display_uninit_dsi(dssdev); - - enable_clocks(0); - dsi_enable_pll_clock(0); - - omap_dss_stop_device(dssdev); -end: - dsi_bus_unlock(); - mutex_unlock(&dsi.lock); -} - -static int dsi_display_suspend(struct omap_dss_device *dssdev) -{ - DSSDBG("dsi_display_suspend\n"); + WARN_ON(!dsi_bus_is_locked()); mutex_lock(&dsi.lock); - dsi_bus_lock(); - - if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED || - dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) - goto end; - - dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; dsi_display_uninit_dispc(dssdev); @@ -3262,63 +3208,12 @@ static int dsi_display_suspend(struct omap_dss_device *dssdev) enable_clocks(0); dsi_enable_pll_clock(0); -end: - dsi_bus_unlock(); - mutex_unlock(&dsi.lock); - return 0; -} - -static int dsi_display_resume(struct omap_dss_device *dssdev) -{ - int r; - - DSSDBG("dsi_display_resume\n"); - - mutex_lock(&dsi.lock); - dsi_bus_lock(); - - if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) { - DSSERR("dssdev not suspended\n"); - r = -EINVAL; - goto err0; - } - - enable_clocks(1); - dsi_enable_pll_clock(1); - - r = _dsi_reset(); - if (r) - goto err1; - - dsi_core_init(); - - r = dsi_display_init_dispc(dssdev); - if (r) - goto err1; - - r = dsi_display_init_dsi(dssdev); - if (r) - goto err2; - - dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; - - dsi_bus_unlock(); - mutex_unlock(&dsi.lock); - - return 0; + omap_dss_stop_device(dssdev); -err2: - dsi_display_uninit_dispc(dssdev); -err1: - enable_clocks(0); - dsi_enable_pll_clock(0); -err0: - dsi_bus_unlock(); mutex_unlock(&dsi.lock); - DSSDBG("dsi_display_resume FAILED\n"); - return r; } +EXPORT_SYMBOL(omapdss_dsi_display_disable); int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable) { @@ -3344,11 +3239,6 @@ int dsi_init_display(struct omap_dss_device *dssdev) { DSSDBG("DSI init\n"); - dssdev->enable = dsi_display_enable; - dssdev->disable = dsi_display_disable; - dssdev->suspend = dsi_display_suspend; - dssdev->resume = dsi_display_resume; - /* XXX these should be figured out dynamically */ dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE | OMAP_DSS_DISPLAY_CAP_TEAR_ELIM; diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c index a6b33160666a..cc23f53cc62d 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/omap2/dss/rfbi.c @@ -1001,8 +1001,7 @@ void rfbi_exit(void) iounmap(rfbi.base); } -/* struct omap_display support */ -static int rfbi_display_enable(struct omap_dss_device *dssdev) +int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev) { int r; @@ -1033,38 +1032,25 @@ static int rfbi_display_enable(struct omap_dss_device *dssdev) &dssdev->ctrl.rfbi_timings); - if (dssdev->driver->enable) { - r = dssdev->driver->enable(dssdev); - if (r) - goto err2; - } - return 0; -err2: - omap_dispc_unregister_isr(framedone_callback, NULL, - DISPC_IRQ_FRAMEDONE); err1: omap_dss_stop_device(dssdev); err0: return r; } +EXPORT_SYMBOL(omapdss_rfbi_display_enable); -static void rfbi_display_disable(struct omap_dss_device *dssdev) +void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev) { - dssdev->driver->disable(dssdev); omap_dispc_unregister_isr(framedone_callback, NULL, DISPC_IRQ_FRAMEDONE); omap_dss_stop_device(dssdev); } +EXPORT_SYMBOL(omapdss_rfbi_display_disable); int rfbi_init_display(struct omap_dss_device *dssdev) { - dssdev->enable = rfbi_display_enable; - dssdev->disable = rfbi_display_disable; - rfbi.dssdev[dssdev->phy.rfbi.channel] = dssdev; - dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE; - return 0; } diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c index 6bd9b0cf76a8..929ceb3ddd9d 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) dispc_lcd_enable_signal_polarity(1); } -static int sdi_display_enable(struct omap_dss_device *dssdev) +int omapdss_sdi_display_enable(struct omap_dss_device *dssdev) { struct omap_video_timings *t = &dssdev->panel.timings; struct dss_clock_info dss_cinfo; @@ -57,12 +57,6 @@ static int sdi_display_enable(struct omap_dss_device *dssdev) goto err0; } - if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { - DSSERR("dssdev already enabled\n"); - r = -EINVAL; - goto err1; - } - /* In case of skip_init sdi_init has already enabled the clocks */ if (!sdi.skip_init) dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); @@ -127,8 +121,6 @@ static int sdi_display_enable(struct omap_dss_device *dssdev) goto err3; } - dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; - sdi.skip_init = 0; return 0; @@ -141,18 +133,10 @@ err1: err0: return r; } +EXPORT_SYMBOL(omapdss_sdi_display_enable); -static int sdi_display_resume(struct omap_dss_device *dssdev); - -static void sdi_display_disable(struct omap_dss_device *dssdev) +void omapdss_sdi_display_disable(struct omap_dss_device *dssdev) { - if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED) - return; - - if (dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) - if (sdi_display_resume(dssdev)) - return; - if (dssdev->driver->disable) dssdev->driver->disable(dssdev); @@ -162,56 +146,9 @@ static void sdi_display_disable(struct omap_dss_device *dssdev) dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); - dssdev->state = OMAP_DSS_DISPLAY_DISABLED; - omap_dss_stop_device(dssdev); } - -static int sdi_display_suspend(struct omap_dss_device *dssdev) -{ - if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) - return -EINVAL; - - if (dssdev->driver->suspend) - dssdev->driver->suspend(dssdev); - - dssdev->manager->disable(dssdev->manager); - - dss_sdi_disable(); - - dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); - - dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; - - return 0; -} - -static int sdi_display_resume(struct omap_dss_device *dssdev) -{ - int r; - - if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) - return -EINVAL; - - dss_clk_enable(DSS_CLK_ICK | DSS_CLK_FCK1); - - r = dss_sdi_enable(); - if (r) - goto err; - mdelay(2); - - dssdev->manager->enable(dssdev->manager); - - if (dssdev->driver->resume) - dssdev->driver->resume(dssdev); - - dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; - - return 0; -err: - dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK1); - return r; -} +EXPORT_SYMBOL(omapdss_sdi_display_disable); static void sdi_get_timings(struct omap_dss_device *dssdev, struct omap_video_timings *timings) @@ -223,10 +160,6 @@ int sdi_init_display(struct omap_dss_device *dssdev) { DSSDBG("SDI init\n"); - dssdev->enable = sdi_display_enable; - dssdev->disable = sdi_display_disable; - dssdev->suspend = sdi_display_suspend; - dssdev->resume = sdi_display_resume; dssdev->get_timings = sdi_get_timings; return 0; diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 0d0dc94417fc..a0ab52c841ee 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c @@ -400,6 +400,56 @@ static const struct venc_config *venc_timings_to_config( BUG(); } +static void venc_power_on(struct omap_dss_device *dssdev) +{ + u32 l; + + venc_enable_clocks(1); + + venc_reset(); + venc_write_config(venc_timings_to_config(&dssdev->panel.timings)); + + dss_set_venc_output(dssdev->phy.venc.type); + dss_set_dac_pwrdn_bgz(1); + + l = 0; + + if (dssdev->phy.venc.type == OMAP_DSS_VENC_TYPE_COMPOSITE) + l |= 1 << 1; + else /* S-Video */ + l |= (1 << 0) | (1 << 2); + + if (dssdev->phy.venc.invert_polarity == false) + l |= 1 << 3; + + venc_write_reg(VENC_OUTPUT_CONTROL, l); + + dispc_set_digit_size(dssdev->panel.timings.x_res, + dssdev->panel.timings.y_res/2); + + regulator_enable(venc.vdda_dac_reg); + + if (dssdev->platform_enable) + dssdev->platform_enable(dssdev); + + dssdev->manager->enable(dssdev->manager); +} + +static void venc_power_off(struct omap_dss_device *dssdev) +{ + venc_write_reg(VENC_OUTPUT_CONTROL, 0); + dss_set_dac_pwrdn_bgz(0); + + dssdev->manager->disable(dssdev->manager); + + if (dssdev->platform_disable) + dssdev->platform_disable(dssdev); + + regulator_disable(venc.vdda_dac_reg); + + venc_enable_clocks(0); +} + @@ -420,23 +470,66 @@ static int venc_panel_enable(struct omap_dss_device *dssdev) { int r = 0; + DSSDBG("venc_enable_display\n"); + + mutex_lock(&venc.venc_lock); + + if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { + r = -EINVAL; + goto err1; + } + + if (dssdev->platform_enable) { + r = dssdev->platform_enable(dssdev); + if (r) + goto err2; + } + + venc_power_on(dssdev); + + venc.wss_data = 0; + + dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; + /* wait couple of vsyncs until enabling the LCD */ msleep(50); - if (dssdev->platform_enable) - r = dssdev->platform_enable(dssdev); + mutex_unlock(&venc.venc_lock); return r; +err2: + venc_power_off(dssdev); +err1: + mutex_unlock(&venc.venc_lock); + return r; } static void venc_panel_disable(struct omap_dss_device *dssdev) { - if (dssdev->platform_disable) - dssdev->platform_disable(dssdev); + DSSDBG("venc_disable_display\n"); - /* wait at least 5 vsyncs after disabling the LCD */ + mutex_lock(&venc.venc_lock); + + if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED) + goto end; + if (dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) { + /* suspended is the same as disabled with venc */ + dssdev->state = OMAP_DSS_DISPLAY_DISABLED; + goto end; + } + + venc_power_off(dssdev); + + /* wait at least 5 vsyncs after disabling the LCD */ msleep(100); + + if (dssdev->platform_disable) + dssdev->platform_disable(dssdev); + + dssdev->state = OMAP_DSS_DISPLAY_DISABLED; +end: + mutex_unlock(&venc.venc_lock); } static int venc_panel_suspend(struct omap_dss_device *dssdev) @@ -526,146 +619,6 @@ void venc_exit(void) iounmap(venc.base); } -static void venc_power_on(struct omap_dss_device *dssdev) -{ - u32 l; - - venc_enable_clocks(1); - - venc_reset(); - venc_write_config(venc_timings_to_config(&dssdev->panel.timings)); - - dss_set_venc_output(dssdev->phy.venc.type); - dss_set_dac_pwrdn_bgz(1); - - l = 0; - - if (dssdev->phy.venc.type == OMAP_DSS_VENC_TYPE_COMPOSITE) - l |= 1 << 1; - else /* S-Video */ - l |= (1 << 0) | (1 << 2); - - if (dssdev->phy.venc.invert_polarity == false) - l |= 1 << 3; - - venc_write_reg(VENC_OUTPUT_CONTROL, l); - - dispc_set_digit_size(dssdev->panel.timings.x_res, - dssdev->panel.timings.y_res/2); - - regulator_enable(venc.vdda_dac_reg); - - if (dssdev->platform_enable) - dssdev->platform_enable(dssdev); - - dssdev->manager->enable(dssdev->manager); -} - -static void venc_power_off(struct omap_dss_device *dssdev) -{ - venc_write_reg(VENC_OUTPUT_CONTROL, 0); - dss_set_dac_pwrdn_bgz(0); - - dssdev->manager->disable(dssdev->manager); - - if (dssdev->platform_disable) - dssdev->platform_disable(dssdev); - - regulator_disable(venc.vdda_dac_reg); - - venc_enable_clocks(0); -} - -static int venc_enable_display(struct omap_dss_device *dssdev) -{ - int r = 0; - - DSSDBG("venc_enable_display\n"); - - mutex_lock(&venc.venc_lock); - - if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) { - r = -EINVAL; - goto err; - } - - venc_power_on(dssdev); - - venc.wss_data = 0; - - dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; -err: - mutex_unlock(&venc.venc_lock); - - return r; -} - -static void venc_disable_display(struct omap_dss_device *dssdev) -{ - DSSDBG("venc_disable_display\n"); - - mutex_lock(&venc.venc_lock); - - if (dssdev->state == OMAP_DSS_DISPLAY_DISABLED) - goto end; - - if (dssdev->state == OMAP_DSS_DISPLAY_SUSPENDED) { - /* suspended is the same as disabled with venc */ - dssdev->state = OMAP_DSS_DISPLAY_DISABLED; - goto end; - } - - venc_power_off(dssdev); - - dssdev->state = OMAP_DSS_DISPLAY_DISABLED; -end: - mutex_unlock(&venc.venc_lock); -} - -static int venc_display_suspend(struct omap_dss_device *dssdev) -{ - int r = 0; - - DSSDBG("venc_display_suspend\n"); - - mutex_lock(&venc.venc_lock); - - if (dssdev->state != OMAP_DSS_DISPLAY_ACTIVE) { - r = -EINVAL; - goto err; - } - - venc_power_off(dssdev); - - dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED; -err: - mutex_unlock(&venc.venc_lock); - - return r; -} - -static int venc_display_resume(struct omap_dss_device *dssdev) -{ - int r = 0; - - DSSDBG("venc_display_resume\n"); - - mutex_lock(&venc.venc_lock); - - if (dssdev->state != OMAP_DSS_DISPLAY_SUSPENDED) { - r = -EINVAL; - goto err; - } - - venc_power_on(dssdev); - - dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; -err: - mutex_unlock(&venc.venc_lock); - - return r; -} - static void venc_get_timings(struct omap_dss_device *dssdev, struct omap_video_timings *timings) { @@ -684,8 +637,8 @@ static void venc_set_timings(struct omap_dss_device *dssdev, dssdev->panel.timings = *timings; if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { /* turn the venc off and on to get new timings to use */ - venc_disable_display(dssdev); - venc_enable_display(dssdev); + venc_panel_disable(dssdev); + venc_panel_enable(dssdev); } } @@ -738,10 +691,6 @@ int venc_init_display(struct omap_dss_device *dssdev) { DSSDBG("init_display\n"); - dssdev->enable = venc_enable_display; - dssdev->disable = venc_disable_display; - dssdev->suspend = venc_display_suspend; - dssdev->resume = venc_display_resume; dssdev->get_timings = venc_get_timings; dssdev->set_timings = venc_set_timings; dssdev->check_timings = venc_check_timings; |