aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorAndrei Andreyanau <a.andreyanau@sam-solutions.net>2013-02-06 09:29:18 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-03-21 13:19:50 -0400
commitbff7993936a1617f7502ddd2a09d37767fc8c929 (patch)
tree456442398f9769f4196c407e5220ae5668aa2e32 /drivers/media/i2c
parent4a1313c447ffb67125802d20653959ac46b0b4ef (diff)
[media] mt9v022 driver: send valid HORIZONTAL_BLANKING values to mt9v024 soc camera
This patch fixes the issue that appears when mt9v024 camera is used with the mt9v022 soc camera driver. The minimum total row time is 690 columns (horizontal width + horizontal blanking). The minimum horizontal blanking is 61. Thus, when the window width is set below 627, horizontal blanking must be increased. For the mt9v024 camera the values above are correct and for the mt9v022 camera the correct values are in the existing kernel driver. Signed-off-by: Andrei Andreyanau <a.andreyanau@sam-solutions.net> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r--drivers/media/i2c/soc_camera/mt9v022.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/media/i2c/soc_camera/mt9v022.c b/drivers/media/i2c/soc_camera/mt9v022.c
index a5e65d6a0781..53eaf899d3b6 100644
--- a/drivers/media/i2c/soc_camera/mt9v022.c
+++ b/drivers/media/i2c/soc_camera/mt9v022.c
@@ -275,6 +275,7 @@ static int mt9v022_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
275 struct i2c_client *client = v4l2_get_subdevdata(sd); 275 struct i2c_client *client = v4l2_get_subdevdata(sd);
276 struct mt9v022 *mt9v022 = to_mt9v022(client); 276 struct mt9v022 *mt9v022 = to_mt9v022(client);
277 struct v4l2_rect rect = a->c; 277 struct v4l2_rect rect = a->c;
278 int min_row, min_blank;
278 int ret; 279 int ret;
279 280
280 /* Bayer format - even size lengths */ 281 /* Bayer format - even size lengths */
@@ -310,13 +311,21 @@ static int mt9v022_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
310 ret = reg_write(client, MT9V022_COLUMN_START, rect.left); 311 ret = reg_write(client, MT9V022_COLUMN_START, rect.left);
311 if (!ret) 312 if (!ret)
312 ret = reg_write(client, MT9V022_ROW_START, rect.top); 313 ret = reg_write(client, MT9V022_ROW_START, rect.top);
314 /*
315 * mt9v022: min total row time is 660 columns, min blanking is 43
316 * mt9v024: min total row time is 690 columns, min blanking is 61
317 */
318 if (is_mt9v024(mt9v022->chip_version)) {
319 min_row = 690;
320 min_blank = 61;
321 } else {
322 min_row = 660;
323 min_blank = 43;
324 }
313 if (!ret) 325 if (!ret)
314 /*
315 * Default 94, Phytec driver says:
316 * "width + horizontal blank >= 660"
317 */
318 ret = v4l2_ctrl_s_ctrl(mt9v022->hblank, 326 ret = v4l2_ctrl_s_ctrl(mt9v022->hblank,
319 rect.width > 660 - 43 ? 43 : 660 - rect.width); 327 rect.width > min_row - min_blank ?
328 min_blank : min_row - rect.width);
320 if (!ret) 329 if (!ret)
321 ret = v4l2_ctrl_s_ctrl(mt9v022->vblank, 45); 330 ret = v4l2_ctrl_s_ctrl(mt9v022->vblank, 45);
322 if (!ret) 331 if (!ret)