[media] exynos4-is: Set valid initial format on FIMC.n subdevs
authorSylwester Nawrocki <s.nawrocki@samsung.com>
Tue, 18 Jun 2013 17:56:11 +0000 (14:56 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 28 Jun 2013 18:33:02 +0000 (15:33 -0300)
Ensure there are valid initial image formats on the FIMC.n subdev pads.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/platform/exynos4-is/fimc-capture.c
drivers/media/platform/exynos4-is/fimc-core.h

index 2b045b6db5693289952bccef6149adca4c33fa64..fb27ff7e1e0750e33215b96ee100c9ad569fd9dd 100644 (file)
@@ -1722,8 +1722,8 @@ static int fimc_capture_set_default_format(struct fimc_dev *fimc)
        struct v4l2_format fmt = {
                .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
                .fmt.pix_mp = {
-                       .width          = 640,
-                       .height         = 480,
+                       .width          = FIMC_DEFAULT_WIDTH,
+                       .height         = FIMC_DEFAULT_HEIGHT,
                        .pixelformat    = V4L2_PIX_FMT_YUYV,
                        .field          = V4L2_FIELD_NONE,
                        .colorspace     = V4L2_COLORSPACE_JPEG,
@@ -1741,6 +1741,7 @@ static int fimc_register_capture_device(struct fimc_dev *fimc,
        struct vb2_queue *q = &fimc->vid_cap.vbq;
        struct fimc_ctx *ctx;
        struct fimc_vid_cap *vid_cap;
+       struct fimc_fmt *fmt;
        int ret = -ENOMEM;
 
        ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
@@ -1788,6 +1789,20 @@ static int fimc_register_capture_device(struct fimc_dev *fimc,
        if (ret)
                goto err_free_ctx;
 
+       /* Default format configuration */
+       fmt = fimc_find_format(NULL, NULL, FMT_FLAGS_CAM, 0);
+       vid_cap->ci_fmt.width = FIMC_DEFAULT_WIDTH;
+       vid_cap->ci_fmt.height = FIMC_DEFAULT_HEIGHT;
+       vid_cap->ci_fmt.code = fmt->mbus_code;
+
+       ctx->s_frame.width = FIMC_DEFAULT_WIDTH;
+       ctx->s_frame.height = FIMC_DEFAULT_HEIGHT;
+       ctx->s_frame.fmt = fmt;
+
+       fmt = fimc_find_format(NULL, NULL, FMT_FLAGS_WRITEBACK, 0);
+       vid_cap->wb_fmt = vid_cap->ci_fmt;
+       vid_cap->wb_fmt.code = fmt->mbus_code;
+
        vid_cap->vd_pad.flags = MEDIA_PAD_FL_SINK;
        ret = media_entity_init(&vfd->entity, 1, &vid_cap->vd_pad, 0);
        if (ret)
index 349c7c01e49a81d0578ebe510fb98d8f4d811a5a..3d376faec777d1781434cdbf5526301f50b98271 100644 (file)
@@ -48,6 +48,8 @@
 #define FIMC_DEF_MIN_SIZE      16
 #define FIMC_DEF_HEIGHT_ALIGN  2
 #define FIMC_DEF_HOR_OFFS_ALIGN        1
+#define FIMC_DEFAULT_WIDTH     640
+#define FIMC_DEFAULT_HEIGHT    480
 
 /* indices to the clocks array */
 enum {