All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrei Andreyanau <a.andreyanau@sam-solutions.net>
To: <linux-media@vger.kernel.org>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Subject: [PATCH] [media] mt9v022 driver: send valid HORIZONTAL_BLANKING values to mt9v024 soc camera
Date: Wed, 6 Feb 2013 17:29:18 +0300	[thread overview]
Message-ID: <511268BE.3020508@sam-solutions.net> (raw)

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>
--- linux/drivers/media/i2c/soc_camera/mt9v022.c.orig	2013-02-06 15:43:35.522079869 +0300
+++ linux/drivers/media/i2c/soc_camera/mt9v022.c	2013-02-06 14:53:44.000000000 +0300
@@ -275,6 +275,7 @@ static int mt9v022_s_crop(struct v4l2_su
 	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 */
@@ -310,13 +311,21 @@ static int mt9v022_s_crop(struct v4l2_su
 		ret = reg_write(client, MT9V022_COLUMN_START, rect.left);
 	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)) {
+		min_row = 690;
+		min_blank = 61;
+	} else {
+		min_row = 660;
+		min_blank = 43;
+	}
 	if (!ret)
-		/*
-		 * Default 94, Phytec driver says:
-		 * "width + horizontal blank >= 660"
-		 */
 		ret = v4l2_ctrl_s_ctrl(mt9v022->hblank,
-				rect.width > 660 - 43 ? 43 : 660 - rect.width);
+				rect.width > min_row - min_blank ?
+				min_blank : min_row - rect.width);
 	if (!ret)
 		ret = v4l2_ctrl_s_ctrl(mt9v022->vblank, 45);
 	if (!ret)

                 reply	other threads:[~2013-02-06 14:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=511268BE.3020508@sam-solutions.net \
    --to=a.andreyanau@sam-solutions.net \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.