aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/s5p-fimc
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2010-12-27 13:02:16 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-21 19:31:38 -0400
commit3d0ce7ed037af9bafec498246d0e4af8302d993a (patch)
tree619627cedea5c93ddf6eee2918b4597d06e3b08e /drivers/media/video/s5p-fimc
parentdf7e09a351199ad9a70eb9ae3b072cc4fc59a9bb (diff)
[media] s5p-fimc: Derive camera bus width from mediabus pixelcode
Remove bus_width from s5p_fimc_isp_info data structure. Determine camera data bus width based on mediabus pixel format. 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>
Diffstat (limited to 'drivers/media/video/s5p-fimc')
-rw-r--r--drivers/media/video/s5p-fimc/fimc-reg.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/drivers/media/video/s5p-fimc/fimc-reg.c b/drivers/media/video/s5p-fimc/fimc-reg.c
index ae33bc1c7bd..63660119ef7 100644
--- a/drivers/media/video/s5p-fimc/fimc-reg.c
+++ b/drivers/media/video/s5p-fimc/fimc-reg.c
@@ -561,37 +561,42 @@ int fimc_hw_set_camera_source(struct fimc_dev *fimc,
561{ 561{
562 struct fimc_frame *f = &fimc->vid_cap.ctx->s_frame; 562 struct fimc_frame *f = &fimc->vid_cap.ctx->s_frame;
563 u32 cfg = 0; 563 u32 cfg = 0;
564 u32 bus_width;
565 int i;
566
567 static const struct {
568 u32 pixelcode;
569 u32 cisrcfmt;
570 u16 bus_width;
571 } pix_desc[] = {
572 { V4L2_MBUS_FMT_YUYV8_2X8, S5P_CISRCFMT_ORDER422_YCBYCR, 8 },
573 { V4L2_MBUS_FMT_YVYU8_2X8, S5P_CISRCFMT_ORDER422_YCRYCB, 8 },
574 { V4L2_MBUS_FMT_VYUY8_2X8, S5P_CISRCFMT_ORDER422_CRYCBY, 8 },
575 { V4L2_MBUS_FMT_UYVY8_2X8, S5P_CISRCFMT_ORDER422_CBYCRY, 8 },
576 /* TODO: Add pixel codes for 16-bit bus width */
577 };
564 578
565 if (cam->bus_type == FIMC_ITU_601 || cam->bus_type == FIMC_ITU_656) { 579 if (cam->bus_type == FIMC_ITU_601 || cam->bus_type == FIMC_ITU_656) {
580 for (i = 0; i < ARRAY_SIZE(pix_desc); i++) {
581 if (fimc->vid_cap.fmt.code == pix_desc[i].pixelcode) {
582 cfg = pix_desc[i].cisrcfmt;
583 bus_width = pix_desc[i].bus_width;
584 break;
585 }
586 }
566 587
567 switch (fimc->vid_cap.fmt.code) { 588 if (i == ARRAY_SIZE(pix_desc)) {
568 case V4L2_MBUS_FMT_YUYV8_2X8: 589 v4l2_err(&fimc->vid_cap.v4l2_dev,
569 cfg = S5P_CISRCFMT_ORDER422_YCBYCR; 590 "Camera color format not supported: %d\n",
570 break; 591 fimc->vid_cap.fmt.code);
571 case V4L2_MBUS_FMT_YVYU8_2X8:
572 cfg = S5P_CISRCFMT_ORDER422_YCRYCB;
573 break;
574 case V4L2_MBUS_FMT_VYUY8_2X8:
575 cfg = S5P_CISRCFMT_ORDER422_CRYCBY;
576 break;
577 case V4L2_MBUS_FMT_UYVY8_2X8:
578 cfg = S5P_CISRCFMT_ORDER422_CBYCRY;
579 break;
580 default:
581 err("camera image format not supported: %d",
582 fimc->vid_cap.fmt.code);
583 return -EINVAL; 592 return -EINVAL;
584 } 593 }
585 594
586 if (cam->bus_type == FIMC_ITU_601) { 595 if (cam->bus_type == FIMC_ITU_601) {
587 if (cam->bus_width == 8) { 596 if (bus_width == 8)
588 cfg |= S5P_CISRCFMT_ITU601_8BIT; 597 cfg |= S5P_CISRCFMT_ITU601_8BIT;
589 } else if (cam->bus_width == 16) { 598 else if (bus_width == 16)
590 cfg |= S5P_CISRCFMT_ITU601_16BIT; 599 cfg |= S5P_CISRCFMT_ITU601_16BIT;
591 } else {
592 err("invalid bus width: %d", cam->bus_width);
593 return -EINVAL;
594 }
595 } /* else defaults to ITU-R BT.656 8-bit */ 600 } /* else defaults to ITU-R BT.656 8-bit */
596 } 601 }
597 602