aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2010-11-28 13:07:20 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 16:56:10 -0400
commit86cf786c04541c18febc897686a0d5bea29ce688 (patch)
treed02c4613544c5fefb4a65b23d8148a1182f3968b /drivers/media
parent7c58e7d06cf2566537714257094b852de6c294c3 (diff)
[media] v4l: mt9v032: Fix Bayer pattern
Compute crop rectangle boundaries to ensure a GRBG Bayer pattern. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/mt9v032.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/media/video/mt9v032.c b/drivers/media/video/mt9v032.c
index 1319c2c48aff..c64e1dc4cb4e 100644
--- a/drivers/media/video/mt9v032.c
+++ b/drivers/media/video/mt9v032.c
@@ -31,14 +31,14 @@
31#define MT9V032_CHIP_VERSION 0x00 31#define MT9V032_CHIP_VERSION 0x00
32#define MT9V032_CHIP_ID_REV1 0x1311 32#define MT9V032_CHIP_ID_REV1 0x1311
33#define MT9V032_CHIP_ID_REV3 0x1313 33#define MT9V032_CHIP_ID_REV3 0x1313
34#define MT9V032_ROW_START 0x01 34#define MT9V032_COLUMN_START 0x01
35#define MT9V032_ROW_START_MIN 4
36#define MT9V032_ROW_START_DEF 10
37#define MT9V032_ROW_START_MAX 482
38#define MT9V032_COLUMN_START 0x02
39#define MT9V032_COLUMN_START_MIN 1 35#define MT9V032_COLUMN_START_MIN 1
40#define MT9V032_COLUMN_START_DEF 2 36#define MT9V032_COLUMN_START_DEF 1
41#define MT9V032_COLUMN_START_MAX 752 37#define MT9V032_COLUMN_START_MAX 752
38#define MT9V032_ROW_START 0x02
39#define MT9V032_ROW_START_MIN 4
40#define MT9V032_ROW_START_DEF 5
41#define MT9V032_ROW_START_MAX 482
42#define MT9V032_WINDOW_HEIGHT 0x03 42#define MT9V032_WINDOW_HEIGHT 0x03
43#define MT9V032_WINDOW_HEIGHT_MIN 1 43#define MT9V032_WINDOW_HEIGHT_MIN 1
44#define MT9V032_WINDOW_HEIGHT_DEF 480 44#define MT9V032_WINDOW_HEIGHT_DEF 480
@@ -420,13 +420,13 @@ static int mt9v032_set_crop(struct v4l2_subdev *subdev,
420 struct v4l2_rect *__crop; 420 struct v4l2_rect *__crop;
421 struct v4l2_rect rect; 421 struct v4l2_rect rect;
422 422
423 /* Clamp the crop rectangle boundaries and align them to a multiple of 2 423 /* Clamp the crop rectangle boundaries and align them to a non multiple
424 * pixels. 424 * of 2 pixels to ensure a GRBG Bayer pattern.
425 */ 425 */
426 rect.left = clamp(ALIGN(crop->rect.left, 2), 426 rect.left = clamp(ALIGN(crop->rect.left + 1, 2) - 1,
427 MT9V032_COLUMN_START_MIN, 427 MT9V032_COLUMN_START_MIN,
428 MT9V032_COLUMN_START_MAX); 428 MT9V032_COLUMN_START_MAX);
429 rect.top = clamp(ALIGN(crop->rect.top, 2), 429 rect.top = clamp(ALIGN(crop->rect.top + 1, 2) - 1,
430 MT9V032_ROW_START_MIN, 430 MT9V032_ROW_START_MIN,
431 MT9V032_ROW_START_MAX); 431 MT9V032_ROW_START_MAX);
432 rect.width = clamp(ALIGN(crop->rect.width, 2), 432 rect.width = clamp(ALIGN(crop->rect.width, 2),