Merge branch 'fbdev-next' of git://github.com/schandinat/linux-2.6
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / media / video / omap / omap_vout.c
index 9c5c19f..a378c2c 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/irq.h>
 #include <linux/videodev2.h>
 #include <linux/dma-mapping.h>
+#include <linux/slab.h>
 
 #include <media/videobuf-dma-contig.h>
 #include <media/v4l2-device.h>
@@ -69,9 +70,9 @@ static u32 video1_numbuffers = 3;
 static u32 video2_numbuffers = 3;
 static u32 video1_bufsize = OMAP_VOUT_MAX_BUF_SIZE;
 static u32 video2_bufsize = OMAP_VOUT_MAX_BUF_SIZE;
-static u32 vid1_static_vrfb_alloc;
-static u32 vid2_static_vrfb_alloc;
-static int debug;
+static bool vid1_static_vrfb_alloc;
+static bool vid2_static_vrfb_alloc;
+static bool debug;
 
 /* Module parameters */
 module_param(video1_numbuffers, uint, S_IRUGO);
@@ -423,7 +424,7 @@ static int omapvid_setup_overlay(struct omap_vout_device *vout,
                "%s enable=%d addr=%x width=%d\n height=%d color_mode=%d\n"
                "rotation=%d mirror=%d posx=%d posy=%d out_width = %d \n"
                "out_height=%d rotation_type=%d screen_width=%d\n",
-               __func__, info.enabled, info.paddr, info.width, info.height,
+               __func__, ovl->is_enabled(ovl), info.paddr, info.width, info.height,
                info.color_mode, info.rotation, info.mirror, info.pos_x,
                info.pos_y, info.out_width, info.out_height, info.rotation_type,
                info.screen_width);
@@ -942,12 +943,8 @@ static int omap_vout_release(struct file *file)
        /* Disable all the overlay managers connected with this interface */
        for (i = 0; i < ovid->num_overlays; i++) {
                struct omap_overlay *ovl = ovid->overlays[i];
-               if (ovl->manager && ovl->manager->device) {
-                       struct omap_overlay_info info;
-                       ovl->get_overlay_info(ovl, &info);
-                       info.enabled = 0;
-                       ovl->set_overlay_info(ovl, &info);
-               }
+               if (ovl->manager && ovl->manager->device)
+                       ovl->disable(ovl);
        }
        /* Turn off the pipeline */
        ret = omapvid_apply_changes(vout);
@@ -1667,7 +1664,6 @@ static int vidioc_streamon(struct file *file, void *fh, enum v4l2_buf_type i)
                if (ovl->manager && ovl->manager->device) {
                        struct omap_overlay_info info;
                        ovl->get_overlay_info(ovl, &info);
-                       info.enabled = 1;
                        info.paddr = addr;
                        if (ovl->set_overlay_info(ovl, &info)) {
                                ret = -EINVAL;
@@ -1686,6 +1682,16 @@ static int vidioc_streamon(struct file *file, void *fh, enum v4l2_buf_type i)
        if (ret)
                v4l2_err(&vout->vid_dev->v4l2_dev, "failed to change mode\n");
 
+       for (j = 0; j < ovid->num_overlays; j++) {
+               struct omap_overlay *ovl = ovid->overlays[j];
+
+               if (ovl->manager && ovl->manager->device) {
+                       ret = ovl->enable(ovl);
+                       if (ret)
+                               goto streamon_err1;
+               }
+       }
+
        ret = 0;
 
 streamon_err1:
@@ -1715,16 +1721,8 @@ static int vidioc_streamoff(struct file *file, void *fh, enum v4l2_buf_type i)
        for (j = 0; j < ovid->num_overlays; j++) {
                struct omap_overlay *ovl = ovid->overlays[j];
 
-               if (ovl->manager && ovl->manager->device) {
-                       struct omap_overlay_info info;
-
-                       ovl->get_overlay_info(ovl, &info);
-                       info.enabled = 0;
-                       ret = ovl->set_overlay_info(ovl, &info);
-                       if (ret)
-                               v4l2_err(&vout->vid_dev->v4l2_dev,
-                               "failed to update overlay info in streamoff\n");
-               }
+               if (ovl->manager && ovl->manager->device)
+                       ovl->disable(ovl);
        }
 
        /* Turn of the pipeline */
@@ -2169,6 +2167,14 @@ static int __init omap_vout_probe(struct platform_device *pdev)
        vid_dev->num_displays = 0;
        for_each_dss_dev(dssdev) {
                omap_dss_get_device(dssdev);
+
+               if (!dssdev->driver) {
+                       dev_warn(&pdev->dev, "no driver for display: %s\n",
+                                       dssdev->name);
+                       omap_dss_put_device(dssdev);
+                       continue;
+               }
+
                vid_dev->displays[vid_dev->num_displays++] = dssdev;
        }