openwrt/target/linux/bcm27xx/patches-6.1/950-0367-media-i2c-ov9281-Increase-diff-between-VTS-and-max-e.patch
Álvaro Fernández Rojas 793f8ab62c bcm27xx: 6.1: add kernel patches
Add kernel patches for version 6.1.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-06-09 19:12:30 +02:00

61 lines
2.1 KiB
Diff

From d66098625b057d12fcffdb07a6f2d462e0e2495d Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Tue, 4 Jan 2022 14:46:01 +0000
Subject: [PATCH] media: i2c: ov9281: Increase diff between VTS and max
exposure
The driver did allow the exposure to go up to VTS - 4 lines,
but this would produce a visible line on 1280x800, and a stall of
the sensor at 640x480.
Whilst it appears to work with a difference of 5, the datasheet states
there should be at least 25 lines difference between VTS and exposure,
so use that value.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/media/i2c/ov9281.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
--- a/drivers/media/i2c/ov9281.c
+++ b/drivers/media/i2c/ov9281.c
@@ -52,7 +52,11 @@
#define OV9281_REG_EXPOSURE 0x3500
#define OV9281_EXPOSURE_MIN 4
#define OV9281_EXPOSURE_STEP 1
-#define OV9281_VTS_MAX 0x7fff
+/*
+ * Number of lines less than frame length (VTS) that exposure must be.
+ * Datasheet states 25, although empirically 5 appears to work.
+ */
+#define OV9281_EXPOSURE_OFFSET 25
#define OV9281_REG_GAIN_H 0x3508
#define OV9281_REG_GAIN_L 0x3509
@@ -69,6 +73,7 @@
#define OV9281_TEST_PATTERN_DISABLE 0x0
#define OV9281_REG_VTS 0x380e
+#define OV9281_VTS_MAX 0x7fff
/*
* OV9281 native and active pixel array size.
@@ -967,7 +972,7 @@ static int ov9281_set_ctrl(struct v4l2_c
switch (ctrl->id) {
case V4L2_CID_VBLANK:
/* Update max exposure while meeting expected vblanking */
- max = ov9281->cur_mode->height + ctrl->val - 4;
+ max = ov9281->cur_mode->height + ctrl->val - OV9281_EXPOSURE_OFFSET;
__v4l2_ctrl_modify_range(ov9281->exposure,
ov9281->exposure->minimum, max,
ov9281->exposure->step,
@@ -1062,7 +1067,7 @@ static int ov9281_initialize_controls(st
OV9281_VTS_MAX - mode->height, 1,
vblank_def);
- exposure_max = mode->vts_def - 4;
+ exposure_max = mode->vts_def - OV9281_EXPOSURE_OFFSET;
ov9281->exposure = v4l2_ctrl_new_std(handler, &ov9281_ctrl_ops,
V4L2_CID_EXPOSURE,
OV9281_EXPOSURE_MIN, exposure_max,