From 16318b795f5b6e226bfd52353a68d1f7df73f938 Mon Sep 17 00:00:00 2001
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Date: Wed, 10 Jun 2009 14:12:36 +0200
Subject: [PATCH 26/38] ov772x: do not use scaling for cropping

OV772x sensors cannot crop, they only support two fixed formats: VGA and QVGA.
We should not change the format when requested to crop, only S_FMT can do this.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
 drivers/media/video/ov772x.c |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index b720558..03488f9 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -955,23 +955,22 @@ ov772x_set_fmt_error:
 	return ret;
 }
 
+/* Cannot crop, just return the current geometry */
 static int ov772x_set_crop(struct soc_camera_device *icd,
 			   struct v4l2_rect *rect)
 {
 	struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
 	struct ov772x_priv *priv = to_ov772x(client);
-	int ret;
 
-	if (!priv->fmt)
+	if (!priv->fmt || !priv->win)
 		return -EINVAL;
 
-	ret = ov772x_set_params(client, &rect->width, &rect->height,
-				priv->fmt->fourcc);
-	if (!ret) {
-		rect->left = 0;
-		rect->top = 0;
-	}
-	return ret;
+	rect->left = 0;
+	rect->top = 0;
+	rect->width = priv->win->width;
+	rect->height = priv->win->height;
+
+	return 0;
 }
 
 static int ov772x_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
-- 
1.6.2.4

