diff options
author | Sylwester Nawrocki <s.nawrocki@samsung.com> | 2010-12-27 13:02:16 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-21 19:31:38 -0400 |
commit | 3d0ce7ed037af9bafec498246d0e4af8302d993a (patch) | |
tree | 619627cedea5c93ddf6eee2918b4597d06e3b08e | |
parent | df7e09a351199ad9a70eb9ae3b072cc4fc59a9bb (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>
-rw-r--r-- | drivers/media/video/s5p-fimc/fimc-reg.c | 49 | ||||
-rw-r--r-- | include/media/s5p_fimc.h | 2 |
2 files changed, 27 insertions, 24 deletions
diff --git a/drivers/media/video/s5p-fimc/fimc-reg.c b/drivers/media/video/s5p-fimc/fimc-reg.c index ae33bc1c7bd4..63660119ef7f 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 | ||
diff --git a/include/media/s5p_fimc.h b/include/media/s5p_fimc.h index eb8793fd150e..d30b9dee0f3b 100644 --- a/include/media/s5p_fimc.h +++ b/include/media/s5p_fimc.h | |||
@@ -34,7 +34,6 @@ struct i2c_board_info; | |||
34 | * @bus_type: determines bus type, MIPI, ITU-R BT.601 etc. | 34 | * @bus_type: determines bus type, MIPI, ITU-R BT.601 etc. |
35 | * @i2c_bus_num: i2c control bus id the sensor is attached to | 35 | * @i2c_bus_num: i2c control bus id the sensor is attached to |
36 | * @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU) | 36 | * @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU) |
37 | * @bus_width: camera data bus width in bits | ||
38 | * @flags: flags defining bus signals polarity inversion (High by default) | 37 | * @flags: flags defining bus signals polarity inversion (High by default) |
39 | */ | 38 | */ |
40 | struct s5p_fimc_isp_info { | 39 | struct s5p_fimc_isp_info { |
@@ -42,7 +41,6 @@ struct s5p_fimc_isp_info { | |||
42 | enum cam_bus_type bus_type; | 41 | enum cam_bus_type bus_type; |
43 | u16 i2c_bus_num; | 42 | u16 i2c_bus_num; |
44 | u16 mux_id; | 43 | u16 mux_id; |
45 | u16 bus_width; | ||
46 | u16 flags; | 44 | u16 flags; |
47 | }; | 45 | }; |
48 | 46 | ||