mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 2/3] media: i2c: ov08d10: fix vertical blanking
Date: Wed, 02 Dec 2026 09:40:01 +0100	[thread overview]
Message-ID: <20261202-ov08d10-ctrl-fixes-v1-2-778dc83babdd@emfend.at> (raw)
In-Reply-To: <20261202-ov08d10-ctrl-fixes-v1-0-778dc83babdd@emfend.at>

Previously, the vblank value was written unchanged to the dummy line
registers. But according to the datasheet, these registers are in units of
half lines and are added to the minimum VTS of the mode. Measurements and
register readouts show that the sensor applies them in steps of 4 lines
only.

As a result, the frame rates were wrong. For example, a frame duration of
33333 us resulted in 30.38 fps at 3280x2460, and the default VTS of 3736
lines in the 1632x1224 mode resulted in 30.03 fps instead of 20.16 fps.
As vts_min was equal to vts_def, the 1632x1224 mode was also limited to
30 fps instead of 60 fps.

Set vts_min to the actual minimum VTS of each mode, set the dummy line
registers correctly and set the VBLANK step to 4, to which OV08D10_VTS_MAX
is aligned as well. Set the default VTS of the 1632x1224 mode to 2508,
which keeps its previous default frame rate of ~30 fps.

Fixes: 7be91e02ed57 ("media: i2c: Add ov08d10 camera sensor driver")
Signed-off-by: Matthias Fend <matthias.fend@emfend.at>
---
 drivers/media/i2c/ov08d10.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/media/i2c/ov08d10.c b/drivers/media/i2c/ov08d10.c
index 22eee655b52628f162810c1b38607b6b25e7f0e6..4a6ec91d0b9f60501882a4458ca15d3ef90df996 100644
--- a/drivers/media/i2c/ov08d10.c
+++ b/drivers/media/i2c/ov08d10.c
@@ -31,7 +31,8 @@
 /* vertical-timings from sensor */
 #define OV08D10_REG_VTS_H		0x05
 #define OV08D10_REG_VTS_L		0x06
-#define OV08D10_VTS_MAX			0x7fff
+#define OV08D10_VTS_MAX			0x7ffc
+#define OV08D10_VBLANK_STEP		4
 
 /* Exposure controls from sensor */
 #define OV08D10_REG_EXPOSURE_H		0x02
@@ -654,8 +655,8 @@ static const struct ov08d10_lane_cfg lane_cfg_2 = {
 		.width = 1632,
 		.height = 1224,
 		.hts = 1912,
-		.vts_def = 3736,
-		.vts_min = 3736,
+		.vts_def = 2508,
+		.vts_min = 1252,
 		.reg_list = {
 			.num_of_regs = ARRAY_SIZE(lane_2_mode_1632x1224),
 			.regs = lane_2_mode_1632x1224,
@@ -827,9 +828,12 @@ static int ov08d10_set_exposure(struct ov08d10 *ov08d10, u32 exposure)
 static int ov08d10_set_vblank(struct ov08d10 *ov08d10, u32 vblank)
 {
 	struct i2c_client *client = v4l2_get_subdevdata(&ov08d10->sd);
+	const struct ov08d10_mode *mode = ov08d10_get_mode(ov08d10);
 	u8 val;
 	int ret;
 
+	vblank = (mode->height + vblank - mode->vts_min) * 2;
+
 	/* CIS control registers */
 	ret = i2c_smbus_write_byte_data(client, OV08D10_REG_PAGE, 0x01);
 	if (ret < 0)
@@ -1016,8 +1020,8 @@ static int ov08d10_init_controls(struct ov08d10 *ov08d10)
 	ov08d10->vblank =
 		v4l2_ctrl_new_std(ctrl_hdlr, &ov08d10_ctrl_ops,
 				  V4L2_CID_VBLANK, vblank_min,
-				  OV08D10_VTS_MAX - mode->height, 1,
-				  vblank_def);
+				  OV08D10_VTS_MAX - mode->height,
+				  OV08D10_VBLANK_STEP, vblank_def);
 
 	h_blank = to_pixels_per_line(ov08d10->priv_lane->link_freq_menu,
 				     mode->hts, mode->link_freq_index,
@@ -1225,8 +1229,8 @@ static int ov08d10_set_format(struct v4l2_subdev *sd,
 		vblank_def = mode->vts_def - mode->height;
 		__v4l2_ctrl_modify_range(ov08d10->vblank,
 					 mode->vts_min - mode->height,
-					 OV08D10_VTS_MAX - mode->height, 1,
-					 vblank_def);
+					 OV08D10_VTS_MAX - mode->height,
+					 OV08D10_VBLANK_STEP, vblank_def);
 		__v4l2_ctrl_s_ctrl(ov08d10->vblank, vblank_def);
 		h_blank = to_pixels_per_line(ov08d10->priv_lane->link_freq_menu,
 					     mode->hts,

-- 
2.34.1


  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 ` [PATCH 1/3] media: i2c: ov08d10: fix exposure Matthias Fend
2026-12-02  8:40 ` Matthias Fend [this message]
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-2-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®