From: Matthias Fend <matthias.fend@emfend.at>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
Jimmy Su <jimmy.su@intel.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Matthias Fend <matthias.fend@emfend.at>
Subject: [PATCH 1/3] media: i2c: ov08d10: fix exposure
Date: Wed, 02 Dec 2026 09:40:00 +0100 [thread overview]
Message-ID: <20261202-ov08d10-ctrl-fixes-v1-1-778dc83babdd@emfend.at> (raw)
In-Reply-To: <20261202-ov08d10-ctrl-fixes-v1-0-778dc83babdd@emfend.at>
According to the datasheet, the exposure register is simply in units of
half lines. The previous, more complex calculation was only approximately
correct in the full resolution modes (+3.4%) and far off in the binning
mode (-33%).
Furthermore, the sensor prolongs the frame if the exposure reaches or
exceeds VTS - 20 lines, so the previous margin of 6 lines allowed exposures
that lowered the frame rate.
Write 2 * exposure to the register and set the margin to 20 + 1 lines.
Fixes: 7be91e02ed57 ("media: i2c: Add ov08d10 camera sensor driver")
Signed-off-by: Matthias Fend <matthias.fend@emfend.at>
---
drivers/media/i2c/ov08d10.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/media/i2c/ov08d10.c b/drivers/media/i2c/ov08d10.c
index a83317da3d92dcb9693053cc6824bf43fd22308c..22eee655b52628f162810c1b38607b6b25e7f0e6 100644
--- a/drivers/media/i2c/ov08d10.c
+++ b/drivers/media/i2c/ov08d10.c
@@ -14,7 +14,6 @@
#include <media/v4l2-fwnode.h>
#define OV08D10_SCLK 144000000ULL
-#define OV08D10_ROWCLK 36000
#define OV08D10_DATA_LANES 2
#define OV08D10_RGB_DEPTH 10
@@ -39,7 +38,7 @@
#define OV08D10_REG_EXPOSURE_M 0x03
#define OV08D10_REG_EXPOSURE_L 0x04
#define OV08D10_EXPOSURE_MIN 6
-#define OV08D10_EXPOSURE_MAX_MARGIN 6
+#define OV08D10_EXPOSURE_MAX_MARGIN (20 + 1)
#define OV08D10_EXPOSURE_STEP 1
/* Analog gain controls from sensor */
@@ -796,20 +795,10 @@ static int ov08d10_set_exposure(struct ov08d10 *ov08d10, u32 exposure)
{
struct i2c_client *client = v4l2_get_subdevdata(&ov08d10->sd);
u8 val;
- u8 hts_h, hts_l;
- u32 hts, cur_vts, exp_cal;
int ret;
- cur_vts = ov08d10_get_mode(ov08d10)->vts_def;
- ret = i2c_smbus_write_byte_data(client, OV08D10_REG_PAGE, 0x01);
- if (ret < 0)
- return ret;
+ exposure *= 2;
- hts_h = i2c_smbus_read_byte_data(client, 0x37);
- hts_l = i2c_smbus_read_byte_data(client, 0x38);
- hts = ((hts_h << 8) | (hts_l));
- exp_cal = 66 * OV08D10_ROWCLK / hts;
- exposure = exposure * exp_cal / (cur_vts - OV08D10_EXPOSURE_MAX_MARGIN);
/* CIS control registers */
ret = i2c_smbus_write_byte_data(client, OV08D10_REG_PAGE, 0x01);
if (ret < 0)
--
2.34.1
next prev parent reply other threads:[~2026-12-02 8:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 8:39 [PATCH 0/3] media: i2c: ov08d10: fix some controls Matthias Fend
2026-12-02 8:40 ` Matthias Fend [this message]
2026-12-02 8:40 ` [PATCH 2/3] media: i2c: ov08d10: fix vertical blanking Matthias Fend
2026-12-02 8:40 ` [PATCH 3/3] media: i2c: ov08d10: fix analogue gain step Matthias Fend
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=20261202-ov08d10-ctrl-fixes-v1-1-778dc83babdd@emfend.at \
--to=matthias.fend@emfend.at \
--cc=jimmy.su@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®