summaryrefslogtreecommitdiff
path: root/drivers/media/i2c/mt9p031.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-05-23 13:51:55 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-09-13 23:29:49 +0400
commit5266c98b15e682694e4d79590d39416ad3bde687 (patch)
tree415b75d7ebc7f31b0eebb53e6565ca169d46dc49 /drivers/media/i2c/mt9p031.c
parent9ec670e2aad515bbb36c020a6ebdc707ace4f24d (diff)
downloadlinux-5266c98b15e682694e4d79590d39416ad3bde687.tar.xz
[media] mt9p031: Fix horizontal and vertical blanking configuration
Compute the horizontal blanking value according to the datasheet. The value written to the hblank and vblank registers must be equal to the number of blank columns and rows minus one. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c/mt9p031.c')
-rw-r--r--drivers/media/i2c/mt9p031.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
index 3be537ef22d2..2c0f4077c491 100644
--- a/drivers/media/i2c/mt9p031.c
+++ b/drivers/media/i2c/mt9p031.c
@@ -55,9 +55,9 @@
#define MT9P031_HORIZONTAL_BLANK_MIN 0
#define MT9P031_HORIZONTAL_BLANK_MAX 4095
#define MT9P031_VERTICAL_BLANK 0x06
-#define MT9P031_VERTICAL_BLANK_MIN 0
-#define MT9P031_VERTICAL_BLANK_MAX 4095
-#define MT9P031_VERTICAL_BLANK_DEF 25
+#define MT9P031_VERTICAL_BLANK_MIN 1
+#define MT9P031_VERTICAL_BLANK_MAX 4096
+#define MT9P031_VERTICAL_BLANK_DEF 26
#define MT9P031_OUTPUT_CONTROL 0x07
#define MT9P031_OUTPUT_CONTROL_CEN 2
#define MT9P031_OUTPUT_CONTROL_SYN 1
@@ -368,13 +368,13 @@ static int mt9p031_set_params(struct mt9p031 *mt9p031)
/* Blanking - use minimum value for horizontal blanking and default
* value for vertical blanking.
*/
- hblank = 346 * ybin + 64 + (80 >> max_t(unsigned int, xbin, 3));
+ hblank = 346 * ybin + 64 + (80 >> min_t(unsigned int, xbin, 3));
vblank = MT9P031_VERTICAL_BLANK_DEF;
- ret = mt9p031_write(client, MT9P031_HORIZONTAL_BLANK, hblank);
+ ret = mt9p031_write(client, MT9P031_HORIZONTAL_BLANK, hblank - 1);
if (ret < 0)
return ret;
- ret = mt9p031_write(client, MT9P031_VERTICAL_BLANK, vblank);
+ ret = mt9p031_write(client, MT9P031_VERTICAL_BLANK, vblank - 1);
if (ret < 0)
return ret;