aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2013-03-20 14:31:03 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-04 19:23:24 -0400
commite90ad659cde4d11ccbc935adcfe018799afcc22d (patch)
tree6210875ebfa690b63a44e8eba5799ca756310de3
parent9c8399c86cbfce767fb32459f8e0eb33e087f910 (diff)
[media] exynos4-is: Allow colorspace conversion at FIMC-LITE
The FIMC-LITE output DMA allows to configure different YUV order than the order at the camera input interface. Thus there is some limited colorspace conversion possible. This patch makes the color format variable be per FIMC-LITE input/output, rather than a global per device. This also fixes incorrect behavior where color format at the FIMC-LITE.N subdev's source pad is modified by VIDIOC_S_FMT ioctl on the related video node. YUV order definitions are corrected so that we use notation: | byte3 | byte2 | byte1 | byte0 -------+-------+-------+-------+------ YCBYCR | CR | Y | CB | Y YCRYCB | CB | Y | CR | Y CBYCRY | Y | CR | Y | CB CRYCBY | Y | CB | Y | CR 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>
-rw-r--r--drivers/media/platform/exynos4-is/fimc-lite-reg.c4
-rw-r--r--drivers/media/platform/exynos4-is/fimc-lite-reg.h8
-rw-r--r--drivers/media/platform/exynos4-is/fimc-lite.c76
-rw-r--r--drivers/media/platform/exynos4-is/fimc-lite.h4
-rw-r--r--include/media/s5p_fimc.h2
5 files changed, 61 insertions, 33 deletions
diff --git a/drivers/media/platform/exynos4-is/fimc-lite-reg.c b/drivers/media/platform/exynos4-is/fimc-lite-reg.c
index ac9663ce2a49..8cc0d39a2fea 100644
--- a/drivers/media/platform/exynos4-is/fimc-lite-reg.c
+++ b/drivers/media/platform/exynos4-is/fimc-lite-reg.c
@@ -127,7 +127,7 @@ static const u32 src_pixfmt_map[8][3] = {
127/* Set camera input pixel format and resolution */ 127/* Set camera input pixel format and resolution */
128void flite_hw_set_source_format(struct fimc_lite *dev, struct flite_frame *f) 128void flite_hw_set_source_format(struct fimc_lite *dev, struct flite_frame *f)
129{ 129{
130 enum v4l2_mbus_pixelcode pixelcode = dev->fmt->mbus_code; 130 enum v4l2_mbus_pixelcode pixelcode = f->fmt->mbus_code;
131 int i = ARRAY_SIZE(src_pixfmt_map); 131 int i = ARRAY_SIZE(src_pixfmt_map);
132 u32 cfg; 132 u32 cfg;
133 133
@@ -227,7 +227,7 @@ static void flite_hw_set_out_order(struct fimc_lite *dev, struct flite_frame *f)
227 int i = ARRAY_SIZE(pixcode); 227 int i = ARRAY_SIZE(pixcode);
228 228
229 while (--i >= 0) 229 while (--i >= 0)
230 if (pixcode[i][0] == dev->fmt->mbus_code) 230 if (pixcode[i][0] == f->fmt->mbus_code)
231 break; 231 break;
232 cfg &= ~FLITE_REG_CIODMAFMT_YCBCR_ORDER_MASK; 232 cfg &= ~FLITE_REG_CIODMAFMT_YCBCR_ORDER_MASK;
233 writel(cfg | pixcode[i][1], dev->regs + FLITE_REG_CIODMAFMT); 233 writel(cfg | pixcode[i][1], dev->regs + FLITE_REG_CIODMAFMT);
diff --git a/drivers/media/platform/exynos4-is/fimc-lite-reg.h b/drivers/media/platform/exynos4-is/fimc-lite-reg.h
index 0e345844c13a..390383941c19 100644
--- a/drivers/media/platform/exynos4-is/fimc-lite-reg.h
+++ b/drivers/media/platform/exynos4-is/fimc-lite-reg.h
@@ -72,10 +72,10 @@
72#define FLITE_REG_CIODMAFMT 0x18 72#define FLITE_REG_CIODMAFMT 0x18
73#define FLITE_REG_CIODMAFMT_RAW_CON (1 << 15) 73#define FLITE_REG_CIODMAFMT_RAW_CON (1 << 15)
74#define FLITE_REG_CIODMAFMT_PACK12 (1 << 14) 74#define FLITE_REG_CIODMAFMT_PACK12 (1 << 14)
75#define FLITE_REG_CIODMAFMT_CRYCBY (0 << 4) 75#define FLITE_REG_CIODMAFMT_YCBYCR (0 << 4)
76#define FLITE_REG_CIODMAFMT_CBYCRY (1 << 4) 76#define FLITE_REG_CIODMAFMT_YCRYCB (1 << 4)
77#define FLITE_REG_CIODMAFMT_YCRYCB (2 << 4) 77#define FLITE_REG_CIODMAFMT_CBYCRY (2 << 4)
78#define FLITE_REG_CIODMAFMT_YCBYCR (3 << 4) 78#define FLITE_REG_CIODMAFMT_CRYCBY (3 << 4)
79#define FLITE_REG_CIODMAFMT_YCBCR_ORDER_MASK (0x3 << 4) 79#define FLITE_REG_CIODMAFMT_YCBCR_ORDER_MASK (0x3 << 4)
80 80
81/* Camera Output Canvas */ 81/* Camera Output Canvas */
diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c
index ba35328aaec5..b11e3583b9fa 100644
--- a/drivers/media/platform/exynos4-is/fimc-lite.c
+++ b/drivers/media/platform/exynos4-is/fimc-lite.c
@@ -46,6 +46,7 @@ static const struct fimc_fmt fimc_lite_formats[] = {
46 .color = FIMC_FMT_YCBYCR422, 46 .color = FIMC_FMT_YCBYCR422,
47 .memplanes = 1, 47 .memplanes = 1,
48 .mbus_code = V4L2_MBUS_FMT_YUYV8_2X8, 48 .mbus_code = V4L2_MBUS_FMT_YUYV8_2X8,
49 .flags = FMT_FLAGS_YUV,
49 }, { 50 }, {
50 .name = "YUV 4:2:2 packed, CbYCrY", 51 .name = "YUV 4:2:2 packed, CbYCrY",
51 .fourcc = V4L2_PIX_FMT_UYVY, 52 .fourcc = V4L2_PIX_FMT_UYVY,
@@ -53,6 +54,7 @@ static const struct fimc_fmt fimc_lite_formats[] = {
53 .color = FIMC_FMT_CBYCRY422, 54 .color = FIMC_FMT_CBYCRY422,
54 .memplanes = 1, 55 .memplanes = 1,
55 .mbus_code = V4L2_MBUS_FMT_UYVY8_2X8, 56 .mbus_code = V4L2_MBUS_FMT_UYVY8_2X8,
57 .flags = FMT_FLAGS_YUV,
56 }, { 58 }, {
57 .name = "YUV 4:2:2 packed, CrYCbY", 59 .name = "YUV 4:2:2 packed, CrYCbY",
58 .fourcc = V4L2_PIX_FMT_VYUY, 60 .fourcc = V4L2_PIX_FMT_VYUY,
@@ -60,6 +62,7 @@ static const struct fimc_fmt fimc_lite_formats[] = {
60 .color = FIMC_FMT_CRYCBY422, 62 .color = FIMC_FMT_CRYCBY422,
61 .memplanes = 1, 63 .memplanes = 1,
62 .mbus_code = V4L2_MBUS_FMT_VYUY8_2X8, 64 .mbus_code = V4L2_MBUS_FMT_VYUY8_2X8,
65 .flags = FMT_FLAGS_YUV,
63 }, { 66 }, {
64 .name = "YUV 4:2:2 packed, YCrYCb", 67 .name = "YUV 4:2:2 packed, YCrYCb",
65 .fourcc = V4L2_PIX_FMT_YVYU, 68 .fourcc = V4L2_PIX_FMT_YVYU,
@@ -67,6 +70,7 @@ static const struct fimc_fmt fimc_lite_formats[] = {
67 .color = FIMC_FMT_YCRYCB422, 70 .color = FIMC_FMT_YCRYCB422,
68 .memplanes = 1, 71 .memplanes = 1,
69 .mbus_code = V4L2_MBUS_FMT_YVYU8_2X8, 72 .mbus_code = V4L2_MBUS_FMT_YVYU8_2X8,
73 .flags = FMT_FLAGS_YUV,
70 }, { 74 }, {
71 .name = "RAW8 (GRBG)", 75 .name = "RAW8 (GRBG)",
72 .fourcc = V4L2_PIX_FMT_SGRBG8, 76 .fourcc = V4L2_PIX_FMT_SGRBG8,
@@ -74,6 +78,7 @@ static const struct fimc_fmt fimc_lite_formats[] = {
74 .color = FIMC_FMT_RAW8, 78 .color = FIMC_FMT_RAW8,
75 .memplanes = 1, 79 .memplanes = 1,
76 .mbus_code = V4L2_MBUS_FMT_SGRBG8_1X8, 80 .mbus_code = V4L2_MBUS_FMT_SGRBG8_1X8,
81 .flags = FMT_FLAGS_RAW_BAYER,
77 }, { 82 }, {
78 .name = "RAW10 (GRBG)", 83 .name = "RAW10 (GRBG)",
79 .fourcc = V4L2_PIX_FMT_SGRBG10, 84 .fourcc = V4L2_PIX_FMT_SGRBG10,
@@ -81,6 +86,7 @@ static const struct fimc_fmt fimc_lite_formats[] = {
81 .color = FIMC_FMT_RAW10, 86 .color = FIMC_FMT_RAW10,
82 .memplanes = 1, 87 .memplanes = 1,
83 .mbus_code = V4L2_MBUS_FMT_SGRBG10_1X10, 88 .mbus_code = V4L2_MBUS_FMT_SGRBG10_1X10,
89 .flags = FMT_FLAGS_RAW_BAYER,
84 }, { 90 }, {
85 .name = "RAW12 (GRBG)", 91 .name = "RAW12 (GRBG)",
86 .fourcc = V4L2_PIX_FMT_SGRBG12, 92 .fourcc = V4L2_PIX_FMT_SGRBG12,
@@ -88,6 +94,7 @@ static const struct fimc_fmt fimc_lite_formats[] = {
88 .color = FIMC_FMT_RAW12, 94 .color = FIMC_FMT_RAW12,
89 .memplanes = 1, 95 .memplanes = 1,
90 .mbus_code = V4L2_MBUS_FMT_SGRBG12_1X12, 96 .mbus_code = V4L2_MBUS_FMT_SGRBG12_1X12,
97 .flags = FMT_FLAGS_RAW_BAYER,
91 }, 98 },
92}; 99};
93 100
@@ -95,10 +102,11 @@ static const struct fimc_fmt fimc_lite_formats[] = {
95 * fimc_lite_find_format - lookup fimc color format by fourcc or media bus code 102 * fimc_lite_find_format - lookup fimc color format by fourcc or media bus code
96 * @pixelformat: fourcc to match, ignored if null 103 * @pixelformat: fourcc to match, ignored if null
97 * @mbus_code: media bus code to match, ignored if null 104 * @mbus_code: media bus code to match, ignored if null
105 * @mask: the color format flags to match
98 * @index: index to the fimc_lite_formats array, ignored if negative 106 * @index: index to the fimc_lite_formats array, ignored if negative
99 */ 107 */
100static const struct fimc_fmt *fimc_lite_find_format(const u32 *pixelformat, 108static const struct fimc_fmt *fimc_lite_find_format(const u32 *pixelformat,
101 const u32 *mbus_code, int index) 109 const u32 *mbus_code, unsigned int mask, int index)
102{ 110{
103 const struct fimc_fmt *fmt, *def_fmt = NULL; 111 const struct fimc_fmt *fmt, *def_fmt = NULL;
104 unsigned int i; 112 unsigned int i;
@@ -109,6 +117,8 @@ static const struct fimc_fmt *fimc_lite_find_format(const u32 *pixelformat,
109 117
110 for (i = 0; i < ARRAY_SIZE(fimc_lite_formats); ++i) { 118 for (i = 0; i < ARRAY_SIZE(fimc_lite_formats); ++i) {
111 fmt = &fimc_lite_formats[i]; 119 fmt = &fimc_lite_formats[i];
120 if (mask && !(fmt->flags & mask))
121 continue;
112 if (pixelformat && fmt->fourcc == *pixelformat) 122 if (pixelformat && fmt->fourcc == *pixelformat)
113 return fmt; 123 return fmt;
114 if (mbus_code && fmt->mbus_code == *mbus_code) 124 if (mbus_code && fmt->mbus_code == *mbus_code)
@@ -132,7 +142,7 @@ static int fimc_lite_hw_init(struct fimc_lite *fimc, bool isp_output)
132 if (sensor == NULL) 142 if (sensor == NULL)
133 return -ENXIO; 143 return -ENXIO;
134 144
135 if (fimc->fmt == NULL) 145 if (fimc->inp_frame.fmt == NULL || fimc->out_frame.fmt == NULL)
136 return -EINVAL; 146 return -EINVAL;
137 147
138 /* Get sensor configuration data from the sensor subdev */ 148 /* Get sensor configuration data from the sensor subdev */
@@ -339,13 +349,13 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt,
339 const struct v4l2_pix_format_mplane *pixm = NULL; 349 const struct v4l2_pix_format_mplane *pixm = NULL;
340 struct fimc_lite *fimc = vq->drv_priv; 350 struct fimc_lite *fimc = vq->drv_priv;
341 struct flite_frame *frame = &fimc->out_frame; 351 struct flite_frame *frame = &fimc->out_frame;
342 const struct fimc_fmt *fmt = fimc->fmt; 352 const struct fimc_fmt *fmt = frame->fmt;
343 unsigned long wh; 353 unsigned long wh;
344 int i; 354 int i;
345 355
346 if (pfmt) { 356 if (pfmt) {
347 pixm = &pfmt->fmt.pix_mp; 357 pixm = &pfmt->fmt.pix_mp;
348 fmt = fimc_lite_find_format(&pixm->pixelformat, NULL, -1); 358 fmt = fimc_lite_find_format(&pixm->pixelformat, NULL, 0, -1);
349 wh = pixm->width * pixm->height; 359 wh = pixm->width * pixm->height;
350 } else { 360 } else {
351 wh = frame->f_width * frame->f_height; 361 wh = frame->f_width * frame->f_height;
@@ -374,10 +384,10 @@ static int buffer_prepare(struct vb2_buffer *vb)
374 struct fimc_lite *fimc = vq->drv_priv; 384 struct fimc_lite *fimc = vq->drv_priv;
375 int i; 385 int i;
376 386
377 if (fimc->fmt == NULL) 387 if (fimc->out_frame.fmt == NULL)
378 return -EINVAL; 388 return -EINVAL;
379 389
380 for (i = 0; i < fimc->fmt->memplanes; i++) { 390 for (i = 0; i < fimc->out_frame.fmt->memplanes; i++) {
381 unsigned long size = fimc->payload[i]; 391 unsigned long size = fimc->payload[i];
382 392
383 if (vb2_plane_size(vb, i) < size) { 393 if (vb2_plane_size(vb, i) < size) {
@@ -530,15 +540,7 @@ static const struct fimc_fmt *fimc_lite_try_format(struct fimc_lite *fimc,
530{ 540{
531 struct flite_drvdata *dd = fimc->dd; 541 struct flite_drvdata *dd = fimc->dd;
532 const struct fimc_fmt *fmt; 542 const struct fimc_fmt *fmt;
533 543 unsigned int flags = 0;
534 fmt = fimc_lite_find_format(fourcc, code, 0);
535 if (WARN_ON(!fmt))
536 return NULL;
537
538 if (code)
539 *code = fmt->mbus_code;
540 if (fourcc)
541 *fourcc = fmt->fourcc;
542 544
543 if (pad == FLITE_SD_PAD_SINK) { 545 if (pad == FLITE_SD_PAD_SINK) {
544 v4l_bound_align_image(width, 8, dd->max_width, 546 v4l_bound_align_image(width, 8, dd->max_width,
@@ -549,8 +551,18 @@ static const struct fimc_fmt *fimc_lite_try_format(struct fimc_lite *fimc,
549 ffs(dd->out_width_align) - 1, 551 ffs(dd->out_width_align) - 1,
550 height, 0, fimc->inp_frame.rect.height, 552 height, 0, fimc->inp_frame.rect.height,
551 0, 0); 553 0, 0);
554 flags = fimc->inp_frame.fmt->flags;
552 } 555 }
553 556
557 fmt = fimc_lite_find_format(fourcc, code, flags, 0);
558 if (WARN_ON(!fmt))
559 return NULL;
560
561 if (code)
562 *code = fmt->mbus_code;
563 if (fourcc)
564 *fourcc = fmt->fourcc;
565
554 v4l2_dbg(1, debug, &fimc->subdev, "code: 0x%x, %dx%d\n", 566 v4l2_dbg(1, debug, &fimc->subdev, "code: 0x%x, %dx%d\n",
555 code ? *code : 0, *width, *height); 567 code ? *code : 0, *width, *height);
556 568
@@ -629,7 +641,7 @@ static int fimc_lite_g_fmt_mplane(struct file *file, void *fh,
629 struct v4l2_pix_format_mplane *pixm = &f->fmt.pix_mp; 641 struct v4l2_pix_format_mplane *pixm = &f->fmt.pix_mp;
630 struct v4l2_plane_pix_format *plane_fmt = &pixm->plane_fmt[0]; 642 struct v4l2_plane_pix_format *plane_fmt = &pixm->plane_fmt[0];
631 struct flite_frame *frame = &fimc->out_frame; 643 struct flite_frame *frame = &fimc->out_frame;
632 const struct fimc_fmt *fmt = fimc->fmt; 644 const struct fimc_fmt *fmt = frame->fmt;
633 645
634 plane_fmt->bytesperline = (frame->f_width * fmt->depth[0]) / 8; 646 plane_fmt->bytesperline = (frame->f_width * fmt->depth[0]) / 8;
635 plane_fmt->sizeimage = plane_fmt->bytesperline * frame->f_height; 647 plane_fmt->sizeimage = plane_fmt->bytesperline * frame->f_height;
@@ -649,9 +661,22 @@ static int fimc_lite_try_fmt(struct fimc_lite *fimc,
649{ 661{
650 u32 bpl = pixm->plane_fmt[0].bytesperline; 662 u32 bpl = pixm->plane_fmt[0].bytesperline;
651 struct flite_drvdata *dd = fimc->dd; 663 struct flite_drvdata *dd = fimc->dd;
664 const struct fimc_fmt *inp_fmt = fimc->inp_frame.fmt;
652 const struct fimc_fmt *fmt; 665 const struct fimc_fmt *fmt;
653 666
654 fmt = fimc_lite_find_format(&pixm->pixelformat, NULL, 0); 667 if (WARN_ON(inp_fmt == NULL))
668 return -EINVAL;
669 /*
670 * We allow some flexibility only for YUV formats. In case of raw
671 * raw Bayer the FIMC-LITE's output format must match its camera
672 * interface input format.
673 */
674 if (inp_fmt->flags & FMT_FLAGS_YUV)
675 fmt = fimc_lite_find_format(&pixm->pixelformat, NULL,
676 inp_fmt->flags, 0);
677 else
678 fmt = inp_fmt;
679
655 if (WARN_ON(fmt == NULL)) 680 if (WARN_ON(fmt == NULL))
656 return -EINVAL; 681 return -EINVAL;
657 if (ffmt) 682 if (ffmt)
@@ -697,7 +722,7 @@ static int fimc_lite_s_fmt_mplane(struct file *file, void *priv,
697 if (ret < 0) 722 if (ret < 0)
698 return ret; 723 return ret;
699 724
700 fimc->fmt = fmt; 725 frame->fmt = fmt;
701 fimc->payload[0] = max((pixm->width * pixm->height * fmt->depth[0]) / 8, 726 fimc->payload[0] = max((pixm->width * pixm->height * fmt->depth[0]) / 8,
702 pixm->plane_fmt[0].sizeimage); 727 pixm->plane_fmt[0].sizeimage);
703 frame->f_width = pixm->width; 728 frame->f_width = pixm->width;
@@ -723,7 +748,7 @@ static int fimc_pipeline_validate(struct fimc_lite *fimc)
723 struct flite_frame *ff = &fimc->out_frame; 748 struct flite_frame *ff = &fimc->out_frame;
724 sink_fmt.format.width = ff->f_width; 749 sink_fmt.format.width = ff->f_width;
725 sink_fmt.format.height = ff->f_height; 750 sink_fmt.format.height = ff->f_height;
726 sink_fmt.format.code = fimc->fmt->mbus_code; 751 sink_fmt.format.code = fimc->inp_frame.fmt->mbus_code;
727 } else { 752 } else {
728 sink_fmt.pad = pad->index; 753 sink_fmt.pad = pad->index;
729 sink_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE; 754 sink_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
@@ -991,7 +1016,7 @@ static int fimc_lite_subdev_enum_mbus_code(struct v4l2_subdev *sd,
991{ 1016{
992 const struct fimc_fmt *fmt; 1017 const struct fimc_fmt *fmt;
993 1018
994 fmt = fimc_lite_find_format(NULL, NULL, code->index); 1019 fmt = fimc_lite_find_format(NULL, NULL, 0, code->index);
995 if (!fmt) 1020 if (!fmt)
996 return -EINVAL; 1021 return -EINVAL;
997 code->code = fmt->mbus_code; 1022 code->code = fmt->mbus_code;
@@ -1004,7 +1029,7 @@ static int fimc_lite_subdev_get_fmt(struct v4l2_subdev *sd,
1004{ 1029{
1005 struct fimc_lite *fimc = v4l2_get_subdevdata(sd); 1030 struct fimc_lite *fimc = v4l2_get_subdevdata(sd);
1006 struct v4l2_mbus_framefmt *mf = &fmt->format; 1031 struct v4l2_mbus_framefmt *mf = &fmt->format;
1007 struct flite_frame *f = &fimc->out_frame; 1032 struct flite_frame *f = &fimc->inp_frame;
1008 1033
1009 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1034 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
1010 mf = v4l2_subdev_get_try_format(fh, fmt->pad); 1035 mf = v4l2_subdev_get_try_format(fh, fmt->pad);
@@ -1014,7 +1039,7 @@ static int fimc_lite_subdev_get_fmt(struct v4l2_subdev *sd,
1014 mf->colorspace = V4L2_COLORSPACE_JPEG; 1039 mf->colorspace = V4L2_COLORSPACE_JPEG;
1015 1040
1016 mutex_lock(&fimc->lock); 1041 mutex_lock(&fimc->lock);
1017 mf->code = fimc->fmt->mbus_code; 1042 mf->code = f->fmt->mbus_code;
1018 1043
1019 if (fmt->pad == FLITE_SD_PAD_SINK) { 1044 if (fmt->pad == FLITE_SD_PAD_SINK) {
1020 /* full camera input frame size */ 1045 /* full camera input frame size */
@@ -1066,7 +1091,7 @@ static int fimc_lite_subdev_set_fmt(struct v4l2_subdev *sd,
1066 if (fmt->pad == FLITE_SD_PAD_SINK) { 1091 if (fmt->pad == FLITE_SD_PAD_SINK) {
1067 sink->f_width = mf->width; 1092 sink->f_width = mf->width;
1068 sink->f_height = mf->height; 1093 sink->f_height = mf->height;
1069 fimc->fmt = ffmt; 1094 sink->fmt = ffmt;
1070 /* Set sink crop rectangle */ 1095 /* Set sink crop rectangle */
1071 sink->rect.width = mf->width; 1096 sink->rect.width = mf->width;
1072 sink->rect.height = mf->height; 1097 sink->rect.height = mf->height;
@@ -1078,7 +1103,7 @@ static int fimc_lite_subdev_set_fmt(struct v4l2_subdev *sd,
1078 source->f_height = mf->height; 1103 source->f_height = mf->height;
1079 } else { 1104 } else {
1080 /* Allow changing format only on sink pad */ 1105 /* Allow changing format only on sink pad */
1081 mf->code = fimc->fmt->mbus_code; 1106 mf->code = sink->fmt->mbus_code;
1082 mf->width = sink->rect.width; 1107 mf->width = sink->rect.width;
1083 mf->height = sink->rect.height; 1108 mf->height = sink->rect.height;
1084 } 1109 }
@@ -1219,7 +1244,8 @@ static int fimc_lite_subdev_registered(struct v4l2_subdev *sd)
1219 1244
1220 memset(vfd, 0, sizeof(*vfd)); 1245 memset(vfd, 0, sizeof(*vfd));
1221 1246
1222 fimc->fmt = &fimc_lite_formats[0]; 1247 fimc->inp_frame.fmt = &fimc_lite_formats[0];
1248 fimc->out_frame.fmt = &fimc_lite_formats[0];
1223 atomic_set(&fimc->out_path, FIMC_IO_DMA); 1249 atomic_set(&fimc->out_path, FIMC_IO_DMA);
1224 1250
1225 snprintf(vfd->name, sizeof(vfd->name), "fimc-lite.%d.capture", 1251 snprintf(vfd->name, sizeof(vfd->name), "fimc-lite.%d.capture",
diff --git a/drivers/media/platform/exynos4-is/fimc-lite.h b/drivers/media/platform/exynos4-is/fimc-lite.h
index 0b6380bb5c8a..8a8d26f58344 100644
--- a/drivers/media/platform/exynos4-is/fimc-lite.h
+++ b/drivers/media/platform/exynos4-is/fimc-lite.h
@@ -70,11 +70,13 @@ struct fimc_lite_events {
70 * @f_width: full pixel width 70 * @f_width: full pixel width
71 * @f_height: full pixel height 71 * @f_height: full pixel height
72 * @rect: crop/composition rectangle 72 * @rect: crop/composition rectangle
73 * @fmt: pointer to pixel format description data structure
73 */ 74 */
74struct flite_frame { 75struct flite_frame {
75 u16 f_width; 76 u16 f_width;
76 u16 f_height; 77 u16 f_height;
77 struct v4l2_rect rect; 78 struct v4l2_rect rect;
79 const struct fimc_fmt *fmt;
78}; 80};
79 81
80/** 82/**
@@ -111,7 +113,6 @@ struct flite_buffer {
111 * @clock: FIMC-LITE gate clock 113 * @clock: FIMC-LITE gate clock
112 * @regs: memory mapped io registers 114 * @regs: memory mapped io registers
113 * @irq_queue: interrupt handler waitqueue 115 * @irq_queue: interrupt handler waitqueue
114 * @fmt: pointer to color format description structure
115 * @payload: image size in bytes (w x h x bpp) 116 * @payload: image size in bytes (w x h x bpp)
116 * @inp_frame: camera input frame structure 117 * @inp_frame: camera input frame structure
117 * @out_frame: DMA output frame structure 118 * @out_frame: DMA output frame structure
@@ -150,7 +151,6 @@ struct fimc_lite {
150 void __iomem *regs; 151 void __iomem *regs;
151 wait_queue_head_t irq_queue; 152 wait_queue_head_t irq_queue;
152 153
153 const struct fimc_fmt *fmt;
154 unsigned long payload[FLITE_MAX_PLANES]; 154 unsigned long payload[FLITE_MAX_PLANES];
155 struct flite_frame inp_frame; 155 struct flite_frame inp_frame;
156 struct flite_frame out_frame; 156 struct flite_frame out_frame;
diff --git a/include/media/s5p_fimc.h b/include/media/s5p_fimc.h
index 2363aff24df7..e316d15896f9 100644
--- a/include/media/s5p_fimc.h
+++ b/include/media/s5p_fimc.h
@@ -125,6 +125,8 @@ struct fimc_fmt {
125#define FMT_HAS_ALPHA (1 << 3) 125#define FMT_HAS_ALPHA (1 << 3)
126#define FMT_FLAGS_COMPRESSED (1 << 4) 126#define FMT_FLAGS_COMPRESSED (1 << 4)
127#define FMT_FLAGS_WRITEBACK (1 << 5) 127#define FMT_FLAGS_WRITEBACK (1 << 5)
128#define FMT_FLAGS_RAW_BAYER (1 << 6)
129#define FMT_FLAGS_YUV (1 << 7)
128}; 130};
129 131
130enum fimc_subdev_index { 132enum fimc_subdev_index {