From: Andrei Andreyanau <a.andreyanau@sam-solutions.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>
Subject: mt9p031 camera driver issue
Date: Wed, 24 Apr 2013 10:21:00 +0300 [thread overview]
Message-ID: <517787DC.5070309@sam-solutions.com> (raw)
Hi, Guennadi!
I have found interesting issue with mt9p031 camera driver.
As far as I got the value of hblank in the kernel driver is not
calculated correctly. According to the datasheet, the minimum horizontal
blanking value should be calculated using the following formula:
346 x (Row_Bin + 1) + 64 + (Wdc / 2)
If I'm right, it should look like in the code attached.
Also I wonder why it is decided to use the default value for vblank,
when it's said that is also should be calculated like this:
vblank = max(8, SW - H) + 1,
where SW - shutter width, H - output image height.
Also, there might be an issue with the calculation of xskip/yskip within
the same function (mt9p031_set_params).
xskip = DIV_ROUND_CLOSEST(crop->width, format->width);
yskip = DIV_ROUND_CLOSEST(crop->height, format->height);
As far as I got, these values are calculated using the predefined macros,
that rounds the calculated value to the nearest integer number. I faced
with the problem, that these values rounded correctly when the result
is > 1 (e.g. 1,5 will be rounded to 1).
But what concerns the value 0,8 it will be rounded to 0 by this function
(DIV_ROUND_CLOSEST). Could you please confirm this issue?
With best regards,
Andrei Andreyanau
Signed-off-by: Andrei Andreyanau <a.andreyanau@sam-solutions.com>
diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
index e328332..838b300 100644
--- a/drivers/media/i2c/mt9p031.c
+++ b/drivers/media/i2c/mt9p031.c
@@ -368,7 +368,7 @@ 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 >> min_t(unsigned int, xbin, 3));
+ hblank = 346 * (xbin + 1) + 64 + ((80 >> clamp_t(unsigned int, xbin,
0, 3)) / 2);
vblank = MT9P031_VERTICAL_BLANK_DEF;
ret = mt9p031_write(client, MT9P031_HORIZONTAL_BLANK, hblank - 1);
next reply other threads:[~2013-04-24 7:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-24 7:21 Andrei Andreyanau [this message]
2013-04-25 11:45 ` mt9p031 camera driver issue Laurent Pinchart
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=517787DC.5070309@sam-solutions.com \
--to=a.andreyanau@sam-solutions.com \
--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.