Merge branch 'for-torvalds' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[pandora-kernel.git] / drivers / video / omap2 / dss / venc.c
index 8e35a5b..980f919 100644 (file)
@@ -34,7 +34,7 @@
 #include <linux/platform_device.h>
 #include <linux/regulator/consumer.h>
 
-#include <plat/display.h>
+#include <video/omapdss.h>
 #include <plat/cpu.h>
 
 #include "dss.h"
@@ -373,8 +373,11 @@ static void venc_reset(void)
                }
        }
 
+#ifdef CONFIG_OMAP2_DSS_SLEEP_AFTER_VENC_RESET
        /* the magical sleep that makes things work */
+       /* XXX more info? What bug this circumvents? */
        msleep(20);
+#endif
 }
 
 static void venc_enable_clocks(int enable)
@@ -473,6 +476,12 @@ static int venc_panel_enable(struct omap_dss_device *dssdev)
 
        mutex_lock(&venc.venc_lock);
 
+       r = omap_dss_start_device(dssdev);
+       if (r) {
+               DSSERR("failed to start device\n");
+               goto err0;
+       }
+
        if (dssdev->state != OMAP_DSS_DISPLAY_DISABLED) {
                r = -EINVAL;
                goto err1;
@@ -484,10 +493,11 @@ static int venc_panel_enable(struct omap_dss_device *dssdev)
 
        dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
 
-       /* wait couple of vsyncs until enabling the LCD */
-       msleep(50);
-
+       mutex_unlock(&venc.venc_lock);
+       return 0;
 err1:
+       omap_dss_stop_device(dssdev);
+err0:
        mutex_unlock(&venc.venc_lock);
 
        return r;
@@ -510,10 +520,9 @@ static void venc_panel_disable(struct omap_dss_device *dssdev)
 
        venc_power_off(dssdev);
 
-       /* wait at least 5 vsyncs after disabling the LCD */
-       msleep(100);
-
        dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
+
+       omap_dss_stop_device(dssdev);
 end:
        mutex_unlock(&venc.venc_lock);
 }