From: Trent Piepho <xyzzy@speakeasy.org>
Date: Sun, 31 May 2009 00:45:46 +0000 (-0300)
Subject: V4L/DVB (11903): sh_mobile_ceu_camera: Use v4l bounding/alignment function
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=bc44fc061ea1f2b7918ec0bb55013b8054c81752;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

V4L/DVB (11903): sh_mobile_ceu_camera: Use v4l bounding/alignment function

The v4l function has a better algorithm for aligning image size.

Signed-off-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
---

diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c
index d369e8409ab8..0db88a53d92c 100644
--- a/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/drivers/media/video/sh_mobile_ceu_camera.c
@@ -689,16 +689,8 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
 
 	/* FIXME: calculate using depth and bus width */
 
-	if (f->fmt.pix.height < 4)
-		f->fmt.pix.height = 4;
-	if (f->fmt.pix.height > 1920)
-		f->fmt.pix.height = 1920;
-	if (f->fmt.pix.width < 2)
-		f->fmt.pix.width = 2;
-	if (f->fmt.pix.width > 2560)
-		f->fmt.pix.width = 2560;
-	f->fmt.pix.width &= ~0x01;
-	f->fmt.pix.height &= ~0x03;
+	v4l_bound_align_image(&f->fmt.pix.width, 2, 2560, 1,
+			      &f->fmt.pix.height, 4, 1920, 2, 0);
 
 	f->fmt.pix.bytesperline = f->fmt.pix.width *
 		DIV_ROUND_UP(xlate->host_fmt->depth, 8);