summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAndrei Andreyanau <a.andreyanau@sam-solutions.net>2013-02-06 14:47:20 +0300
committerJustin Waters <justin.waters@timesys.com>2013-11-07 12:19:23 -0500
commit60394e45b4b630cbf530ffd3b858f4a13bcf111a (patch)
treeca29e9e7d622028debbb1f96f091a478638f8682 /drivers
parent9ed2a695f8cb6e2b3207ca32e4dc936fec9b8766 (diff)
Beautify code
modified: drivers/media/video/mt9v022.c Signed-off-by: Christian Hemp <c.hemp@phytec.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/mt9v022.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c
index 35f074e9b0fb..c7b9fe292f61 100644
--- a/drivers/media/video/mt9v022.c
+++ b/drivers/media/video/mt9v022.c
@@ -321,6 +321,7 @@ static int mt9v022_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct mt9v022 *mt9v022 = to_mt9v022(client);
struct v4l2_rect rect = a->c;
+ int min_row, min_blank;
int ret;
/* Bayer format - even size lengths */
@@ -352,25 +353,21 @@ static int mt9v022_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
if (!ret)
ret = reg_write(client, MT9V022_ROW_START, rect.top);
+ /*
+ * mt9v022: min total row time is 660 columns, min blanking is 43
+ * mt9v024: min total row time is 690 columns, min blanking is 61
+ */
if (is_mt9v024(mt9v022->chip_version)) {
- if (!ret)
- /*
- * Default is 94. The Datasheet says:
- * "width + horizontal blank >= 690"
- */
- ret = reg_write(client, MT9V022_HORIZONTAL_BLANKING,
- rect.width > 690 - 61 ? 61 :
- 690 - rect.width);
+ min_row = 690;
+ min_blank = 61;
} else {
- if (!ret)
- /*
- * Default 94, Phytec driver says:
- * "width + horizontal blank >= 660"
- */
- ret = reg_write(client, MT9V022_HORIZONTAL_BLANKING,
- rect.width > 660 - 43 ? 43 :
- 660 - rect.width);
+ min_row = 660;
+ min_blank = 43;
}
+ if (!ret)
+ ret = reg_write(client, MT9V022_HORIZONTAL_BLANKING,
+ rect.width > min_row - min_blank ?
+ min_blank : min_row - rect.width);
if (!ret)
ret = reg_write(client, MT9V022_VERTICAL_BLANKING, 45);