public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pxa_camera: Fix YUV format handling.
@ 2008-11-06 23:04 Robert Jarzmik
  2008-11-06 23:52 ` Guennadi Liakhovetski
  0 siblings, 1 reply; 8+ messages in thread
From: Robert Jarzmik @ 2008-11-06 23:04 UTC (permalink / raw)
  To: video4linux-list, g.liakhovetski

Allows all YUV formats on pxa interface. Even if PXA capture
interface expects data in UYVY format, we allow all formats
considering the pxa bus is not making any translation.

For the special YUV planar format, we translate the pixel
format asked to the sensor to VYUY, which is the bus byte
order necessary (out of the sensor) for the pxa to make the
correct translation.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/media/video/pxa_camera.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c
index eb6be58..863e0df 100644
--- a/drivers/media/video/pxa_camera.c
+++ b/drivers/media/video/pxa_camera.c
@@ -862,7 +862,15 @@ static int pxa_camera_set_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
 	case V4L2_PIX_FMT_YUV422P:
 		pcdev->channels = 3;
 		cicr1 |= CICR1_YCBCR_F;
+		/*
+		 * Normally, pxa bus wants as input VYUY format.
+		 * We allow all YUV formats, as no translation is used, and the
+		 * YUV stream is just passed through without any transformation.
+		 */
+	case V4L2_PIX_FMT_UYVY:
+	case V4L2_PIX_FMT_VYUY:
 	case V4L2_PIX_FMT_YUYV:
+	case V4L2_PIX_FMT_YVYU:
 		cicr1 |= CICR1_COLOR_SP_VAL(2);
 		break;
 	case V4L2_PIX_FMT_RGB555:
@@ -907,6 +915,13 @@ static int pxa_camera_try_bus_param(struct soc_camera_device *icd, __u32 pixfmt)
 static int pxa_camera_set_fmt_cap(struct soc_camera_device *icd,
 				  __u32 pixfmt, struct v4l2_rect *rect)
 {
+	/*
+	 * The YUV 4:2:2 planar format is translated by the pxa assuming its
+	 * input (ie. camera device output) is VYUV.
+	 * We fix the pixel format asked to the camera device.
+	 */
+	if (pixfmt == V4L2_PIX_FMT_YUV422P)
+		pixfmt = V4L2_PIX_FMT_VYUY;
 	return icd->ops->set_fmt_cap(icd, pixfmt, rect);
 }
 
-- 
1.5.6.5

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-11-16 22:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-06 23:04 [PATCH] pxa_camera: Fix YUV format handling Robert Jarzmik
2008-11-06 23:52 ` Guennadi Liakhovetski
2008-11-07  7:10   ` Antonio Ospite
2008-11-07 17:14   ` Robert Jarzmik
2008-11-16 22:23     ` [PATCH] Add new pixel format VYUY 16 bits wide Guennadi Liakhovetski
2008-11-16 22:33       ` [PATCH v2] " Robert Jarzmik
2008-11-16 22:39         ` Guennadi Liakhovetski
2008-11-16 22:44           ` Guennadi Liakhovetski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox