summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiu Ying <b17645@freescale.com>2010-11-10 18:11:11 +0800
committerJustin Waters <justin.waters@timesys.com>2010-12-13 16:10:47 -0500
commit5bece5e2c9ed306fa529f4302e07657d1cb7add8 (patch)
tree46a2f46f4efe23b13d1486b059807dec509b36d6
parent5f58c42178d8e6bce405a00629bb8bb747ce001c (diff)
ENGR00133318-2 MXC V4L2 capture:Correct TVin PAL/NTSC video formats
As IPUv3 CSI supports interlaced scan order for CSI->SMFCx->MEM channels, change TVin PAL/NTSC video formats to be standard. Signed-off-by: Liu Ying <b17645@freescale.com> (cherry picked from commit aef894228ba2c94cff1029a4cbd6b8e9a0a8d89b)
-rw-r--r--drivers/media/video/mxc/capture/ipu_csi_enc.c21
-rw-r--r--drivers/media/video/mxc/capture/mxc_v4l2_capture.c20
2 files changed, 26 insertions, 15 deletions
diff --git a/drivers/media/video/mxc/capture/ipu_csi_enc.c b/drivers/media/video/mxc/capture/ipu_csi_enc.c
index c0842f81ee27..9725b7ee47ba 100644
--- a/drivers/media/video/mxc/capture/ipu_csi_enc.c
+++ b/drivers/media/video/mxc/capture/ipu_csi_enc.c
@@ -64,7 +64,7 @@ static int csi_enc_setup(cam_data *cam)
{
ipu_channel_params_t params;
u32 pixel_fmt;
- int err = 0;
+ int err = 0, sensor_protocol = 0;
dma_addr_t dummy = cam->dummy_frame.buffer.m.offset;
CAMERA_TRACE("In csi_enc_setup\n");
@@ -76,6 +76,25 @@ static int csi_enc_setup(cam_data *cam)
memset(&params, 0, sizeof(ipu_channel_params_t));
params.csi_mem.csi = cam->csi;
+ sensor_protocol = ipu_csi_get_sensor_protocol(cam->csi);
+ switch (sensor_protocol) {
+ case IPU_CSI_CLK_MODE_GATED_CLK:
+ case IPU_CSI_CLK_MODE_NONGATED_CLK:
+ case IPU_CSI_CLK_MODE_CCIR656_PROGRESSIVE:
+ case IPU_CSI_CLK_MODE_CCIR1120_PROGRESSIVE_DDR:
+ case IPU_CSI_CLK_MODE_CCIR1120_PROGRESSIVE_SDR:
+ params.csi_mem.interlaced = false;
+ break;
+ case IPU_CSI_CLK_MODE_CCIR656_INTERLACED:
+ case IPU_CSI_CLK_MODE_CCIR1120_INTERLACED_DDR:
+ case IPU_CSI_CLK_MODE_CCIR1120_INTERLACED_SDR:
+ params.csi_mem.interlaced = true;
+ break;
+ default:
+ printk(KERN_ERR "sensor protocol unsupported\n");
+ return -EINVAL;
+ }
+
if (cam->v2f.fmt.pix.pixelformat == V4L2_PIX_FMT_YUV420)
pixel_fmt = IPU_PIX_FMT_YUV420P;
else if (cam->v2f.fmt.pix.pixelformat == V4L2_PIX_FMT_YUV422P)
diff --git a/drivers/media/video/mxc/capture/mxc_v4l2_capture.c b/drivers/media/video/mxc/capture/mxc_v4l2_capture.c
index 0cb8a95f48ef..8133d202304e 100644
--- a/drivers/media/video/mxc/capture/mxc_v4l2_capture.c
+++ b/drivers/media/video/mxc/capture/mxc_v4l2_capture.c
@@ -131,8 +131,8 @@ static video_fmt_t video_fmts[] = {
.raw_width = 720, /* SENS_FRM_WIDTH */
.raw_height = 525, /* SENS_FRM_HEIGHT */
.active_width = 720, /* ACT_FRM_WIDTH */
- .active_height = 240, /* ACT_FRM_HEIGHT */
- .active_top = 0,
+ .active_height = 480, /* ACT_FRM_HEIGHT */
+ .active_top = 13,
.active_left = 0,
},
{ /*! (B, G, H, I, N) PAL */
@@ -141,7 +141,7 @@ static video_fmt_t video_fmts[] = {
.raw_width = 720,
.raw_height = 625,
.active_width = 720,
- .active_height = 288,
+ .active_height = 576,
.active_top = 0,
.active_left = 0,
},
@@ -151,7 +151,7 @@ static video_fmt_t video_fmts[] = {
.raw_width = 720,
.raw_height = 625,
.active_width = 720,
- .active_height = 288,
+ .active_height = 576,
.active_top = 0,
.active_left = 0,
},
@@ -1224,29 +1224,20 @@ exit:
*/
static int mxc_v4l2_s_std(cam_data *cam, v4l2_std_id e)
{
- bool change = false;
-
- if (e != cam->standard.id) {
- change = true;
- }
-
pr_debug("In mxc_v4l2_s_std %Lx\n", e);
if (e == V4L2_STD_PAL) {
pr_debug(" Setting standard to PAL %Lx\n", V4L2_STD_PAL);
cam->standard.id = V4L2_STD_PAL;
video_index = TV_PAL;
- cam->crop_current.top = 0;
} else if (e == V4L2_STD_NTSC) {
pr_debug(" Setting standard to NTSC %Lx\n",
V4L2_STD_NTSC);
/* Get rid of the white dot line in NTSC signal input */
cam->standard.id = V4L2_STD_NTSC;
video_index = TV_NTSC;
- cam->crop_current.top = 12;
} else {
cam->standard.id = V4L2_STD_ALL;
video_index = TV_NOT_LOCKED;
- cam->crop_current.top = 0;
pr_err("ERROR: unrecognized std! %Lx (PAL=%Lx, NTSC=%Lx\n",
e, V4L2_STD_PAL, V4L2_STD_NTSC);
}
@@ -1257,7 +1248,8 @@ static int mxc_v4l2_s_std(cam_data *cam, v4l2_std_id e)
cam->crop_bounds.height = video_fmts[video_index].raw_height;
cam->crop_current.width = video_fmts[video_index].active_width;
cam->crop_current.height = video_fmts[video_index].active_height;
- cam->crop_current.left = 0;
+ cam->crop_current.top = video_fmts[video_index].active_top;
+ cam->crop_current.left = video_fmts[video_index].active_left;
return 0;
}