From 6b2cd7d6e7f5a816865bd1d0512e3fc22b03b9c2 Mon Sep 17 00:00:00 2001 From: Sheng Nan Date: Wed, 5 Dec 2012 10:22:35 +0800 Subject: [PATCH] ENGR00235665: mxc_v4l2_capture: add YV12 format support in camera driver Android CTS verifier have a must requirement for YV12 format. Since IPUv3 common driver has supported IPU_PIX_FMT_YVU420P pixel format, add the support of YV12 format in mxc_v4l2_capture. Signed-off-by: Sheng Nan --- drivers/media/video/mxc/capture/ipu_csi_enc.c | 2 ++ drivers/media/video/mxc/capture/ipu_prp_enc.c | 3 +++ drivers/media/video/mxc/capture/mxc_v4l2_capture.c | 2 ++ 3 files changed, 7 insertions(+) diff --git a/drivers/media/video/mxc/capture/ipu_csi_enc.c b/drivers/media/video/mxc/capture/ipu_csi_enc.c index 872598bd102d..2c8d8d01a971 100644 --- a/drivers/media/video/mxc/capture/ipu_csi_enc.c +++ b/drivers/media/video/mxc/capture/ipu_csi_enc.c @@ -104,6 +104,8 @@ static int csi_enc_setup(cam_data *cam) 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_YVU420) + pixel_fmt = IPU_PIX_FMT_YVU420P; else if (cam->v2f.fmt.pix.pixelformat == V4L2_PIX_FMT_YUV422P) pixel_fmt = IPU_PIX_FMT_YUV422P; else if (cam->v2f.fmt.pix.pixelformat == V4L2_PIX_FMT_UYVY) diff --git a/drivers/media/video/mxc/capture/ipu_prp_enc.c b/drivers/media/video/mxc/capture/ipu_prp_enc.c index a3c90d53f2eb..e24b1b086d68 100644 --- a/drivers/media/video/mxc/capture/ipu_prp_enc.c +++ b/drivers/media/video/mxc/capture/ipu_prp_enc.c @@ -99,6 +99,9 @@ static int prp_enc_setup(cam_data *cam) if (cam->v2f.fmt.pix.pixelformat == V4L2_PIX_FMT_YUV420) { enc.csi_prp_enc_mem.out_pixel_fmt = IPU_PIX_FMT_YUV420P; pr_info("YUV420\n"); + } else if (cam->v2f.fmt.pix.pixelformat == V4L2_PIX_FMT_YVU420) { + enc.csi_prp_enc_mem.out_pixel_fmt = IPU_PIX_FMT_YVU420P; + pr_info("YVU420\n"); } else if (cam->v2f.fmt.pix.pixelformat == V4L2_PIX_FMT_YUV422P) { enc.csi_prp_enc_mem.out_pixel_fmt = IPU_PIX_FMT_YUV422P; pr_info("YUV422P\n"); diff --git a/drivers/media/video/mxc/capture/mxc_v4l2_capture.c b/drivers/media/video/mxc/capture/mxc_v4l2_capture.c index 4fd89b0335bf..3e9346d356cd 100644 --- a/drivers/media/video/mxc/capture/mxc_v4l2_capture.c +++ b/drivers/media/video/mxc/capture/mxc_v4l2_capture.c @@ -366,6 +366,7 @@ static inline int valid_mode(u32 palette) (palette == V4L2_PIX_FMT_UYVY) || (palette == V4L2_PIX_FMT_YUYV) || (palette == V4L2_PIX_FMT_YUV420) || + (palette == V4L2_PIX_FMT_YVU420) || (palette == V4L2_PIX_FMT_NV12)); } @@ -881,6 +882,7 @@ static int mxc_v4l2_s_fmt(cam_data *cam, struct v4l2_format *f) bytesperline = f->fmt.pix.width * 2; break; case V4L2_PIX_FMT_YUV420: + case V4L2_PIX_FMT_YVU420: size = f->fmt.pix.width * f->fmt.pix.height * 3 / 2; bytesperline = f->fmt.pix.width; break; -- 2.39.5